diff --git a/.gitignore b/.gitignore index f1ea04e3efb..a6c8c2940d8 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ internal/ !tests/cases/projects/NodeModulesSearch/**/* !tests/baselines/reference/project/nodeModules*/**/* .idea +yarn.lock \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 08bd7817c79..5d6663ad6d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ branches: only: - master - release-2.1 + - release-2.2 install: - npm uninstall typescript diff --git a/Gulpfile.ts b/Gulpfile.ts index 2f243b9c39c..5b3fa19face 100644 --- a/Gulpfile.ts +++ b/Gulpfile.ts @@ -21,10 +21,6 @@ declare module "gulp-typescript" { import * as insert from "gulp-insert"; import * as sourcemaps from "gulp-sourcemaps"; import Q = require("q"); -declare global { - // `del` further depends on `Promise` (and is also not included), so we just, patch the global scope's Promise to Q's (which we already include in our deps because gulp depends on it) - type Promise = Q.Promise; -} import del = require("del"); import mkdirP = require("mkdirp"); import minimist = require("minimist"); @@ -41,7 +37,7 @@ const {runTestsInParallel} = mochaParallel; Error.stackTraceLimit = 1000; const cmdLineOptions = minimist(process.argv.slice(2), { - boolean: ["debug", "light", "colors", "lint", "soft"], + boolean: ["debug", "inspect", "light", "colors", "lint", "soft"], string: ["browser", "tests", "host", "reporter", "stackTraceLimit"], alias: { b: "browser", @@ -58,6 +54,7 @@ const cmdLineOptions = minimist(process.argv.slice(2), { soft: false, colors: process.env.colors || process.env.color || true, debug: process.env.debug || process.env.d, + inspect: process.env.inspect, host: process.env.TYPESCRIPT_HOST || process.env.host || "node", browser: process.env.browser || process.env.b || "IE", tests: process.env.test || process.env.tests || process.env.t, @@ -139,6 +136,14 @@ const es2017LibrarySourceMap = es2017LibrarySource.map(function(source) { return { target: "lib." + source, sources: ["header.d.ts", source] }; }); +const esnextLibrarySource = [ + "esnext.asynciterable.d.ts" +]; + +const esnextLibrarySourceMap = esnextLibrarySource.map(function (source) { + return { target: "lib." + source, sources: ["header.d.ts", source] }; +}); + const hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"]; const librarySourceMap = [ @@ -153,11 +158,12 @@ const librarySourceMap = [ { target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] }, { target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] }, { target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] }, + { target: "lib.esnext.d.ts", sources: ["header.d.ts", "esnext.d.ts"] }, // JavaScript + all host library { target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) }, { target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") } -].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap); +].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, esnextLibrarySourceMap); const libraryTargets = librarySourceMap.map(function(f) { return path.join(builtLocalDirectory, f.target); @@ -589,6 +595,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done: cleanTestDirs((err) => { if (err) { console.error(err); failWithStatus(err, 1); } const debug = cmdLineOptions["debug"]; + const inspect = cmdLineOptions["inspect"]; const tests = cmdLineOptions["tests"]; const light = cmdLineOptions["light"]; const stackTraceLimit = cmdLineOptions["stackTraceLimit"]; @@ -625,7 +632,10 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done: // default timeout is 2sec which really should be enough, but maybe we just need a small amount longer if (!runInParallel) { const args = []; - if (debug) { + if (inspect) { + args.push("--inspect"); + } + if (inspect || debug) { args.push("--debug-brk"); } args.push("-R", reporter); diff --git a/Jakefile.js b/Jakefile.js index 1aba38fddb6..f8be7c2b671 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -15,6 +15,7 @@ var servicesDirectory = "src/services/"; var serverDirectory = "src/server/"; var typingsInstallerDirectory = "src/server/typingsInstaller"; var cancellationTokenDirectory = "src/server/cancellationToken"; +var watchGuardDirectory = "src/server/watchGuard"; var harnessDirectory = "src/harness/"; var libraryDirectory = "src/lib/"; var scriptsDirectory = "scripts/"; @@ -80,6 +81,7 @@ var compilerSources = filesFromConfig("./src/compiler/tsconfig.json"); var servicesSources = filesFromConfig("./src/services/tsconfig.json"); var cancellationTokenSources = filesFromConfig(path.join(serverDirectory, "cancellationToken/tsconfig.json")); var typingsInstallerSources = filesFromConfig(path.join(serverDirectory, "typingsInstaller/tsconfig.json")); +var watchGuardSources = filesFromConfig(path.join(serverDirectory, "watchGuard/tsconfig.json")); var serverSources = filesFromConfig(path.join(serverDirectory, "tsconfig.json")) var languageServiceLibrarySources = filesFromConfig(path.join(serverDirectory, "tsconfig.library.json")); @@ -129,6 +131,8 @@ var harnessSources = harnessCoreSources.concat([ "matchFiles.ts", "initializeTSConfig.ts", "printer.ts", + "transform.ts", + "customTransforms.ts", ].map(function (f) { return path.join(unittestsDirectory, f); })).concat([ @@ -170,13 +174,21 @@ var es2016LibrarySourceMap = es2016LibrarySource.map(function (source) { var es2017LibrarySource = [ "es2017.object.d.ts", "es2017.sharedmemory.d.ts", - "es2017.string.d.ts", + "es2017.string.d.ts" ]; var es2017LibrarySourceMap = es2017LibrarySource.map(function (source) { return { target: "lib." + source, sources: ["header.d.ts", source] }; }); +var esnextLibrarySource = [ + "esnext.asynciterable.d.ts" +]; + +var esnextLibrarySourceMap = esnextLibrarySource.map(function (source) { + return { target: "lib." + source, sources: ["header.d.ts", source] }; +}); + var hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"]; var librarySourceMap = [ @@ -191,11 +203,12 @@ var librarySourceMap = [ { target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] }, { target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] }, { target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] }, + { target: "lib.esnext.d.ts", sources: ["header.d.ts", "esnext.d.ts"] }, // JavaScript + all host library { target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) }, { target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") } -].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap); +].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, esnextLibrarySourceMap); var libraryTargets = librarySourceMap.map(function (f) { return path.join(builtLocalDirectory, f.target); @@ -570,8 +583,11 @@ compileFile(cancellationTokenFile, cancellationTokenSources, [builtLocalDirector var typingsInstallerFile = path.join(builtLocalDirectory, "typingsInstaller.js"); compileFile(typingsInstallerFile, typingsInstallerSources, [builtLocalDirectory].concat(typingsInstallerSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { outDir: builtLocalDirectory, noOutFile: false }); +var watchGuardFile = path.join(builtLocalDirectory, "watchGuard.js"); +compileFile(watchGuardFile, watchGuardSources, [builtLocalDirectory].concat(watchGuardSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { outDir: builtLocalDirectory, noOutFile: false }); + var serverFile = path.join(builtLocalDirectory, "tsserver.js"); -compileFile(serverFile, serverSources, [builtLocalDirectory, copyright, cancellationTokenFile, typingsInstallerFile].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], preserveConstEnums: true }); +compileFile(serverFile, serverSources, [builtLocalDirectory, copyright, cancellationTokenFile, typingsInstallerFile, watchGuardFile].concat(serverSources).concat(servicesSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], preserveConstEnums: true }); var tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js"); var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts"); compileFile( @@ -665,7 +681,7 @@ task("generate-spec", [specMd]); // Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory desc("Makes a new LKG out of the built js files"); task("LKG", ["clean", "release", "local"].concat(libraryTargets), function () { - var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile, cancellationTokenFile, typingsInstallerFile, buildProtocolDts].concat(libraryTargets); + var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile, cancellationTokenFile, typingsInstallerFile, buildProtocolDts, watchGuardFile].concat(libraryTargets); var missingFiles = expectedFiles.filter(function (f) { return !fs.existsSync(f); }); @@ -778,6 +794,7 @@ function runConsoleTests(defaultReporter, runInParallel) { } var debug = process.env.debug || process.env.d; + var inspect = process.env.inspect; tests = process.env.test || process.env.tests || process.env.t; var light = process.env.light || false; var stackTraceLimit = process.env.stackTraceLimit; @@ -807,18 +824,39 @@ function runConsoleTests(defaultReporter, runInParallel) { testTimeout = 800000; } - colors = process.env.colors || process.env.color; - colors = colors ? ' --no-colors ' : ' --colors '; - reporter = process.env.reporter || process.env.r || defaultReporter; - var bail = (process.env.bail || process.env.b) ? "--bail" : ""; + var colors = process.env.colors || process.env.color || true; + var reporter = process.env.reporter || process.env.r || defaultReporter; + var bail = process.env.bail || process.env.b; var lintFlag = process.env.lint !== 'false'; // timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally // default timeout is 2sec which really should be enough, but maybe we just need a small amount longer if (!runInParallel) { var startTime = mark(); - tests = tests ? ' -g "' + tests + '"' : ''; - var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + bail + ' -t ' + testTimeout + ' ' + run; + var args = []; + if (inspect) { + args.push("--inspect"); + } + if (inspect || debug) { + args.push("--debug-brk"); + } + args.push("-R", reporter); + if (tests) { + args.push("-g", `"${tests}"`); + } + if (colors) { + args.push("--colors"); + } + else { + args.push("--no-colors"); + } + if (bail) { + args.push("--bail"); + } + args.push("-t", testTimeout); + args.push(run); + + var cmd = "mocha " + args.join(" "); console.log(cmd); var savedNodeEnv = process.env.NODE_ENV; @@ -839,7 +877,7 @@ function runConsoleTests(defaultReporter, runInParallel) { var savedNodeEnv = process.env.NODE_ENV; process.env.NODE_ENV = "development"; var startTime = mark(); - runTestsInParallel(taskConfigsFolder, run, { testTimeout: testTimeout, noColors: colors === " --no-colors " }, function (err) { + runTestsInParallel(taskConfigsFolder, run, { testTimeout: testTimeout, noColors: !colors }, function (err) { process.env.NODE_ENV = savedNodeEnv; measure(startTime); // last worker clean everything and runs linter in case if there were no errors diff --git a/package.json b/package.json index 817ce333b0a..3ffab4bfb13 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "gulp-insert": "latest", "gulp-newer": "latest", "gulp-sourcemaps": "latest", - "gulp-typescript": "3.1.3", + "gulp-typescript": "3.1.5", "into-stream": "latest", "istanbul": "latest", "jake": "latest", diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 1e8f8b403cc..7e8a99343bd 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -265,6 +265,7 @@ namespace ts { return "export="; case SpecialPropertyAssignmentKind.ExportsProperty: case SpecialPropertyAssignmentKind.ThisProperty: + case SpecialPropertyAssignmentKind.Property: // exports.x = ... or this.y = ... return ((node as BinaryExpression).left as PropertyAccessExpression).name.text; case SpecialPropertyAssignmentKind.PrototypeProperty: @@ -669,6 +670,12 @@ namespace ts { case SyntaxKind.CallExpression: bindCallExpressionFlow(node); break; + case SyntaxKind.JSDocComment: + bindJSDocComment(node); + break; + case SyntaxKind.JSDocTypedefTag: + bindJSDocTypedefTag(node); + break; default: bindEachChild(node); break; @@ -956,6 +963,9 @@ namespace ts { const postLoopLabel = createBranchLabel(); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; + if (node.kind === SyntaxKind.ForOfStatement) { + bind(node.awaitModifier); + } bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); @@ -1051,8 +1061,8 @@ namespace ts { // second -> edge that represents post-finally flow. // these edges are used in following scenario: // let a; (1) - // try { a = someOperation(); (2)} - // finally { (3) console.log(a) } (4) + // try { a = someOperation(); (2)} + // finally { (3) console.log(a) } (4) // (5) a // flow graph for this case looks roughly like this (arrows show ): @@ -1064,11 +1074,11 @@ namespace ts { // In case when we walk the flow starting from inside the finally block we want to take edge '*****' into account // since it ensures that finally is always reachable. However when we start outside the finally block and go through label (5) // then edge '*****' should be discarded because label 4 is only reachable if post-finally label-4 is reachable - // Simply speaking code inside finally block is treated as reachable as pre-try-flow + // Simply speaking code inside finally block is treated as reachable as pre-try-flow // since we conservatively assume that any line in try block can throw or return in which case we'll enter finally. // However code after finally is reachable only if control flow was not abrupted in try/catch or finally blocks - it should be composed from // final flows of these blocks without taking pre-try flow into account. - // + // // extra edges that we inject allows to control this behavior // if when walking the flow we step on post-finally edge - we can mark matching pre-finally edge as locked so it will be skipped. const preFinallyFlow: PreFinallyFlow = { flags: FlowFlags.PreFinally, antecedent: preTryFlow, lock: {} }; @@ -1331,6 +1341,26 @@ namespace ts { } } + function bindJSDocComment(node: JSDoc) { + forEachChild(node, n => { + if (n.kind !== SyntaxKind.JSDocTypedefTag) { + bind(n); + } + }); + } + + function bindJSDocTypedefTag(node: JSDocTypedefTag) { + forEachChild(node, n => { + // if the node has a fullName "A.B.C", that means symbol "C" was already bound + // when we visit "fullName"; so when we visit the name "C" as the next child of + // the jsDocTypedefTag, we should skip binding it. + if (node.fullName && n === node.name && node.fullName.kind !== SyntaxKind.Identifier) { + return; + } + bind(n); + }); + } + function bindCallExpressionFlow(node: CallExpression) { // If the target of the call expression is a function expression or arrow function we have // an immediately invoked function expression (IIFE). Initialize the flowNode property to @@ -1870,6 +1900,18 @@ namespace ts { } node.parent = parent; const saveInStrictMode = inStrictMode; + + // Even though in the AST the jsdoc @typedef node belongs to the current node, + // its symbol might be in the same scope with the current node's symbol. Consider: + // + // /** @typedef {string | number} MyType */ + // function foo(); + // + // Here the current node is "foo", which is a container, but the scope of "MyType" should + // not be inside "foo". Therefore we always bind @typedef before bind the parent node, + // and skip binding this tag later when binding all the other jsdoc tags. + bindJSDocTypedefTagIfAny(node); + // First we bind declaration nodes to a symbol if possible. We'll both create a symbol // and then potentially add the symbol to an appropriate symbol table. Possible // destination symbol tables are: @@ -1904,6 +1946,27 @@ namespace ts { inStrictMode = saveInStrictMode; } + function bindJSDocTypedefTagIfAny(node: Node) { + if (!node.jsDoc) { + return; + } + + for (const jsDoc of node.jsDoc) { + if (!jsDoc.tags) { + continue; + } + + for (const tag of jsDoc.tags) { + if (tag.kind === SyntaxKind.JSDocTypedefTag) { + const savedParent = parent; + parent = jsDoc; + bind(tag); + parent = savedParent; + } + } + } + } + function updateStrictModeStatementList(statements: NodeArray) { if (!inStrictMode) { for (const statement of statements) { @@ -1969,6 +2032,9 @@ namespace ts { case SpecialPropertyAssignmentKind.ThisProperty: bindThisPropertyAssignment(node); break; + case SpecialPropertyAssignmentKind.Property: + bindStaticPropertyAssignment(node); + break; case SpecialPropertyAssignmentKind.None: // Nothing to do break; @@ -2265,18 +2331,41 @@ namespace ts { constructorFunction.parent = classPrototype; classPrototype.parent = leftSideOfAssignment; - const funcSymbol = container.locals.get(constructorFunction.text); - if (!funcSymbol || !(funcSymbol.flags & SymbolFlags.Function || isDeclarationOfFunctionExpression(funcSymbol))) { + bindPropertyAssignment(constructorFunction.text, leftSideOfAssignment, /*isPrototypeProperty*/ true); + } + + function bindStaticPropertyAssignment(node: BinaryExpression) { + // We saw a node of the form 'x.y = z'. Declare a 'member' y on x if x was a function. + + // Look up the function in the local scope, since prototype assignments should + // follow the function declaration + const leftSideOfAssignment = node.left as PropertyAccessExpression; + const target = leftSideOfAssignment.expression as Identifier; + + // Fix up parent pointers since we're going to use these nodes before we bind into them + leftSideOfAssignment.parent = node; + target.parent = leftSideOfAssignment; + + bindPropertyAssignment(target.text, leftSideOfAssignment, /*isPrototypeProperty*/ false); + } + + function bindPropertyAssignment(functionName: string, propertyAccessExpression: PropertyAccessExpression, isPrototypeProperty: boolean) { + let targetSymbol = container.locals.get(functionName); + if (targetSymbol && isDeclarationOfFunctionOrClassExpression(targetSymbol)) { + targetSymbol = (targetSymbol.valueDeclaration as VariableDeclaration).initializer.symbol; + } + + if (!targetSymbol || !(targetSymbol.flags & (SymbolFlags.Function | SymbolFlags.Class))) { return; } // Set up the members collection if it doesn't exist already - if (!funcSymbol.members) { - funcSymbol.members = createMap(); - } + const symbolTable = isPrototypeProperty ? + (targetSymbol.members || (targetSymbol.members = createMap())) : + (targetSymbol.exports || (targetSymbol.exports = createMap())); // Declare the method/property - declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, SymbolFlags.Property, SymbolFlags.PropertyExcludes); + declareSymbol(symbolTable, targetSymbol, propertyAccessExpression, SymbolFlags.Property, SymbolFlags.PropertyExcludes); } function bindCallExpression(node: CallExpression) { @@ -2380,7 +2469,7 @@ namespace ts { function bindFunctionDeclaration(node: FunctionDeclaration) { if (!isDeclarationFile(file) && !isInAmbientContext(node)) { - if (isAsyncFunctionLike(node)) { + if (isAsyncFunction(node)) { emitFlags |= NodeFlags.HasAsyncFunctions; } } @@ -2397,7 +2486,7 @@ namespace ts { function bindFunctionExpression(node: FunctionExpression) { if (!isDeclarationFile(file) && !isInAmbientContext(node)) { - if (isAsyncFunctionLike(node)) { + if (isAsyncFunction(node)) { emitFlags |= NodeFlags.HasAsyncFunctions; } } @@ -2411,7 +2500,7 @@ namespace ts { function bindPropertyOrMethodOrAccessor(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags) { if (!isDeclarationFile(file) && !isInAmbientContext(node)) { - if (isAsyncFunctionLike(node)) { + if (isAsyncFunction(node)) { emitFlags |= NodeFlags.HasAsyncFunctions; } } @@ -2845,11 +2934,10 @@ namespace ts { // An async method declaration is ES2017 syntax. if (hasModifier(node, ModifierFlags.Async)) { - transformFlags |= TransformFlags.AssertES2017; + transformFlags |= node.asteriskToken ? TransformFlags.AssertESNext : TransformFlags.AssertES2017; } - // Currently, we only support generators that were originally async function bodies. - if (node.asteriskToken && getEmitFlags(node) & EmitFlags.AsyncFunctionBody) { + if (node.asteriskToken) { transformFlags |= TransformFlags.AssertGenerator; } @@ -2915,7 +3003,7 @@ namespace ts { // An async function declaration is ES2017 syntax. if (modifierFlags & ModifierFlags.Async) { - transformFlags |= TransformFlags.AssertES2017; + transformFlags |= node.asteriskToken ? TransformFlags.AssertESNext : TransformFlags.AssertES2017; } // function declarations with object rest destructuring are ES Next syntax @@ -2935,7 +3023,7 @@ namespace ts { // down-level generator. // Currently we do not support transforming any other generator fucntions // down level. - if (node.asteriskToken && getEmitFlags(node) & EmitFlags.AsyncFunctionBody) { + if (node.asteriskToken) { transformFlags |= TransformFlags.AssertGenerator; } } @@ -2957,7 +3045,7 @@ namespace ts { // An async function expression is ES2017 syntax. if (hasModifier(node, ModifierFlags.Async)) { - transformFlags |= TransformFlags.AssertES2017; + transformFlags |= node.asteriskToken ? TransformFlags.AssertESNext : TransformFlags.AssertES2017; } // function expressions with object rest destructuring are ES Next syntax @@ -2976,9 +3064,7 @@ namespace ts { // If a FunctionExpression is generator function and is the body of a // transformed async function, then this node can be transformed to a // down-level generator. - // Currently we do not support transforming any other generator fucntions - // down level. - if (node.asteriskToken && getEmitFlags(node) & EmitFlags.AsyncFunctionBody) { + if (node.asteriskToken) { transformFlags |= TransformFlags.AssertGenerator; } @@ -3146,8 +3232,8 @@ namespace ts { switch (kind) { case SyntaxKind.AsyncKeyword: case SyntaxKind.AwaitExpression: - // async/await is ES2017 syntax - transformFlags |= TransformFlags.AssertES2017; + // async/await is ES2017 syntax, but may be ESNext syntax (for async generators) + transformFlags |= TransformFlags.AssertESNext | TransformFlags.AssertES2017; break; case SyntaxKind.PublicKeyword: @@ -3179,10 +3265,6 @@ namespace ts { transformFlags |= TransformFlags.AssertJsx; break; - case SyntaxKind.ForOfStatement: - // for-of might be ESNext if it has a rest destructuring - transformFlags |= TransformFlags.AssertESNext; - // FALLTHROUGH case SyntaxKind.NoSubstitutionTemplateLiteral: case SyntaxKind.TemplateHead: case SyntaxKind.TemplateMiddle: @@ -3196,9 +3278,18 @@ namespace ts { transformFlags |= TransformFlags.AssertES2015; break; + case SyntaxKind.ForOfStatement: + // This node is either ES2015 syntax or ES2017 syntax (if it is a for-await-of). + if ((node).awaitModifier) { + transformFlags |= TransformFlags.AssertESNext; + } + transformFlags |= TransformFlags.AssertES2015; + break; + case SyntaxKind.YieldExpression: - // This node is ES6 syntax. - transformFlags |= TransformFlags.AssertES2015 | TransformFlags.ContainsYield; + // This node is either ES2015 syntax (in a generator) or ES2017 syntax (in an async + // generator). + transformFlags |= TransformFlags.AssertESNext | TransformFlags.AssertES2015 | TransformFlags.ContainsYield; break; case SyntaxKind.AnyKeyword: diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 30e7d34f174..a225885f85a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -52,7 +52,7 @@ namespace ts { const emptySymbols = createMap(); const compilerOptions = host.getCompilerOptions(); - const languageVersion = compilerOptions.target || ScriptTarget.ES3; + const languageVersion = getEmitScriptTarget(compilerOptions); const modulekind = getEmitModuleKind(compilerOptions); const noUnusedIdentifiers = !!compilerOptions.noUnusedLocals || !!compilerOptions.noUnusedParameters; const allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ModuleKind.System; @@ -64,6 +64,11 @@ namespace ts { undefinedSymbol.declarations = []; const argumentsSymbol = createSymbol(SymbolFlags.Property, "arguments"); + // for public members that accept a Node or one of its subtypes, we must guard against + // synthetic nodes created during transformations by calling `getParseTreeNode`. + // for most of these, we perform the guard only on `checker` to avoid any possible + // extra cost of calling `getParseTreeNode` when calling these functions from inside the + // checker. const checker: TypeChecker = { getNodeCount: () => sum(host.getSourceFiles(), "nodeCount"), getIdentifierCount: () => sum(host.getSourceFiles(), "identifierCount"), @@ -75,8 +80,15 @@ namespace ts { getMergedSymbol, getDiagnostics, getGlobalDiagnostics, - getTypeOfSymbolAtLocation, - getSymbolsOfParameterPropertyDeclaration, + getTypeOfSymbolAtLocation: (symbol, location) => { + location = getParseTreeNode(location); + return location ? getTypeOfSymbolAtLocation(symbol, location) : unknownType; + }, + getSymbolsOfParameterPropertyDeclaration: (parameter, parameterName) => { + parameter = getParseTreeNode(parameter, isParameter); + Debug.assert(parameter !== undefined, "Cannot get symbols of a synthetic parameter that cannot be resolved to a parse-tree node."); + return getSymbolsOfParameterPropertyDeclaration(parameter, parameterName); + }, getDeclaredTypeOfSymbol, getPropertiesOfType, getPropertyOfType, @@ -84,38 +96,101 @@ namespace ts { getSignaturesOfType, getIndexTypeOfType, getBaseTypes, - getTypeFromTypeNode, + getBaseTypeOfLiteralType, + getWidenedType, + getTypeFromTypeNode: node => { + node = getParseTreeNode(node, isTypeNode); + return node ? getTypeFromTypeNode(node) : unknownType; + }, getParameterType: getTypeAtPosition, getReturnTypeOfSignature, getNonNullableType, - getSymbolsInScope, - getSymbolAtLocation, - getShorthandAssignmentValueSymbol, - getExportSpecifierLocalTargetSymbol, - getTypeAtLocation: getTypeOfNode, - getPropertySymbolOfDestructuringAssignment, - signatureToString, - typeToString, + getSymbolsInScope: (location, meaning) => { + location = getParseTreeNode(location); + return location ? getSymbolsInScope(location, meaning) : []; + }, + getSymbolAtLocation: node => { + node = getParseTreeNode(node); + return node ? getSymbolAtLocation(node) : undefined; + }, + getShorthandAssignmentValueSymbol: node => { + node = getParseTreeNode(node); + return node ? getShorthandAssignmentValueSymbol(node) : undefined; + }, + getExportSpecifierLocalTargetSymbol: node => { + node = getParseTreeNode(node, isExportSpecifier); + return node ? getExportSpecifierLocalTargetSymbol(node) : undefined; + }, + getTypeAtLocation: node => { + node = getParseTreeNode(node); + return node ? getTypeOfNode(node) : unknownType; + }, + getPropertySymbolOfDestructuringAssignment: location => { + location = getParseTreeNode(location, isIdentifier); + return location ? getPropertySymbolOfDestructuringAssignment(location) : undefined; + }, + signatureToString: (signature, enclosingDeclaration?, flags?, kind?) => { + return signatureToString(signature, getParseTreeNode(enclosingDeclaration), flags, kind); + }, + typeToString: (type, enclosingDeclaration?, flags?) => { + return typeToString(type, getParseTreeNode(enclosingDeclaration), flags); + }, getSymbolDisplayBuilder, - symbolToString, + symbolToString: (symbol, enclosingDeclaration?, meaning?) => { + return symbolToString(symbol, getParseTreeNode(enclosingDeclaration), meaning); + }, getAugmentedPropertiesOfType, getRootSymbols, - getContextualType, + getContextualType: node => { + node = getParseTreeNode(node, isExpression) + return node ? getContextualType(node) : undefined; + }, getFullyQualifiedName, - getResolvedSignature, - getConstantValue, - isValidPropertyAccess, - getSignatureFromDeclaration, - isImplementationOfOverload, - getImmediateAliasedSymbol, + getResolvedSignature: (node, candidatesOutArray?) => { + node = getParseTreeNode(node, isCallLikeExpression); + return node ? getResolvedSignature(node, candidatesOutArray) : undefined; + }, + getConstantValue: node => { + node = getParseTreeNode(node, canHaveConstantValue); + return node ? getConstantValue(node) : undefined; + }, + isValidPropertyAccess: (node, propertyName) => { + node = getParseTreeNode(node, isPropertyAccessOrQualifiedName); + return node ? isValidPropertyAccess(node, propertyName) : false; + }, + getSignatureFromDeclaration: declaration => { + declaration = getParseTreeNode(declaration, isFunctionLike); + return declaration ? getSignatureFromDeclaration(declaration) : undefined; + }, + isImplementationOfOverload: node => { + node = getParseTreeNode(node, isFunctionLike); + return node ? isImplementationOfOverload(node) : undefined; + }, + getImmediateAliasedSymbol: symbol => { + Debug.assert((symbol.flags & SymbolFlags.Alias) !== 0, "Should only get Alias here."); + const links = getSymbolLinks(symbol); + if (!links.immediateTarget) { + const node = getDeclarationOfAliasSymbol(symbol); + Debug.assert(!!node); + links.immediateTarget = getTargetOfAliasDeclaration(node, /*dontRecursivelyResolve*/true); + } + + return links.immediateTarget; + }, getAliasedSymbol: resolveAlias, getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, getExportsAndPropertiesOfModule, getAmbientModules, - getAllAttributesTypeFromJsxOpeningLikeElement, + getAllAttributesTypeFromJsxOpeningLikeElement: node => { + node = getParseTreeNode(node, isJsxOpeningLikeElement); + return node ? getAllAttributesTypeFromJsxOpeningLikeElement(node) : undefined; + }, getJsxIntrinsicTagNames, - isOptionalParameter, + isOptionalParameter: node => { + node = getParseTreeNode(node, isParameter); + return node ? isOptionalParameter(node) : false; + }, tryGetMemberInModuleExports, tryFindAmbientModuleWithoutAugmentations: moduleName => { // we deliberately exclude augmentations @@ -186,11 +261,6 @@ namespace ts { */ let patternAmbientModules: PatternAmbientModule[]; - let getGlobalESSymbolConstructorSymbol: () => Symbol; - - let getGlobalPromiseConstructorSymbol: () => Symbol; - let tryGetGlobalPromiseConstructorSymbol: () => Symbol; - let globalObjectType: ObjectType; let globalFunctionType: ObjectType; let globalArrayType: GenericType; @@ -206,26 +276,20 @@ namespace ts { // The library files are only loaded when the feature is used. // This allows users to just specify library files they want to used through --lib // and they will not get an error from not having unrelated library files - let getGlobalTemplateStringsArrayType: () => ObjectType; - - let getGlobalESSymbolType: () => ObjectType; - let getGlobalIterableType: () => GenericType; - let getGlobalIteratorType: () => GenericType; - let getGlobalIterableIteratorType: () => GenericType; - - let getGlobalClassDecoratorType: () => ObjectType; - let getGlobalParameterDecoratorType: () => ObjectType; - let getGlobalPropertyDecoratorType: () => ObjectType; - let getGlobalMethodDecoratorType: () => ObjectType; - let getGlobalTypedPropertyDescriptorType: () => ObjectType; - let getGlobalPromiseType: () => ObjectType; - let tryGetGlobalPromiseType: () => ObjectType; - let getGlobalPromiseLikeType: () => ObjectType; - let getInstantiatedGlobalPromiseLikeType: () => ObjectType; - let getGlobalPromiseConstructorLikeType: () => ObjectType; - let getGlobalThenableType: () => ObjectType; - - let jsxElementClassType: Type; + let deferredGlobalESSymbolConstructorSymbol: Symbol; + let deferredGlobalESSymbolType: ObjectType; + let deferredGlobalTypedPropertyDescriptorType: GenericType; + let deferredGlobalPromiseType: GenericType; + let deferredGlobalPromiseConstructorSymbol: Symbol; + let deferredGlobalPromiseConstructorLikeType: ObjectType; + let deferredGlobalIterableType: GenericType; + let deferredGlobalIteratorType: GenericType; + let deferredGlobalIterableIteratorType: GenericType; + let deferredGlobalAsyncIterableType: GenericType; + let deferredGlobalAsyncIteratorType: GenericType; + let deferredGlobalAsyncIterableIteratorType: GenericType; + let deferredGlobalTemplateStringsArrayType: ObjectType; + let deferredJsxElementClassType: Type; let deferredNodes: Node[]; let deferredUnusedIdentifierNodes: Node[]; @@ -1324,18 +1388,6 @@ namespace ts { return shouldResolve ? resolveAlias(symbol) : symbol; } - function getImmediateAliasedSymbol(symbol: Symbol): Symbol { - Debug.assert((symbol.flags & SymbolFlags.Alias) !== 0, "Should only get Alias here."); - const links = getSymbolLinks(symbol); - if (!links.immediateTarget) { - const node = getDeclarationOfAliasSymbol(symbol); - Debug.assert(!!node); - links.immediateTarget = getTargetOfAliasDeclaration(node, /*dontRecursivelyResolve*/true); - } - - return links.immediateTarget; - } - function resolveAlias(symbol: Symbol): Symbol { Debug.assert((symbol.flags & SymbolFlags.Alias) !== 0, "Should only get Alias here."); const links = getSymbolLinks(symbol); @@ -2196,13 +2248,15 @@ namespace ts { return type.flags & TypeFlags.StringLiteral ? `"${escapeString((type).text)}"` : (type).text; } - function getNameOfSymbol(symbol: Symbol): string { if (symbol.declarations && symbol.declarations.length) { const declaration = symbol.declarations[0]; if (declaration.name) { return declarationNameToString(declaration.name); } + if (declaration.parent && declaration.parent.kind === SyntaxKind.VariableDeclaration) { + return declarationNameToString((declaration.parent).name); + } switch (declaration.kind) { case SyntaxKind.ClassExpression: return "(Anonymous class)"; @@ -3255,7 +3309,7 @@ namespace ts { // This elementType will be used if the specific property corresponding to this index is not // present (aka the tuple element property). This call also checks that the parentType is in // fact an iterable or array (depending on target language). - const elementType = checkIteratedTypeOrElementType(parentType, pattern, /*allowStringInput*/ false); + const elementType = checkIteratedTypeOrElementType(parentType, pattern, /*allowStringInput*/ false, /*allowAsyncIterable*/ false); if (declaration.dotDotDotToken) { // Rest element has an array type with the same element type as the parent type type = createArrayType(elementType); @@ -3343,7 +3397,8 @@ namespace ts { // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, // or it may have led to an error inside getElementTypeOfIterable. - return checkRightHandSideOfForOf((declaration.parent.parent).expression) || anyType; + const forOfStatement = declaration.parent.parent; + return checkRightHandSideOfForOf(forOfStatement.expression, forOfStatement.awaitModifier) || anyType; } if (isBindingPattern(declaration.parent)) { @@ -3802,6 +3857,13 @@ namespace ts { return unknownType; } + function isReferenceToType(type: Type, target: Type) { + return type !== undefined + && target !== undefined + && (getObjectFlags(type) & ObjectFlags.Reference) !== 0 + && (type).target === target; + } + function getTargetType(type: Type): Type { return getObjectFlags(type) & ObjectFlags.Reference ? (type).target : type; } @@ -3900,7 +3962,7 @@ namespace ts { } if (type.flags & TypeFlags.TypeVariable) { const constraint = getBaseConstraintOfType(type); - return isValidBaseType(constraint) && isMixinConstructorType(constraint); + return constraint && isValidBaseType(constraint) && isMixinConstructorType(constraint); } return false; } @@ -4704,7 +4766,7 @@ namespace ts { // Combinations of function, class, enum and module let members = emptySymbols; let constructSignatures: Signature[] = emptyArray; - if (symbol.flags & SymbolFlags.HasExports) { + if (symbol.exports) { members = getExportsOfSymbol(symbol); } if (symbol.flags & SymbolFlags.Class) { @@ -5027,7 +5089,7 @@ namespace ts { t.flags & TypeFlags.StringLike ? globalStringType : t.flags & TypeFlags.NumberLike ? globalNumberType : t.flags & TypeFlags.BooleanLike ? globalBooleanType : - t.flags & TypeFlags.ESSymbol ? getGlobalESSymbolType() : + t.flags & TypeFlags.ESSymbol ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= ScriptTarget.ES2015) : t.flags & TypeFlags.NonPrimitive ? emptyObjectType : t; } @@ -5845,15 +5907,52 @@ namespace ts { return getTypeFromNonGenericTypeReference(node, symbol); } + function getPrimitiveTypeFromJSDocTypeReference(node: JSDocTypeReference): Type { + if (isIdentifier(node.name)) { + switch (node.name.text) { + case "String": + return stringType; + case "Number": + return numberType; + case "Boolean": + return booleanType; + case "Void": + return voidType; + case "Undefined": + return undefinedType; + case "Null": + return nullType; + case "Object": + return anyType; + case "Function": + return anyFunctionType; + case "Array": + case "array": + return !node.typeArguments || !node.typeArguments.length ? createArrayType(anyType) : undefined; + case "Promise": + case "promise": + return !node.typeArguments || !node.typeArguments.length ? createPromiseType(anyType) : undefined; + } + } + } + + function getTypeFromJSDocNullableTypeNode(node: JSDocNullableType) { + const type = getTypeFromTypeNode(node.type); + return strictNullChecks ? getUnionType([type, nullType]) : type; + } + function getTypeFromTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference): Type { const links = getNodeLinks(node); if (!links.resolvedType) { let symbol: Symbol; let type: Type; if (node.kind === SyntaxKind.JSDocTypeReference) { - const typeReferenceName = getTypeReferenceName(node); - symbol = resolveTypeReferenceName(typeReferenceName); - type = getTypeReferenceType(node, symbol); + type = getPrimitiveTypeFromJSDocTypeReference(node); + if (!type) { + const typeReferenceName = getTypeReferenceName(node); + symbol = resolveTypeReferenceName(typeReferenceName); + type = getTypeReferenceType(node, symbol); + } } else { // We only support expressions that are simple qualified names. For other expressions this produces undefined. @@ -5917,20 +6016,75 @@ namespace ts { return type; } - function getGlobalValueSymbol(name: string): Symbol { - return getGlobalSymbol(name, SymbolFlags.Value, Diagnostics.Cannot_find_global_value_0); + function getGlobalValueSymbol(name: string, reportErrors: boolean): Symbol { + return getGlobalSymbol(name, SymbolFlags.Value, reportErrors ? Diagnostics.Cannot_find_global_value_0 : undefined); } - function getGlobalTypeSymbol(name: string): Symbol { - return getGlobalSymbol(name, SymbolFlags.Type, Diagnostics.Cannot_find_global_type_0); + function getGlobalTypeSymbol(name: string, reportErrors: boolean): Symbol { + return getGlobalSymbol(name, SymbolFlags.Type, reportErrors ? Diagnostics.Cannot_find_global_type_0 : undefined); } function getGlobalSymbol(name: string, meaning: SymbolFlags, diagnostic: DiagnosticMessage): Symbol { return resolveName(undefined, name, meaning, diagnostic, name); } - function getGlobalType(name: string, arity = 0): ObjectType { - return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity); + function getGlobalType(name: string, arity: 0, reportErrors: boolean): ObjectType; + function getGlobalType(name: string, arity: number, reportErrors: boolean): GenericType; + function getGlobalType(name: string, arity: number, reportErrors: boolean): ObjectType { + const symbol = getGlobalTypeSymbol(name, reportErrors); + return symbol || reportErrors ? getTypeOfGlobalSymbol(symbol, arity) : undefined; + } + + function getGlobalTypedPropertyDescriptorType() { + return deferredGlobalTypedPropertyDescriptorType || (deferredGlobalTypedPropertyDescriptorType = getGlobalType("TypedPropertyDescriptor", /*arity*/ 1, /*reportErrors*/ true)) || emptyGenericType; + } + + function getGlobalTemplateStringsArrayType() { + return deferredGlobalTemplateStringsArrayType || (deferredGlobalTemplateStringsArrayType = getGlobalType("TemplateStringsArray", /*arity*/ 0, /*reportErrors*/ true)) || emptyObjectType; + } + + function getGlobalESSymbolConstructorSymbol(reportErrors: boolean) { + return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol", reportErrors)); + } + + function getGlobalESSymbolType(reportErrors: boolean) { + return deferredGlobalESSymbolType || (deferredGlobalESSymbolType = getGlobalType("Symbol", /*arity*/ 0, reportErrors)) || emptyObjectType; + } + + function getGlobalPromiseType(reportErrors: boolean) { + return deferredGlobalPromiseType || (deferredGlobalPromiseType = getGlobalType("Promise", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + + function getGlobalPromiseConstructorSymbol(reportErrors: boolean): Symbol | undefined { + return deferredGlobalPromiseConstructorSymbol || (deferredGlobalPromiseConstructorSymbol = getGlobalValueSymbol("Promise", reportErrors)); + } + + function getGlobalPromiseConstructorLikeType(reportErrors: boolean) { + return deferredGlobalPromiseConstructorLikeType || (deferredGlobalPromiseConstructorLikeType = getGlobalType("PromiseConstructorLike", /*arity*/ 0, reportErrors)) || emptyObjectType; + } + + function getGlobalAsyncIterableType(reportErrors: boolean) { + return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType("AsyncIterable", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + + function getGlobalAsyncIteratorType(reportErrors: boolean) { + return deferredGlobalAsyncIteratorType || (deferredGlobalAsyncIteratorType = getGlobalType("AsyncIterator", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + + function getGlobalAsyncIterableIteratorType(reportErrors: boolean) { + return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType("AsyncIterableIterator", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + + function getGlobalIterableType(reportErrors: boolean) { + return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType("Iterable", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + + function getGlobalIteratorType(reportErrors: boolean) { + return deferredGlobalIteratorType || (deferredGlobalIteratorType = getGlobalType("Iterator", /*arity*/ 1, reportErrors)) || emptyGenericType; + } + + function getGlobalIterableIteratorType(reportErrors: boolean) { + return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType("IterableIterator", /*arity*/ 1, reportErrors)) || emptyGenericType; } /** @@ -5943,16 +6097,6 @@ namespace ts { return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - /** - * Creates a TypeReference for a generic `TypedPropertyDescriptor`. - */ - function createTypedPropertyDescriptorType(propertyType: Type): Type { - const globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); - return globalTypedPropertyDescriptorType !== emptyGenericType - ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType]) - : emptyObjectType; - } - /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ @@ -5960,12 +6104,24 @@ namespace ts { return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } - function createIterableType(elementType: Type): Type { - return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); + function createTypedPropertyDescriptorType(propertyType: Type): Type { + return createTypeFromGenericGlobalType(getGlobalTypedPropertyDescriptorType(), [propertyType]); } - function createIterableIteratorType(elementType: Type): Type { - return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); + function createAsyncIterableType(iteratedType: Type): Type { + return createTypeFromGenericGlobalType(getGlobalAsyncIterableType(/*reportErrors*/ true), [iteratedType]); + } + + function createAsyncIterableIteratorType(iteratedType: Type): Type { + return createTypeFromGenericGlobalType(getGlobalAsyncIterableIteratorType(/*reportErrors*/ true), [iteratedType]); + } + + function createIterableType(iteratedType: Type): Type { + return createTypeFromGenericGlobalType(getGlobalIterableType(/*reportErrors*/ true), [iteratedType]); + } + + function createIterableIteratorType(iteratedType: Type): Type { + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(/*reportErrors*/ true), [iteratedType]); } function createArrayType(elementType: Type): ObjectType { @@ -6703,12 +6859,6 @@ namespace ts { return neverType; case SyntaxKind.ObjectKeyword: return nonPrimitiveType; - case SyntaxKind.JSDocNullKeyword: - return nullType; - case SyntaxKind.JSDocUndefinedKeyword: - return undefinedType; - case SyntaxKind.JSDocNeverKeyword: - return neverType; case SyntaxKind.ThisType: case SyntaxKind.ThisKeyword: return getTypeFromThisTypeNode(node); @@ -6735,8 +6885,9 @@ namespace ts { return getTypeFromUnionTypeNode(node); case SyntaxKind.IntersectionType: return getTypeFromIntersectionTypeNode(node); - case SyntaxKind.ParenthesizedType: case SyntaxKind.JSDocNullableType: + return getTypeFromJSDocNullableTypeNode(node); + case SyntaxKind.ParenthesizedType: case SyntaxKind.JSDocNonNullableType: case SyntaxKind.JSDocConstructorType: case SyntaxKind.JSDocThisType: @@ -7608,7 +7759,7 @@ namespace ts { if ((globalStringType === source && stringType === target) || (globalNumberType === source && numberType === target) || (globalBooleanType === source && booleanType === target) || - (getGlobalESSymbolType() === source && esSymbolType === target)) { + (getGlobalESSymbolType(/*reportErrors*/ false) === source && esSymbolType === target)) { reportError(Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType); } } @@ -9728,12 +9879,12 @@ namespace ts { function getTypeOfDestructuredArrayElement(type: Type, index: number) { return isTupleLikeType(type) && getTypeOfPropertyOfType(type, "" + index) || - checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || + checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) || unknownType; } function getTypeOfDestructuredSpreadExpression(type: Type) { - return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || unknownType); + return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) || unknownType); } function getAssignedTypeOfBinaryExpression(node: BinaryExpression): Type { @@ -9772,7 +9923,7 @@ namespace ts { case SyntaxKind.ForInStatement: return stringType; case SyntaxKind.ForOfStatement: - return checkRightHandSideOfForOf((parent).expression) || unknownType; + return checkRightHandSideOfForOf((parent).expression, (parent).awaitModifier) || unknownType; case SyntaxKind.BinaryExpression: return getAssignedTypeOfBinaryExpression(parent); case SyntaxKind.DeleteExpression: @@ -9816,7 +9967,7 @@ namespace ts { return stringType; } if (node.parent.parent.kind === SyntaxKind.ForOfStatement) { - return checkRightHandSideOfForOf((node.parent.parent).expression) || unknownType; + return checkRightHandSideOfForOf((node.parent.parent).expression, (node.parent.parent).awaitModifier) || unknownType; } return unknownType; } @@ -10092,7 +10243,7 @@ namespace ts { } let type: FlowType; if (flow.flags & FlowFlags.AfterFinally) { - // block flow edge: finally -> pre-try (for larger explanation check comment in binder.ts - bindTryStatement + // block flow edge: finally -> pre-try (for larger explanation check comment in binder.ts - bindTryStatement (flow).locked = true; type = getTypeAtFlowNode((flow).antecedent); (flow).locked = false; @@ -10260,7 +10411,7 @@ namespace ts { let seenIncomplete = false; for (const antecedent of flow.antecedents) { if (antecedent.flags & FlowFlags.PreFinally && (antecedent).lock.locked) { - // if flow correspond to branch from pre-try to finally and this branch is locked - this means that + // if flow correspond to branch from pre-try to finally and this branch is locked - this means that // we initially have started following the flow outside the finally block. // in this case we should ignore this branch. continue; @@ -11452,31 +11603,29 @@ namespace ts { function getContextualTypeForReturnExpression(node: Expression): Type { const func = getContainingFunction(node); - - if (isAsyncFunctionLike(func)) { - const contextualReturnType = getContextualReturnType(func); - if (contextualReturnType) { - return getPromisedType(contextualReturnType); + if (func) { + const functionFlags = getFunctionFlags(func); + if (functionFlags & FunctionFlags.Generator) { // AsyncGenerator function or Generator function + return undefined; } - return undefined; + const contextualReturnType = getContextualReturnType(func); + return functionFlags & FunctionFlags.Async + ? contextualReturnType && getAwaitedTypeOfPromise(contextualReturnType) // Async function + : contextualReturnType; // Regular function } - - if (func && !func.asteriskToken) { - return getContextualReturnType(func); - } - return undefined; } function getContextualTypeForYieldOperand(node: YieldExpression): Type { const func = getContainingFunction(node); if (func) { + const functionFlags = getFunctionFlags(func); const contextualReturnType = getContextualReturnType(func); if (contextualReturnType) { return node.asteriskToken ? contextualReturnType - : getElementTypeOfIterableIterator(contextualReturnType); + : getIteratedTypeOfGenerator(contextualReturnType, (functionFlags & FunctionFlags.Async) !== 0); } } @@ -11654,7 +11803,7 @@ namespace ts { const index = indexOf(arrayLiteral.elements, node); return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, IndexKind.Number) - || (languageVersion >= ScriptTarget.ES2015 ? getElementTypeOfIterable(type, /*errorNode*/ undefined) : undefined); + || getIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false, /*checkAssignability*/ false); } return undefined; } @@ -11869,8 +12018,12 @@ namespace ts { } function checkSpreadExpression(node: SpreadElement, contextualMapper?: TypeMapper): Type { + if (languageVersion < ScriptTarget.ES2015 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.SpreadIncludes); + } + const arrayOrIterableType = checkExpression(node.expression, contextualMapper); - return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); + return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false, /*allowAsyncIterable*/ false); } function hasDefaultValue(node: BindingElement | Expression): boolean { @@ -11899,7 +12052,7 @@ namespace ts { // if there is no index type / iterated type. const restArrayType = checkExpression((e).expression, contextualMapper); const restElementType = getIndexTypeOfType(restArrayType, IndexKind.Number) || - (languageVersion >= ScriptTarget.ES2015 ? getElementTypeOfIterable(restArrayType, /*errorNode*/ undefined) : undefined); + getIteratedTypeOrElementType(restArrayType, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterable*/ false, /*checkAssignability*/ false); if (restElementType) { elementTypes.push(restElementType); } @@ -12253,10 +12406,12 @@ namespace ts { /** * Get attributes type of the JSX opening-like element. The result is from resolving "attributes" property of the opening-like element. - * + * * @param openingLikeElement a JSX opening-like element * @param filter a function to remove attributes that will not participate in checking whether attributes are assignable * @return an anonymous type (similar to the one returned by checkObjectLiteral) in which its properties are attributes property. + * @remarks Because this function calls getSpreadType, it needs to use the same checks as checkObjectLiteral, + * which also calls getSpreadType. */ function createJsxAttributesTypeFromAttributesProperty(openingLikeElement: JsxOpeningLikeElement, filter?: (symbol: Symbol) => boolean, contextualMapper?: TypeMapper) { const attributes = openingLikeElement.attributes; @@ -12268,7 +12423,7 @@ namespace ts { if (isJsxAttribute(attributeDecl)) { const exprType = attributeDecl.initializer ? checkExpression(attributeDecl.initializer, contextualMapper) : - trueType; // is sugar for + trueType; // is sugar for const attributeSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.name); attributeSymbol.declarations = member.declarations; @@ -12289,7 +12444,7 @@ namespace ts { attributesTable = createMap(); } const exprType = checkExpression(attributeDecl.expression); - if (!(exprType.flags & (TypeFlags.Object | TypeFlags.Any))) { + if (!isValidSpreadType(exprType)) { error(attributeDecl, Diagnostics.Spread_types_may_only_be_created_from_object_types); return anyType; } @@ -12581,7 +12736,7 @@ namespace ts { // If the elemType is a stringLiteral type, we can then provide a check to make sure that the string literal type is one of the Jsx intrinsic element type // For example: // var CustomTag: "h1" = "h1"; - // Hello World + // Hello World const intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements); if (intrinsicElementsType !== unknownType) { const stringLiteralTypeName = (elementType).text; @@ -12641,11 +12796,6 @@ namespace ts { // Props is of type 'any' or unknown return attributesType; } - else if (attributesType.flags & TypeFlags.Union) { - // Props cannot be a union type - error(openingLikeElement.tagName, Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType)); - return anyType; - } else { // Normal case -- add in IntrinsicClassElements and IntrinsicElements let apparentAttributesType = attributesType; @@ -12727,7 +12877,7 @@ namespace ts { } /** - * Get the attributes type, which indicates the attributes that are valid on the given JSXOpeningLikeElement. + * Get the attributes type, which indicates the attributes that are valid on the given JSXOpeningLikeElement. * @param node a JSXOpeningLikeElement node * @return an attributes type of the given node */ @@ -12752,10 +12902,10 @@ namespace ts { } function getJsxGlobalElementClassType(): Type { - if (!jsxElementClassType) { - jsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); + if (!deferredJsxElementClassType) { + deferredJsxElementClassType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.ElementClass); } - return jsxElementClassType; + return deferredJsxElementClassType; } /** @@ -13221,7 +13371,7 @@ namespace ts { return false; } - const globalESSymbol = getGlobalESSymbolConstructorSymbol(); + const globalESSymbol = getGlobalESSymbolConstructorSymbol(/*reportErrors*/ true); if (!globalESSymbol) { // Already errored when we tried to look up the symbol return false; @@ -13540,7 +13690,7 @@ namespace ts { */ function checkApplicableSignatureForJsxOpeningLikeElement(node: JsxOpeningLikeElement, signature: Signature, relation: Map) { // JSX opening-like element has correct arity for stateless-function component if the one of the following condition is true: - // 1. callIsIncomplete + // 1. callIsIncomplete // 2. attributes property has same number of properties as the parameter object type. // We can figure that out by resolving attributes property and check number of properties in the resolved type // If the call has correct arity, we will then check if the argument type and parameter type is assignable @@ -14587,10 +14737,13 @@ namespace ts { // in a JS file // Note:JS inferred classes might come from a variable declaration instead of a function declaration. // In this case, using getResolvedSymbol directly is required to avoid losing the members from the declaration. - const funcSymbol = node.expression.kind === SyntaxKind.Identifier ? + let funcSymbol = node.expression.kind === SyntaxKind.Identifier ? getResolvedSymbol(node.expression as Identifier) : checkExpression(node.expression).symbol; - if (funcSymbol && funcSymbol.members && (funcSymbol.flags & SymbolFlags.Function || isDeclarationOfFunctionExpression(funcSymbol))) { + if (funcSymbol && isDeclarationOfFunctionOrClassExpression(funcSymbol)) { + funcSymbol = getSymbolOfNode((funcSymbol.valueDeclaration).initializer); + } + if (funcSymbol && funcSymbol.members && funcSymbol.flags & SymbolFlags.Function) { return getInferredClassType(funcSymbol); } else if (compilerOptions.noImplicitAny) { @@ -14661,7 +14814,6 @@ namespace ts { function checkMetaProperty(node: MetaProperty) { checkGrammarMetaProperty(node); - Debug.assert(node.keywordToken === SyntaxKind.NewKeyword && node.name.text === "target", "Unrecognized meta-property."); const container = getNewTargetContainer(node); if (!container) { error(node, Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); @@ -14694,6 +14846,10 @@ namespace ts { pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } + function getTypeOfFirstParameterOfSignature(signature: Signature) { + return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; + } + function assignContextualParameterTypes(signature: Signature, context: Signature, mapper: TypeMapper) { const len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); if (isInferentialContext(mapper)) { @@ -14801,10 +14957,10 @@ namespace ts { function createPromiseType(promisedType: Type): Type { // creates a `Promise` type where `T` is the promisedType argument - const globalPromiseType = getGlobalPromiseType(); + const globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true); if (globalPromiseType !== emptyGenericType) { // if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type - promisedType = getAwaitedType(promisedType); + promisedType = getAwaitedType(promisedType) || emptyObjectType; return createTypeReference(globalPromiseType, [promisedType]); } @@ -14817,7 +14973,7 @@ namespace ts { error(func, Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); return unknownType; } - else if (!getGlobalPromiseConstructorSymbol()) { + else if (!getGlobalPromiseConstructorSymbol(/*reportErrors*/ true)) { error(func, Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); } @@ -14830,25 +14986,26 @@ namespace ts { return unknownType; } - const isAsync = isAsyncFunctionLike(func); + const functionFlags = getFunctionFlags(func); let type: Type; if (func.body.kind !== SyntaxKind.Block) { type = checkExpressionCached(func.body, contextualMapper); - if (isAsync) { + if (functionFlags & FunctionFlags.Async) { // From within an async function you can return either a non-promise value or a promise. Any // Promise/A+ compatible implementation will always assimilate any foreign promise, so the // return type of the body should be unwrapped to its awaited type, which we will wrap in // the native Promise type later in this function. - type = checkAwaitedType(type, func, Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + type = checkAwaitedType(type, /*errorNode*/ func); } } else { let types: Type[]; - const funcIsGenerator = !!func.asteriskToken; - if (funcIsGenerator) { + if (functionFlags & FunctionFlags.Generator) { // Generator or AsyncGenerator function types = checkAndAggregateYieldOperandTypes(func, contextualMapper); if (types.length === 0) { - const iterableIteratorAny = createIterableIteratorType(anyType); + const iterableIteratorAny = functionFlags & FunctionFlags.Async + ? createAsyncIterableIteratorType(anyType) // AsyncGenerator function + : createIterableIteratorType(anyType); // Generator function if (compilerOptions.noImplicitAny) { error(func.asteriskToken, Diagnostics.Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type, typeToString(iterableIteratorAny)); @@ -14860,23 +15017,31 @@ namespace ts { types = checkAndAggregateReturnExpressionTypes(func, contextualMapper); if (!types) { // For an async function, the return type will not be never, but rather a Promise for never. - return isAsync ? createPromiseReturnType(func, neverType) : neverType; + return functionFlags & FunctionFlags.Async + ? createPromiseReturnType(func, neverType) // Async function + : neverType; // Normal function } if (types.length === 0) { // For an async function, the return type will not be void, but rather a Promise for void. - return isAsync ? createPromiseReturnType(func, voidType) : voidType; + return functionFlags & FunctionFlags.Async + ? createPromiseReturnType(func, voidType) // Async function + : voidType; // Normal function } } // Return a union of the return expression types. type = getUnionType(types, /*subtypeReduction*/ true); - if (funcIsGenerator) { - type = createIterableIteratorType(type); + if (functionFlags & FunctionFlags.Generator) { // AsyncGenerator function or Generator function + type = functionFlags & FunctionFlags.Async + ? createAsyncIterableIteratorType(type) // AsyncGenerator function + : createIterableIteratorType(type); // Generator function } } + if (!contextualSignature) { reportErrorsFromWidening(func, type); } + if (isUnitType(type) && !(contextualSignature && isLiteralContextualType( @@ -14888,22 +15053,22 @@ namespace ts { // From within an async function you can return either a non-promise value or a promise. Any // Promise/A+ compatible implementation will always assimilate any foreign promise, so the // return type of the body is awaited type of the body, wrapped in a native Promise type. - return isAsync ? createPromiseReturnType(func, widenedType) : widenedType; + return (functionFlags & FunctionFlags.AsyncOrAsyncGenerator) === FunctionFlags.Async + ? createPromiseReturnType(func, widenedType) // Async function + : widenedType; // Generator function, AsyncGenerator function, or normal function } function checkAndAggregateYieldOperandTypes(func: FunctionLikeDeclaration, contextualMapper: TypeMapper): Type[] { const aggregatedTypes: Type[] = []; - + const functionFlags = getFunctionFlags(func); forEachYieldExpression(func.body, yieldExpression => { const expr = yieldExpression.expression; if (expr) { let type = checkExpressionCached(expr, contextualMapper); - if (yieldExpression.asteriskToken) { // A yield* expression effectively yields everything that its operand yields - type = checkElementTypeOfIterable(type, yieldExpression.expression); + type = checkIteratedTypeOrElementType(type, yieldExpression.expression, /*allowStringInput*/ false, (functionFlags & FunctionFlags.Async) !== 0); } - if (!contains(aggregatedTypes, type)) { aggregatedTypes.push(type); } @@ -14940,7 +15105,7 @@ namespace ts { } function checkAndAggregateReturnExpressionTypes(func: FunctionLikeDeclaration, contextualMapper: TypeMapper): Type[] { - const isAsync = isAsyncFunctionLike(func); + const functionFlags = getFunctionFlags(func); const aggregatedTypes: Type[] = []; let hasReturnWithNoExpression = functionHasImplicitReturn(func); let hasReturnOfTypeNever = false; @@ -14948,12 +15113,12 @@ namespace ts { const expr = returnStatement.expression; if (expr) { let type = checkExpressionCached(expr, contextualMapper); - if (isAsync) { + if (functionFlags & FunctionFlags.Async) { // From within an async function you can return either a non-promise value or a promise. Any // Promise/A+ compatible implementation will always assimilate any foreign promise, so the // return type of the body should be unwrapped to its awaited type, which should be wrapped in // the native Promise type by the caller. - type = checkAwaitedType(type, func, Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + type = checkAwaitedType(type, func); } if (type.flags & TypeFlags.Never) { hasReturnOfTypeNever = true; @@ -15097,9 +15262,13 @@ namespace ts { function checkFunctionExpressionOrObjectLiteralMethodDeferred(node: ArrowFunction | FunctionExpression | MethodDeclaration) { Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node)); - const isAsync = isAsyncFunctionLike(node); - const returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); - if (!node.asteriskToken) { + const functionFlags = getFunctionFlags(node); + const returnOrPromisedType = node.type && + ((functionFlags & FunctionFlags.AsyncOrAsyncGenerator) === FunctionFlags.Async ? + checkAsyncFunctionReturnType(node) : // Async function + getTypeFromTypeNode(node.type)); // AsyncGenerator function, Generator function, or normal function + + if ((functionFlags & FunctionFlags.Generator) === 0) { // Async function or normal function // return is not necessary in the body of generators checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } @@ -15125,11 +15294,11 @@ namespace ts { // its return type annotation. const exprType = checkExpression(node.body); if (returnOrPromisedType) { - if (isAsync) { - const awaitedType = checkAwaitedType(exprType, node.body, Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member); + if ((functionFlags & FunctionFlags.AsyncOrAsyncGenerator) === FunctionFlags.Async) { // Async function + const awaitedType = checkAwaitedType(exprType, node.body); checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body); } - else { + else { // Normal function checkTypeAssignableTo(exprType, returnOrPromisedType, node.body); } } @@ -15444,10 +15613,14 @@ namespace ts { } function checkArrayLiteralAssignment(node: ArrayLiteralExpression, sourceType: Type, contextualMapper?: TypeMapper): Type { + if (languageVersion < ScriptTarget.ES2015 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.Read); + } + // This elementType will be used if the specific property corresponding to this index is not // present (aka the tuple element property). This call also checks that the parentType is in // fact an iterable or array (depending on target language). - const elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false) || unknownType; + const elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) || unknownType; const elements = node.elements; for (let i = 0; i < elements.length; i++) { checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper); @@ -15765,12 +15938,16 @@ namespace ts { checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); case SyntaxKind.CommaToken: - if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left)) { + if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isEvalNode(right)) { error(left, Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects); } return rightType; } + function isEvalNode(node: Expression) { + return node.kind === SyntaxKind.Identifier && (node as Identifier).text === "eval"; + } + // Return true if there was no error, false if there was an error. function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean { const offendingSymbolOperand = @@ -15855,18 +16032,31 @@ namespace ts { const func = getContainingFunction(node); // If the user's code is syntactically correct, the func should always have a star. After all, // we are in a yield context. - if (func && func.asteriskToken) { + const functionFlags = func && getFunctionFlags(func); + if (node.asteriskToken) { + if (functionFlags & FunctionFlags.Async) { + if (languageVersion < ScriptTarget.ES2017) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.AsyncDelegator); + } + } + else if (languageVersion < ScriptTarget.ES2015 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.Values); + } + } + + if (functionFlags & FunctionFlags.Generator) { const expressionType = checkExpressionCached(node.expression, /*contextualMapper*/ undefined); let expressionElementType: Type; const nodeIsYieldStar = !!node.asteriskToken; if (nodeIsYieldStar) { - expressionElementType = checkElementTypeOfIterable(expressionType, node.expression); + expressionElementType = checkIteratedTypeOrElementType(expressionType, node.expression, /*allowStringInput*/ false, (functionFlags & FunctionFlags.Async) !== 0); } + // There is no point in doing an assignability check if the function // has no explicit return type because the return type is directly computed // from the yield expressions. if (func.type) { - const signatureElementType = getElementTypeOfIterableIterator(getTypeFromTypeNode(func.type)) || anyType; + const signatureElementType = getIteratedTypeOfGenerator(getTypeFromTypeNode(func.type), (functionFlags & FunctionFlags.Async) !== 0) || anyType; if (nodeIsYieldStar) { checkTypeAssignableTo(expressionElementType, signatureElementType, node.expression, /*headMessage*/ undefined); } @@ -16212,16 +16402,6 @@ namespace ts { } } - function isSyntacticallyValidGenerator(node: SignatureDeclaration): boolean { - if (!(node).asteriskToken || !(node).body) { - return false; - } - - return node.kind === SyntaxKind.MethodDeclaration || - node.kind === SyntaxKind.FunctionDeclaration || - node.kind === SyntaxKind.FunctionExpression; - } - function getTypePredicateParameterIndex(parameterList: NodeArray, parameter: Identifier): number { if (parameterList) { for (let i = 0; i < parameterList.length; i++) { @@ -16341,13 +16521,23 @@ namespace ts { checkGrammarFunctionLikeDeclaration(node); } - if (isAsyncFunctionLike(node) && languageVersion < ScriptTarget.ES2017) { + const functionFlags = getFunctionFlags(node); + if ((functionFlags & FunctionFlags.InvalidAsyncOrAsyncGenerator) === FunctionFlags.Async && languageVersion < ScriptTarget.ES2017) { checkExternalEmitHelpers(node, ExternalEmitHelpers.Awaiter); if (languageVersion < ScriptTarget.ES2015) { checkExternalEmitHelpers(node, ExternalEmitHelpers.Generator); } } + if ((functionFlags & FunctionFlags.InvalidGenerator) === FunctionFlags.Generator) { + if (functionFlags & FunctionFlags.Async && languageVersion < ScriptTarget.ES2017) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.AsyncGenerator); + } + else if (languageVersion < ScriptTarget.ES2015) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.Generator); + } + } + checkTypeParameters(node.typeParameters); forEach(node.parameters, checkParameter); @@ -16370,14 +16560,17 @@ namespace ts { } if (node.type) { - if (languageVersion >= ScriptTarget.ES2015 && isSyntacticallyValidGenerator(node)) { + const functionFlags = getFunctionFlags(node); + if ((functionFlags & FunctionFlags.InvalidGenerator) === FunctionFlags.Generator) { const returnType = getTypeFromTypeNode(node.type); if (returnType === voidType) { error(node.type, Diagnostics.A_generator_cannot_have_a_void_type_annotation); } else { - const generatorElementType = getElementTypeOfIterableIterator(returnType) || anyType; - const iterableIteratorInstantiation = createIterableIteratorType(generatorElementType); + const generatorElementType = getIteratedTypeOfGenerator(returnType, (functionFlags & FunctionFlags.Async) !== 0) || anyType; + const iterableIteratorInstantiation = functionFlags & FunctionFlags.Async + ? createAsyncIterableIteratorType(generatorElementType) // AsyncGenerator function + : createIterableIteratorType(generatorElementType); // Generator function // Naively, one could check that IterableIterator is assignable to the return type annotation. // However, that would not catch the error in the following case. @@ -16388,7 +16581,7 @@ namespace ts { checkTypeAssignableTo(iterableIteratorInstantiation, returnType, node.type); } } - else if (isAsyncFunctionLike(node)) { + else if ((functionFlags & FunctionFlags.AsyncOrAsyncGenerator) === FunctionFlags.Async) { checkAsyncFunctionReturnType(node); } } @@ -17189,22 +17382,9 @@ namespace ts { } } - function checkNonThenableType(type: Type, location?: Node, message?: DiagnosticMessage): Type { - type = getWidenedType(type); - const apparentType = getApparentType(type); - if ((apparentType.flags & (TypeFlags.Any | TypeFlags.Never)) === 0 && isTypeAssignableTo(type, getGlobalThenableType())) { - if (location) { - if (!message) { - message = Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; - } - - error(location, message); - } - - return unknownType; - } - - return type; + function getAwaitedTypeOfPromise(type: Type, errorNode?: Node): Type | undefined { + const promisedType = getPromisedTypeOfPromise(type, errorNode); + return promisedType && getAwaitedType(promisedType, errorNode); } /** @@ -17212,7 +17392,7 @@ namespace ts { * @param type The type of the promise. * @remarks The "promised type" of a type is the type of the "value" parameter of the "onfulfilled" callback. */ - function getPromisedType(promise: Type): Type { + function getPromisedTypeOfPromise(promise: Type, errorNode?: Node): Type { // // { // promise // then( // thenFunction @@ -17227,25 +17407,25 @@ namespace ts { return undefined; } - if (getObjectFlags(promise) & ObjectFlags.Reference) { - if ((promise).target === tryGetGlobalPromiseType() - || (promise).target === getGlobalPromiseLikeType()) { - return (promise).typeArguments[0]; - } + const typeAsPromise = promise; + if (typeAsPromise.promisedTypeOfPromise) { + return typeAsPromise.promisedTypeOfPromise; } - const globalPromiseLikeType = getInstantiatedGlobalPromiseLikeType(); - if (globalPromiseLikeType === emptyObjectType || !isTypeAssignableTo(promise, globalPromiseLikeType)) { - return undefined; + if (isReferenceToType(promise, getGlobalPromiseType(/*reportErrors*/ false))) { + return typeAsPromise.promisedTypeOfPromise = (promise).typeArguments[0]; } const thenFunction = getTypeOfPropertyOfType(promise, "then"); - if (!thenFunction || isTypeAny(thenFunction)) { + if (isTypeAny(thenFunction)) { return undefined; } - const thenSignatures = getSignaturesOfType(thenFunction, SignatureKind.Call); + const thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, SignatureKind.Call) : emptyArray; if (thenSignatures.length === 0) { + if (errorNode) { + error(errorNode, Diagnostics.A_promise_must_have_a_then_method); + } return undefined; } @@ -17256,14 +17436,13 @@ namespace ts { const onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, SignatureKind.Call); if (onfulfilledParameterSignatures.length === 0) { + if (errorNode) { + error(errorNode, Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback); + } return undefined; } - return getUnionType(map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), /*subtypeReduction*/ true); - } - - function getTypeOfFirstParameterOfSignature(signature: Signature) { - return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : neverType; + return typeAsPromise.promisedTypeOfPromise = getUnionType(map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), /*subtypeReduction*/ true); } /** @@ -17273,96 +17452,111 @@ namespace ts { * Promise-like type; otherwise, it is the type of the expression. This is used to reflect * The runtime behavior of the `await` keyword. */ - function getAwaitedType(type: Type) { - return checkAwaitedType(type, /*location*/ undefined, /*message*/ undefined); + function checkAwaitedType(type: Type, errorNode: Node): Type { + return getAwaitedType(type, errorNode) || unknownType; } - function checkAwaitedType(type: Type, location?: Node, message?: DiagnosticMessage) { - return checkAwaitedTypeWorker(type); - - function checkAwaitedTypeWorker(type: Type): Type { - if (type.flags & TypeFlags.Union) { - const types: Type[] = []; - for (const constituentType of (type).types) { - types.push(checkAwaitedTypeWorker(constituentType)); - } - - return getUnionType(types, /*subtypeReduction*/ true); - } - else { - const promisedType = getPromisedType(type); - if (promisedType === undefined) { - // The type was not a PromiseLike, so it could not be unwrapped any further. - // As long as the type does not have a callable "then" property, it is - // safe to return the type; otherwise, an error will have been reported in - // the call to checkNonThenableType and we will return unknownType. - // - // An example of a non-promise "thenable" might be: - // - // await { then(): void {} } - // - // The "thenable" does not match the minimal definition for a PromiseLike. When - // a Promise/A+-compatible or ES6 promise tries to adopt this value, the promise - // will never settle. We treat this as an error to help flag an early indicator - // of a runtime problem. If the user wants to return this value from an async - // function, they would need to wrap it in some other value. If they want it to - // be treated as a promise, they can cast to . - return checkNonThenableType(type, location, message); - } - else { - if (type.id === promisedType.id || indexOf(awaitedTypeStack, promisedType.id) >= 0) { - // We have a bad actor in the form of a promise whose promised type is - // the same promise type, or a mutually recursive promise. Return the - // unknown type as we cannot guess the shape. If this were the actual - // case in the JavaScript, this Promise would never resolve. - // - // An example of a bad actor with a singly-recursive promise type might - // be: - // - // interface BadPromise { - // then( - // onfulfilled: (value: BadPromise) => any, - // onrejected: (error: any) => any): BadPromise; - // } - // - // The above interface will pass the PromiseLike check, and return a - // promised type of `BadPromise`. Since this is a self reference, we - // don't want to keep recursing ad infinitum. - // - // An example of a bad actor in the form of a mutually-recursive - // promise type might be: - // - // interface BadPromiseA { - // then( - // onfulfilled: (value: BadPromiseB) => any, - // onrejected: (error: any) => any): BadPromiseB; - // } - // - // interface BadPromiseB { - // then( - // onfulfilled: (value: BadPromiseA) => any, - // onrejected: (error: any) => any): BadPromiseA; - // } - // - if (location) { - error( - location, - Diagnostics._0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method, - symbolToString(type.symbol)); - } - - return unknownType; - } - - // Keep track of the type we're about to unwrap to avoid bad recursive promise types. - // See the comments above for more information. - awaitedTypeStack.push(type.id); - const awaitedType = checkAwaitedTypeWorker(promisedType); - awaitedTypeStack.pop(); - return awaitedType; - } - } + function getAwaitedType(type: Type, errorNode?: Node): Type | undefined { + const typeAsAwaitable = type; + if (typeAsAwaitable.awaitedTypeOfType) { + return typeAsAwaitable.awaitedTypeOfType; } + + if (isTypeAny(type)) { + return typeAsAwaitable.awaitedTypeOfType = type; + } + + if (type.flags & TypeFlags.Union) { + let types: Type[]; + for (const constituentType of (type).types) { + types = append(types, getAwaitedType(constituentType, errorNode)); + } + + if (!types) { + return undefined; + } + + return typeAsAwaitable.awaitedTypeOfType = getUnionType(types, /*subtypeReduction*/ true); + } + + const promisedType = getPromisedTypeOfPromise(type); + if (promisedType) { + if (type.id === promisedType.id || indexOf(awaitedTypeStack, promisedType.id) >= 0) { + // Verify that we don't have a bad actor in the form of a promise whose + // promised type is the same as the promise type, or a mutually recursive + // promise. If so, we return undefined as we cannot guess the shape. If this + // were the actual case in the JavaScript, this Promise would never resolve. + // + // An example of a bad actor with a singly-recursive promise type might + // be: + // + // interface BadPromise { + // then( + // onfulfilled: (value: BadPromise) => any, + // onrejected: (error: any) => any): BadPromise; + // } + // The above interface will pass the PromiseLike check, and return a + // promised type of `BadPromise`. Since this is a self reference, we + // don't want to keep recursing ad infinitum. + // + // An example of a bad actor in the form of a mutually-recursive + // promise type might be: + // + // interface BadPromiseA { + // then( + // onfulfilled: (value: BadPromiseB) => any, + // onrejected: (error: any) => any): BadPromiseB; + // } + // + // interface BadPromiseB { + // then( + // onfulfilled: (value: BadPromiseA) => any, + // onrejected: (error: any) => any): BadPromiseA; + // } + // + if (errorNode) { + error(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method); + } + return undefined; + } + + // Keep track of the type we're about to unwrap to avoid bad recursive promise types. + // See the comments above for more information. + awaitedTypeStack.push(type.id); + const awaitedType = getAwaitedType(promisedType, errorNode); + awaitedTypeStack.pop(); + + if (!awaitedType) { + return undefined; + } + + return typeAsAwaitable.awaitedTypeOfType = awaitedType; + } + + // The type was not a promise, so it could not be unwrapped any further. + // As long as the type does not have a callable "then" property, it is + // safe to return the type; otherwise, an error will be reported in + // the call to getNonThenableType and we will return undefined. + // + // An example of a non-promise "thenable" might be: + // + // await { then(): void {} } + // + // The "thenable" does not match the minimal definition for a promise. When + // a Promise/A+-compatible or ES6 promise tries to adopt this value, the promise + // will never settle. We treat this as an error to help flag an early indicator + // of a runtime problem. If the user wants to return this value from an async + // function, they would need to wrap it in some other value. If they want it to + // be treated as a promise, they can cast to . + const thenFunction = getTypeOfPropertyOfType(type, "then"); + if (thenFunction && getSignaturesOfType(thenFunction, SignatureKind.Call).length > 0) { + if (errorNode) { + error(errorNode, Diagnostics.Type_used_as_operand_to_await_or_the_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); + } + return undefined; + } + + return typeAsAwaitable.awaitedTypeOfType = type; } /** @@ -17409,8 +17603,8 @@ namespace ts { if (returnType === unknownType) { return unknownType; } - const globalPromiseType = getGlobalPromiseType(); - if (globalPromiseType !== emptyGenericType && globalPromiseType !== getTargetType(returnType)) { + const globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true); + if (globalPromiseType !== emptyGenericType && !isReferenceToType(returnType, globalPromiseType)) { // The promise type was not a valid type reference to the global promise type, so we // report an error and return the unknown type. error(node.type, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); @@ -17434,7 +17628,7 @@ namespace ts { const promiseConstructorSymbol = resolveEntityName(promiseConstructorName, SymbolFlags.Value, /*ignoreErrors*/ true); const promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType; if (promiseConstructorType === unknownType) { - if (promiseConstructorName.kind === SyntaxKind.Identifier && promiseConstructorName.text === "Promise" && getTargetType(returnType) === tryGetGlobalPromiseType()) { + if (promiseConstructorName.kind === SyntaxKind.Identifier && promiseConstructorName.text === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) { error(node.type, Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); } else { @@ -17443,7 +17637,7 @@ namespace ts { return unknownType; } - const globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); + const globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(/*reportErrors*/ true); if (globalPromiseConstructorLikeType === emptyObjectType) { // If we couldn't resolve the global PromiseConstructorLike type we cannot verify // compatibility with __awaiter. @@ -17468,7 +17662,7 @@ namespace ts { } // Get and return the awaited type of the return type. - return checkAwaitedType(returnType, node, Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + return checkAwaitedType(returnType, node); } /** Check a decorator */ @@ -17614,7 +17808,7 @@ namespace ts { function checkFunctionOrMethodDeclaration(node: FunctionDeclaration | MethodDeclaration): void { checkDecorators(node); checkSignatureDeclaration(node); - const isAsync = isAsyncFunctionLike(node); + const functionFlags = getFunctionFlags(node); // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including @@ -17656,8 +17850,10 @@ namespace ts { checkSourceElement(node.body); - if (!node.asteriskToken) { - const returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); + if ((functionFlags & FunctionFlags.Generator) === 0) { // Async function or normal function + const returnOrPromisedType = node.type && (functionFlags & FunctionFlags.Async + ? checkAsyncFunctionReturnType(node) // Async function + : getTypeFromTypeNode(node.type)); // normal function checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType); } @@ -17668,7 +17864,7 @@ namespace ts { reportImplicitAnyError(node, anyType); } - if (node.asteriskToken && nodeIsPresent(node.body)) { + if (functionFlags & FunctionFlags.Generator && nodeIsPresent(node.body)) { // A generator with a body and no type annotation can still cause errors. It can error if the // yielded values have no common supertype, or it can give an implicit any error if it has no // yielded values. The only way to trigger these errors is to try checking its return type. @@ -18165,7 +18361,7 @@ namespace ts { } if (node.kind === SyntaxKind.BindingElement) { - if (node.parent.kind === SyntaxKind.ObjectBindingPattern && languageVersion < ScriptTarget.ESNext && !isInAmbientContext(node)) { + if (node.parent.kind === SyntaxKind.ObjectBindingPattern && languageVersion < ScriptTarget.ESNext) { checkExternalEmitHelpers(node, ExternalEmitHelpers.Rest); } // check computed properties inside property names of binding elements @@ -18186,6 +18382,10 @@ namespace ts { // For a binding pattern, check contained binding elements if (isBindingPattern(node.name)) { + if (node.name.kind === SyntaxKind.ArrayBindingPattern && languageVersion < ScriptTarget.ES2015 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.Read); + } + forEach((node.name).elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body @@ -18279,10 +18479,10 @@ namespace ts { forEach(node.declarationList.declarations, checkSourceElement); } - function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node: Node) { + function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node: MethodDeclaration) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression if (node.modifiers && node.parent.kind === SyntaxKind.ObjectLiteralExpression) { - if (isAsyncFunctionLike(node)) { + if (getFunctionFlags(node) & FunctionFlags.Async) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, Diagnostics.Modifiers_cannot_appear_here); } @@ -18358,6 +18558,17 @@ namespace ts { function checkForOfStatement(node: ForOfStatement): void { checkGrammarForInOrForOfStatement(node); + if (node.kind === SyntaxKind.ForOfStatement) { + if ((node).awaitModifier) { + if (languageVersion < ScriptTarget.ES2017) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.ForAwaitOfIncludes); + } + } + else if (languageVersion < ScriptTarget.ES2015 && compilerOptions.downlevelIteration) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.ForOfIncludes); + } + } + // Check the LHS and RHS // If the LHS is a declaration, just check it as a variable declaration, which will in turn check the RHS // via checkRightHandSideOfForOf. @@ -18368,7 +18579,7 @@ namespace ts { } else { const varExpr = node.initializer; - const iteratedType = checkRightHandSideOfForOf(node.expression); + const iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier); // There may be a destructuring assignment on the left side if (varExpr.kind === SyntaxKind.ArrayLiteralExpression || varExpr.kind === SyntaxKind.ObjectLiteralExpression) { @@ -18454,56 +18665,126 @@ namespace ts { } } - function checkRightHandSideOfForOf(rhsExpression: Expression): Type { + function checkRightHandSideOfForOf(rhsExpression: Expression, awaitModifier: AwaitKeywordToken | undefined): Type { const expressionType = checkNonNullExpression(rhsExpression); - return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true); + return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true, awaitModifier !== undefined); } - function checkIteratedTypeOrElementType(inputType: Type, errorNode: Node, allowStringInput: boolean): Type { + function checkIteratedTypeOrElementType(inputType: Type, errorNode: Node, allowStringInput: boolean, allowAsyncIterable: boolean): Type { if (isTypeAny(inputType)) { return inputType; } - if (languageVersion >= ScriptTarget.ES2015) { - return checkElementTypeOfIterable(inputType, errorNode); - } - if (allowStringInput) { - return checkElementTypeOfArrayOrString(inputType, errorNode); - } - if (isArrayLikeType(inputType)) { - const indexType = getIndexTypeOfType(inputType, IndexKind.Number); - if (indexType) { - return indexType; - } - } - if (errorNode) { - error(errorNode, Diagnostics.Type_0_is_not_an_array_type, typeToString(inputType)); - } - return unknownType; + + return getIteratedTypeOrElementType(inputType, errorNode, allowStringInput, allowAsyncIterable, /*checkAssignability*/ true) || anyType; } /** - * When errorNode is undefined, it means we should not report any errors. + * When consuming an iterable type in a for..of, spread, or iterator destructuring assignment + * we want to get the iterated type of an iterable for ES2015 or later, or the iterated type + * of a iterable (if defined globally) or element type of an array like for ES2015 or earlier. */ - function checkElementTypeOfIterable(iterable: Type, errorNode: Node): Type { - const elementType = getElementTypeOfIterable(iterable, errorNode); - // Now even though we have extracted the iteratedType, we will have to validate that the type - // passed in is actually an Iterable. - if (errorNode && elementType) { - checkTypeAssignableTo(iterable, createIterableType(elementType), errorNode); + function getIteratedTypeOrElementType(inputType: Type, errorNode: Node, allowStringInput: boolean, allowAsyncIterable: boolean, checkAssignability: boolean): Type { + const uplevelIteration = languageVersion >= ScriptTarget.ES2015; + const downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; + + // Get the iterated type of an `Iterable` or `IterableIterator` only in ES2015 + // or higher, when inside of an async generator or for-await-if, or when + // downlevelIteration is requested. + if (uplevelIteration || downlevelIteration || allowAsyncIterable) { + // We only report errors for an invalid iterable type in ES2015 or higher. + const iteratedType = getIteratedTypeOfIterable(inputType, uplevelIteration ? errorNode : undefined, allowAsyncIterable, allowAsyncIterable, checkAssignability); + if (iteratedType || uplevelIteration) { + return iteratedType; + } } - return elementType || anyType; + let arrayType = inputType; + let reportedError = false; + let hasStringConstituent = false; + + // If strings are permitted, remove any string-like constituents from the array type. + // This allows us to find other non-string element types from an array unioned with + // a string. + if (allowStringInput) { + if (arrayType.flags & TypeFlags.Union) { + // After we remove all types that are StringLike, we will know if there was a string constituent + // based on whether the result of filter is a new array. + const arrayTypes = (inputType).types; + const filteredTypes = filter(arrayTypes, t => !(t.flags & TypeFlags.StringLike)); + if (filteredTypes !== arrayTypes) { + arrayType = getUnionType(filteredTypes, /*subtypeReduction*/ true); + } + } + else if (arrayType.flags & TypeFlags.StringLike) { + arrayType = neverType; + } + + hasStringConstituent = arrayType !== inputType; + if (hasStringConstituent) { + if (languageVersion < ScriptTarget.ES5) { + if (errorNode) { + error(errorNode, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); + reportedError = true; + } + } + + // Now that we've removed all the StringLike types, if no constituents remain, then the entire + // arrayOrStringType was a string. + if (arrayType.flags & TypeFlags.Never) { + return stringType; + } + } + } + + if (!isArrayLikeType(arrayType)) { + if (errorNode && !reportedError) { + // Which error we report depends on whether we allow strings or if there was a + // string constituent. For example, if the input type is number | string, we + // want to say that number is not an array type. But if the input was just + // number and string input is allowed, we want to say that number is not an + // array type or a string type. + const diagnostic = !allowStringInput || hasStringConstituent + ? downlevelIteration + ? Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator + : Diagnostics.Type_0_is_not_an_array_type + : downlevelIteration + ? Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator + : Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + error(errorNode, diagnostic, typeToString(arrayType)); + } + return hasStringConstituent ? stringType : undefined; + } + + const arrayElementType = getIndexTypeOfType(arrayType, IndexKind.Number); + if (hasStringConstituent && arrayElementType) { + // This is just an optimization for the case where arrayOrStringType is string | string[] + if (arrayElementType.flags & TypeFlags.StringLike) { + return stringType; + } + + return getUnionType([arrayElementType, stringType], /*subtypeReduction*/ true); + } + + return arrayElementType; } /** * We want to treat type as an iterable, and get the type it is an iterable of. The iterable * must have the following structure (annotated with the names of the variables below): * - * { // iterable - * [Symbol.iterator]: { // iteratorFunction - * (): Iterator + * { // iterable + * [Symbol.iterator]: { // iteratorMethod + * (): Iterator + * } + * } + * + * For an async iterable, we expect the following structure: + * + * { // iterable + * [Symbol.asyncIterator]: { // iteratorMethod + * (): AsyncIterator + * } * } - * } * * T is the type we are after. At every level that involves analyzing return types * of signatures, we union the return types of all the signatures. @@ -18515,187 +18796,190 @@ namespace ts { * caller requested it. Then the caller can decide what to do in the case where there is no iterated * type. This is different from returning anyType, because that would signify that we have matched the * whole pattern and that T (above) is 'any'. + * + * For a **for-of** statement, `yield*` (in a normal generator), spread, array + * destructuring, or normal generator we will only ever look for a `[Symbol.iterator]()` + * method. + * + * For an async generator we will only ever look at the `[Symbol.asyncIterator]()` method. + * + * For a **for-await-of** statement or a `yield*` in an async generator we will look for + * the `[Symbol.asyncIterator]()` method first, and then the `[Symbol.iterator]()` method. */ - function getElementTypeOfIterable(type: Type, errorNode: Node): Type { + function getIteratedTypeOfIterable(type: Type, errorNode: Node | undefined, isAsyncIterable: boolean, allowNonAsyncIterables: boolean, checkAssignability: boolean): Type | undefined { if (isTypeAny(type)) { return undefined; } const typeAsIterable = type; - if (!typeAsIterable.iterableElementType) { - // As an optimization, if the type is instantiated directly using the globalIterableType (Iterable), - // then just grab its type argument. - if ((getObjectFlags(type) & ObjectFlags.Reference) && (type).target === getGlobalIterableType()) { - typeAsIterable.iterableElementType = (type).typeArguments[0]; - } - else { - const iteratorFunction = getTypeOfPropertyOfType(type, getPropertyNameForKnownSymbolName("iterator")); - if (isTypeAny(iteratorFunction)) { - return undefined; - } + if (isAsyncIterable ? typeAsIterable.iteratedTypeOfAsyncIterable : typeAsIterable.iteratedTypeOfIterable) { + return isAsyncIterable ? typeAsIterable.iteratedTypeOfAsyncIterable : typeAsIterable.iteratedTypeOfIterable; + } - const iteratorFunctionSignatures = iteratorFunction ? getSignaturesOfType(iteratorFunction, SignatureKind.Call) : emptyArray; - if (iteratorFunctionSignatures.length === 0) { - if (errorNode) { - error(errorNode, Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); - } - return undefined; - } - - typeAsIterable.iterableElementType = getElementTypeOfIterator(getUnionType(map(iteratorFunctionSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true), errorNode); + if (isAsyncIterable) { + // As an optimization, if the type is an instantiation of the global `AsyncIterable` + // or the global `AsyncIterableIterator` then just grab its type argument. + if (isReferenceToType(type, getGlobalAsyncIterableType(/*reportErrors*/ false)) || + isReferenceToType(type, getGlobalAsyncIterableIteratorType(/*reportErrors*/ false))) { + return typeAsIterable.iteratedTypeOfAsyncIterable = (type).typeArguments[0]; } } - return typeAsIterable.iterableElementType; + if (!isAsyncIterable || allowNonAsyncIterables) { + // As an optimization, if the type is an instantiation of the global `Iterable` or + // `IterableIterator` then just grab its type argument. + if (isReferenceToType(type, getGlobalIterableType(/*reportErrors*/ false)) || + isReferenceToType(type, getGlobalIterableIteratorType(/*reportErrors*/ false))) { + return isAsyncIterable + ? typeAsIterable.iteratedTypeOfAsyncIterable = (type).typeArguments[0] + : typeAsIterable.iteratedTypeOfIterable = (type).typeArguments[0]; + } + } + + let iteratorMethodSignatures: Signature[]; + let mayBeIterable = false; + if (isAsyncIterable) { + const iteratorMethod = getTypeOfPropertyOfType(type, getPropertyNameForKnownSymbolName("asyncIterator")); + if (isTypeAny(iteratorMethod)) { + return undefined; + } + iteratorMethodSignatures = iteratorMethod && getSignaturesOfType(iteratorMethod, SignatureKind.Call); + } + + if (!isAsyncIterable || (allowNonAsyncIterables && !some(iteratorMethodSignatures))) { + const iteratorMethod = getTypeOfPropertyOfType(type, getPropertyNameForKnownSymbolName("iterator")); + if (isTypeAny(iteratorMethod)) { + return undefined; + } + iteratorMethodSignatures = iteratorMethod && getSignaturesOfType(iteratorMethod, SignatureKind.Call); + mayBeIterable = true; + } + + if (some(iteratorMethodSignatures)) { + const iteratorMethodReturnType = getUnionType(map(iteratorMethodSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true); + const iteratedType = getIteratedTypeOfIterator(iteratorMethodReturnType, errorNode, /*isAsyncIterator*/ false); + if (checkAssignability && errorNode && iteratedType) { + // If `checkAssignability` was specified, we were called from + // `checkIteratedTypeOrElementType`. As such, we need to validate that + // the type passed in is actually an Iterable. + checkTypeAssignableTo(type, mayBeIterable + ? createIterableType(iteratedType) + : createAsyncIterableType(iteratedType), errorNode); + } + return isAsyncIterable + ? typeAsIterable.iteratedTypeOfAsyncIterable = iteratedType + : typeAsIterable.iteratedTypeOfIterable = iteratedType; + } + + if (errorNode) { + error(errorNode, + isAsyncIterable + ? Diagnostics.Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator + : Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator); + } + + return undefined; } /** - * This function has very similar logic as getElementTypeOfIterable, except that it operates on + * This function has very similar logic as getIteratedTypeOfIterable, except that it operates on * Iterators instead of Iterables. Here is the structure: * * { // iterator - * next: { // iteratorNextFunction - * (): { // iteratorNextResult - * value: T // iteratorNextValue + * next: { // nextMethod + * (): { // nextResult + * value: T // nextValue * } * } * } * + * For an async iterator, we expect the following structure: + * + * { // iterator + * next: { // nextMethod + * (): PromiseLike<{ // nextResult + * value: T // nextValue + * }> + * } + * } */ - function getElementTypeOfIterator(type: Type, errorNode: Node): Type { + function getIteratedTypeOfIterator(type: Type, errorNode: Node | undefined, isAsyncIterator: boolean): Type | undefined { if (isTypeAny(type)) { return undefined; } const typeAsIterator = type; - if (!typeAsIterator.iteratorElementType) { - // As an optimization, if the type is instantiated directly using the globalIteratorType (Iterator), - // then just grab its type argument. - if ((getObjectFlags(type) & ObjectFlags.Reference) && (type).target === getGlobalIteratorType()) { - typeAsIterator.iteratorElementType = (type).typeArguments[0]; - } - else { - const iteratorNextFunction = getTypeOfPropertyOfType(type, "next"); - if (isTypeAny(iteratorNextFunction)) { - return undefined; - } - - const iteratorNextFunctionSignatures = iteratorNextFunction ? getSignaturesOfType(iteratorNextFunction, SignatureKind.Call) : emptyArray; - if (iteratorNextFunctionSignatures.length === 0) { - if (errorNode) { - error(errorNode, Diagnostics.An_iterator_must_have_a_next_method); - } - return undefined; - } - - const iteratorNextResult = getUnionType(map(iteratorNextFunctionSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true); - if (isTypeAny(iteratorNextResult)) { - return undefined; - } - - const iteratorNextValue = getTypeOfPropertyOfType(iteratorNextResult, "value"); - if (!iteratorNextValue) { - if (errorNode) { - error(errorNode, Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property); - } - return undefined; - } - - typeAsIterator.iteratorElementType = iteratorNextValue; - } + if (isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator : typeAsIterator.iteratedTypeOfIterator) { + return isAsyncIterator ? typeAsIterator.iteratedTypeOfAsyncIterator : typeAsIterator.iteratedTypeOfIterator; } - return typeAsIterator.iteratorElementType; - } + // As an optimization, if the type is an instantiation of the global `Iterator` (for + // a non-async iterator) or the global `AsyncIterator` (for an async-iterator) then + // just grab its type argument. + const getIteratorType = isAsyncIterator ? getGlobalAsyncIteratorType : getGlobalIteratorType; + if (isReferenceToType(type, getIteratorType(/*reportErrors*/ false))) { + return isAsyncIterator + ? typeAsIterator.iteratedTypeOfAsyncIterator = (type).typeArguments[0] + : typeAsIterator.iteratedTypeOfIterator = (type).typeArguments[0]; + } - function getElementTypeOfIterableIterator(type: Type): Type { - if (isTypeAny(type)) { + // Both async and non-async iterators must have a `next` method. + const nextMethod = getTypeOfPropertyOfType(type, "next"); + if (isTypeAny(nextMethod)) { return undefined; } - // As an optimization, if the type is instantiated directly using the globalIterableIteratorType (IterableIterator), - // then just grab its type argument. - if ((getObjectFlags(type) & ObjectFlags.Reference) && (type).target === getGlobalIterableIteratorType()) { - return (type).typeArguments[0]; + const nextMethodSignatures = nextMethod ? getSignaturesOfType(nextMethod, SignatureKind.Call) : emptyArray; + if (nextMethodSignatures.length === 0) { + if (errorNode) { + error(errorNode, isAsyncIterator + ? Diagnostics.An_async_iterator_must_have_a_next_method + : Diagnostics.An_iterator_must_have_a_next_method); + } + return undefined; } - return getElementTypeOfIterable(type, /*errorNode*/ undefined) || - getElementTypeOfIterator(type, /*errorNode*/ undefined); + let nextResult = getUnionType(map(nextMethodSignatures, getReturnTypeOfSignature), /*subtypeReduction*/ true); + if (isTypeAny(nextResult)) { + return undefined; + } + + // For an async iterator, we must get the awaited type of the return type. + if (isAsyncIterator) { + nextResult = getAwaitedTypeOfPromise(nextResult, errorNode); + if (isTypeAny(nextResult)) { + return undefined; + } + } + + const nextValue = nextResult && getTypeOfPropertyOfType(nextResult, "value"); + if (!nextValue) { + if (errorNode) { + error(errorNode, isAsyncIterator + ? Diagnostics.The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property + : Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property); + } + return undefined; + } + + return isAsyncIterator + ? typeAsIterator.iteratedTypeOfAsyncIterator = nextValue + : typeAsIterator.iteratedTypeOfIterator = nextValue; } /** - * This function does the following steps: - * 1. Break up arrayOrStringType (possibly a union) into its string constituents and array constituents. - * 2. Take the element types of the array constituents. - * 3. Return the union of the element types, and string if there was a string constituent. - * - * For example: - * string -> string - * number[] -> number - * string[] | number[] -> string | number - * string | number[] -> string | number - * string | string[] | number[] -> string | number - * - * It also errors if: - * 1. Some constituent is neither a string nor an array. - * 2. Some constituent is a string and target is less than ES5 (because in ES3 string is not indexable). + * A generator may have a return type of `Iterator`, `Iterable`, or + * `IterableIterator`. An async generator may have a return type of `AsyncIterator`, + * `AsyncIterable`, or `AsyncIterableIterator`. This function can be used to extract + * the iterated type from this return type for contextual typing and verifying signatures. */ - function checkElementTypeOfArrayOrString(arrayOrStringType: Type, errorNode: Node): Type { - Debug.assert(languageVersion < ScriptTarget.ES2015); - - let arrayType = arrayOrStringType; - if (arrayOrStringType.flags & TypeFlags.Union) { - // After we remove all types that are StringLike, we will know if there was a string constituent - // based on whether the result of filter is a new array. - const arrayTypes = (arrayOrStringType as UnionType).types; - const filteredTypes = filter(arrayTypes, t => !(t.flags & TypeFlags.StringLike)); - if (filteredTypes !== arrayTypes) { - arrayType = getUnionType(filteredTypes, /*subtypeReduction*/ true); - } - } - else if (arrayOrStringType.flags & TypeFlags.StringLike) { - arrayType = neverType; - } - const hasStringConstituent = arrayOrStringType !== arrayType; - let reportedError = false; - if (hasStringConstituent) { - if (languageVersion < ScriptTarget.ES5) { - error(errorNode, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); - reportedError = true; - } - - // Now that we've removed all the StringLike types, if no constituents remain, then the entire - // arrayOrStringType was a string. - if (arrayType.flags & TypeFlags.Never) { - return stringType; - } + function getIteratedTypeOfGenerator(returnType: Type, isAsyncGenerator: boolean): Type { + if (isTypeAny(returnType)) { + return undefined; } - if (!isArrayLikeType(arrayType)) { - if (!reportedError) { - // Which error we report depends on whether there was a string constituent. For example, - // if the input type is number | string, we want to say that number is not an array type. - // But if the input was just number, we want to say that number is not an array type - // or a string type. - const diagnostic = hasStringConstituent - ? Diagnostics.Type_0_is_not_an_array_type - : Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; - error(errorNode, diagnostic, typeToString(arrayType)); - } - return hasStringConstituent ? stringType : unknownType; - } - - const arrayElementType = getIndexTypeOfType(arrayType, IndexKind.Number) || unknownType; - if (hasStringConstituent) { - // This is just an optimization for the case where arrayOrStringType is string | string[] - if (arrayElementType.flags & TypeFlags.StringLike) { - return stringType; - } - - return getUnionType([arrayElementType, stringType], /*subtypeReduction*/ true); - } - - return arrayElementType; + return getIteratedTypeOfIterable(returnType, /*errorNode*/ undefined, isAsyncGenerator, /*allowNonAsyncIterables*/ false, /*checkAssignability*/ false) + || getIteratedTypeOfIterator(returnType, /*errorNode*/ undefined, isAsyncGenerator); } function checkBreakOrContinueStatement(node: BreakOrContinueStatement) { @@ -18710,7 +18994,9 @@ namespace ts { } function isUnwrappedReturnTypeVoidOrAny(func: FunctionLikeDeclaration, returnType: Type): boolean { - const unwrappedReturnType = isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + const unwrappedReturnType = (getFunctionFlags(func) & FunctionFlags.AsyncOrAsyncGenerator) === FunctionFlags.Async + ? getPromisedTypeOfPromise(returnType) // Async function + : returnType; // AsyncGenerator function, Generator function, or normal function return unwrappedReturnType && maybeTypeOfKind(unwrappedReturnType, TypeFlags.Void | TypeFlags.Any); } @@ -18729,8 +19015,8 @@ namespace ts { const returnType = getReturnTypeOfSignature(signature); if (strictNullChecks || node.expression || returnType.flags & TypeFlags.Never) { const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - - if (func.asteriskToken) { + const functionFlags = getFunctionFlags(func); + if (functionFlags & FunctionFlags.Generator) { // AsyncGenerator function or Generator function // A generator does not need its return expressions checked against its return type. // Instead, the yield expressions are checked against the element type. // TODO: Check return expressions of generators when return type tracking is added @@ -18749,9 +19035,9 @@ namespace ts { } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { - if (isAsyncFunctionLike(func)) { - const promisedType = getPromisedType(returnType); - const awaitedType = checkAwaitedType(exprType, node, Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + if (functionFlags & FunctionFlags.Async) { // Async function + const promisedType = getPromisedTypeOfPromise(returnType); + const awaitedType = checkAwaitedType(exprType, node); if (promisedType) { // If the function has a return type, but promisedType is // undefined, an error will be reported in checkAsyncFunctionReturnType @@ -19154,7 +19440,7 @@ namespace ts { const baseTypeNode = getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - if (languageVersion < ScriptTarget.ES2015 && !isInAmbientContext(node)) { + if (languageVersion < ScriptTarget.ES2015) { checkExternalEmitHelpers(baseTypeNode.parent, ExternalEmitHelpers.Extends); } @@ -20474,14 +20760,14 @@ namespace ts { } function getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[] { - const symbols = createMap(); - let memberFlags: ModifierFlags = ModifierFlags.None; - if (isInsideWithStatementBody(location)) { // We cannot answer semantic questions within a with block, do not proceed any further return []; } + const symbols = createMap(); + let memberFlags: ModifierFlags = ModifierFlags.None; + populateSymbols(); return symbolsToArray(symbols); @@ -20639,22 +20925,31 @@ namespace ts { return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } + function getSpecialPropertyAssignmentSymbolFromEntityName(entityName: EntityName | PropertyAccessExpression) { + const specialPropertyAssignmentKind = getSpecialPropertyAssignmentKind(entityName.parent.parent); + switch (specialPropertyAssignmentKind) { + case SpecialPropertyAssignmentKind.ExportsProperty: + case SpecialPropertyAssignmentKind.PrototypeProperty: + return getSymbolOfNode(entityName.parent); + case SpecialPropertyAssignmentKind.ThisProperty: + case SpecialPropertyAssignmentKind.ModuleExports: + case SpecialPropertyAssignmentKind.Property: + return getSymbolOfNode(entityName.parent.parent); + } + } + function getSymbolOfEntityNameOrPropertyAccessExpression(entityName: EntityName | PropertyAccessExpression): Symbol | undefined { if (isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (isInJavaScriptFile(entityName) && entityName.parent.kind === SyntaxKind.PropertyAccessExpression) { - const specialPropertyAssignmentKind = getSpecialPropertyAssignmentKind(entityName.parent.parent); - switch (specialPropertyAssignmentKind) { - case SpecialPropertyAssignmentKind.ExportsProperty: - case SpecialPropertyAssignmentKind.PrototypeProperty: - return getSymbolOfNode(entityName.parent); - case SpecialPropertyAssignmentKind.ThisProperty: - case SpecialPropertyAssignmentKind.ModuleExports: - return getSymbolOfNode(entityName.parent.parent); - default: - // Fall through if it is not a special property assignment + if (isInJavaScriptFile(entityName) && + entityName.parent.kind === SyntaxKind.PropertyAccessExpression && + entityName.parent === (entityName.parent.parent as BinaryExpression).left) { + // Check if this is a special property assignment + const specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName); + if (specialPropertyAssignmentSymbol) { + return specialPropertyAssignmentSymbol; } } @@ -20741,6 +21036,7 @@ namespace ts { if (node.kind === SyntaxKind.SourceFile) { return isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } + if (isInsideWithStatementBody(node)) { // We cannot answer semantic questions within a with block, do not proceed any further return undefined; @@ -20912,7 +21208,7 @@ namespace ts { // for ( { a } of elems) { // } if (expr.parent.kind === SyntaxKind.ForOfStatement) { - const iteratedType = checkRightHandSideOfForOf((expr.parent).expression); + const iteratedType = checkRightHandSideOfForOf((expr.parent).expression, (expr.parent).awaitModifier); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from "for" initializer @@ -20931,7 +21227,7 @@ namespace ts { Debug.assert(expr.parent.kind === SyntaxKind.ArrayLiteralExpression); // [{ property1: p1, property2 }] = elems; const typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); - const elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false) || unknownType; + const elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterable*/ false) || unknownType; return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, indexOf((expr.parent).elements, expr), elementType || unknownType); } @@ -21191,12 +21487,6 @@ namespace ts { } function isValueAliasDeclaration(node: Node): boolean { - node = getParseTreeNode(node); - if (node === undefined) { - // A synthesized node comes from an emit transformation and is always a value. - return true; - } - switch (node.kind) { case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.ImportClause: @@ -21243,12 +21533,6 @@ namespace ts { } function isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean { - node = getParseTreeNode(node); - // Purely synthesized nodes are always emitted. - if (node === undefined) { - return true; - } - if (isAliasSymbolDeclaration(node)) { const symbol = getSymbolOfNode(node); if (symbol && getSymbolLinks(symbol).referenced) { @@ -21291,8 +21575,7 @@ namespace ts { } function getNodeCheckFlags(node: Node): NodeCheckFlags { - node = getParseTreeNode(node); - return node ? getNodeLinks(node).flags : undefined; + return getNodeLinks(node).flags; } function getEnumMemberValue(node: EnumMember): number { @@ -21300,6 +21583,16 @@ namespace ts { return getNodeLinks(node).enumMemberValue; } + function canHaveConstantValue(node: Node): node is EnumMember | PropertyAccessExpression | ElementAccessExpression { + switch (node.kind) { + case SyntaxKind.EnumMember: + case SyntaxKind.PropertyAccessExpression: + case SyntaxKind.ElementAccessExpression: + return true; + } + return false; + } + function getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number { if (node.kind === SyntaxKind.EnumMember) { return getEnumMemberValue(node); @@ -21327,7 +21620,7 @@ namespace ts { // Resolve the symbol as a type so that we can provide a more useful hint for the type serializer. const typeSymbol = resolveEntityName(typeName, SymbolFlags.Type, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location); if (valueSymbol && valueSymbol === typeSymbol) { - const globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); + const globalPromiseSymbol = getGlobalPromiseConstructorSymbol(/*reportErrors*/ false); if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { return TypeReferenceSerializationKind.Promise; } @@ -21481,10 +21774,21 @@ namespace ts { getReferencedImportDeclaration, getReferencedDeclarationWithCollidingName, isDeclarationWithCollidingName, - isValueAliasDeclaration, + isValueAliasDeclaration: node => { + node = getParseTreeNode(node); + // Synthesized nodes are always treated like values. + return node ? isValueAliasDeclaration(node) : true; + }, hasGlobalName, - isReferencedAliasDeclaration, - getNodeCheckFlags, + isReferencedAliasDeclaration: (node, checkChildren?) => { + node = getParseTreeNode(node); + // Synthesized nodes are always treated as referenced. + return node ? isReferencedAliasDeclaration(node, checkChildren) : true; + }, + getNodeCheckFlags: node => { + node = getParseTreeNode(node); + return node ? getNodeCheckFlags(node) : undefined; + }, isTopLevelValueImportEqualsWithEntityName, isDeclarationVisible, isImplementationOfOverload, @@ -21495,7 +21799,10 @@ namespace ts { writeBaseConstructorTypeOfClass, isSymbolAccessible, isEntityNameVisible, - getConstantValue, + getConstantValue: node => { + node = getParseTreeNode(node, canHaveConstantValue); + return node ? getConstantValue(node) : undefined; + }, collectLinkedAliases, getReferencedValueDeclaration, getTypeReferenceSerializationKind, @@ -21641,49 +21948,18 @@ namespace ts { addToSymbolTable(globals, builtinGlobals, Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0); getSymbolLinks(undefinedSymbol).type = undefinedWideningType; - getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); + getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments", /*arity*/ 0, /*reportErrors*/ true); getSymbolLinks(unknownSymbol).type = unknownType; // Initialize special types - globalArrayType = getGlobalType("Array", /*arity*/ 1); - globalObjectType = getGlobalType("Object"); - globalFunctionType = getGlobalType("Function"); - globalStringType = getGlobalType("String"); - globalNumberType = getGlobalType("Number"); - globalBooleanType = getGlobalType("Boolean"); - globalRegExpType = getGlobalType("RegExp"); - + globalArrayType = getGlobalType("Array", /*arity*/ 1, /*reportErrors*/ true); + globalObjectType = getGlobalType("Object", /*arity*/ 0, /*reportErrors*/ true); + globalFunctionType = getGlobalType("Function", /*arity*/ 0, /*reportErrors*/ true); + globalStringType = getGlobalType("String", /*arity*/ 0, /*reportErrors*/ true); + globalNumberType = getGlobalType("Number", /*arity*/ 0, /*reportErrors*/ true); + globalBooleanType = getGlobalType("Boolean", /*arity*/ 0, /*reportErrors*/ true); + globalRegExpType = getGlobalType("RegExp", /*arity*/ 0, /*reportErrors*/ true); jsxElementType = getExportedTypeFromNamespace("JSX", JsxNames.Element); - getGlobalClassDecoratorType = memoize(() => getGlobalType("ClassDecorator")); - getGlobalPropertyDecoratorType = memoize(() => getGlobalType("PropertyDecorator")); - getGlobalMethodDecoratorType = memoize(() => getGlobalType("MethodDecorator")); - getGlobalParameterDecoratorType = memoize(() => getGlobalType("ParameterDecorator")); - getGlobalTypedPropertyDescriptorType = memoize(() => getGlobalType("TypedPropertyDescriptor", /*arity*/ 1)); - getGlobalESSymbolConstructorSymbol = memoize(() => getGlobalValueSymbol("Symbol")); - getGlobalPromiseType = memoize(() => getGlobalType("Promise", /*arity*/ 1)); - tryGetGlobalPromiseType = memoize(() => getGlobalSymbol("Promise", SymbolFlags.Type, /*diagnostic*/ undefined) && getGlobalPromiseType()); - getGlobalPromiseLikeType = memoize(() => getGlobalType("PromiseLike", /*arity*/ 1)); - getInstantiatedGlobalPromiseLikeType = memoize(createInstantiatedPromiseLikeType); - getGlobalPromiseConstructorSymbol = memoize(() => getGlobalValueSymbol("Promise")); - tryGetGlobalPromiseConstructorSymbol = memoize(() => getGlobalSymbol("Promise", SymbolFlags.Value, /*diagnostic*/ undefined) && getGlobalPromiseConstructorSymbol()); - getGlobalPromiseConstructorLikeType = memoize(() => getGlobalType("PromiseConstructorLike")); - getGlobalThenableType = memoize(createThenableType); - - getGlobalTemplateStringsArrayType = memoize(() => getGlobalType("TemplateStringsArray")); - - if (languageVersion >= ScriptTarget.ES2015) { - getGlobalESSymbolType = memoize(() => getGlobalType("Symbol")); - getGlobalIterableType = memoize(() => getGlobalType("Iterable", /*arity*/ 1)); - getGlobalIteratorType = memoize(() => getGlobalType("Iterator", /*arity*/ 1)); - getGlobalIterableIteratorType = memoize(() => getGlobalType("IterableIterator", /*arity*/ 1)); - } - else { - getGlobalESSymbolType = memoize(() => emptyObjectType); - getGlobalIterableType = memoize(() => emptyGenericType); - getGlobalIteratorType = memoize(() => emptyGenericType); - getGlobalIterableIteratorType = memoize(() => emptyGenericType); - } - anyArrayType = createArrayType(anyType); autoArrayType = createArrayType(autoType); @@ -21695,7 +21971,7 @@ namespace ts { function checkExternalEmitHelpers(location: Node, helpers: ExternalEmitHelpers) { if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { const sourceFile = getSourceFileOfNode(location); - if (isEffectiveExternalModule(sourceFile, compilerOptions)) { + if (isEffectiveExternalModule(sourceFile, compilerOptions) && !isInAmbientContext(location)) { const helpersModule = resolveHelpersModule(sourceFile, location); if (helpersModule !== unknownSymbol) { const uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; @@ -21724,6 +22000,13 @@ namespace ts { case ExternalEmitHelpers.Param: return "__param"; case ExternalEmitHelpers.Awaiter: return "__awaiter"; case ExternalEmitHelpers.Generator: return "__generator"; + case ExternalEmitHelpers.Values: return "__values"; + case ExternalEmitHelpers.Read: return "__read"; + case ExternalEmitHelpers.Spread: return "__spread"; + case ExternalEmitHelpers.AsyncGenerator: return "__asyncGenerator"; + case ExternalEmitHelpers.AsyncDelegator: return "__asyncDelegator"; + case ExternalEmitHelpers.AsyncValues: return "__asyncValues"; + default: Debug.fail("Unrecognized helper."); } } @@ -21734,29 +22017,6 @@ namespace ts { return externalHelpersModule; } - - function createInstantiatedPromiseLikeType(): ObjectType { - const promiseLikeType = getGlobalPromiseLikeType(); - if (promiseLikeType !== emptyGenericType) { - return createTypeReference(promiseLikeType, [anyType]); - } - - return emptyObjectType; - } - - function createThenableType() { - // build the thenable type that is used to verify against a non-promise "thenable" operand to `await`. - const thenPropertySymbol = createSymbol(SymbolFlags.Property, "then"); - getSymbolLinks(thenPropertySymbol).type = globalFunctionType; - - const thenableType = createObjectType(ObjectFlags.Anonymous); - thenableType.properties = [thenPropertySymbol]; - thenableType.members = createSymbolTable(thenableType.properties); - thenableType.callSignatures = []; - thenableType.constructSignatures = []; - return thenableType; - } - // GRAMMAR CHECKING function checkGrammarDecorators(node: Node): boolean { if (!node.decorators) { @@ -22048,10 +22308,7 @@ namespace ts { case SyntaxKind.FunctionDeclaration: case SyntaxKind.FunctionExpression: case SyntaxKind.ArrowFunction: - if (!(node).asteriskToken) { - return false; - } - break; + return false; } return grammarErrorOnNode(asyncModifier, Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -22296,9 +22553,6 @@ namespace ts { if (!node.body) { return grammarErrorOnNode(node.asteriskToken, Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator); } - if (languageVersion < ScriptTarget.ES2015) { - return grammarErrorOnNode(node.asteriskToken, Diagnostics.Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher); - } } } @@ -22427,6 +22681,12 @@ namespace ts { return true; } + if (forInOrOfStatement.kind === SyntaxKind.ForOfStatement && forInOrOfStatement.awaitModifier) { + if ((forInOrOfStatement.flags & NodeFlags.AwaitContext) === NodeFlags.None) { + return grammarErrorOnNode(forInOrOfStatement.awaitModifier, Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator); + } + } + if (forInOrOfStatement.initializer.kind === SyntaxKind.VariableDeclarationList) { const variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { @@ -22770,7 +23030,7 @@ namespace ts { function checkGrammarMetaProperty(node: MetaProperty) { if (node.keywordToken === SyntaxKind.NewKeyword) { if (node.name.text !== "target") { - return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0, node.name.text, tokenToString(node.keywordToken), "target"); + return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.text, tokenToString(node.keywordToken), "target"); } } } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index ebb6a9ec39f..6b4e9ff590e 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -333,6 +333,11 @@ namespace ts { type: "boolean", description: Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file }, + { + name: "downlevelIteration", + type: "boolean", + description: Diagnostics.Use_full_down_level_iteration_for_iterables_and_arrays_for_for_of_spread_and_destructuring_in_ES5_Slash3 + }, { name: "baseUrl", type: "string", @@ -418,6 +423,7 @@ namespace ts { "es7": "lib.es2016.d.ts", "es2016": "lib.es2016.d.ts", "es2017": "lib.es2017.d.ts", + "esnext": "lib.esnext.d.ts", // Host only "dom": "lib.dom.d.ts", "dom.iterable": "lib.dom.iterable.d.ts", @@ -437,6 +443,7 @@ namespace ts { "es2017.object": "lib.es2017.object.d.ts", "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts", "es2017.string": "lib.es2017.string.d.ts", + "esnext.asynciterable": "lib.esnext.asynciterable.d.ts", }), }, description: Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon diff --git a/src/compiler/comments.ts b/src/compiler/comments.ts index dcb471dcfcc..9e077ebfaa8 100644 --- a/src/compiler/comments.ts +++ b/src/compiler/comments.ts @@ -43,18 +43,14 @@ namespace ts { } if (node) { - const { pos, end } = getCommentRange(node); - const emitFlags = getEmitFlags(node); + hasWrittenComment = false; + + const emitNode = node.emitNode; + const emitFlags = emitNode && emitNode.flags; + const { pos, end } = emitNode && emitNode.commentRange || node; if ((pos < 0 && end < 0) || (pos === end)) { // Both pos and end are synthesized, so just emit the node without comments. - if (emitFlags & EmitFlags.NoNestedComments) { - disabled = true; - emitCallback(hint, node); - disabled = false; - } - else { - emitCallback(hint, node); - } + emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback); } else { if (extendedDiagnostics) { @@ -94,17 +90,10 @@ namespace ts { performance.measure("commentTime", "preEmitNodeWithComment"); } - if (emitFlags & EmitFlags.NoNestedComments) { - disabled = true; - emitCallback(hint, node); - disabled = false; - } - else { - emitCallback(hint, node); - } + emitNodeWithSynthesizedComments(hint, node, emitNode, emitFlags, emitCallback); if (extendedDiagnostics) { - performance.mark("beginEmitNodeWithComment"); + performance.mark("postEmitNodeWithComment"); } // Restore previous container state. @@ -119,12 +108,88 @@ namespace ts { } if (extendedDiagnostics) { - performance.measure("commentTime", "beginEmitNodeWithComment"); + performance.measure("commentTime", "postEmitNodeWithComment"); } } } } + function emitNodeWithSynthesizedComments(hint: EmitHint, node: Node, emitNode: EmitNode, emitFlags: EmitFlags, emitCallback: (hint: EmitHint, node: Node) => void) { + const leadingComments = emitNode && emitNode.leadingComments; + if (some(leadingComments)) { + if (extendedDiagnostics) { + performance.mark("preEmitNodeWithSynthesizedComments"); + } + + forEach(leadingComments, emitLeadingSynthesizedComment); + + if (extendedDiagnostics) { + performance.measure("commentTime", "preEmitNodeWithSynthesizedComments"); + } + } + + emitNodeWithNestedComments(hint, node, emitFlags, emitCallback); + + const trailingComments = emitNode && emitNode.trailingComments; + if (some(trailingComments)) { + if (extendedDiagnostics) { + performance.mark("postEmitNodeWithSynthesizedComments"); + } + + forEach(trailingComments, emitTrailingSynthesizedComment); + + if (extendedDiagnostics) { + performance.measure("commentTime", "postEmitNodeWithSynthesizedComments"); + } + } + } + + function emitLeadingSynthesizedComment(comment: SynthesizedComment) { + if (comment.kind === SyntaxKind.SingleLineCommentTrivia) { + writer.writeLine(); + } + writeSynthesizedComment(comment); + if (comment.hasTrailingNewLine || comment.kind === SyntaxKind.SingleLineCommentTrivia) { + writer.writeLine(); + } + else { + writer.write(" "); + } + } + + function emitTrailingSynthesizedComment(comment: SynthesizedComment) { + if (!writer.isAtStartOfLine()) { + writer.write(" "); + } + writeSynthesizedComment(comment); + if (comment.hasTrailingNewLine) { + writer.writeLine(); + } + } + + function writeSynthesizedComment(comment: SynthesizedComment) { + const text = formatSynthesizedComment(comment); + const lineMap = comment.kind === SyntaxKind.MultiLineCommentTrivia ? computeLineStarts(text) : undefined; + writeCommentRange(text, lineMap, writer, 0, text.length, newLine); + } + + function formatSynthesizedComment(comment: SynthesizedComment) { + return comment.kind === SyntaxKind.MultiLineCommentTrivia + ? `/*${comment.text}*/` + : `//${comment.text}`; + } + + function emitNodeWithNestedComments(hint: EmitHint, node: Node, emitFlags: EmitFlags, emitCallback: (hint: EmitHint, node: Node) => void) { + if (emitFlags & EmitFlags.NoNestedComments) { + disabled = true; + emitCallback(hint, node); + disabled = false; + } + else { + emitCallback(hint, node); + } + } + function emitBodyWithDetachedComments(node: Node, detachedRange: TextRange, emitCallback: (node: Node) => void) { if (extendedDiagnostics) { performance.mark("preEmitBodyWithDetachedComments"); diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 3be35036144..75aa5d25f72 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -175,15 +175,15 @@ "category": "Error", "code": 1057 }, - "Operand for 'await' does not have a valid callable 'then' member.": { + "Type used as operand to 'await' or the return type of an async function must either be a valid promise or must not contain a callable 'then' member.": { "category": "Error", "code": 1058 }, - "Return expression in async function does not have a valid callable 'then' member.": { + "A promise must have a 'then' method.": { "category": "Error", "code": 1059 }, - "Expression body for async arrow function does not have a valid callable 'then' member.": { + "The first parameter of the 'then' method of a promise must be a callback.": { "category": "Error", "code": 1060 }, @@ -191,7 +191,7 @@ "category": "Error", "code": 1061 }, - "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method.": { + "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method.": { "category": "Error", "code": 1062 }, @@ -291,6 +291,10 @@ "category": "Error", "code": 1102 }, + "A 'for-await-of' statement is only allowed within an async function or async generator.": { + "category": "Error", + "code": 1103 + }, "A 'continue' statement can only be used within an enclosing iteration statement.": { "category": "Error", "code": 1104 @@ -319,7 +323,7 @@ "category": "Error", "code": 1113 }, - "Duplicate label '{0}'": { + "Duplicate label '{0}'.": { "category": "Error", "code": 1114 }, @@ -447,7 +451,7 @@ "category": "Error", "code": 1148 }, - "File name '{0}' differs from already included file name '{1}' only in casing": { + "File name '{0}' differs from already included file name '{1}' only in casing.": { "category": "Error", "code": 1149 }, @@ -455,7 +459,7 @@ "category": "Error", "code": 1150 }, - "'const' declarations must be initialized": { + "'const' declarations must be initialized.": { "category": "Error", "code": 1155 }, @@ -651,11 +655,11 @@ "category": "Error", "code": 1210 }, - "A class declaration without the 'default' modifier must have a name": { + "A class declaration without the 'default' modifier must have a name.": { "category": "Error", "code": 1211 }, - "Identifier expected. '{0}' is a reserved word in strict mode": { + "Identifier expected. '{0}' is a reserved word in strict mode.": { "category": "Error", "code": 1212 }, @@ -1107,7 +1111,7 @@ "category": "Error", "code": 2360 }, - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter": { + "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": { "category": "Error", "code": 2361 }, @@ -1131,7 +1135,7 @@ "category": "Error", "code": 2366 }, - "Type parameter name cannot be '{0}'": { + "Type parameter name cannot be '{0}'.": { "category": "Error", "code": 2368 }, @@ -1291,7 +1295,7 @@ "category": "Error", "code": 2408 }, - "Return type of constructor signature must be assignable to the instance type of the class": { + "Return type of constructor signature must be assignable to the instance type of the class.": { "category": "Error", "code": 2409 }, @@ -1311,7 +1315,7 @@ "category": "Error", "code": 2413 }, - "Class name cannot be '{0}'": { + "Class name cannot be '{0}'.": { "category": "Error", "code": 2414 }, @@ -1347,7 +1351,7 @@ "category": "Error", "code": 2426 }, - "Interface name cannot be '{0}'": { + "Interface name cannot be '{0}'.": { "category": "Error", "code": 2427 }, @@ -1359,7 +1363,7 @@ "category": "Error", "code": 2430 }, - "Enum name cannot be '{0}'": { + "Enum name cannot be '{0}'.": { "category": "Error", "code": 2431 }, @@ -1367,11 +1371,11 @@ "category": "Error", "code": 2432 }, - "A namespace declaration cannot be in a different file from a class or function with which it is merged": { + "A namespace declaration cannot be in a different file from a class or function with which it is merged.": { "category": "Error", "code": 2433 }, - "A namespace declaration cannot be located prior to a class or function with which it is merged": { + "A namespace declaration cannot be located prior to a class or function with which it is merged.": { "category": "Error", "code": 2434 }, @@ -1383,11 +1387,11 @@ "category": "Error", "code": 2436 }, - "Module '{0}' is hidden by a local declaration with the same name": { + "Module '{0}' is hidden by a local declaration with the same name.": { "category": "Error", "code": 2437 }, - "Import name cannot be '{0}'": { + "Import name cannot be '{0}'.": { "category": "Error", "code": 2438 }, @@ -1395,7 +1399,7 @@ "category": "Error", "code": 2439 }, - "Import declaration conflicts with local declaration of '{0}'": { + "Import declaration conflicts with local declaration of '{0}'.": { "category": "Error", "code": 2440 }, @@ -1455,7 +1459,7 @@ "category": "Error", "code": 2456 }, - "Type alias name cannot be '{0}'": { + "Type alias name cannot be '{0}'.": { "category": "Error", "code": 2457 }, @@ -1475,7 +1479,7 @@ "category": "Error", "code": 2461 }, - "A rest element must be last in a destructuring pattern": { + "A rest element must be last in a destructuring pattern.": { "category": "Error", "code": 2462 }, @@ -1559,7 +1563,7 @@ "category": "Error", "code": 2483 }, - "Export declaration conflicts with exported declaration of '{0}'": { + "Export declaration conflicts with exported declaration of '{0}'.": { "category": "Error", "code": 2484 }, @@ -1583,7 +1587,7 @@ "category": "Error", "code": 2491 }, - "Cannot redeclare identifier '{0}' in catch clause": { + "Cannot redeclare identifier '{0}' in catch clause.": { "category": "Error", "code": 2492 }, @@ -1631,6 +1635,10 @@ "category": "Error", "code": 2503 }, + "Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.": { + "category": "Error", + "code": 2504 + }, "A generator cannot have a 'void' type annotation.": { "category": "Error", "code": 2505 @@ -1687,6 +1695,10 @@ "category": "Error", "code": 2518 }, + "An async iterator must have a 'next()' method.": { + "category": "Error", + "code": 2519 + }, "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.": { "category": "Error", "code": 2520 @@ -1795,6 +1807,18 @@ "category": "Error", "code": 2546 }, + "The type returned by the 'next()' method of an async iterator must be a promise for a type with a 'value' property.": { + "category": "Error", + "code": 2547 + }, + "Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator.": { + "category": "Error", + "code": 2548 + }, + "Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator.": { + "category": "Error", + "code": 2549 + }, "JSX element attributes type '{0}' may not be a union type.": { "category": "Error", "code": 2600 @@ -1807,7 +1831,7 @@ "category": "Error", "code": 2602 }, - "Property '{0}' in type '{1}' is not assignable to type '{2}'": { + "Property '{0}' in type '{1}' is not assignable to type '{2}'.": { "category": "Error", "code": 2603 }, @@ -1823,11 +1847,11 @@ "category": "Error", "code": 2606 }, - "JSX element class does not support attributes because it does not have a '{0}' property": { + "JSX element class does not support attributes because it does not have a '{0}' property.": { "category": "Error", "code": 2607 }, - "The global type 'JSX.{0}' may not have more than one property": { + "The global type 'JSX.{0}' may not have more than one property.": { "category": "Error", "code": 2608 }, @@ -1839,7 +1863,7 @@ "category": "Error", "code": 2649 }, - "Cannot emit namespaced JSX elements in React": { + "Cannot emit namespaced JSX elements in React.": { "category": "Error", "code": 2650 }, @@ -1863,11 +1887,11 @@ "category": "Error", "code": 2656 }, - "JSX expressions must have one parent element": { + "JSX expressions must have one parent element.": { "category": "Error", "code": 2657 }, - "Type '{0}' provides no match for the signature '{1}'": { + "Type '{0}' provides no match for the signature '{1}'.": { "category": "Error", "code": 2658 }, @@ -2047,11 +2071,11 @@ "category": "Error", "code": 2702 }, - "The operand of a delete operator must be a property reference": { + "The operand of a delete operator must be a property reference.": { "category": "Error", "code": 2703 }, - "The operand of a delete operator cannot be a read-only property": { + "The operand of a delete operator cannot be a read-only property.": { "category": "Error", "code": 2704 }, @@ -2385,7 +2409,7 @@ "category": "Error", "code": 5011 }, - "Cannot read file '{0}': {1}": { + "Cannot read file '{0}': {1}.": { "category": "Error", "code": 5012 }, @@ -2405,7 +2429,7 @@ "category": "Error", "code": 5024 }, - "Could not write file '{0}': {1}": { + "Could not write file '{0}': {1}.": { "category": "Error", "code": 5033 }, @@ -2441,11 +2465,11 @@ "category": "Error", "code": 5056 }, - "Cannot find a tsconfig.json file at the specified directory: '{0}'": { + "Cannot find a tsconfig.json file at the specified directory: '{0}'.": { "category": "Error", "code": 5057 }, - "The specified path does not exist: '{0}'": { + "The specified path does not exist: '{0}'.": { "category": "Error", "code": 5058 }, @@ -2457,11 +2481,11 @@ "category": "Error", "code": 5060 }, - "Pattern '{0}' can have at most one '*' character": { + "Pattern '{0}' can have at most one '*' character.": { "category": "Error", "code": 5061 }, - "Substitution '{0}' in pattern '{1}' in can have at most one '*' character": { + "Substitution '{0}' in pattern '{1}' in can have at most one '*' character.": { "category": "Error", "code": 5062 }, @@ -2533,11 +2557,11 @@ "category": "Message", "code": 6012 }, - "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'": { + "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'.": { "category": "Message", "code": 6015 }, - "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'": { + "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'.": { "category": "Message", "code": 6016 }, @@ -2549,7 +2573,7 @@ "category": "Message", "code": 6019 }, - "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'": { + "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.": { "category": "Message", "code": 6020 }, @@ -2629,7 +2653,7 @@ "category": "Error", "code": 6045 }, - "Argument for '{0}' option must be: {1}": { + "Argument for '{0}' option must be: {1}.": { "category": "Error", "code": 6046 }, @@ -2717,7 +2741,7 @@ "category": "Message", "code": 6072 }, - "Stylize errors and messages using color and context. (experimental)": { + "Stylize errors and messages using color and context (experimental).": { "category": "Message", "code": 6073 }, @@ -2745,7 +2769,7 @@ "category": "Message", "code": 6079 }, - "Specify JSX code generation: 'preserve', 'react-native', or 'react'": { + "Specify JSX code generation: 'preserve', 'react-native', or 'react'.": { "category": "Message", "code": 6080 }, @@ -2761,7 +2785,7 @@ "category": "Message", "code": 6083 }, - "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit": { + "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit.": { "category": "Message", "code": 6084 }, @@ -2849,27 +2873,27 @@ "category": "Message", "code": 6105 }, - "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'": { + "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'.": { "category": "Message", "code": 6106 }, - "'rootDirs' option is set, using it to resolve relative module name '{0}'": { + "'rootDirs' option is set, using it to resolve relative module name '{0}'.": { "category": "Message", "code": 6107 }, - "Longest matching prefix for '{0}' is '{1}'": { + "Longest matching prefix for '{0}' is '{1}'.": { "category": "Message", "code": 6108 }, - "Loading '{0}' from the root dir '{1}', candidate location '{2}'": { + "Loading '{0}' from the root dir '{1}', candidate location '{2}'.": { "category": "Message", "code": 6109 }, - "Trying other entries in 'rootDirs'": { + "Trying other entries in 'rootDirs'.": { "category": "Message", "code": 6110 }, - "Module resolution using 'rootDirs' has failed": { + "Module resolution using 'rootDirs' has failed.": { "category": "Message", "code": 6111 }, @@ -2909,7 +2933,7 @@ "category": "Message", "code": 6120 }, - "Resolving with primary search path '{0}'": { + "Resolving with primary search path '{0}'.": { "category": "Message", "code": 6121 }, @@ -2925,7 +2949,7 @@ "category": "Message", "code": 6124 }, - "Looking up in 'node_modules' folder, initial location '{0}'": { + "Looking up in 'node_modules' folder, initial location '{0}'.": { "category": "Message", "code": 6125 }, @@ -2945,7 +2969,7 @@ "category": "Error", "code": 6129 }, - "Resolving real path for '{0}', result '{1}'": { + "Resolving real path for '{0}', result '{1}'.": { "category": "Message", "code": 6130 }, @@ -2953,7 +2977,7 @@ "category": "Error", "code": 6131 }, - "File name '{0}' has a '{1}' extension - stripping it": { + "File name '{0}' has a '{1}' extension - stripping it.": { "category": "Message", "code": 6132 }, @@ -2969,7 +2993,7 @@ "category": "Message", "code": 6135 }, - "The maximum dependency depth to search under node_modules and load JavaScript files": { + "The maximum dependency depth to search under node_modules and load JavaScript files.": { "category": "Message", "code": 6136 }, @@ -2985,7 +3009,7 @@ "category": "Error", "code": 6140 }, - "Parse in strict mode and emit \"use strict\" for each source file": { + "Parse in strict mode and emit \"use strict\" for each source file.": { "category": "Message", "code": 6141 }, @@ -3017,6 +3041,10 @@ "category": "Message", "code": 6148 }, + "Use full down-level iteration for iterables and arrays for 'for-of', spread, and destructuring in ES5/3.": { + "category": "Message", + "code": 6149 + }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", "code": 7005 @@ -3085,7 +3113,7 @@ "category": "Error", "code": 7025 }, - "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists": { + "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists.": { "category": "Error", "code": 7026 }, @@ -3213,7 +3241,7 @@ "category": "Error", "code": 17004 }, - "A constructor cannot contain a 'super' call when its class extends 'null'": { + "A constructor cannot contain a 'super' call when its class extends 'null'.": { "category": "Error", "code": 17005 }, @@ -3241,7 +3269,7 @@ "category": "Error", "code": 17011 }, - "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{0}'?": { + "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?": { "category": "Error", "code": 17012 }, @@ -3279,7 +3307,7 @@ "category": "Message", "code": 90003 }, - "Remove declaration for: {0}": { + "Remove declaration for: '{0}'.": { "category": "Message", "code": 90004 }, @@ -3295,7 +3323,7 @@ "category": "Message", "code": 90008 }, - "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig": { + "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig.": { "category": "Error", "code": 90009 }, @@ -3303,18 +3331,26 @@ "category": "Error", "code": 90010 }, - "Import {0} from {1}": { + "Import {0} from {1}.": { "category": "Message", "code": 90013 }, - "Change {0} to {1}": { + "Change {0} to {1}.": { "category": "Message", "code": 90014 }, - "Add {0} to existing import declaration from {1}": { + "Add {0} to existing import declaration from {1}.": { "category": "Message", "code": 90015 }, + "Add declaration for missing property '{0}'.": { + "category": "Message", + "code": 90016 + }, + "Add index signature for missing property '{0}'.": { + "category": "Message", + "code": 90017 + }, "Octal literal types must use ES2015 syntax. Use the syntax '{0}'.": { "category": "Error", "code": 8017 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index b60f9ca91fd..ee224befd45 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -10,14 +10,13 @@ namespace ts { /*@internal*/ // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature - export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile, emitOnlyDtsFiles?: boolean): EmitResult { + export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile, emitOnlyDtsFiles?: boolean, transformers?: TransformerFactory[]): EmitResult { const compilerOptions = host.getCompilerOptions(); const moduleKind = getEmitModuleKind(compilerOptions); const sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; const emittedFilesList: string[] = compilerOptions.listEmittedFiles ? [] : undefined; const emitterDiagnostics = createDiagnosticCollection(); const newLine = host.getNewLine(); - const transformers = emitOnlyDtsFiles ? [] : getTransformers(compilerOptions); const writer = createTextWriter(newLine); const sourceMap = createSourceMapWriter(host, writer); @@ -29,7 +28,7 @@ namespace ts { const sourceFiles = getSourceFilesToEmit(host, targetSourceFile); // Transform the source files - const transform = transformFiles(resolver, host, sourceFiles, transformers); + const transform = transformNodes(resolver, host, compilerOptions, sourceFiles, transformers, /*allowDtsFiles*/ false); // Create a printer to print the nodes const printer = createPrinter(compilerOptions, { @@ -38,7 +37,7 @@ namespace ts { // transform hooks onEmitNode: transform.emitNodeWithNotification, - onSubstituteNode: transform.emitNodeWithSubstitution, + substituteNode: transform.substituteNode, // sourcemap hooks onEmitSourceMapOfNode: sourceMap.emitNodeWithSourceMap, @@ -56,9 +55,7 @@ namespace ts { performance.measure("printTime", "beforePrint"); // Clean up emit nodes on parse tree - for (const sourceFile of sourceFiles) { - disposeEmitNodes(sourceFile); - } + transform.dispose(); return { emitSkipped, @@ -201,7 +198,7 @@ namespace ts { onEmitNode, onEmitHelpers, onSetSourceFile, - onSubstituteNode, + substituteNode, } = handlers; const newLine = getNewLineCharacter(printerOptions); @@ -331,8 +328,8 @@ namespace ts { setWriter(/*output*/ undefined); } - function emit(node: Node, hint = EmitHint.Unspecified) { - pipelineEmitWithNotification(hint, node); + function emit(node: Node) { + pipelineEmitWithNotification(EmitHint.Unspecified, node); } function emitIdentifierName(node: Identifier) { @@ -353,6 +350,7 @@ namespace ts { } function pipelineEmitWithComments(hint: EmitHint, node: Node) { + node = trySubstituteNode(hint, node); if (emitNodeWithComments && hint !== EmitHint.SourceFile) { emitNodeWithComments(hint, node, pipelineEmitWithSourceMap); } @@ -363,16 +361,7 @@ namespace ts { function pipelineEmitWithSourceMap(hint: EmitHint, node: Node) { if (onEmitSourceMapOfNode && hint !== EmitHint.SourceFile && hint !== EmitHint.IdentifierName) { - onEmitSourceMapOfNode(hint, node, pipelineEmitWithSubstitution); - } - else { - pipelineEmitWithSubstitution(hint, node); - } - } - - function pipelineEmitWithSubstitution(hint: EmitHint, node: Node) { - if (onSubstituteNode) { - onSubstituteNode(hint, node, pipelineEmitWithHint); + onEmitSourceMapOfNode(hint, node, pipelineEmitWithHint); } else { pipelineEmitWithHint(hint, node); @@ -640,7 +629,7 @@ namespace ts { // If the node is an expression, try to emit it as an expression with // substitution. if (isExpression(node)) { - return pipelineEmitWithSubstitution(EmitHint.Expression, node); + return pipelineEmitExpression(trySubstituteNode(EmitHint.Expression, node)); } } @@ -737,6 +726,10 @@ namespace ts { } } + function trySubstituteNode(hint: EmitHint, node: Node) { + return node && substituteNode && substituteNode(hint, node) || node; + } + function emitBodyIndirect(node: Node, elements: NodeArray, emitCallback: (node: Node) => void): void { if (emitBodyWithDetachedComments) { emitBodyWithDetachedComments(node, elements, emitCallback); @@ -759,9 +752,6 @@ namespace ts { // SyntaxKind.NumericLiteral function emitNumericLiteral(node: NumericLiteral) { emitLiteral(node); - if (node.trailingComment) { - write(` /*${node.trailingComment}*/`); - } } // SyntaxKind.StringLiteral @@ -1450,6 +1440,7 @@ namespace ts { function emitForOfStatement(node: ForOfStatement) { const openParenPos = writeToken(SyntaxKind.ForKeyword, node.pos); write(" "); + emitWithSuffix(node.awaitModifier, " "); writeToken(SyntaxKind.OpenParenToken, openParenPos); emitForBinding(node.initializer); write(" of "); @@ -1762,7 +1753,6 @@ namespace ts { else { pushNameGenerationScope(); write("{"); - increaseIndent(); emitBlockStatements(node); write("}"); popNameGenerationScope(); @@ -2915,4 +2905,4 @@ namespace ts { Parameters = CommaDelimited | SpaceBetweenSiblings | SingleLine | Indented | Parenthesis, IndexSignatureParameters = CommaDelimited | SpaceBetweenSiblings | SingleLine | Indented | SquareBrackets, } -} \ No newline at end of file +} diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index d946933c52e..cfafaabebff 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -215,7 +215,7 @@ namespace ts { // Signature elements - export function createParameter(decorators: Decorator[], modifiers: Modifier[], dotDotDotToken: DotDotDotToken, name: string | Identifier | BindingPattern, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression) { + export function createParameter(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: string | BindingName, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression) { const node = createSynthesizedNode(SyntaxKind.Parameter); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -227,7 +227,7 @@ namespace ts { return node; } - export function updateParameter(node: ParameterDeclaration, decorators: Decorator[], modifiers: Modifier[], dotDotDotToken: DotDotDotToken, name: BindingName, type: TypeNode, initializer: Expression) { + export function updateParameter(node: ParameterDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, dotDotDotToken: DotDotDotToken | undefined, name: BindingName, type: TypeNode | undefined, initializer: Expression | undefined) { return node.decorators !== decorators || node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken @@ -252,7 +252,7 @@ namespace ts { // Type members - export function createProperty(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, questionToken: QuestionToken, type: TypeNode, initializer: Expression) { + export function createProperty(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | PropertyName, questionToken: QuestionToken | undefined, type: TypeNode | undefined, initializer: Expression) { const node = createSynthesizedNode(SyntaxKind.PropertyDeclaration); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -263,7 +263,7 @@ namespace ts { return node; } - export function updateProperty(node: PropertyDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, type: TypeNode, initializer: Expression) { + export function updateProperty(node: PropertyDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, type: TypeNode | undefined, initializer: Expression) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name @@ -273,7 +273,7 @@ namespace ts { : node; } - export function createMethod(decorators: Decorator[], modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | PropertyName, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block) { + export function createMethod(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | PropertyName, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) { const node = createSynthesizedNode(SyntaxKind.MethodDeclaration); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -286,19 +286,20 @@ namespace ts { return node; } - export function updateMethod(node: MethodDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block) { + export function updateMethod(node: MethodDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: PropertyName, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) { return node.decorators !== decorators || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body - ? updateNode(createMethod(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body), node) + ? updateNode(createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) : node; } - export function createConstructor(decorators: Decorator[], modifiers: Modifier[], parameters: ParameterDeclaration[], body: Block) { + export function createConstructor(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], body: Block | undefined) { const node = createSynthesizedNode(SyntaxKind.Constructor); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -309,7 +310,7 @@ namespace ts { return node; } - export function updateConstructor(node: ConstructorDeclaration, decorators: Decorator[], modifiers: Modifier[], parameters: ParameterDeclaration[], body: Block) { + export function updateConstructor(node: ConstructorDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, parameters: ParameterDeclaration[], body: Block | undefined) { return node.decorators !== decorators || node.modifiers !== modifiers || node.parameters !== parameters @@ -318,7 +319,7 @@ namespace ts { : node; } - export function createGetAccessor(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, parameters: ParameterDeclaration[], type: TypeNode, body: Block) { + export function createGetAccessor(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | PropertyName, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) { const node = createSynthesizedNode(SyntaxKind.GetAccessor); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -330,7 +331,7 @@ namespace ts { return node; } - export function updateGetAccessor(node: GetAccessorDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, parameters: ParameterDeclaration[], type: TypeNode, body: Block) { + export function updateGetAccessor(node: GetAccessorDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name @@ -341,7 +342,7 @@ namespace ts { : node; } - export function createSetAccessor(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, parameters: ParameterDeclaration[], body: Block) { + export function createSetAccessor(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | PropertyName, parameters: ParameterDeclaration[], body: Block | undefined) { const node = createSynthesizedNode(SyntaxKind.SetAccessor); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -352,7 +353,7 @@ namespace ts { return node; } - export function updateSetAccessor(node: SetAccessorDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, parameters: ParameterDeclaration[], body: Block) { + export function updateSetAccessor(node: SetAccessorDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: PropertyName, parameters: ParameterDeclaration[], body: Block | undefined) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name @@ -388,21 +389,21 @@ namespace ts { : node; } - export function createBindingElement(propertyName: string | PropertyName, dotDotDotToken: DotDotDotToken, name: string | BindingName, initializer?: Expression) { + export function createBindingElement(dotDotDotToken: DotDotDotToken | undefined, propertyName: string | PropertyName | undefined, name: string | BindingName, initializer?: Expression) { const node = createSynthesizedNode(SyntaxKind.BindingElement); - node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; + node.propertyName = asName(propertyName); node.name = asName(name); node.initializer = initializer; return node; } - export function updateBindingElement(node: BindingElement, dotDotDotToken: DotDotDotToken, propertyName: PropertyName, name: BindingName, initializer: Expression) { + export function updateBindingElement(node: BindingElement, dotDotDotToken: DotDotDotToken | undefined, propertyName: PropertyName | undefined, name: BindingName, initializer: Expression | undefined) { return node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer - ? updateNode(createBindingElement(propertyName, dotDotDotToken, name, initializer), node) + ? updateNode(createBindingElement(dotDotDotToken, propertyName, name, initializer), node) : node; } @@ -470,7 +471,7 @@ namespace ts { : node; } - export function createCall(expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[]) { + export function createCall(expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[]) { const node = createSynthesizedNode(SyntaxKind.CallExpression); node.expression = parenthesizeForAccess(expression); node.typeArguments = asNodeArray(typeArguments); @@ -478,7 +479,7 @@ namespace ts { return node; } - export function updateCall(node: CallExpression, expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[]) { + export function updateCall(node: CallExpression, expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[]) { return expression !== node.expression || typeArguments !== node.typeArguments || argumentsArray !== node.arguments @@ -486,7 +487,7 @@ namespace ts { : node; } - export function createNew(expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[]) { + export function createNew(expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[] | undefined) { const node = createSynthesizedNode(SyntaxKind.NewExpression); node.expression = parenthesizeForNew(expression); node.typeArguments = asNodeArray(typeArguments); @@ -494,7 +495,7 @@ namespace ts { return node; } - export function updateNew(node: NewExpression, expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[]) { + export function updateNew(node: NewExpression, expression: Expression, typeArguments: TypeNode[] | undefined, argumentsArray: Expression[] | undefined) { return node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray @@ -542,7 +543,7 @@ namespace ts { : node; } - export function createFunctionExpression(modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block) { + export function createFunctionExpression(modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block) { const node = createSynthesizedNode(SyntaxKind.FunctionExpression); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; @@ -554,18 +555,19 @@ namespace ts { return node; } - export function updateFunctionExpression(node: FunctionExpression, modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block) { + export function updateFunctionExpression(node: FunctionExpression, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block) { return node.name !== name || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body - ? updateNode(createFunctionExpression(modifiers, node.asteriskToken, name, typeParameters, parameters, type, body), node) + ? updateNode(createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) : node; } - export function createArrowFunction(modifiers: Modifier[], typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, equalsGreaterThanToken: EqualsGreaterThanToken, body: ConciseBody) { + export function createArrowFunction(modifiers: Modifier[] | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, equalsGreaterThanToken: EqualsGreaterThanToken | undefined, body: ConciseBody) { const node = createSynthesizedNode(SyntaxKind.ArrowFunction); node.modifiers = asNodeArray(modifiers); node.typeParameters = asNodeArray(typeParameters); @@ -576,7 +578,7 @@ namespace ts { return node; } - export function updateArrowFunction(node: ArrowFunction, modifiers: Modifier[], typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: ConciseBody) { + export function updateArrowFunction(node: ArrowFunction, modifiers: Modifier[] | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: ConciseBody) { return node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters @@ -720,9 +722,10 @@ namespace ts { return node; } - export function updateYield(node: YieldExpression, expression: Expression) { + export function updateYield(node: YieldExpression, asteriskToken: AsteriskToken | undefined, expression: Expression) { return node.expression !== expression - ? updateNode(createYield(node.asteriskToken, expression), node) + || node.asteriskToken !== asteriskToken + ? updateNode(createYield(asteriskToken, expression), node) : node; } @@ -738,7 +741,7 @@ namespace ts { : node; } - export function createClassExpression(modifiers: Modifier[], name: string | Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[]) { + export function createClassExpression(modifiers: Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]) { const node = createSynthesizedNode(SyntaxKind.ClassExpression); node.decorators = undefined; node.modifiers = asNodeArray(modifiers); @@ -749,7 +752,7 @@ namespace ts { return node; } - export function updateClassExpression(node: ClassExpression, modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[]) { + export function updateClassExpression(node: ClassExpression, modifiers: Modifier[] | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]) { return node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters @@ -834,7 +837,7 @@ namespace ts { : node; } - export function createVariableStatement(modifiers: Modifier[], declarationList: VariableDeclarationList | VariableDeclaration[]): VariableStatement { + export function createVariableStatement(modifiers: Modifier[] | undefined, declarationList: VariableDeclarationList | VariableDeclaration[]) { const node = createSynthesizedNode(SyntaxKind.VariableStatement); node.decorators = undefined; node.modifiers = asNodeArray(modifiers); @@ -842,14 +845,14 @@ namespace ts { return node; } - export function updateVariableStatement(node: VariableStatement, modifiers: Modifier[], declarationList: VariableDeclarationList): VariableStatement { + export function updateVariableStatement(node: VariableStatement, modifiers: Modifier[] | undefined, declarationList: VariableDeclarationList) { return node.modifiers !== modifiers || node.declarationList !== declarationList ? updateNode(createVariableStatement(modifiers, declarationList), node) : node; } - export function createVariableDeclarationList(declarations: VariableDeclaration[], flags?: NodeFlags): VariableDeclarationList { + export function createVariableDeclarationList(declarations: VariableDeclaration[], flags?: NodeFlags) { const node = createSynthesizedNode(SyntaxKind.VariableDeclarationList); node.flags |= flags; node.declarations = createNodeArray(declarations); @@ -862,7 +865,7 @@ namespace ts { : node; } - export function createVariableDeclaration(name: string | BindingName, type?: TypeNode, initializer?: Expression): VariableDeclaration { + export function createVariableDeclaration(name: string | BindingName, type?: TypeNode, initializer?: Expression) { const node = createSynthesizedNode(SyntaxKind.VariableDeclaration); node.name = asName(name); node.type = type; @@ -870,7 +873,7 @@ namespace ts { return node; } - export function updateVariableDeclaration(node: VariableDeclaration, name: BindingName, type: TypeNode, initializer: Expression) { + export function updateVariableDeclaration(node: VariableDeclaration, name: BindingName, type: TypeNode | undefined, initializer: Expression | undefined) { return node.name !== name || node.type !== type || node.initializer !== initializer @@ -882,7 +885,7 @@ namespace ts { return createSynthesizedNode(SyntaxKind.EmptyStatement); } - export function createStatement(expression: Expression): ExpressionStatement { + export function createStatement(expression: Expression) { const node = createSynthesizedNode(SyntaxKind.ExpressionStatement); node.expression = parenthesizeExpressionForExpressionStatement(expression); return node; @@ -902,7 +905,7 @@ namespace ts { return node; } - export function updateIf(node: IfStatement, expression: Expression, thenStatement: Statement, elseStatement: Statement) { + export function updateIf(node: IfStatement, expression: Expression, thenStatement: Statement, elseStatement: Statement | undefined) { return node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement @@ -938,7 +941,7 @@ namespace ts { : node; } - export function createFor(initializer: ForInitializer, condition: Expression, incrementor: Expression, statement: Statement) { + export function createFor(initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement) { const node = createSynthesizedNode(SyntaxKind.ForStatement); node.initializer = initializer; node.condition = condition; @@ -947,7 +950,7 @@ namespace ts { return node; } - export function updateFor(node: ForStatement, initializer: ForInitializer, condition: Expression, incrementor: Expression, statement: Statement) { + export function updateFor(node: ForStatement, initializer: ForInitializer | undefined, condition: Expression | undefined, incrementor: Expression | undefined, statement: Statement) { return node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor @@ -972,19 +975,21 @@ namespace ts { : node; } - export function createForOf(initializer: ForInitializer, expression: Expression, statement: Statement) { + export function createForOf(awaitModifier: AwaitKeywordToken, initializer: ForInitializer, expression: Expression, statement: Statement) { const node = createSynthesizedNode(SyntaxKind.ForOfStatement); + node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = expression; node.statement = statement; return node; } - export function updateForOf(node: ForOfStatement, initializer: ForInitializer, expression: Expression, statement: Statement) { - return node.initializer !== initializer + export function updateForOf(node: ForOfStatement, awaitModifier: AwaitKeywordToken, initializer: ForInitializer, expression: Expression, statement: Statement) { + return node.awaitModifier !== awaitModifier + || node.initializer !== initializer || node.expression !== expression || node.statement !== statement - ? updateNode(createForOf(initializer, expression, statement), node) + ? updateNode(createForOf(awaitModifier, initializer, expression, statement), node) : node; } @@ -994,7 +999,7 @@ namespace ts { return node; } - export function updateContinue(node: ContinueStatement, label: Identifier) { + export function updateContinue(node: ContinueStatement, label: Identifier | undefined) { return node.label !== label ? updateNode(createContinue(label), node) : node; @@ -1006,7 +1011,7 @@ namespace ts { return node; } - export function updateBreak(node: BreakStatement, label: Identifier) { + export function updateBreak(node: BreakStatement, label: Identifier | undefined) { return node.label !== label ? updateNode(createBreak(label), node) : node; @@ -1018,7 +1023,7 @@ namespace ts { return node; } - export function updateReturn(node: ReturnStatement, expression: Expression) { + export function updateReturn(node: ReturnStatement, expression: Expression | undefined) { return node.expression !== expression ? updateNode(createReturn(expression), node) : node; @@ -1078,7 +1083,7 @@ namespace ts { : node; } - export function createTry(tryBlock: Block, catchClause: CatchClause, finallyBlock: Block) { + export function createTry(tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined) { const node = createSynthesizedNode(SyntaxKind.TryStatement); node.tryBlock = tryBlock; node.catchClause = catchClause; @@ -1086,7 +1091,7 @@ namespace ts { return node; } - export function updateTry(node: TryStatement, tryBlock: Block, catchClause: CatchClause, finallyBlock: Block) { + export function updateTry(node: TryStatement, tryBlock: Block, catchClause: CatchClause | undefined, finallyBlock: Block | undefined) { return node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock @@ -1094,7 +1099,7 @@ namespace ts { : node; } - export function createFunctionDeclaration(decorators: Decorator[], modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block) { + export function createFunctionDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) { const node = createSynthesizedNode(SyntaxKind.FunctionDeclaration); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -1107,19 +1112,20 @@ namespace ts { return node; } - export function updateFunctionDeclaration(node: FunctionDeclaration, decorators: Decorator[], modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block) { + export function updateFunctionDeclaration(node: FunctionDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, asteriskToken: AsteriskToken | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, parameters: ParameterDeclaration[], type: TypeNode | undefined, body: Block | undefined) { return node.decorators !== decorators || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body - ? updateNode(createFunctionDeclaration(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body), node) + ? updateNode(createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) : node; } - export function createClassDeclaration(decorators: Decorator[], modifiers: Modifier[], name: string | Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[]) { + export function createClassDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]) { const node = createSynthesizedNode(SyntaxKind.ClassDeclaration); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -1130,7 +1136,7 @@ namespace ts { return node; } - export function updateClassDeclaration(node: ClassDeclaration, decorators: Decorator[], modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[]) { + export function updateClassDeclaration(node: ClassDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: ClassElement[]) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name @@ -1141,7 +1147,7 @@ namespace ts { : node; } - export function createEnumDeclaration(decorators: Decorator[], modifiers: Modifier[], name: string | Identifier, members: EnumMember[]) { + export function createEnumDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier, members: EnumMember[]) { const node = createSynthesizedNode(SyntaxKind.EnumDeclaration); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -1150,7 +1156,7 @@ namespace ts { return node; } - export function updateEnumDeclaration(node: EnumDeclaration, decorators: Decorator[], modifiers: Modifier[], name: Identifier, members: EnumMember[]) { + export function updateEnumDeclaration(node: EnumDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier, members: EnumMember[]) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name @@ -1159,7 +1165,7 @@ namespace ts { : node; } - export function createModuleDeclaration(decorators: Decorator[], modifiers: Modifier[], name: ModuleName, body: ModuleBody, flags?: NodeFlags) { + export function createModuleDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, flags?: NodeFlags) { const node = createSynthesizedNode(SyntaxKind.ModuleDeclaration); node.flags |= flags; node.decorators = asNodeArray(decorators); @@ -1169,7 +1175,7 @@ namespace ts { return node; } - export function updateModuleDeclaration(node: ModuleDeclaration, decorators: Decorator[], modifiers: Modifier[], name: ModuleName, body: ModuleBody) { + export function updateModuleDeclaration(node: ModuleDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name @@ -1179,7 +1185,7 @@ namespace ts { } export function createModuleBlock(statements: Statement[]) { - const node = createSynthesizedNode(SyntaxKind.CaseBlock); + const node = createSynthesizedNode(SyntaxKind.ModuleBlock); node.statements = createNodeArray(statements); return node; } @@ -1202,7 +1208,7 @@ namespace ts { : node; } - export function createImportEqualsDeclaration(decorators: Decorator[], modifiers: Modifier[], name: string | Identifier, moduleReference: ModuleReference) { + export function createImportEqualsDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier, moduleReference: ModuleReference) { const node = createSynthesizedNode(SyntaxKind.ImportEqualsDeclaration); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -1211,7 +1217,7 @@ namespace ts { return node; } - export function updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: Decorator[], modifiers: Modifier[], name: Identifier, moduleReference: ModuleReference) { + export function updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier, moduleReference: ModuleReference) { return node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name @@ -1220,7 +1226,7 @@ namespace ts { : node; } - export function createImportDeclaration(decorators: Decorator[], modifiers: Modifier[], importClause: ImportClause, moduleSpecifier?: Expression): ImportDeclaration { + export function createImportDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier?: Expression): ImportDeclaration { const node = createSynthesizedNode(SyntaxKind.ImportDeclaration); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -1229,7 +1235,7 @@ namespace ts { return node; } - export function updateImportDeclaration(node: ImportDeclaration, decorators: Decorator[], modifiers: Modifier[], importClause: ImportClause, moduleSpecifier: Expression) { + export function updateImportDeclaration(node: ImportDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression | undefined) { return node.decorators !== decorators || node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier @@ -1275,21 +1281,21 @@ namespace ts { : node; } - export function createImportSpecifier(propertyName: Identifier, name: Identifier) { + export function createImportSpecifier(propertyName: Identifier | undefined, name: Identifier) { const node = createSynthesizedNode(SyntaxKind.ImportSpecifier); node.propertyName = propertyName; node.name = name; return node; } - export function updateImportSpecifier(node: ImportSpecifier, propertyName: Identifier, name: Identifier) { + export function updateImportSpecifier(node: ImportSpecifier, propertyName: Identifier | undefined, name: Identifier) { return node.propertyName !== propertyName || node.name !== name ? updateNode(createImportSpecifier(propertyName, name), node) : node; } - export function createExportAssignment(decorators: Decorator[], modifiers: Modifier[], isExportEquals: boolean, expression: Expression) { + export function createExportAssignment(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, isExportEquals: boolean, expression: Expression) { const node = createSynthesizedNode(SyntaxKind.ExportAssignment); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -1298,7 +1304,7 @@ namespace ts { return node; } - export function updateExportAssignment(node: ExportAssignment, decorators: Decorator[], modifiers: Modifier[], expression: Expression) { + export function updateExportAssignment(node: ExportAssignment, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, expression: Expression) { return node.decorators !== decorators || node.modifiers !== modifiers || node.expression !== expression @@ -1306,7 +1312,7 @@ namespace ts { : node; } - export function createExportDeclaration(decorators: Decorator[], modifiers: Modifier[], exportClause: NamedExports, moduleSpecifier?: Expression) { + export function createExportDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, exportClause: NamedExports | undefined, moduleSpecifier?: Expression) { const node = createSynthesizedNode(SyntaxKind.ExportDeclaration); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -1315,7 +1321,7 @@ namespace ts { return node; } - export function updateExportDeclaration(node: ExportDeclaration, decorators: Decorator[], modifiers: Modifier[], exportClause: NamedExports, moduleSpecifier: Expression) { + export function updateExportDeclaration(node: ExportDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, exportClause: NamedExports | undefined, moduleSpecifier: Expression | undefined) { return node.decorators !== decorators || node.modifiers !== modifiers || node.exportClause !== exportClause @@ -1336,16 +1342,17 @@ namespace ts { : node; } - export function createExportSpecifier(name: string | Identifier, propertyName?: string | Identifier) { + export function createExportSpecifier(propertyName: string | Identifier | undefined, name: string | Identifier) { const node = createSynthesizedNode(SyntaxKind.ExportSpecifier); - node.name = asName(name); node.propertyName = asName(propertyName); + node.name = asName(name); return node; } - export function updateExportSpecifier(node: ExportSpecifier, name: Identifier, propertyName: Identifier) { - return node.name !== name || node.propertyName !== propertyName - ? updateNode(createExportSpecifier(name, propertyName), node) + export function updateExportSpecifier(node: ExportSpecifier, propertyName: Identifier | undefined, name: Identifier) { + return node.propertyName !== propertyName + || node.name !== name + ? updateNode(createExportSpecifier(propertyName, name), node) : node; } @@ -1460,16 +1467,16 @@ namespace ts { : node; } - export function createJsxExpression(expression: Expression, dotDotDotToken: DotDotDotToken) { + export function createJsxExpression(dotDotDotToken: DotDotDotToken | undefined, expression: Expression | undefined) { const node = createSynthesizedNode(SyntaxKind.JsxExpression); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; } - export function updateJsxExpression(node: JsxExpression, expression: Expression) { + export function updateJsxExpression(node: JsxExpression, expression: Expression | undefined) { return node.expression !== expression - ? updateNode(createJsxExpression(expression, node.dotDotDotToken), node) + ? updateNode(createJsxExpression(node.dotDotDotToken, expression), node) : node; } @@ -1547,26 +1554,26 @@ namespace ts { return node; } - export function createShorthandPropertyAssignment(name: string | Identifier, objectAssignmentInitializer: Expression) { + export function createShorthandPropertyAssignment(name: string | Identifier, objectAssignmentInitializer?: Expression) { const node = createSynthesizedNode(SyntaxKind.ShorthandPropertyAssignment); node.name = asName(name); node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } - export function createSpreadAssignment(expression: Expression) { - const node = createSynthesizedNode(SyntaxKind.SpreadAssignment); - node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; - return node; - } - - export function updateShorthandPropertyAssignment(node: ShorthandPropertyAssignment, name: Identifier, objectAssignmentInitializer: Expression) { + export function updateShorthandPropertyAssignment(node: ShorthandPropertyAssignment, name: Identifier, objectAssignmentInitializer: Expression | undefined) { if (node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer) { return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer), node); } return node; } + export function createSpreadAssignment(expression: Expression) { + const node = createSynthesizedNode(SyntaxKind.SpreadAssignment); + node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; + return node; + } + export function updateSpreadAssignment(node: SpreadAssignment, expression: Expression) { if (node.expression !== expression) { return updateNode(createSpreadAssignment(expression), node); @@ -1774,7 +1781,7 @@ namespace ts { } export function createExternalModuleExport(exportName: Identifier) { - return createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createNamedExports([createExportSpecifier(exportName)])); + return createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createNamedExports([createExportSpecifier(/*propertyName*/ undefined, exportName)])); } // Utilities @@ -1855,7 +1862,7 @@ namespace ts { /** * Gets flags that control emit behavior of a node. */ - export function getEmitFlags(node: Node) { + export function getEmitFlags(node: Node): EmitFlags | undefined { const emitNode = node.emitNode; return emitNode && emitNode.flags; } @@ -1879,7 +1886,7 @@ namespace ts { /** * Sets a custom text range to use when emitting source maps. */ - export function setSourceMapRange(node: T, range: TextRange) { + export function setSourceMapRange(node: T, range: TextRange | undefined) { getOrCreateEmitNode(node).sourceMapRange = range; return node; } @@ -1887,7 +1894,7 @@ namespace ts { /** * Gets the TextRange to use for source maps for a token of a node. */ - export function getTokenSourceMapRange(node: Node, token: SyntaxKind) { + export function getTokenSourceMapRange(node: Node, token: SyntaxKind): TextRange | undefined { const emitNode = node.emitNode; const tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; return tokenSourceMapRanges && tokenSourceMapRanges[token]; @@ -1896,7 +1903,7 @@ namespace ts { /** * Sets the TextRange to use for source maps for a token of a node. */ - export function setTokenSourceMapRange(node: T, token: SyntaxKind, range: TextRange) { + export function setTokenSourceMapRange(node: T, token: SyntaxKind, range: TextRange | undefined) { const emitNode = getOrCreateEmitNode(node); const tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []); tokenSourceMapRanges[token] = range; @@ -1919,6 +1926,34 @@ namespace ts { return node; } + export function getSyntheticLeadingComments(node: Node): SynthesizedComment[] | undefined { + const emitNode = node.emitNode; + return emitNode && emitNode.leadingComments; + } + + export function setSyntheticLeadingComments(node: T, comments: SynthesizedComment[]) { + getOrCreateEmitNode(node).leadingComments = comments; + return node; + } + + export function addSyntheticLeadingComment(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean) { + return setSyntheticLeadingComments(node, append(getSyntheticLeadingComments(node), { kind, pos: -1, end: -1, hasTrailingNewLine, text })); + } + + export function getSyntheticTrailingComments(node: Node): SynthesizedComment[] | undefined { + const emitNode = node.emitNode; + return emitNode && emitNode.trailingComments; + } + + export function setSyntheticTrailingComments(node: T, comments: SynthesizedComment[]) { + getOrCreateEmitNode(node).trailingComments = comments; + return node; + } + + export function addSyntheticTrailingComment(node: T, kind: SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia, text: string, hasTrailingNewLine?: boolean) { + return setSyntheticTrailingComments(node, append(getSyntheticTrailingComments(node), { kind, pos: -1, end: -1, hasTrailingNewLine, text })); + } + /** * Gets the constant value to emit for an expression. */ @@ -2019,7 +2054,7 @@ namespace ts { return compareValues(x.priority, y.priority); } - export function setOriginalNode(node: T, original: Node): T { + export function setOriginalNode(node: T, original: Node | undefined): T { node.original = original; if (original) { const emitNode = original.emitNode; @@ -2031,6 +2066,8 @@ namespace ts { function mergeEmitNode(sourceEmitNode: EmitNode, destEmitNode: EmitNode) { const { flags, + leadingComments, + trailingComments, commentRange, sourceMapRange, tokenSourceMapRanges, @@ -2038,6 +2075,8 @@ namespace ts { helpers } = sourceEmitNode; if (!destEmitNode) destEmitNode = {}; + if (leadingComments) destEmitNode.leadingComments = addRange(leadingComments.slice(), destEmitNode.leadingComments); + if (trailingComments) destEmitNode.trailingComments = addRange(trailingComments.slice(), destEmitNode.trailingComments); if (flags) destEmitNode.flags = flags; if (commentRange) destEmitNode.commentRange = commentRange; if (sourceMapRange) destEmitNode.sourceMapRange = sourceMapRange; @@ -2211,8 +2250,129 @@ namespace ts { return setEmitFlags(createIdentifier(name), EmitFlags.HelperName | EmitFlags.AdviseOnEmitNode); } + const valuesHelper: EmitHelper = { + name: "typescript:values", + scoped: false, + text: ` + var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + }; + ` + }; + + export function createValuesHelper(context: TransformationContext, expression: Expression, location?: TextRange) { + context.requestEmitHelper(valuesHelper); + return setTextRange( + createCall( + getHelperName("__values"), + /*typeArguments*/ undefined, + [expression] + ), + location + ); + } + + const readHelper: EmitHelper = { + name: "typescript:read", + scoped: false, + text: ` + 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; + }; + ` + }; + + export function createReadHelper(context: TransformationContext, iteratorRecord: Expression, count: number | undefined, location?: TextRange) { + context.requestEmitHelper(readHelper); + return setTextRange( + createCall( + getHelperName("__read"), + /*typeArguments*/ undefined, + count !== undefined + ? [iteratorRecord, createLiteral(count)] + : [iteratorRecord] + ), + location + ); + } + + const spreadHelper: EmitHelper = { + name: "typescript:spread", + scoped: false, + text: ` + var __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; + };` + }; + + export function createSpreadHelper(context: TransformationContext, argumentList: Expression[], location?: TextRange) { + context.requestEmitHelper(readHelper); + context.requestEmitHelper(spreadHelper); + return setTextRange( + createCall( + getHelperName("__spread"), + /*typeArguments*/ undefined, + argumentList + ), + location + ); + } + // Utilities + export function createForOfBindingStatement(node: ForInitializer, boundValue: Expression): Statement { + if (isVariableDeclarationList(node)) { + const firstDeclaration = firstOrUndefined(node.declarations); + const updatedDeclaration = updateVariableDeclaration( + firstDeclaration, + firstDeclaration.name, + /*typeNode*/ undefined, + boundValue + ); + return setTextRange( + createVariableStatement( + /*modifiers*/ undefined, + updateVariableDeclarationList(node, [updatedDeclaration]) + ), + /*location*/ node + ); + } + else { + const updatedExpression = setTextRange(createAssignment(node, boundValue), /*location*/ node); + return setTextRange(createStatement(updatedExpression), /*location*/ node); + } + } + + export function insertLeadingStatement(dest: Statement, source: Statement) { + if (isBlock(dest)) { + return updateBlock(dest, setTextRange(createNodeArray([source, ...dest.statements]), dest.statements)); + } + else { + return createBlock(createNodeArray([dest, source]), /*multiLine*/ true); + } + } + export function restoreEnclosingLabel(node: Statement, outermostLabeledStatement: LabeledStatement, afterRestoreLabelCallback?: (node: LabeledStatement) => void): Statement { if (!outermostLabeledStatement) { return node; @@ -2271,6 +2431,10 @@ namespace ts { ? setTextRange(createIdentifier("_super"), callee) : callee; } + else if (getEmitFlags(callee) & EmitFlags.HelperName) { + thisArg = createVoidZero(); + target = parenthesizeForAccess(callee); + } else { switch (callee.kind) { case SyntaxKind.PropertyAccessExpression: { @@ -2684,6 +2848,16 @@ namespace ts { return statements; } + export function parenthesizeConditionalHead(condition: Expression) { + const conditionalPrecedence = getOperatorPrecedence(SyntaxKind.ConditionalExpression, SyntaxKind.QuestionToken); + const emittedCondition = skipPartiallyEmittedExpressions(condition); + const conditionPrecedence = getExpressionPrecedence(emittedCondition); + if (compareValues(conditionPrecedence, conditionalPrecedence) === Comparison.LessThan) { + return createParen(condition); + } + return condition; + } + /** * Wraps the operand to a BinaryExpression in parentheses if they are needed to preserve the intended * order of operations. diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 73708eb08f3..47a49fe3773 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -243,7 +243,8 @@ namespace ts { visitNode(cbNode, (node).expression) || visitNode(cbNode, (node).statement); case SyntaxKind.ForOfStatement: - return visitNode(cbNode, (node).initializer) || + return visitNode(cbNode, (node).awaitModifier) || + visitNode(cbNode, (node).initializer) || visitNode(cbNode, (node).expression) || visitNode(cbNode, (node).statement); case SyntaxKind.ContinueStatement: @@ -4462,6 +4463,7 @@ namespace ts { function parseForOrForInOrForOfStatement(): Statement { const pos = getNodePos(); parseExpected(SyntaxKind.ForKeyword); + const awaitToken = parseOptionalToken(SyntaxKind.AwaitKeyword); parseExpected(SyntaxKind.OpenParenToken); let initializer: VariableDeclarationList | Expression = undefined; @@ -4474,20 +4476,21 @@ namespace ts { } } let forOrForInOrForOfStatement: IterationStatement; - if (parseOptional(SyntaxKind.InKeyword)) { + if (awaitToken ? parseExpected(SyntaxKind.OfKeyword) : parseOptional(SyntaxKind.OfKeyword)) { + const forOfStatement = createNode(SyntaxKind.ForOfStatement, pos); + forOfStatement.awaitModifier = awaitToken; + forOfStatement.initializer = initializer; + forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); + parseExpected(SyntaxKind.CloseParenToken); + forOrForInOrForOfStatement = forOfStatement; + } + else if (parseOptional(SyntaxKind.InKeyword)) { const forInStatement = createNode(SyntaxKind.ForInStatement, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(SyntaxKind.CloseParenToken); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(SyntaxKind.OfKeyword)) { - const forOfStatement = createNode(SyntaxKind.ForOfStatement, pos); - forOfStatement.initializer = initializer; - forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); - parseExpected(SyntaxKind.CloseParenToken); - forOrForInOrForOfStatement = forOfStatement; - } else { const forStatement = createNode(SyntaxKind.ForStatement, pos); forStatement.initializer = initializer; @@ -5830,7 +5833,11 @@ namespace ts { } } - const range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() }; + const range = { + kind: triviaScanner.getToken(), + pos: triviaScanner.getTokenPos(), + end: triviaScanner.getTextPos(), + }; const comment = sourceText.substring(range.pos, range.end); const referencePathMatchResult = getFileReferenceFromReferencePath(comment, range); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 62f3c066442..eb9f0f0e0a1 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -754,15 +754,15 @@ namespace ts { return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = createTypeChecker(program, /*produceDiagnostics:*/ false)); } - function emit(sourceFile?: SourceFile, writeFileCallback?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean): EmitResult { - return runWithCancellationToken(() => emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles)); + function emit(sourceFile?: SourceFile, writeFileCallback?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, transformers?: CustomTransformers): EmitResult { + return runWithCancellationToken(() => emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers)); } function isEmitBlocked(emitFileName: string): boolean { return hasEmitBlockingDiagnostics.contains(toPath(emitFileName, currentDirectory, getCanonicalFileName)); } - function emitWorker(program: Program, sourceFile: SourceFile, writeFileCallback: WriteFileCallback, cancellationToken: CancellationToken, emitOnlyDtsFiles?: boolean): EmitResult { + function emitWorker(program: Program, sourceFile: SourceFile, writeFileCallback: WriteFileCallback, cancellationToken: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult { let declarationDiagnostics: Diagnostic[] = []; if (options.noEmit) { @@ -804,11 +804,13 @@ namespace ts { performance.mark("beforeEmit"); + const transformers = emitOnlyDtsFiles ? [] : getTransformers(options, customTransformers); const emitResult = emitFiles( emitResolver, getEmitHost(writeFileCallback), sourceFile, - emitOnlyDtsFiles); + emitOnlyDtsFiles, + transformers); performance.mark("afterEmit"); performance.measure("Emit", "beforeEmit", "afterEmit"); diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 52c75a37005..fb91b0ff5b7 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -608,10 +608,10 @@ namespace ts { * @returns If "reduce" is true, the accumulated value. If "reduce" is false, the first truthy * return value of the callback. */ - function iterateCommentRanges(reduce: boolean, text: string, pos: number, trailing: boolean, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial?: U): U { + function iterateCommentRanges(reduce: boolean, text: string, pos: number, trailing: boolean, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial?: U): U { let pendingPos: number; let pendingEnd: number; - let pendingKind: SyntaxKind; + let pendingKind: CommentKind; let pendingHasTrailingNewLine: boolean; let hasPendingCommentRange = false; let collecting = trailing || pos === 0; @@ -707,28 +707,28 @@ namespace ts { return accumulator; } - export function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T) { + export function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state?: T) { return iterateCommentRanges(/*reduce*/ false, text, pos, /*trailing*/ false, cb, state); } - export function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T) { + export function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state?: T) { return iterateCommentRanges(/*reduce*/ false, text, pos, /*trailing*/ true, cb, state); } - export function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U) { + export function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U) { return iterateCommentRanges(/*reduce*/ true, text, pos, /*trailing*/ false, cb, state, initial); } - export function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U) { + export function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U) { return iterateCommentRanges(/*reduce*/ true, text, pos, /*trailing*/ true, cb, state, initial); } - function appendCommentRange(pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, _state: any, comments: CommentRange[]) { + function appendCommentRange(pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, _state: any, comments: CommentRange[]) { if (!comments) { comments = []; } - comments.push({ pos, end, hasTrailingNewLine, kind }); + comments.push({ kind, pos, end, hasTrailingNewLine }); return comments; } diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index c90a3484a8a..cf50ab6482b 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -59,6 +59,21 @@ namespace ts { declare var global: any; declare var __filename: string; + export function getNodeMajorVersion() { + if (typeof process === "undefined") { + return undefined; + } + const version: string = process.version; + if (!version) { + return undefined; + } + const dot = version.indexOf("."); + if (dot === -1) { + return undefined; + } + return parseInt(version.substring(1, dot)); + } + declare class Enumerator { public atEnd(): boolean; public moveNext(): boolean; @@ -315,9 +330,8 @@ namespace ts { } const watchedFileSet = createWatchedFileSet(); - function isNode4OrLater(): boolean { - return parseInt(process.version.charAt(1)) >= 4; - } + const nodeVersion = getNodeMajorVersion(); + const isNode4OrLater = nodeVersion >= 4; function isFileSystemCaseSensitive(): boolean { // win32\win64 are case insensitive platforms @@ -485,14 +499,12 @@ namespace ts { // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643) let options: any; - if (!directoryExists(directoryName) || (isUNCPath(directoryName) && process.platform === "win32")) { - // do nothing if either - // - target folder does not exist - // - this is UNC path on Windows (https://github.com/Microsoft/TypeScript/issues/13874) + if (!directoryExists(directoryName)) { + // do nothing if target folder does not exist return noOpFileWatcher; } - if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) { + if (isNode4OrLater && (process.platform === "win32" || process.platform === "darwin")) { options = { persistent: true, recursive: !!recursive }; } else { @@ -512,10 +524,6 @@ namespace ts { }; } ); - - function isUNCPath(s: string): boolean { - return s.length > 2 && s.charCodeAt(0) === CharacterCodes.slash && s.charCodeAt(1) === CharacterCodes.slash; - } }, resolvePath: function(path: string): string { return _path.resolve(path); diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 62469df79c1..b9a75015f41 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -13,7 +13,7 @@ /* @internal */ namespace ts { - function getModuleTransformer(moduleKind: ModuleKind): Transformer { + function getModuleTransformer(moduleKind: ModuleKind): TransformerFactory { switch (moduleKind) { case ModuleKind.ES2015: return transformES2015Module; @@ -24,16 +24,25 @@ namespace ts { } } + const enum TransformationState { + Uninitialized, + Initialized, + Completed, + Disposed + } + const enum SyntaxKindFeatureFlags { Substitution = 1 << 0, EmitNotifications = 1 << 1, } - export function getTransformers(compilerOptions: CompilerOptions) { + export function getTransformers(compilerOptions: CompilerOptions, customTransformers?: CustomTransformers) { const jsx = compilerOptions.jsx; const languageVersion = getEmitScriptTarget(compilerOptions); const moduleKind = getEmitModuleKind(compilerOptions); - const transformers: Transformer[] = []; + const transformers: TransformerFactory[] = []; + + addRange(transformers, customTransformers && customTransformers.before); transformers.push(transformTypeScript); @@ -66,6 +75,8 @@ namespace ts { transformers.push(transformES5); } + addRange(transformers, customTransformers && customTransformers.after); + return transformers; } @@ -73,28 +84,29 @@ namespace ts { * Transforms an array of SourceFiles by passing them through each transformer. * * @param resolver The emit resolver provided by the checker. - * @param host The emit host. - * @param sourceFiles An array of source files - * @param transforms An array of Transformers. + * @param host The emit host object used to interact with the file system. + * @param options Compiler options to surface in the `TransformationContext`. + * @param nodes An array of nodes to transform. + * @param transforms An array of `TransformerFactory` callbacks. + * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ - export function transformFiles(resolver: EmitResolver, host: EmitHost, sourceFiles: SourceFile[], transformers: Transformer[]): TransformationResult { + export function transformNodes(resolver: EmitResolver, host: EmitHost, options: CompilerOptions, nodes: T[], transformers: TransformerFactory[], allowDtsFiles: boolean): TransformationResult { const enabledSyntaxKindFeatures = new Array(SyntaxKind.Count); - - let lexicalEnvironmentDisabled = false; - let lexicalEnvironmentVariableDeclarations: VariableDeclaration[]; let lexicalEnvironmentFunctionDeclarations: FunctionDeclaration[]; let lexicalEnvironmentVariableDeclarationsStack: VariableDeclaration[][] = []; let lexicalEnvironmentFunctionDeclarationsStack: FunctionDeclaration[][] = []; let lexicalEnvironmentStackOffset = 0; let lexicalEnvironmentSuspended = false; - let emitHelpers: EmitHelper[]; + let onSubstituteNode: TransformationContext["onSubstituteNode"] = (_, node) => node; + let onEmitNode: TransformationContext["onEmitNode"] = (hint, node, callback) => callback(hint, node); + let state = TransformationState.Uninitialized; // The transformation context is provided to each transformer as part of transformer // initialization. const context: TransformationContext = { - getCompilerOptions: () => host.getCompilerOptions(), + getCompilerOptions: () => options, getEmitResolver: () => resolver, getEmitHost: () => host, startLexicalEnvironment, @@ -105,51 +117,62 @@ namespace ts { hoistFunctionDeclaration, requestEmitHelper, readEmitHelpers, - onSubstituteNode: (_, node) => node, enableSubstitution, - isSubstitutionEnabled, - onEmitNode: (hint, node, callback) => callback(hint, node), enableEmitNotification, - isEmitNotificationEnabled + isSubstitutionEnabled, + isEmitNotificationEnabled, + get onSubstituteNode() { return onSubstituteNode }, + set onSubstituteNode(value) { + Debug.assert(state < TransformationState.Initialized, "Cannot modify transformation hooks after initialization has completed."); + Debug.assert(value !== undefined, "Value must not be 'undefined'"); + onSubstituteNode = value; + }, + get onEmitNode() { return onEmitNode }, + set onEmitNode(value) { + Debug.assert(state < TransformationState.Initialized, "Cannot modify transformation hooks after initialization has completed."); + Debug.assert(value !== undefined, "Value must not be 'undefined'"); + onEmitNode = value; + } }; + // Ensure the parse tree is clean before applying transformations + for (const node of nodes) { + disposeEmitNodes(getSourceFileOfNode(getParseTreeNode(node))); + } + performance.mark("beforeTransform"); // Chain together and initialize each transformer. const transformation = chain(...transformers)(context); - // Transform each source file. - const transformed = map(sourceFiles, transformSourceFile); + // prevent modification of transformation hooks. + state = TransformationState.Initialized; - // Disable modification of the lexical environment. - lexicalEnvironmentDisabled = true; + // Transform each node. + const transformed = map(nodes, allowDtsFiles ? transformation : transformRoot); + + // prevent modification of the lexical environment. + state = TransformationState.Completed; performance.mark("afterTransform"); performance.measure("transformTime", "beforeTransform", "afterTransform"); return { transformed, - emitNodeWithSubstitution, - emitNodeWithNotification + substituteNode, + emitNodeWithNotification, + dispose }; - /** - * Transforms a source file. - * - * @param sourceFile The source file to transform. - */ - function transformSourceFile(sourceFile: SourceFile) { - if (isDeclarationFile(sourceFile)) { - return sourceFile; - } - - return transformation(sourceFile); + function transformRoot(node: T) { + return node && (!isSourceFile(node) || !isDeclarationFile(node)) ? transformation(node) : node; } /** * Enables expression substitutions in the pretty printer for the provided SyntaxKind. */ function enableSubstitution(kind: SyntaxKind) { + Debug.assert(state < TransformationState.Completed, "Cannot modify the transformation context after transformation has completed."); enabledSyntaxKindFeatures[kind] |= SyntaxKindFeatureFlags.Substitution; } @@ -168,19 +191,16 @@ namespace ts { * @param node The node to emit. * @param emitCallback The callback used to emit the node or its substitute. */ - function emitNodeWithSubstitution(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) { - if (node) { - if (isSubstitutionEnabled(node)) { - node = context.onSubstituteNode(hint, node) || node; - } - emitCallback(hint, node); - } + function substituteNode(hint: EmitHint, node: Node) { + Debug.assert(state < TransformationState.Disposed, "Cannot substitute a node after the result is disposed."); + return node && isSubstitutionEnabled(node) && onSubstituteNode(hint, node) || node; } /** * Enables before/after emit notifications in the pretty printer for the provided SyntaxKind. */ function enableEmitNotification(kind: SyntaxKind) { + Debug.assert(state < TransformationState.Completed, "Cannot modify the transformation context after transformation has completed."); enabledSyntaxKindFeatures[kind] |= SyntaxKindFeatureFlags.EmitNotifications; } @@ -201,9 +221,10 @@ namespace ts { * @param emitCallback The callback used to emit the node. */ function emitNodeWithNotification(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) { + Debug.assert(state < TransformationState.Disposed, "Cannot invoke TransformationResult callbacks after the result is disposed."); if (node) { if (isEmitNotificationEnabled(node)) { - context.onEmitNode(hint, node, emitCallback); + onEmitNode(hint, node, emitCallback); } else { emitCallback(hint, node); @@ -215,7 +236,8 @@ namespace ts { * Records a hoisted variable declaration for the provided name within a lexical environment. */ function hoistVariableDeclaration(name: Identifier): void { - Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + Debug.assert(state > TransformationState.Uninitialized, "Cannot modify the lexical environment during initialization."); + Debug.assert(state < TransformationState.Completed, "Cannot modify the lexical environment after transformation has completed."); const decl = createVariableDeclaration(name); if (!lexicalEnvironmentVariableDeclarations) { lexicalEnvironmentVariableDeclarations = [decl]; @@ -229,7 +251,8 @@ namespace ts { * Records a hoisted function declaration within a lexical environment. */ function hoistFunctionDeclaration(func: FunctionDeclaration): void { - Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + Debug.assert(state > TransformationState.Uninitialized, "Cannot modify the lexical environment during initialization."); + Debug.assert(state < TransformationState.Completed, "Cannot modify the lexical environment after transformation has completed."); if (!lexicalEnvironmentFunctionDeclarations) { lexicalEnvironmentFunctionDeclarations = [func]; } @@ -243,7 +266,8 @@ namespace ts { * are pushed onto a stack, and the related storage variables are reset. */ function startLexicalEnvironment(): void { - Debug.assert(!lexicalEnvironmentDisabled, "Cannot start a lexical environment during the print phase."); + Debug.assert(state > TransformationState.Uninitialized, "Cannot modify the lexical environment during initialization."); + Debug.assert(state < TransformationState.Completed, "Cannot modify the lexical environment after transformation has completed."); Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); // Save the current lexical environment. Rather than resizing the array we adjust the @@ -259,14 +283,16 @@ namespace ts { /** Suspends the current lexical environment, usually after visiting a parameter list. */ function suspendLexicalEnvironment(): void { - Debug.assert(!lexicalEnvironmentDisabled, "Cannot suspend a lexical environment during the print phase."); + Debug.assert(state > TransformationState.Uninitialized, "Cannot modify the lexical environment during initialization."); + Debug.assert(state < TransformationState.Completed, "Cannot modify the lexical environment after transformation has completed."); Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is already suspended."); lexicalEnvironmentSuspended = true; } /** Resumes a suspended lexical environment, usually before visiting a function body. */ function resumeLexicalEnvironment(): void { - Debug.assert(!lexicalEnvironmentDisabled, "Cannot resume a lexical environment during the print phase."); + Debug.assert(state > TransformationState.Uninitialized, "Cannot modify the lexical environment during initialization."); + Debug.assert(state < TransformationState.Completed, "Cannot modify the lexical environment after transformation has completed."); Debug.assert(lexicalEnvironmentSuspended, "Lexical environment is not suspended."); lexicalEnvironmentSuspended = false; } @@ -276,7 +302,8 @@ namespace ts { * any hoisted declarations added in this environment are returned. */ function endLexicalEnvironment(): Statement[] { - Debug.assert(!lexicalEnvironmentDisabled, "Cannot end a lexical environment during the print phase."); + Debug.assert(state > TransformationState.Uninitialized, "Cannot modify the lexical environment during initialization."); + Debug.assert(state < TransformationState.Completed, "Cannot modify the lexical environment after transformation has completed."); Debug.assert(!lexicalEnvironmentSuspended, "Lexical environment is suspended."); let statements: Statement[]; @@ -312,16 +339,39 @@ namespace ts { } function requestEmitHelper(helper: EmitHelper): void { - Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + Debug.assert(state > TransformationState.Uninitialized, "Cannot modify the transformation context during initialization."); + Debug.assert(state < TransformationState.Completed, "Cannot modify the transformation context after transformation has completed."); Debug.assert(!helper.scoped, "Cannot request a scoped emit helper."); emitHelpers = append(emitHelpers, helper); } function readEmitHelpers(): EmitHelper[] | undefined { - Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + Debug.assert(state > TransformationState.Uninitialized, "Cannot modify the transformation context during initialization."); + Debug.assert(state < TransformationState.Completed, "Cannot modify the transformation context after transformation has completed."); const helpers = emitHelpers; emitHelpers = undefined; return helpers; } + + function dispose() { + if (state < TransformationState.Disposed) { + // Clean up emit nodes on parse tree + for (const node of nodes) { + disposeEmitNodes(getSourceFileOfNode(getParseTreeNode(node))); + } + + // Release references to external entries for GC purposes. + lexicalEnvironmentVariableDeclarations = undefined; + lexicalEnvironmentVariableDeclarationsStack = undefined; + lexicalEnvironmentFunctionDeclarations = undefined; + lexicalEnvironmentFunctionDeclarationsStack = undefined; + onSubstituteNode = undefined; + onEmitNode = undefined; + emitHelpers = undefined; + + // Prevent further use of the transformation result. + state = TransformationState.Disposed; + } + } } } diff --git a/src/compiler/transformers/destructuring.ts b/src/compiler/transformers/destructuring.ts index b4473e6a261..bb129cd1187 100644 --- a/src/compiler/transformers/destructuring.ts +++ b/src/compiler/transformers/destructuring.ts @@ -6,6 +6,7 @@ namespace ts { interface FlattenContext { context: TransformationContext; level: FlattenLevel; + downlevelIteration: boolean; hoistTempVariables: boolean; emitExpression: (value: Expression) => void; emitBindingOrAssignment: (target: BindingOrAssignmentElementTarget, value: Expression, location: TextRange, original: Node) => void; @@ -57,6 +58,7 @@ namespace ts { const flattenContext: FlattenContext = { context, level, + downlevelIteration: context.getCompilerOptions().downlevelIteration, hoistTempVariables: true, emitExpression, emitBindingOrAssignment, @@ -146,6 +148,7 @@ namespace ts { const flattenContext: FlattenContext = { context, level, + downlevelIteration: context.getCompilerOptions().downlevelIteration, hoistTempVariables, emitExpression, emitBindingOrAssignment, @@ -312,7 +315,23 @@ namespace ts { function flattenArrayBindingOrAssignmentPattern(flattenContext: FlattenContext, parent: BindingOrAssignmentElement, pattern: ArrayBindingOrAssignmentPattern, value: Expression, location: TextRange) { const elements = getElementsOfBindingOrAssignmentPattern(pattern); const numElements = elements.length; - if (numElements !== 1 && (flattenContext.level < FlattenLevel.ObjectRest || numElements === 0)) { + if (flattenContext.level < FlattenLevel.ObjectRest && flattenContext.downlevelIteration) { + // Read the elements of the iterable into an array + value = ensureIdentifier( + flattenContext, + createReadHelper( + flattenContext.context, + value, + numElements > 0 && getRestIndicatorOfBindingOrAssignmentElement(elements[numElements - 1]) + ? undefined + : numElements, + location + ), + /*reuseIdentifierExpressions*/ false, + location + ); + } + else if (numElements !== 1 && (flattenContext.level < FlattenLevel.ObjectRest || numElements === 0)) { // For anything other than a single-element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. Additionally, if we have zero elements // we need to emit *something* to ensure that in case a 'var' keyword was already emitted, @@ -448,7 +467,7 @@ namespace ts { } function makeBindingElement(name: Identifier) { - return createBindingElement(/*propertyName*/ undefined, /*dotDotDotToken*/ undefined, name); + return createBindingElement(/*dotDotDotToken*/ undefined, /*propertyName*/ undefined, name); } function makeAssignmentElement(name: Identifier) { diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index e0fd435a90d..03d4b9ce328 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -1,5 +1,6 @@ /// /// +/// /*@internal*/ namespace ts { @@ -268,6 +269,7 @@ namespace ts { hoistVariableDeclaration, } = context; + const compilerOptions = context.getCompilerOptions(); const resolver = context.getEmitResolver(); const previousOnSubstituteNode = context.onSubstituteNode; const previousOnEmitNode = context.onEmitNode; @@ -1716,6 +1718,7 @@ namespace ts { return updateFunctionExpression( node, /*modifiers*/ undefined, + node.asteriskToken, name, /*typeParameters*/ undefined, parameters, @@ -1747,6 +1750,7 @@ namespace ts { node, /*decorators*/ undefined, visitNodes(node.modifiers, visitor, isModifier), + node.asteriskToken, name, /*typeParameters*/ undefined, parameters, @@ -1939,6 +1943,9 @@ namespace ts { function visitParenthesizedExpression(node: ParenthesizedExpression, needsDestructuringValue: boolean): ParenthesizedExpression { // If we are here it is most likely because our expression is a destructuring assignment. if (!needsDestructuringValue) { + // By default we always emit the RHS at the end of a flattened destructuring + // expression. If we are in a state where we do not need the destructuring value, + // we pass that information along to the children that care about it. switch (node.expression.kind) { case SyntaxKind.ParenthesizedExpression: return updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); @@ -1990,7 +1997,8 @@ namespace ts { else { assignment = createBinary(decl.name, SyntaxKind.EqualsToken, visitNode(decl.initializer, visitor, isExpression)); } - (assignments || (assignments = [])).push(assignment); + + assignments = append(assignments, assignment); } } if (assignments) { @@ -2172,12 +2180,26 @@ namespace ts { if (convertedLoopState && !convertedLoopState.labels) { convertedLoopState.labels = createMap(); } - const statement = unwrapInnermostStatmentOfLabel(node, convertedLoopState && recordLabel); - return isIterationStatement(statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(statement) + const statement = unwrapInnermostStatementOfLabel(node, convertedLoopState && recordLabel); + return isIterationStatement(statement, /*lookInLabeledStatements*/ false) ? visitIterationStatement(statement, /*outermostLabeledStatement*/ node) : restoreEnclosingLabel(visitNode(statement, visitor, isStatement), node, convertedLoopState && resetLabel); } + function visitIterationStatement(node: IterationStatement, outermostLabeledStatement: LabeledStatement) { + switch (node.kind) { + case SyntaxKind.DoStatement: + case SyntaxKind.WhileStatement: + return visitDoOrWhileStatement(node, outermostLabeledStatement); + case SyntaxKind.ForStatement: + return visitForStatement(node, outermostLabeledStatement); + case SyntaxKind.ForInStatement: + return visitForInStatement(node, outermostLabeledStatement); + case SyntaxKind.ForOfStatement: + return visitForOfStatement(node, outermostLabeledStatement); + } + } + function visitIterationStatementWithFacts(excludeFacts: HierarchyFacts, includeFacts: HierarchyFacts, node: IterationStatement, outermostLabeledStatement: LabeledStatement, convert?: LoopConverter) { const ancestorFacts = enterSubtree(excludeFacts, includeFacts); const updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); @@ -2215,54 +2237,17 @@ namespace ts { HierarchyFacts.ForInOrForOfStatementIncludes, node, outermostLabeledStatement, - convertForOfToFor); + compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray); } - function convertForOfToFor(node: ForOfStatement, outermostLabeledStatement: LabeledStatement, convertedLoopBodyStatements: Statement[]): Statement { - // The following ES6 code: - // - // for (let v of expr) { } - // - // should be emitted as - // - // for (var _i = 0, _a = expr; _i < _a.length; _i++) { - // var v = _a[_i]; - // } - // - // where _a and _i are temps emitted to capture the RHS and the counter, - // respectively. - // When the left hand side is an expression instead of a let declaration, - // the "let v" is not emitted. - // When the left hand side is a let/const, the v is renamed if there is - // another v in scope. - // Note that all assignments to the LHS are emitted in the body, including - // all destructuring. - // Note also that because an extra statement is needed to assign to the LHS, - // for-of bodies are always emitted as blocks. - - const expression = visitNode(node.expression, visitor, isExpression); - const initializer = node.initializer; + function convertForOfStatementHead(node: ForOfStatement, boundValue: Expression, convertedLoopBodyStatements: Statement[]) { const statements: Statement[] = []; - - // In the case where the user wrote an identifier as the RHS, like this: - // - // for (let v of arr) { } - // - // we don't want to emit a temporary variable for the RHS, just use it directly. - const counter = createLoopVariable(); - const rhsReference = expression.kind === SyntaxKind.Identifier - ? createUniqueName(unescapeIdentifier((expression).text)) - : createTempVariable(/*recordTempVariable*/ undefined); - const elementAccess = createElementAccess(rhsReference, counter); - - // Initialize LHS - // var v = _a[_i]; - if (isVariableDeclarationList(initializer)) { - if (initializer.flags & NodeFlags.BlockScoped) { + if (isVariableDeclarationList(node.initializer)) { + if (node.initializer.flags & NodeFlags.BlockScoped) { enableSubstitutionsForBlockScopedBindings(); } - const firstOriginalDeclaration = firstOrUndefined(initializer.declarations); + const firstOriginalDeclaration = firstOrUndefined(node.initializer.declarations); if (firstOriginalDeclaration && isBindingPattern(firstOriginalDeclaration.name)) { // This works whether the declaration is a var, let, or const. // It will use rhsIterationValue _a[_i] as the initializer. @@ -2271,12 +2256,11 @@ namespace ts { visitor, context, FlattenLevel.All, - elementAccess + boundValue ); - const declarationList = createVariableDeclarationList(declarations); - setOriginalNode(declarationList, initializer); - setTextRange(declarationList, initializer); + const declarationList = setTextRange(createVariableDeclarationList(declarations), node.initializer); + setOriginalNode(declarationList, node.initializer); // Adjust the source map range for the first declaration to align with the old // emitter. @@ -2304,15 +2288,15 @@ namespace ts { createVariableDeclaration( firstOriginalDeclaration ? firstOriginalDeclaration.name : createTempVariable(/*recordTempVariable*/ undefined), /*type*/ undefined, - createElementAccess(rhsReference, counter) + boundValue ) ]), - moveRangePos(initializer, -1) + moveRangePos(node.initializer, -1) ), - initializer + node.initializer ) ), - moveRangeEnd(initializer, -1) + moveRangeEnd(node.initializer, -1) ) ); } @@ -2320,25 +2304,14 @@ namespace ts { else { // Initializer is an expression. Emit the expression in the body, so that it's // evaluated on every iteration. - const assignment = createAssignment(initializer, elementAccess); + const assignment = createAssignment(node.initializer, boundValue); if (isDestructuringAssignment(assignment)) { - // This is a destructuring pattern, so we flatten the destructuring instead. - statements.push( - createStatement( - flattenDestructuringAssignment( - assignment, - visitor, - context, - FlattenLevel.All - ) - ) - ); + aggregateTransformFlags(assignment); + statements.push(createStatement(visitBinaryExpression(assignment, /*needsDestructuringValue*/ false))); } else { - // Currently there is not way to check that assignment is binary expression of destructing assignment - // so we have to cast never type to binaryExpression - (assignment).end = initializer.end; - statements.push(setTextRange(createStatement(assignment), moveRangeEnd(initializer, -1))); + assignment.end = node.initializer.end; + statements.push(setTextRange(createStatement(visitNode(assignment, visitor, isExpression)), moveRangeEnd(node.initializer, -1))); } } @@ -2348,7 +2321,7 @@ namespace ts { addRange(statements, convertedLoopBodyStatements); } else { - const statement = visitNode(node.statement, visitor, isStatement, /*optional*/ false, liftToBlock); + const statement = visitNode(node.statement, visitor, isStatement, liftToBlock); if (isBlock(statement)) { addRange(statements, statement.statements); bodyLocation = statement; @@ -2359,38 +2332,82 @@ namespace ts { } } + // The old emitter does not emit source maps for the block. + // We add the location to preserve comments. + return setEmitFlags( + setTextRange( + createBlock( + setTextRange(createNodeArray(statements), statementsLocation), + /*multiLine*/ true + ), + bodyLocation, + ), + EmitFlags.NoSourceMap | EmitFlags.NoTokenSourceMaps + ); + } + + function convertForOfStatementForArray(node: ForOfStatement, outermostLabeledStatement: LabeledStatement, convertedLoopBodyStatements: Statement[]): Statement { + // The following ES6 code: + // + // for (let v of expr) { } + // + // should be emitted as + // + // for (var _i = 0, _a = expr; _i < _a.length; _i++) { + // var v = _a[_i]; + // } + // + // where _a and _i are temps emitted to capture the RHS and the counter, + // respectively. + // When the left hand side is an expression instead of a let declaration, + // the "let v" is not emitted. + // When the left hand side is a let/const, the v is renamed if there is + // another v in scope. + // Note that all assignments to the LHS are emitted in the body, including + // all destructuring. + // Note also that because an extra statement is needed to assign to the LHS, + // for-of bodies are always emitted as blocks. + + const expression = visitNode(node.expression, visitor, isExpression); + + // In the case where the user wrote an identifier as the RHS, like this: + // + // for (let v of arr) { } + // + // we don't want to emit a temporary variable for the RHS, just use it directly. + const counter = createLoopVariable(); + const rhsReference = isIdentifier(expression) ? getGeneratedNameForNode(expression) : createTempVariable(/*recordTempVariable*/ undefined); + // The old emitter does not emit source maps for the expression setEmitFlags(expression, EmitFlags.NoSourceMap | getEmitFlags(expression)); - // The old emitter does not emit source maps for the block. - // We add the location to preserve comments. - const body = createBlock(setTextRange(createNodeArray(statements), /*location*/ statementsLocation)); - setTextRange(body, bodyLocation); - setEmitFlags(body, EmitFlags.NoSourceMap | EmitFlags.NoTokenSourceMaps); - - const forStatement = createFor( - setEmitFlags( - setTextRange( - createVariableDeclarationList([ - setTextRange(createVariableDeclaration(counter, /*type*/ undefined, createLiteral(0)), moveRangePos(node.expression, -1)), - setTextRange(createVariableDeclaration(rhsReference, /*type*/ undefined, expression), node.expression) - ]), + const forStatement = setTextRange( + createFor( + /*initializer*/ setEmitFlags( + setTextRange( + createVariableDeclarationList([ + setTextRange(createVariableDeclaration(counter, /*type*/ undefined, createLiteral(0)), moveRangePos(node.expression, -1)), + setTextRange(createVariableDeclaration(rhsReference, /*type*/ undefined, expression), node.expression) + ]), + node.expression + ), + EmitFlags.NoHoisting + ), + /*condition*/ setTextRange( + createLessThan( + counter, + createPropertyAccess(rhsReference, "length") + ), node.expression ), - EmitFlags.NoHoisting + /*incrementor*/ setTextRange(createPostfixIncrement(counter), node.expression), + /*statement*/ convertForOfStatementHead( + node, + createElementAccess(rhsReference, counter), + convertedLoopBodyStatements + ) ), - setTextRange( - createLessThan( - counter, - createPropertyAccess(rhsReference, "length") - ), - node.expression - ), - setTextRange( - createPostfixIncrement(counter), - node.expression - ), - body + /*location*/ node ); // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter. @@ -2399,18 +2416,110 @@ namespace ts { return restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); } - function visitIterationStatement(node: IterationStatement, outermostLabeledStatement: LabeledStatement) { - switch (node.kind) { - case SyntaxKind.DoStatement: - case SyntaxKind.WhileStatement: - return visitDoOrWhileStatement(node, outermostLabeledStatement); - case SyntaxKind.ForStatement: - return visitForStatement(node, outermostLabeledStatement); - case SyntaxKind.ForInStatement: - return visitForInStatement(node, outermostLabeledStatement); - case SyntaxKind.ForOfStatement: - return visitForOfStatement(node, outermostLabeledStatement); - } + function convertForOfStatementForIterable(node: ForOfStatement, outermostLabeledStatement: LabeledStatement, convertedLoopBodyStatements: Statement[]): Statement { + const expression = visitNode(node.expression, visitor, isExpression); + const iterator = isIdentifier(expression) ? getGeneratedNameForNode(expression) : createTempVariable(/*recordTempVariable*/ undefined); + const result = isIdentifier(expression) ? getGeneratedNameForNode(iterator) : createTempVariable(/*recordTempVariable*/ undefined); + const errorRecord = createUniqueName("e"); + const catchVariable = getGeneratedNameForNode(errorRecord); + const returnMethod = createTempVariable(/*recordTempVariable*/ undefined); + const values = createValuesHelper(context, expression, node.expression); + const next = createCall(createPropertyAccess(iterator, "next" ), /*typeArguments*/ undefined, []); + + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); + + const forStatement = setEmitFlags( + setTextRange( + createFor( + /*initializer*/ setEmitFlags( + setTextRange( + createVariableDeclarationList([ + setTextRange(createVariableDeclaration(iterator, /*type*/ undefined, values), node.expression), + createVariableDeclaration(result, /*type*/ undefined, next) + ]), + node.expression + ), + EmitFlags.NoHoisting + ), + /*condition*/ createLogicalNot(createPropertyAccess(result, "done")), + /*incrementor*/ createAssignment(result, next), + /*statement*/ convertForOfStatementHead( + node, + createPropertyAccess(result, "value"), + convertedLoopBodyStatements + ) + ), + /*location*/ node + ), + EmitFlags.NoTokenTrailingSourceMaps + ); + + return createTry( + createBlock([ + restoreEnclosingLabel( + forStatement, + outermostLabeledStatement, + convertedLoopState && resetLabel + ) + ]), + createCatchClause(createVariableDeclaration(catchVariable), + setEmitFlags( + createBlock([ + createStatement( + createAssignment( + errorRecord, + createObjectLiteral([ + createPropertyAssignment("error", catchVariable) + ]) + ) + ) + ]), + EmitFlags.SingleLine + ) + ), + createBlock([ + createTry( + /*tryBlock*/ createBlock([ + setEmitFlags( + createIf( + createLogicalAnd( + createLogicalAnd( + result, + createLogicalNot( + createPropertyAccess(result, "done") + ) + ), + createAssignment( + returnMethod, + createPropertyAccess(iterator, "return") + ) + ), + createStatement( + createFunctionCall(returnMethod, iterator, []) + ) + ), + EmitFlags.SingleLine + ), + ]), + /*catchClause*/ undefined, + /*finallyBlock*/ setEmitFlags( + createBlock([ + setEmitFlags( + createIf( + errorRecord, + createThrow( + createPropertyAccess(errorRecord, "error") + ) + ), + EmitFlags.SingleLine + ) + ]), + EmitFlags.SingleLine + ) + ) + ]) + ); } /** @@ -2570,7 +2679,7 @@ namespace ts { } startLexicalEnvironment(); - let loopBody = visitNode(node.statement, visitor, isStatement, /*optional*/ false, liftToBlock); + let loopBody = visitNode(node.statement, visitor, isStatement, liftToBlock); const lexicalEnvironment = endLexicalEnvironment(); const currentState = convertedLoopState; @@ -2712,6 +2821,7 @@ namespace ts { } const convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait); + let loop: Statement; if (convert) { loop = convert(node, outermostLabeledStatement, convertedLoopBodyStatements); @@ -3239,15 +3349,30 @@ namespace ts { ) ); - if (segments.length === 1) { - const firstElement = elements[0]; - return needsUniqueCopy && isSpreadExpression(firstElement) && firstElement.expression.kind !== SyntaxKind.ArrayLiteralExpression - ? createArraySlice(segments[0]) - : segments[0]; - } + if (compilerOptions.downlevelIteration) { + if (segments.length === 1) { + const firstSegment = segments[0]; + if (isCallExpression(firstSegment) + && isIdentifier(firstSegment.expression) + && (getEmitFlags(firstSegment.expression) & EmitFlags.HelperName) + && firstSegment.expression.text === "___spread") { + return segments[0]; + } + } - // Rewrite using the pattern .concat(, , ...) - return createArrayConcat(segments.shift(), segments); + return createSpreadHelper(context, segments); + } + else { + if (segments.length === 1) { + const firstElement = elements[0]; + return needsUniqueCopy && isSpreadExpression(firstElement) && firstElement.expression.kind !== SyntaxKind.ArrayLiteralExpression + ? createArraySlice(segments[0]) + : segments[0]; + } + + // Rewrite using the pattern .concat(, , ...) + return createArrayConcat(segments.shift(), segments); + } } function partitionSpread(node: Expression) { @@ -3549,7 +3674,7 @@ namespace ts { if (enabledSubstitutions & ES2015SubstitutionFlags.BlockScopedBindings) { const original = getParseTreeNode(node, isIdentifier); if (original && isNameOfDeclarationWithCollidingName(original)) { - return getGeneratedNameForNode(original); + return setTextRange(getGeneratedNameForNode(original), node); } } @@ -3602,7 +3727,7 @@ namespace ts { if (enabledSubstitutions & ES2015SubstitutionFlags.BlockScopedBindings) { const declaration = resolver.getReferencedDeclarationWithCollidingName(node); if (declaration) { - return getGeneratedNameForNode(declaration.name); + return setTextRange(getGeneratedNameForNode(declaration.name), node); } } diff --git a/src/compiler/transformers/es2017.ts b/src/compiler/transformers/es2017.ts index b437298656c..31aae5055a0 100644 --- a/src/compiler/transformers/es2017.ts +++ b/src/compiler/transformers/es2017.ts @@ -14,7 +14,7 @@ namespace ts { const { startLexicalEnvironment, resumeLexicalEnvironment, - endLexicalEnvironment, + endLexicalEnvironment } = context; const resolver = context.getEmitResolver(); @@ -34,7 +34,7 @@ namespace ts { * This keeps track of containers where `super` is valid, for use with * just-in-time substitution for `super` expressions inside of async methods. */ - let currentSuperContainer: SuperContainer; + let enclosingSuperContainerFlags: NodeCheckFlags = 0; // Save the previous transformation hooks. const previousOnEmitNode = context.onEmitNode; @@ -71,23 +71,18 @@ namespace ts { return undefined; case SyntaxKind.AwaitExpression: - // ES2017 'await' expressions must be transformed for targets < ES2017. return visitAwaitExpression(node); case SyntaxKind.MethodDeclaration: - // ES2017 method declarations may be 'async' return visitMethodDeclaration(node); case SyntaxKind.FunctionDeclaration: - // ES2017 function declarations may be 'async' return visitFunctionDeclaration(node); case SyntaxKind.FunctionExpression: - // ES2017 function expressions may be 'async' return visitFunctionExpression(node); case SyntaxKind.ArrowFunction: - // ES2017 arrow functions may be 'async' return visitArrowFunction(node); default: @@ -128,11 +123,12 @@ namespace ts { node, /*decorators*/ undefined, visitNodes(node.modifiers, visitor, isModifier), + node.asteriskToken, node.name, /*typeParameters*/ undefined, visitParameterList(node.parameters, visitor, context), /*type*/ undefined, - isAsyncFunctionLike(node) + getFunctionFlags(node) & FunctionFlags.Async ? transformAsyncFunctionBody(node) : visitFunctionBody(node.body, visitor, context) ); @@ -151,11 +147,12 @@ namespace ts { node, /*decorators*/ undefined, visitNodes(node.modifiers, visitor, isModifier), + node.asteriskToken, node.name, /*typeParameters*/ undefined, visitParameterList(node.parameters, visitor, context), /*type*/ undefined, - isAsyncFunctionLike(node) + getFunctionFlags(node) & FunctionFlags.Async ? transformAsyncFunctionBody(node) : visitFunctionBody(node.body, visitor, context) ); @@ -170,17 +167,15 @@ namespace ts { * @param node The node to visit. */ function visitFunctionExpression(node: FunctionExpression): Expression { - if (nodeIsMissing(node.body)) { - return createOmittedExpression(); - } return updateFunctionExpression( node, - /*modifiers*/ undefined, + visitNodes(node.modifiers, visitor, isModifier), + node.asteriskToken, node.name, /*typeParameters*/ undefined, visitParameterList(node.parameters, visitor, context), /*type*/ undefined, - isAsyncFunctionLike(node) + getFunctionFlags(node) & FunctionFlags.Async ? transformAsyncFunctionBody(node) : visitFunctionBody(node.body, visitor, context) ); @@ -201,7 +196,7 @@ namespace ts { /*typeParameters*/ undefined, visitParameterList(node.parameters, visitor, context), /*type*/ undefined, - isAsyncFunctionLike(node) + getFunctionFlags(node) & FunctionFlags.Async ? transformAsyncFunctionBody(node) : visitFunctionBody(node.body, visitor, context) ); @@ -320,6 +315,44 @@ namespace ts { } } + /** + * Hook for node emit. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to emit. + * @param emit A callback used to emit the node in the printer. + */ + function onEmitNode(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void { + // If we need to support substitutions for `super` in an async method, + // we should track it here. + if (enabledSubstitutions & ES2017SubstitutionFlags.AsyncMethodsWithSuper && isSuperContainer(node)) { + const superContainerFlags = resolver.getNodeCheckFlags(node) & (NodeCheckFlags.AsyncMethodWithSuper | NodeCheckFlags.AsyncMethodWithSuperBinding); + if (superContainerFlags !== enclosingSuperContainerFlags) { + const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = superContainerFlags; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; + } + } + previousOnEmitNode(hint, node, emitCallback); + } + + /** + * Hooks node substitutions. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to substitute. + */ + function onSubstituteNode(hint: EmitHint, node: Node) { + node = previousOnSubstituteNode(hint, node); + if (hint === EmitHint.Expression && enclosingSuperContainerFlags) { + return substituteExpression(node); + } + + return node; + } + function substituteExpression(node: Expression) { switch (node.kind) { case SyntaxKind.PropertyAccessExpression: @@ -327,62 +360,45 @@ namespace ts { case SyntaxKind.ElementAccessExpression: return substituteElementAccessExpression(node); case SyntaxKind.CallExpression: - if (enabledSubstitutions & ES2017SubstitutionFlags.AsyncMethodsWithSuper) { - return substituteCallExpression(node); - } - break; + return substituteCallExpression(node); } - return node; } function substitutePropertyAccessExpression(node: PropertyAccessExpression) { - if (enabledSubstitutions & ES2017SubstitutionFlags.AsyncMethodsWithSuper && node.expression.kind === SyntaxKind.SuperKeyword) { - const flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - return createSuperAccessInAsyncMethod( - createLiteral(node.name.text), - flags, - node - ); - } + if (node.expression.kind === SyntaxKind.SuperKeyword) { + return createSuperAccessInAsyncMethod( + createLiteral(node.name.text), + node + ); } - return node; } function substituteElementAccessExpression(node: ElementAccessExpression) { - if (enabledSubstitutions & ES2017SubstitutionFlags.AsyncMethodsWithSuper && node.expression.kind === SyntaxKind.SuperKeyword) { - const flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - return createSuperAccessInAsyncMethod( - node.argumentExpression, - flags, - node - ); - } + if (node.expression.kind === SyntaxKind.SuperKeyword) { + return createSuperAccessInAsyncMethod( + node.argumentExpression, + node + ); } - return node; } function substituteCallExpression(node: CallExpression): Expression { const expression = node.expression; if (isSuperProperty(expression)) { - const flags = getSuperContainerAsyncMethodFlags(); - if (flags) { - const argumentExpression = isPropertyAccessExpression(expression) - ? substitutePropertyAccessExpression(expression) - : substituteElementAccessExpression(expression); - return createCall( - createPropertyAccess(argumentExpression, "call"), - /*typeArguments*/ undefined, - [ - createThis(), - ...node.arguments - ] - ); - } + const argumentExpression = isPropertyAccessExpression(expression) + ? substitutePropertyAccessExpression(expression) + : substituteElementAccessExpression(expression); + return createCall( + createPropertyAccess(argumentExpression, "call"), + /*typeArguments*/ undefined, + [ + createThis(), + ...node.arguments + ] + ); } return node; } @@ -396,44 +412,8 @@ namespace ts { || kind === SyntaxKind.SetAccessor; } - /** - * Hook for node emit. - * - * @param hint A hint as to the intended usage of the node. - * @param node The node to emit. - * @param emit A callback used to emit the node in the printer. - */ - function onEmitNode(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void { - // If we need to support substitutions for `super` in an async method, - // we should track it here. - if (enabledSubstitutions & ES2017SubstitutionFlags.AsyncMethodsWithSuper && isSuperContainer(node)) { - const savedCurrentSuperContainer = currentSuperContainer; - currentSuperContainer = node; - previousOnEmitNode(hint, node, emitCallback); - currentSuperContainer = savedCurrentSuperContainer; - } - else { - previousOnEmitNode(hint, node, emitCallback); - } - } - - /** - * Hooks node substitutions. - * - * @param hint A hint as to the intended usage of the node. - * @param node The node to substitute. - */ - function onSubstituteNode(hint: EmitHint, node: Node) { - node = previousOnSubstituteNode(hint, node); - if (hint === EmitHint.Expression) { - return substituteExpression(node); - } - - return node; - } - - function createSuperAccessInAsyncMethod(argumentExpression: Expression, flags: NodeCheckFlags, location: TextRange): LeftHandSideExpression { - if (flags & NodeCheckFlags.AsyncMethodWithSuperBinding) { + function createSuperAccessInAsyncMethod(argumentExpression: Expression, location: TextRange): LeftHandSideExpression { + if (enclosingSuperContainerFlags & NodeCheckFlags.AsyncMethodWithSuperBinding) { return setTextRange( createPropertyAccess( createCall( @@ -457,15 +437,26 @@ namespace ts { ); } } - - function getSuperContainerAsyncMethodFlags() { - return currentSuperContainer !== undefined - && resolver.getNodeCheckFlags(currentSuperContainer) & (NodeCheckFlags.AsyncMethodWithSuper | NodeCheckFlags.AsyncMethodWithSuperBinding); - } } + const awaiterHelper: EmitHelper = { + name: "typescript:awaiter", + scoped: false, + priority: 5, + text: ` + var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + 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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + };` + }; + function createAwaiterHelper(context: TransformationContext, hasLexicalArguments: boolean, promiseConstructor: EntityName | Expression, body: Block) { context.requestEmitHelper(awaiterHelper); + const generatorFunc = createFunctionExpression( /*modifiers*/ undefined, createToken(SyntaxKind.AsteriskToken), @@ -491,35 +482,22 @@ namespace ts { ); } - const awaiterHelper: EmitHelper = { - name: "typescript:awaiter", - scoped: false, - priority: 5, - text: ` - var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - 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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - };` - }; - - const asyncSuperHelper: EmitHelper = { + export const asyncSuperHelper: EmitHelper = { name: "typescript:async-super", scoped: true, text: ` - const _super = name => super[name];` + const _super = name => super[name]; + ` }; - const advancedAsyncSuperHelper: EmitHelper = { + export const advancedAsyncSuperHelper: EmitHelper = { name: "typescript:advanced-async-super", scoped: true, text: ` const _super = (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);` + })(name => super[name], (name, value) => super[name] = value); + ` }; } diff --git a/src/compiler/transformers/esnext.ts b/src/compiler/transformers/esnext.ts index f058e627df7..971dddd20ea 100644 --- a/src/compiler/transformers/esnext.ts +++ b/src/compiler/transformers/esnext.ts @@ -1,13 +1,35 @@ /// /// +/// /*@internal*/ namespace ts { + const enum ESNextSubstitutionFlags { + /** Enables substitutions for async methods with `super` calls. */ + AsyncMethodsWithSuper = 1 << 0 + } + export function transformESNext(context: TransformationContext) { const { resumeLexicalEnvironment, - endLexicalEnvironment + endLexicalEnvironment, + hoistVariableDeclaration } = context; + + const resolver = context.getEmitResolver(); + const compilerOptions = context.getCompilerOptions(); + const languageVersion = getEmitScriptTarget(compilerOptions); + + const previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + + const previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + + let enabledSubstitutions: ESNextSubstitutionFlags; + let enclosingFunctionFlags: FunctionFlags; + let enclosingSuperContainerFlags: NodeCheckFlags = 0; + return transformSourceFile; function transformSourceFile(node: SourceFile) { @@ -28,12 +50,25 @@ namespace ts { return visitorWorker(node, /*noDestructuringValue*/ true); } + function visitorNoAsyncModifier(node: Node): VisitResult { + if (node.kind === SyntaxKind.AsyncKeyword) { + return undefined; + } + return node; + } + function visitorWorker(node: Node, noDestructuringValue: boolean): VisitResult { if ((node.transformFlags & TransformFlags.ContainsESNext) === 0) { return node; } switch (node.kind) { + case SyntaxKind.AwaitExpression: + return visitAwaitExpression(node as AwaitExpression); + case SyntaxKind.YieldExpression: + return visitYieldExpression(node as YieldExpression); + case SyntaxKind.LabeledStatement: + return visitLabeledStatement(node as LabeledStatement); case SyntaxKind.ObjectLiteralExpression: return visitObjectLiteralExpression(node as ObjectLiteralExpression); case SyntaxKind.BinaryExpression: @@ -41,7 +76,7 @@ namespace ts { case SyntaxKind.VariableDeclaration: return visitVariableDeclaration(node as VariableDeclaration); case SyntaxKind.ForOfStatement: - return visitForOfStatement(node as ForOfStatement); + return visitForOfStatement(node as ForOfStatement, /*outermostLabeledStatement*/ undefined); case SyntaxKind.ForStatement: return visitForStatement(node as ForStatement); case SyntaxKind.VoidExpression: @@ -71,6 +106,52 @@ namespace ts { } } + function visitAwaitExpression(node: AwaitExpression) { + if (enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator) { + const expression = visitNode(node.expression, visitor, isExpression); + return setOriginalNode( + setTextRange( + createYield( + /*asteriskToken*/ undefined, + createArrayLiteral([createLiteral("await"), expression]) + ), + /*location*/ node + ), + node + ); + } + return visitEachChild(node, visitor, context); + } + + function visitYieldExpression(node: YieldExpression) { + if (enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator) { + const expression = visitNode(node.expression, visitor, isExpression); + return updateYield( + node, + node.asteriskToken, + node.asteriskToken + ? createAsyncDelegatorHelper(context, expression, expression) + : createArrayLiteral( + expression + ? [createLiteral("yield"), expression] + : [createLiteral("yield")] + ) + ); + } + return visitEachChild(node, visitor, context); + } + + function visitLabeledStatement(node: LabeledStatement) { + if (enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator) { + const statement = unwrapInnermostStatementOfLabel(node); + if (statement.kind === SyntaxKind.ForOfStatement && (statement).awaitModifier) { + return visitForOfStatement(statement, node); + } + return restoreEnclosingLabel(visitEachChild(node, visitor, context), node); + } + return visitEachChild(node, visitor, context); + } + function chunkObjectLiteralElements(elements: ObjectLiteralElement[]): Expression[] { let chunkObject: (ShorthandPropertyAssignment | PropertyAssignment)[]; const objects: Expression[] = []; @@ -189,67 +270,199 @@ namespace ts { * * @param node A ForOfStatement. */ - function visitForOfStatement(node: ForOfStatement): VisitResult { - let leadingStatements: Statement[]; - let temp: Identifier; - const initializer = skipParentheses(node.initializer); - if (initializer.transformFlags & TransformFlags.ContainsObjectRest) { - if (isVariableDeclarationList(initializer)) { - temp = createTempVariable(/*recordTempVariable*/ undefined); - const firstDeclaration = firstOrUndefined(initializer.declarations); - const declarations = flattenDestructuringBinding( - firstDeclaration, - visitor, - context, - FlattenLevel.ObjectRest, - temp, - /*doNotRecordTempVariablesInLine*/ false, - /*skipInitializer*/ true, - ); - if (some(declarations)) { - const statement = createVariableStatement( - /*modifiers*/ undefined, - updateVariableDeclarationList(initializer, declarations), - ); - setTextRange(statement, initializer); - leadingStatements = append(leadingStatements, statement); - } - } - else if (isAssignmentPattern(initializer)) { - temp = createTempVariable(/*recordTempVariable*/ undefined); - const expression = flattenDestructuringAssignment( - aggregateTransformFlags( - setTextRange( - createAssignment(initializer, temp), - node.initializer - ) - ), - visitor, - context, - FlattenLevel.ObjectRest - ); - leadingStatements = append(leadingStatements, setTextRange(createStatement(expression), node.initializer)); - } + function visitForOfStatement(node: ForOfStatement, outermostLabeledStatement: LabeledStatement): VisitResult { + if (node.initializer.transformFlags & TransformFlags.ContainsObjectRest) { + node = transformForOfStatementWithObjectRest(node); } - if (temp) { - const expression = visitNode(node.expression, visitor, isExpression); - const statement = visitNode(node.statement, visitor, isStatement); - const block = isBlock(statement) - ? updateBlock(statement, setTextRange(createNodeArray(concatenate(leadingStatements, statement.statements)), statement.statements)) - : setTextRange(createBlock(append(leadingStatements, statement), /*multiLine*/ true), statement); + if (node.awaitModifier) { + return transformForAwaitOfStatement(node, outermostLabeledStatement); + } + else { + return restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement); + } + } + + function transformForOfStatementWithObjectRest(node: ForOfStatement) { + const initializerWithoutParens = skipParentheses(node.initializer) as ForInitializer; + if (isVariableDeclarationList(initializerWithoutParens) || isAssignmentPattern(initializerWithoutParens)) { + let bodyLocation: TextRange; + let statementsLocation: TextRange; + const temp = createTempVariable(/*recordTempVariable*/ undefined); + const statements: Statement[] = [createForOfBindingStatement(initializerWithoutParens, temp)]; + if (isBlock(node.statement)) { + addRange(statements, node.statement.statements); + bodyLocation = node.statement; + statementsLocation = node.statement.statements; + } return updateForOf( node, + node.awaitModifier, setTextRange( - createVariableDeclarationList([ - setTextRange(createVariableDeclaration(temp), node.initializer) - ], NodeFlags.Let), + createVariableDeclarationList( + [ + setTextRange(createVariableDeclaration(temp), node.initializer) + ], + NodeFlags.Let + ), node.initializer ), - expression, - block + node.expression, + setTextRange( + createBlock( + setTextRange(createNodeArray(statements), statementsLocation), + /*multiLine*/ true + ), + bodyLocation + ) ); } - return visitEachChild(node, visitor, context); + return node; + } + + function convertForOfStatementHead(node: ForOfStatement, boundValue: Expression) { + const binding = createForOfBindingStatement(node.initializer, boundValue); + + let bodyLocation: TextRange; + let statementsLocation: TextRange; + const statements: Statement[] = [visitNode(binding, visitor, isStatement)]; + const statement = visitNode(node.statement, visitor, isStatement); + if (isBlock(statement)) { + addRange(statements, statement.statements); + bodyLocation = statement; + statementsLocation = statement.statements; + } + else { + statements.push(statement); + } + + return setEmitFlags( + setTextRange( + createBlock( + setTextRange(createNodeArray(statements), statementsLocation), + /*multiLine*/ true + ), + bodyLocation + ), + EmitFlags.NoSourceMap | EmitFlags.NoTokenSourceMaps + ); + } + + function transformForAwaitOfStatement(node: ForOfStatement, outermostLabeledStatement: LabeledStatement) { + const expression = visitNode(node.expression, visitor, isExpression); + const iterator = isIdentifier(expression) ? getGeneratedNameForNode(expression) : createTempVariable(/*recordTempVariable*/ undefined); + const result = isIdentifier(expression) ? getGeneratedNameForNode(iterator) : createTempVariable(/*recordTempVariable*/ undefined); + const errorRecord = createUniqueName("e"); + const catchVariable = getGeneratedNameForNode(errorRecord); + const returnMethod = createTempVariable(/*recordTempVariable*/ undefined); + const values = createAsyncValuesHelper(context, expression, /*location*/ node.expression); + const next = createYield( + /*asteriskToken*/ undefined, + enclosingFunctionFlags & FunctionFlags.Generator + ? createArrayLiteral([ + createLiteral("await"), + createCall(createPropertyAccess(iterator, "next" ), /*typeArguments*/ undefined, []) + ]) + : createCall(createPropertyAccess(iterator, "next" ), /*typeArguments*/ undefined, []) + ); + + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); + + const forStatement = setEmitFlags( + setTextRange( + createFor( + /*initializer*/ setEmitFlags( + setTextRange( + createVariableDeclarationList([ + setTextRange(createVariableDeclaration(iterator, /*type*/ undefined, values), node.expression), + createVariableDeclaration(result, /*type*/ undefined, next) + ]), + node.expression + ), + EmitFlags.NoHoisting + ), + /*condition*/ createLogicalNot(createPropertyAccess(result, "done")), + /*incrementor*/ createAssignment(result, next), + /*statement*/ convertForOfStatementHead(node, createPropertyAccess(result, "value")) + ), + /*location*/ node + ), + EmitFlags.NoTokenTrailingSourceMaps + ); + + return createTry( + createBlock([ + restoreEnclosingLabel( + forStatement, + outermostLabeledStatement + ) + ]), + createCatchClause( + createVariableDeclaration(catchVariable), + setEmitFlags( + createBlock([ + createStatement( + createAssignment( + errorRecord, + createObjectLiteral([ + createPropertyAssignment("error", catchVariable) + ]) + ) + ) + ]), + EmitFlags.SingleLine + ) + ), + createBlock([ + createTry( + /*tryBlock*/ createBlock([ + setEmitFlags( + createIf( + createLogicalAnd( + createLogicalAnd( + result, + createLogicalNot( + createPropertyAccess(result, "done") + ) + ), + createAssignment( + returnMethod, + createPropertyAccess(iterator, "return") + ) + ), + createStatement( + createYield( + /*asteriskToken*/ undefined, + enclosingFunctionFlags & FunctionFlags.Generator + ? createArrayLiteral([ + createLiteral("await"), + createFunctionCall(returnMethod, iterator, []) + ]) + : createFunctionCall(returnMethod, iterator, []) + ) + ) + ), + EmitFlags.SingleLine + ) + ]), + /*catchClause*/ undefined, + /*finallyBlock*/ setEmitFlags( + createBlock([ + setEmitFlags( + createIf( + errorRecord, + createThrow( + createPropertyAccess(errorRecord, "error") + ) + ), + EmitFlags.SingleLine + ) + ]), + EmitFlags.SingleLine + ) + ) + ]) + ); } function visitParameter(node: ParameterDeclaration): ParameterDeclaration { @@ -270,17 +483,23 @@ namespace ts { } function visitConstructorDeclaration(node: ConstructorDeclaration) { - return updateConstructor( + const savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = FunctionFlags.Normal; + const updated = updateConstructor( node, /*decorators*/ undefined, node.modifiers, visitParameterList(node.parameters, visitor, context), transformFunctionBody(node) ); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitGetAccessorDeclaration(node: GetAccessorDeclaration) { - return updateGetAccessor( + const savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = FunctionFlags.Normal; + const updated = updateGetAccessor( node, /*decorators*/ undefined, node.modifiers, @@ -289,10 +508,14 @@ namespace ts { /*type*/ undefined, transformFunctionBody(node) ); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitSetAccessorDeclaration(node: SetAccessorDeclaration) { - return updateSetAccessor( + const savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = FunctionFlags.Normal; + const updated = updateSetAccessor( node, /*decorators*/ undefined, node.modifiers, @@ -300,36 +523,62 @@ namespace ts { visitParameterList(node.parameters, visitor, context), transformFunctionBody(node) ); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitMethodDeclaration(node: MethodDeclaration) { - return updateMethod( + const savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = getFunctionFlags(node); + const updated = updateMethod( node, /*decorators*/ undefined, - node.modifiers, + enclosingFunctionFlags & FunctionFlags.Generator + ? visitNodes(node.modifiers, visitorNoAsyncModifier, isModifier) + : node.modifiers, + enclosingFunctionFlags & FunctionFlags.Async + ? undefined + : node.asteriskToken, visitNode(node.name, visitor, isPropertyName), /*typeParameters*/ undefined, visitParameterList(node.parameters, visitor, context), /*type*/ undefined, - transformFunctionBody(node) + enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node) ); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitFunctionDeclaration(node: FunctionDeclaration) { - return updateFunctionDeclaration( + const savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = getFunctionFlags(node); + const updated = updateFunctionDeclaration( node, /*decorators*/ undefined, - node.modifiers, + enclosingFunctionFlags & FunctionFlags.Generator + ? visitNodes(node.modifiers, visitorNoAsyncModifier, isModifier) + : node.modifiers, + enclosingFunctionFlags & FunctionFlags.Async + ? undefined + : node.asteriskToken, node.name, /*typeParameters*/ undefined, visitParameterList(node.parameters, visitor, context), /*type*/ undefined, - transformFunctionBody(node) + enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node) ); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitArrowFunction(node: ArrowFunction) { - return updateArrowFunction( + const savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = getFunctionFlags(node); + const updated = updateArrowFunction( node, node.modifiers, /*typeParameters*/ undefined, @@ -337,25 +586,92 @@ namespace ts { /*type*/ undefined, transformFunctionBody(node) ); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; } function visitFunctionExpression(node: FunctionExpression) { - return updateFunctionExpression( + const savedEnclosingFunctionFlags = enclosingFunctionFlags; + enclosingFunctionFlags = getFunctionFlags(node); + const updated = updateFunctionExpression( node, - node.modifiers, + enclosingFunctionFlags & FunctionFlags.Generator + ? visitNodes(node.modifiers, visitorNoAsyncModifier, isModifier) + : node.modifiers, + enclosingFunctionFlags & FunctionFlags.Async + ? undefined + : node.asteriskToken, node.name, /*typeParameters*/ undefined, visitParameterList(node.parameters, visitor, context), /*type*/ undefined, - transformFunctionBody(node) + enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator + ? transformAsyncGeneratorFunctionBody(node) + : transformFunctionBody(node) ); + enclosingFunctionFlags = savedEnclosingFunctionFlags; + return updated; + } + + function transformAsyncGeneratorFunctionBody(node: MethodDeclaration | AccessorDeclaration | FunctionDeclaration | FunctionExpression): FunctionBody { + resumeLexicalEnvironment(); + const statements: Statement[] = []; + const statementOffset = addPrologueDirectives(statements, node.body.statements, /*ensureUseStrict*/ false, visitor); + appendObjectRestAssignmentsIfNeeded(statements, node); + + statements.push( + createReturn( + createAsyncGeneratorHelper( + context, + createFunctionExpression( + /*modifiers*/ undefined, + createToken(SyntaxKind.AsteriskToken), + node.name && getGeneratedNameForNode(node.name), + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, + updateBlock( + node.body, + visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset) + ) + ) + ) + ) + ); + + addRange(statements, endLexicalEnvironment()); + const block = updateBlock(node.body, statements); + + // Minor optimization, emit `_super` helper to capture `super` access in an arrow. + // This step isn't needed if we eventually transform this to ES5. + if (languageVersion >= ScriptTarget.ES2015) { + if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuperBinding) { + enableSubstitutionForAsyncMethodsWithSuper(); + addEmitHelper(block, advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuper) { + enableSubstitutionForAsyncMethodsWithSuper(); + addEmitHelper(block, asyncSuperHelper); + } + } + return block; } function transformFunctionBody(node: FunctionDeclaration | FunctionExpression | ConstructorDeclaration | MethodDeclaration | AccessorDeclaration): FunctionBody; function transformFunctionBody(node: ArrowFunction): ConciseBody; function transformFunctionBody(node: FunctionLikeDeclaration): ConciseBody { resumeLexicalEnvironment(); - let leadingStatements: Statement[]; + const leadingStatements = appendObjectRestAssignmentsIfNeeded(/*statements*/ undefined, node); + const body = visitNode(node.body, visitor, isConciseBody); + const trailingStatements = endLexicalEnvironment(); + if (some(leadingStatements) || some(trailingStatements)) { + const block = convertToFunctionBody(body, /*multiLine*/ true); + return updateBlock(block, setTextRange(createNodeArray(concatenate(concatenate(leadingStatements, block.statements), trailingStatements)), block.statements)); + } + return body; + } + + function appendObjectRestAssignmentsIfNeeded(statements: Statement[], node: FunctionLikeDeclaration): Statement[] { for (const parameter of node.parameters) { if (parameter.transformFlags & TransformFlags.ContainsObjectRest) { const temp = getGeneratedNameForNode(parameter); @@ -376,17 +692,153 @@ namespace ts { ) ); setEmitFlags(statement, EmitFlags.CustomPrologue); - leadingStatements = append(leadingStatements, statement); + statements = append(statements, statement); } } } - const body = visitNode(node.body, visitor, isConciseBody); - const trailingStatements = endLexicalEnvironment(); - if (some(leadingStatements) || some(trailingStatements)) { - const block = convertToFunctionBody(body, /*multiLine*/ true); - return updateBlock(block, setTextRange(createNodeArray(concatenate(concatenate(leadingStatements, block.statements), trailingStatements)), block.statements)); + return statements; + } + + function enableSubstitutionForAsyncMethodsWithSuper() { + if ((enabledSubstitutions & ESNextSubstitutionFlags.AsyncMethodsWithSuper) === 0) { + enabledSubstitutions |= ESNextSubstitutionFlags.AsyncMethodsWithSuper; + + // We need to enable substitutions for call, property access, and element access + // if we need to rewrite super calls. + context.enableSubstitution(SyntaxKind.CallExpression); + context.enableSubstitution(SyntaxKind.PropertyAccessExpression); + context.enableSubstitution(SyntaxKind.ElementAccessExpression); + + // We need to be notified when entering and exiting declarations that bind super. + context.enableEmitNotification(SyntaxKind.ClassDeclaration); + context.enableEmitNotification(SyntaxKind.MethodDeclaration); + context.enableEmitNotification(SyntaxKind.GetAccessor); + context.enableEmitNotification(SyntaxKind.SetAccessor); + context.enableEmitNotification(SyntaxKind.Constructor); + } + } + + /** + * Called by the printer just before a node is printed. + * + * @param hint A hint as to the intended usage of the node. + * @param node The node to be printed. + * @param emitCallback The callback used to emit the node. + */ + function onEmitNode(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) { + // If we need to support substitutions for `super` in an async method, + // we should track it here. + if (enabledSubstitutions & ESNextSubstitutionFlags.AsyncMethodsWithSuper && isSuperContainer(node)) { + const superContainerFlags = resolver.getNodeCheckFlags(node) & (NodeCheckFlags.AsyncMethodWithSuper | NodeCheckFlags.AsyncMethodWithSuperBinding); + if (superContainerFlags !== enclosingSuperContainerFlags) { + const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; + enclosingSuperContainerFlags = superContainerFlags; + previousOnEmitNode(hint, node, emitCallback); + enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags; + return; + } + } + + previousOnEmitNode(hint, node, emitCallback); + } + + /** + * Hooks node substitutions. + * + * @param hint The context for the emitter. + * @param node The node to substitute. + */ + function onSubstituteNode(hint: EmitHint, node: Node) { + node = previousOnSubstituteNode(hint, node); + if (hint === EmitHint.Expression && enclosingSuperContainerFlags) { + return substituteExpression(node); + } + return node; + } + + function substituteExpression(node: Expression) { + switch (node.kind) { + case SyntaxKind.PropertyAccessExpression: + return substitutePropertyAccessExpression(node); + case SyntaxKind.ElementAccessExpression: + return substituteElementAccessExpression(node); + case SyntaxKind.CallExpression: + return substituteCallExpression(node); + } + return node; + } + + function substitutePropertyAccessExpression(node: PropertyAccessExpression) { + if (node.expression.kind === SyntaxKind.SuperKeyword) { + return createSuperAccessInAsyncMethod( + createLiteral(node.name.text), + node + ); + } + return node; + } + + function substituteElementAccessExpression(node: ElementAccessExpression) { + if (node.expression.kind === SyntaxKind.SuperKeyword) { + return createSuperAccessInAsyncMethod( + node.argumentExpression, + node + ); + } + return node; + } + + function substituteCallExpression(node: CallExpression): Expression { + const expression = node.expression; + if (isSuperProperty(expression)) { + const argumentExpression = isPropertyAccessExpression(expression) + ? substitutePropertyAccessExpression(expression) + : substituteElementAccessExpression(expression); + return createCall( + createPropertyAccess(argumentExpression, "call"), + /*typeArguments*/ undefined, + [ + createThis(), + ...node.arguments + ] + ); + } + return node; + } + + function isSuperContainer(node: Node) { + const kind = node.kind; + return kind === SyntaxKind.ClassDeclaration + || kind === SyntaxKind.Constructor + || kind === SyntaxKind.MethodDeclaration + || kind === SyntaxKind.GetAccessor + || kind === SyntaxKind.SetAccessor; + } + + function createSuperAccessInAsyncMethod(argumentExpression: Expression, location: TextRange): LeftHandSideExpression { + if (enclosingSuperContainerFlags & NodeCheckFlags.AsyncMethodWithSuperBinding) { + return setTextRange( + createPropertyAccess( + createCall( + createIdentifier("_super"), + /*typeArguments*/ undefined, + [argumentExpression] + ), + "value" + ), + location + ); + } + else { + return setTextRange( + createCall( + createIdentifier("_super"), + /*typeArguments*/ undefined, + [argumentExpression] + ), + location + ); } - return body; } } @@ -418,4 +870,89 @@ namespace ts { attributesSegments ); } + + const asyncGeneratorHelper: EmitHelper = { + name: "typescript:asyncGenerator", + scoped: false, + text: ` + 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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } + }; + ` + }; + + function createAsyncGeneratorHelper(context: TransformationContext, generatorFunc: FunctionExpression) { + context.requestEmitHelper(asyncGeneratorHelper); + + // Mark this node as originally an async function + (generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= EmitFlags.AsyncFunctionBody; + + return createCall( + getHelperName("__asyncGenerator"), + /*typeArguments*/ undefined, + [ + createThis(), + createIdentifier("arguments"), + generatorFunc + ] + ); + } + + const asyncDelegator: EmitHelper = { + name: "typescript:asyncDelegator", + scoped: false, + text: ` + var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } + }; + ` + }; + + function createAsyncDelegatorHelper(context: TransformationContext, expression: Expression, location?: TextRange) { + context.requestEmitHelper(asyncDelegator); + return setTextRange( + createCall( + getHelperName("__asyncDelegator"), + /*typeArguments*/ undefined, + [expression] + ), + location + ); + } + + const asyncValues: EmitHelper = { + name: "typescript:asyncValues", + scoped: false, + text: ` + var __asyncValues = (this && this.__asyncIterator) || function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator]; + return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); + }; + ` + }; + + function createAsyncValuesHelper(context: TransformationContext, expression: Expression, location?: TextRange) { + context.requestEmitHelper(asyncValues); + return setTextRange( + createCall( + getHelperName("__asyncValues"), + /*typeArguments*/ undefined, + [expression] + ), + location + ); + } } diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index cabd5d2a96d..57e85f50f39 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -232,7 +232,7 @@ namespace ts { resumeLexicalEnvironment, endLexicalEnvironment, hoistFunctionDeclaration, - hoistVariableDeclaration, + hoistVariableDeclaration } = context; const compilerOptions = context.getCompilerOptions(); @@ -448,7 +448,7 @@ namespace ts { */ function visitFunctionDeclaration(node: FunctionDeclaration): Statement { // Currently, we only support generators that were originally async functions. - if (node.asteriskToken && getEmitFlags(node) & EmitFlags.AsyncFunctionBody) { + if (node.asteriskToken) { node = setOriginalNode( setTextRange( createFunctionDeclaration( @@ -498,7 +498,7 @@ namespace ts { */ function visitFunctionExpression(node: FunctionExpression): Expression { // Currently, we only support generators that were originally async functions. - if (node.asteriskToken && getEmitFlags(node) & EmitFlags.AsyncFunctionBody) { + if (node.asteriskToken) { node = setOriginalNode( setTextRange( createFunctionExpression( @@ -936,11 +936,10 @@ namespace ts { // .mark resumeLabel // x = %sent%; - // NOTE: we are explicitly not handling YieldStar at this time. const resumeLabel = defineLabel(); const expression = visitNode(node.expression, visitor, isExpression); if (node.asteriskToken) { - emitYieldStar(expression, /*location*/ node); + emitYieldStar(createValuesHelper(context, expression, /*location*/ node), /*location*/ node); } else { emitYield(expression, /*location*/ node); @@ -978,9 +977,10 @@ namespace ts { // ar = _a.concat([%sent%, 2]); const numInitialElements = countInitialNodesWithoutYield(elements); - const temp = declareLocal(); - let hasAssignedTemp = false; + + let temp: Identifier; if (numInitialElements > 0) { + temp = declareLocal(); const initialElements = visitNodes(elements, visitor, isExpression, 0, numInitialElements); emitAssignment(temp, createArrayLiteral( @@ -990,11 +990,10 @@ namespace ts { ) ); leadingElement = undefined; - hasAssignedTemp = true; } const expressions = reduceLeft(elements, reduceElement, [], numInitialElements); - return hasAssignedTemp + return temp ? createArrayConcat(temp, [createArrayLiteral(expressions, multiLine)]) : setTextRange( createArrayLiteral(leadingElement ? [leadingElement, ...expressions] : expressions, multiLine), @@ -1003,6 +1002,11 @@ namespace ts { function reduceElement(expressions: Expression[], element: Expression) { if (containsYield(element) && expressions.length > 0) { + const hasAssignedTemp = temp !== undefined; + if (!temp) { + temp = declareLocal(); + } + emitAssignment( temp, hasAssignedTemp @@ -1015,7 +1019,6 @@ namespace ts { multiLine ) ); - hasAssignedTemp = true; leadingElement = undefined; expressions = []; } @@ -1227,7 +1230,7 @@ namespace ts { case SyntaxKind.TryStatement: return transformAndEmitTryStatement(node); default: - return emitStatement(visitNode(node, visitor, isStatement, /*optional*/ true)); + return emitStatement(visitNode(node, visitor, isStatement)); } } @@ -1485,9 +1488,9 @@ namespace ts { variables.length > 0 ? inlineExpressions(map(variables, transformInitializedVariable)) : undefined, - visitNode(node.condition, visitor, isExpression, /*optional*/ true), - visitNode(node.incrementor, visitor, isExpression, /*optional*/ true), - visitNode(node.statement, visitor, isStatement, /*optional*/ false, liftToBlock) + visitNode(node.condition, visitor, isExpression), + visitNode(node.incrementor, visitor, isExpression), + visitNode(node.statement, visitor, isStatement, liftToBlock) ); } else { @@ -1609,7 +1612,7 @@ namespace ts { node = updateForIn(node, initializer.declarations[0].name, visitNode(node.expression, visitor, isExpression), - visitNode(node.statement, visitor, isStatement, /*optional*/ false, liftToBlock) + visitNode(node.statement, visitor, isStatement, liftToBlock) ); } else { @@ -1659,14 +1662,14 @@ namespace ts { function transformAndEmitReturnStatement(node: ReturnStatement): void { emitReturn( - visitNode(node.expression, visitor, isExpression, /*optional*/ true), + visitNode(node.expression, visitor, isExpression), /*location*/ node ); } function visitReturnStatement(node: ReturnStatement) { return createInlineReturn( - visitNode(node.expression, visitor, isExpression, /*optional*/ true), + visitNode(node.expression, visitor, isExpression), /*location*/ node ); } @@ -1939,7 +1942,7 @@ namespace ts { } function substituteExpressionIdentifier(node: Identifier) { - if (renamedCatchVariables && renamedCatchVariables.has(node.text)) { + if (!isGeneratedIdentifier(node) && renamedCatchVariables && renamedCatchVariables.has(node.text)) { const original = getOriginalNode(node); if (isIdentifier(original) && original.parent) { const declaration = resolver.getReferencedValueDeclaration(original); @@ -1960,7 +1963,7 @@ namespace ts { function cacheExpression(node: Expression): Identifier { let temp: Identifier; - if (isGeneratedIdentifier(node)) { + if (isGeneratedIdentifier(node) || getEmitFlags(node) & EmitFlags.HelperName) { return node; } @@ -2105,17 +2108,24 @@ namespace ts { function beginCatchBlock(variable: VariableDeclaration): void { Debug.assert(peekBlockKind() === CodeBlockKind.Exception); - const text = (variable.name).text; - const name = declareLocal(text); - - if (!renamedCatchVariables) { - renamedCatchVariables = createMap(); - renamedCatchVariableDeclarations = []; - context.enableSubstitution(SyntaxKind.Identifier); + // generated identifiers should already be unique within a file + let name: Identifier; + if (isGeneratedIdentifier(variable.name)) { + name = variable.name; + hoistVariableDeclaration(variable.name); } + else { + const text = (variable.name).text; + name = declareLocal(text); + if (!renamedCatchVariables) { + renamedCatchVariables = createMap(); + renamedCatchVariableDeclarations = []; + context.enableSubstitution(SyntaxKind.Identifier); + } - renamedCatchVariables.set(text, true); - renamedCatchVariableDeclarations[getOriginalNodeId(variable)] = name; + renamedCatchVariables.set(text, true); + renamedCatchVariableDeclarations[getOriginalNodeId(variable)] = name; + } const exception = peekBlock(); Debug.assert(exception.state < ExceptionBlockState.Catch); @@ -2419,7 +2429,7 @@ namespace ts { */ function createInstruction(instruction: Instruction): NumericLiteral { const literal = createLiteral(instruction); - literal.trailingComment = getInstructionName(instruction); + addSyntheticTrailingComment(literal, SyntaxKind.MultiLineCommentTrivia, getInstructionName(instruction)); return literal; } @@ -3229,8 +3239,8 @@ namespace ts { priority: 6, text: ` 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; - return { next: verb(0), "throw": verb(1), "return": verb(2) }; + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "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."); diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index fb84736ffda..e9455490a5d 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -6,7 +6,6 @@ namespace ts { export function transformJsx(context: TransformationContext) { const compilerOptions = context.getCompilerOptions(); - let currentSourceFile: SourceFile; return transformSourceFile; @@ -20,12 +19,8 @@ namespace ts { return node; } - currentSourceFile = node; - const visited = visitEachChild(node, visitor, context); addEmitHelpers(visited, context.readEmitHelpers()); - - currentSourceFile = undefined; return visited; } diff --git a/src/compiler/transformers/module/es2015.ts b/src/compiler/transformers/module/es2015.ts index cc197073c32..7028e235961 100644 --- a/src/compiler/transformers/module/es2015.ts +++ b/src/compiler/transformers/module/es2015.ts @@ -101,6 +101,7 @@ namespace ts { if (isIdentifier(node) && hint === EmitHint.Expression) { return substituteExpressionIdentifier(node); } + return node; } diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index bf963bdc0e5..72a3558b1a3 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -1,5 +1,6 @@ /// /// +/// /*@internal*/ namespace ts { @@ -88,13 +89,15 @@ namespace ts { append(statements, createUnderscoreUnderscoreESModule()); } - append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, isStatement, /*optional*/ true)); + append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, isStatement)); addRange(statements, visitNodes(node.statements, sourceElementVisitor, isStatement, statementOffset)); - addRange(statements, endLexicalEnvironment()); addExportEqualsIfNeeded(statements, /*emitAsReturn*/ false); + addRange(statements, endLexicalEnvironment()); const updated = updateSourceFileNode(node, setTextRange(createNodeArray(statements), node.statements)); if (currentModuleInfo.hasExportStarsToExportValues) { + // If we have any `export * from ...` declarations + // we need to inform the emitter to add the __export helper. addEmitHelper(updated, exportStarHelper); } return updated; @@ -380,16 +383,16 @@ namespace ts { } // Visit each statement of the module body. - append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, isStatement, /*optional*/ true)); + append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, isStatement)); addRange(statements, visitNodes(node.statements, sourceElementVisitor, isStatement, statementOffset)); + // Append the 'export =' statement if provided. + addExportEqualsIfNeeded(statements, /*emitAsReturn*/ true); + // End the lexical environment for the module body // and merge any new lexical declarations. addRange(statements, endLexicalEnvironment()); - // Append the 'export =' statement if provided. - addExportEqualsIfNeeded(statements, /*emitAsReturn*/ true); - const body = createBlock(statements, /*multiLine*/ true); if (currentModuleInfo.hasExportStarsToExportValues) { // If we have any `export * from ...` declarations @@ -1334,6 +1337,7 @@ namespace ts { if (externalHelpersModuleName) { return createPropertyAccess(externalHelpersModuleName, node); } + return node; } diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index b2999201504..7488c51ed91 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -1,5 +1,6 @@ /// /// +/// /*@internal*/ namespace ts { @@ -136,7 +137,6 @@ namespace ts { contextObject = undefined; hoistedStatements = undefined; enclosingBlockScopedContainer = undefined; - return aggregateTransformFlags(updated); } @@ -245,7 +245,7 @@ namespace ts { ); // Visit the synthetic external helpers import declaration if present - visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, isStatement, /*optional*/ true); + visitNode(moduleInfo.externalHelpersImportDeclaration, sourceElementVisitor, isStatement); // Visit the statements of the source file, emitting any transformations into // the `executeStatements` array. We do this *before* we fill the `setters` array @@ -669,6 +669,7 @@ namespace ts { node, node.decorators, visitNodes(node.modifiers, modifierVisitor, isModifier), + node.asteriskToken, getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), /*typeParameters*/ undefined, visitNodes(node.parameters, destructuringVisitor, isParameterDeclaration), @@ -1218,8 +1219,8 @@ namespace ts { node = updateFor( node, visitForInitializer(node.initializer), - visitNode(node.condition, destructuringVisitor, isExpression, /*optional*/ true), - visitNode(node.incrementor, destructuringVisitor, isExpression, /*optional*/ true), + visitNode(node.condition, destructuringVisitor, isExpression), + visitNode(node.incrementor, destructuringVisitor, isExpression), visitNode(node.statement, nestedElementVisitor, isStatement) ); @@ -1240,7 +1241,7 @@ namespace ts { node, visitForInitializer(node.initializer), visitNode(node.expression, destructuringVisitor, isExpression), - visitNode(node.statement, nestedElementVisitor, isStatement, /*optional*/ false, liftToBlock) + visitNode(node.statement, nestedElementVisitor, isStatement, liftToBlock) ); enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; @@ -1258,9 +1259,10 @@ namespace ts { node = updateForOf( node, + node.awaitModifier, visitForInitializer(node.initializer), visitNode(node.expression, destructuringVisitor, isExpression), - visitNode(node.statement, nestedElementVisitor, isStatement, /*optional*/ false, liftToBlock) + visitNode(node.statement, nestedElementVisitor, isStatement, liftToBlock) ); enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; @@ -1305,7 +1307,7 @@ namespace ts { function visitDoStatement(node: DoStatement): VisitResult { return updateDo( node, - visitNode(node.statement, nestedElementVisitor, isStatement, /*optional*/ false, liftToBlock), + visitNode(node.statement, nestedElementVisitor, isStatement, liftToBlock), visitNode(node.expression, destructuringVisitor, isExpression) ); } @@ -1319,7 +1321,7 @@ namespace ts { return updateWhile( node, visitNode(node.expression, destructuringVisitor, isExpression), - visitNode(node.statement, nestedElementVisitor, isStatement, /*optional*/ false, liftToBlock) + visitNode(node.statement, nestedElementVisitor, isStatement, liftToBlock) ); } @@ -1332,7 +1334,7 @@ namespace ts { return updateLabel( node, node.label, - visitNode(node.statement, nestedElementVisitor, isStatement, /*optional*/ false, liftToBlock) + visitNode(node.statement, nestedElementVisitor, isStatement, liftToBlock) ); } @@ -1345,7 +1347,7 @@ namespace ts { return updateWith( node, visitNode(node.expression, destructuringVisitor, isExpression), - visitNode(node.statement, nestedElementVisitor, isStatement, /*optional*/ false, liftToBlock) + visitNode(node.statement, nestedElementVisitor, isStatement, liftToBlock) ); } @@ -1492,7 +1494,7 @@ namespace ts { * @param node The destructuring target. */ function hasExportedReferenceInDestructuringTarget(node: Expression | ObjectLiteralElementLike): boolean { - if (isAssignmentExpression(node)) { + if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { return hasExportedReferenceInDestructuringTarget(node.left); } else if (isSpreadExpression(node)) { @@ -1625,6 +1627,7 @@ namespace ts { if (externalHelpersModuleName) { return createPropertyAccess(externalHelpersModuleName, node); } + return node; } diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 4ef3bd5c067..e712393b2f0 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -872,7 +872,7 @@ namespace ts { * @param hasExtendsClause A value indicating whether the class has an extends clause. */ function transformConstructorBody(node: ClassExpression | ClassDeclaration, constructor: ConstructorDeclaration, hasExtendsClause: boolean) { - const statements: Statement[] = []; + let statements: Statement[] = []; let indexOfFirstStatement = 0; resumeLexicalEnvironment(); @@ -930,7 +930,7 @@ namespace ts { } // End the lexical environment. - addRange(statements, endLexicalEnvironment()); + statements = mergeLexicalEnvironment(statements, endLexicalEnvironment()); return setTextRange( createBlock( setTextRange( @@ -1651,7 +1651,7 @@ namespace ts { if (isFunctionLike(node) && node.type) { return serializeTypeNode(node.type); } - else if (isAsyncFunctionLike(node)) { + else if (isAsyncFunction(node)) { return createIdentifier("Promise"); } @@ -2019,7 +2019,13 @@ namespace ts { return undefined; } - return visitEachChild(node, visitor, context); + return updateConstructor( + node, + visitNodes(node.decorators, visitor, isDecorator), + visitNodes(node.modifiers, visitor, isModifier), + visitParameterList(node.parameters, visitor, context), + visitFunctionBody(node.body, visitor, context) + ); } /** @@ -2040,6 +2046,7 @@ namespace ts { node, /*decorators*/ undefined, visitNodes(node.modifiers, modifierVisitor, isModifier), + node.asteriskToken, visitPropertyNameOfClassElement(node), /*typeParameters*/ undefined, visitParameterList(node.parameters, visitor, context), @@ -2144,6 +2151,7 @@ namespace ts { node, /*decorators*/ undefined, visitNodes(node.modifiers, modifierVisitor, isModifier), + node.asteriskToken, node.name, /*typeParameters*/ undefined, visitParameterList(node.parameters, visitor, context), @@ -2167,17 +2175,18 @@ namespace ts { * @param node The function expression node. */ function visitFunctionExpression(node: FunctionExpression): Expression { - if (nodeIsMissing(node.body)) { + if (!shouldEmitFunctionLikeDeclaration(node)) { return createOmittedExpression(); } const updated = updateFunctionExpression( node, visitNodes(node.modifiers, modifierVisitor, isModifier), + node.asteriskToken, node.name, /*typeParameters*/ undefined, visitParameterList(node.parameters, visitor, context), /*type*/ undefined, - visitFunctionBody(node.body, visitor, context) + visitFunctionBody(node.body, visitor, context) || createBlock([]) ); return updated; } @@ -2833,7 +2842,7 @@ namespace ts { } // Elide the declaration if the import clause was elided. - const importClause = visitNode(node.importClause, visitImportClause, isImportClause, /*optional*/ true); + const importClause = visitNode(node.importClause, visitImportClause, isImportClause); return importClause ? updateImportDeclaration( node, @@ -2852,7 +2861,7 @@ namespace ts { function visitImportClause(node: ImportClause): VisitResult { // Elide the import clause if we elide both its name and its named bindings. const name = resolver.isReferencedAliasDeclaration(node) ? node.name : undefined; - const namedBindings = visitNode(node.namedBindings, visitNamedImportBindings, isNamedImportBindings, /*optional*/ true); + const namedBindings = visitNode(node.namedBindings, visitNamedImportBindings, isNamedImportBindings); return (name || namedBindings) ? updateImportClause(node, name, namedBindings) : undefined; } @@ -2914,7 +2923,7 @@ namespace ts { } // Elide the export declaration if all of its named exports are elided. - const exportClause = visitNode(node.exportClause, visitNamedExports, isNamedExports, /*optional*/ true); + const exportClause = visitNode(node.exportClause, visitNamedExports, isNamedExports); return exportClause ? updateExportDeclaration( node, @@ -3187,6 +3196,11 @@ namespace ts { */ function onEmitNode(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void { const savedApplicableSubstitutions = applicableSubstitutions; + const savedCurrentSourceFile = currentSourceFile; + + if (isSourceFile(node)) { + currentSourceFile = node; + } if (enabledSubstitutions & TypeScriptSubstitutionFlags.NamespaceExports && isTransformedModuleDeclaration(node)) { applicableSubstitutions |= TypeScriptSubstitutionFlags.NamespaceExports; @@ -3199,6 +3213,7 @@ namespace ts { previousOnEmitNode(hint, node, emitCallback); applicableSubstitutions = savedApplicableSubstitutions; + currentSourceFile = savedCurrentSourceFile; } /** @@ -3312,17 +3327,18 @@ namespace ts { function substituteConstantValue(node: PropertyAccessExpression | ElementAccessExpression): LeftHandSideExpression { const constantValue = tryGetConstEnumValue(node); if (constantValue !== undefined) { + // track the constant value on the node for the printer in needsDotDotForPropertyAccess + setConstantValue(node, constantValue); + const substitute = createLiteral(constantValue); - setSourceMapRange(substitute, node); - setCommentRange(substitute, node); if (!compilerOptions.removeComments) { const propertyName = isPropertyAccessExpression(node) ? declarationNameToString(node.name) : getTextOfNode(node.argumentExpression); - substitute.trailingComment = ` ${propertyName} `; + + addSyntheticTrailingComment(substitute, SyntaxKind.MultiLineCommentTrivia, ` ${propertyName} `); } - setConstantValue(node, constantValue); return substitute; } @@ -3340,13 +3356,60 @@ namespace ts { } } - const paramHelper: EmitHelper = { - name: "typescript:param", + function createDecorateHelper(context: TransformationContext, decoratorExpressions: Expression[], target: Expression, memberName?: Expression, descriptor?: Expression, location?: TextRange) { + const argumentsArray: Expression[] = []; + argumentsArray.push(createArrayLiteral(decoratorExpressions, /*multiLine*/ true)); + argumentsArray.push(target); + if (memberName) { + argumentsArray.push(memberName); + if (descriptor) { + argumentsArray.push(descriptor); + } + } + + context.requestEmitHelper(decorateHelper); + return setTextRange( + createCall( + getHelperName("__decorate"), + /*typeArguments*/ undefined, + argumentsArray + ), + location + ); + } + + const decorateHelper: EmitHelper = { + name: "typescript:decorate", scoped: false, - priority: 4, + priority: 2, text: ` - var __param = (this && this.__param) || function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } + var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + };` + }; + + function createMetadataHelper(context: TransformationContext, metadataKey: string, metadataValue: Expression) { + context.requestEmitHelper(metadataHelper); + return createCall( + getHelperName("__metadata"), + /*typeArguments*/ undefined, + [ + createLiteral(metadataKey), + metadataValue + ] + ); + } + + const metadataHelper: EmitHelper = { + name: "typescript:metadata", + scoped: false, + priority: 3, + text: ` + var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); };` }; @@ -3365,60 +3428,13 @@ namespace ts { ); } - const metadataHelper: EmitHelper = { - name: "typescript:metadata", + const paramHelper: EmitHelper = { + name: "typescript:param", scoped: false, - priority: 3, + priority: 4, text: ` - var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); + var __param = (this && this.__param) || function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } };` }; - - function createMetadataHelper(context: TransformationContext, metadataKey: string, metadataValue: Expression) { - context.requestEmitHelper(metadataHelper); - return createCall( - getHelperName("__metadata"), - /*typeArguments*/ undefined, - [ - createLiteral(metadataKey), - metadataValue - ] - ); - } - - const decorateHelper: EmitHelper = { - name: "typescript:decorate", - scoped: false, - priority: 2, - text: ` - var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - };` - }; - - function createDecorateHelper(context: TransformationContext, decoratorExpressions: Expression[], target: Expression, memberName?: Expression, descriptor?: Expression, location?: TextRange) { - context.requestEmitHelper(decorateHelper); - const argumentsArray: Expression[] = []; - argumentsArray.push(createArrayLiteral(decoratorExpressions, /*multiLine*/ true)); - argumentsArray.push(target); - if (memberName) { - argumentsArray.push(memberName); - if (descriptor) { - argumentsArray.push(descriptor); - } - } - - return setTextRange( - createCall( - getHelperName("__decorate"), - /*typeArguments*/ undefined, - argumentsArray - ), - location - ); - } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 83b9dd9dbd7..a72b0a06886 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -381,9 +381,6 @@ JSDocPropertyTag, JSDocTypeLiteral, JSDocLiteralType, - JSDocNullKeyword, - JSDocUndefinedKeyword, - JSDocNeverKeyword, // Synthesized list SyntaxList, @@ -423,9 +420,9 @@ LastBinaryOperator = CaretEqualsToken, FirstNode = QualifiedName, FirstJSDocNode = JSDocTypeExpression, - LastJSDocNode = JSDocNeverKeyword, + LastJSDocNode = JSDocLiteralType, FirstJSDocTagNode = JSDocComment, - LastJSDocTagNode = JSDocNeverKeyword + LastJSDocTagNode = JSDocLiteralType } export const enum NodeFlags { @@ -542,6 +539,7 @@ export type EndOfFileToken = Token; export type AtToken = Token; export type ReadonlyToken = Token; + export type AwaitKeywordToken = Token; export type Modifier = Token @@ -699,7 +697,13 @@ name?: PropertyName; } - export type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration | SpreadAssignment; + export type ObjectLiteralElementLike + = PropertyAssignment + | ShorthandPropertyAssignment + | SpreadAssignment + | MethodDeclaration + | AccessorDeclaration + ; export interface PropertyAssignment extends ObjectLiteralElement { kind: SyntaxKind.PropertyAssignment; @@ -1316,7 +1320,6 @@ export interface NumericLiteral extends LiteralExpression { kind: SyntaxKind.NumericLiteral; - trailingComment?: string; } export interface TemplateHead extends LiteralLikeNode { @@ -1637,6 +1640,7 @@ export interface ForOfStatement extends IterationStatement { kind: SyntaxKind.ForOfStatement; + awaitModifier?: AwaitKeywordToken; initializer: ForInitializer; expression: Expression; } @@ -1904,9 +1908,17 @@ fileName: string; } + export type CommentKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia; + export interface CommentRange extends TextRange { hasTrailingNewLine?: boolean; - kind: SyntaxKind; + kind: CommentKind; + } + + export interface SynthesizedComment extends CommentRange { + text: string; + pos: -1; + end: -1; } // represents a top level: { type } expression in a JSDoc comment. @@ -2291,7 +2303,7 @@ * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter * will be invoked when writing the JavaScript and declaration files. */ - emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean): EmitResult; + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult; getOptionsDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; getGlobalDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; @@ -2325,6 +2337,13 @@ /* @internal */ structureIsReused?: boolean; } + export interface CustomTransformers { + /** Custom transformers to evaluate before built-in transformations. */ + before?: TransformerFactory[]; + /** Custom transformers to evaluate after built-in transformations. */ + after?: TransformerFactory[]; + } + export interface SourceMapSpan { /** Line number in the .js file. */ emittedLine: number; @@ -2393,6 +2412,8 @@ getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type; getBaseTypes(type: InterfaceType): BaseType[]; + getBaseTypeOfLiteralType(type: Type): Type; + getWidenedType(type: Type): Type; getReturnTypeOfSignature(signature: Signature): Type; /** * Gets the type of a parameter at a given position in a signature. @@ -3066,8 +3087,17 @@ // Just a place to cache element types of iterables and iterators /* @internal */ export interface IterableOrIteratorType extends ObjectType, UnionType { - iterableElementType?: Type; - iteratorElementType?: Type; + iteratedTypeOfIterable?: Type; + iteratedTypeOfIterator?: Type; + iteratedTypeOfAsyncIterable?: Type; + iteratedTypeOfAsyncIterator?: Type; + } + + /* @internal */ + export interface PromiseOrAwaitableType extends ObjectType, UnionType { + promiseTypeOfPromiseConstructor?: Type; + promisedTypeOfPromise?: Type; + awaitedTypeOfType?: Type; } export interface TypeVariable extends Type { @@ -3190,7 +3220,9 @@ /// className.prototype.name = expr PrototypeProperty, /// this.name = expr - ThisProperty + ThisProperty, + // F.name = expr + Property } export interface JsFileExtensionInfo { @@ -3259,6 +3291,7 @@ /* @internal */ diagnostics?: boolean; /* @internal */ extendedDiagnostics?: boolean; disableSizeLimit?: boolean; + downlevelIteration?: boolean; emitBOM?: boolean; emitDecoratorMetadata?: boolean; experimentalDecorators?: boolean; @@ -3777,9 +3810,11 @@ export interface EmitNode { annotatedNodes?: Node[]; // Tracks Parse-tree nodes with EmitNodes for eventual cleanup. flags?: EmitFlags; // Flags that customize emit + leadingComments?: SynthesizedComment[]; // Synthesized leading comments + trailingComments?: SynthesizedComment[]; // Synthesized trailing comments commentRange?: TextRange; // The text range to use when emitting leading or trailing comments sourceMapRange?: TextRange; // The text range to use when emitting leading or trailing source mappings - tokenSourceMapRanges?: TextRange[]; // The text range to use when emitting source mappings for tokens + tokenSourceMapRanges?: TextRange[]; // The text range to use when emitting source mappings for tokens constantValue?: number; // The constant value of an expression externalHelpersModuleName?: Identifier; // The local name for an imported helpers module helpers?: EmitHelper[]; // Emit helpers for the node @@ -3815,7 +3850,7 @@ export interface EmitHelper { readonly name: string; // A unique name for this helper. - readonly scoped: boolean; // Indicates whether ther helper MUST be emitted in the current scope. + readonly scoped: boolean; // Indicates whether the helper MUST be emitted in the current scope. readonly text: string; // ES3-compatible raw script text. readonly priority?: number; // Helpers with a higher priority are emitted earlier than other helpers on the node. } @@ -3834,9 +3869,24 @@ Param = 1 << 5, // __param (used by TypeScript decorators transformation) Awaiter = 1 << 6, // __awaiter (used by ES2017 async functions transformation) Generator = 1 << 7, // __generator (used by ES2015 generator transformation) + Values = 1 << 8, // __values (used by ES2015 for..of and yield* transformations) + Read = 1 << 9, // __read (used by ES2015 iterator destructuring transformation) + Spread = 1 << 10, // __spread (used by ES2015 array spread and argument list spread transformations) + AsyncGenerator = 1 << 11, // __asyncGenerator (used by ES2017 async generator transformation) + AsyncDelegator = 1 << 12, // __asyncDelegator (used by ES2017 async generator yield* transformation) + AsyncValues = 1 << 13, // __asyncValues (used by ES2017 for..await..of transformation) + + // Helpers included by ES2015 for..of + ForOfIncludes = Values, + + // Helpers included by ES2017 for..await..of + ForAwaitOfIncludes = AsyncValues, + + // Helpers included by ES2015 spread + SpreadIncludes = Read | Spread, FirstEmitHelper = Extends, - LastEmitHelper = Generator + LastEmitHelper = AsyncValues } export const enum EmitHint { @@ -3862,11 +3912,12 @@ writeFile: WriteFileCallback; } - /* @internal */ export interface TransformationContext { + /*@internal*/ getEmitResolver(): EmitResolver; + /*@internal*/ getEmitHost(): EmitHost; + + /** Gets the compiler options supplied to the transformer. */ getCompilerOptions(): CompilerOptions; - getEmitResolver(): EmitResolver; - getEmitHost(): EmitHost; /** Starts a new lexical environment. */ startLexicalEnvironment(): void; @@ -3880,41 +3931,32 @@ /** Ends a lexical environment, returning any declarations. */ endLexicalEnvironment(): Statement[]; - /** - * Hoists a function declaration to the containing scope. - */ + /** Hoists a function declaration to the containing scope. */ hoistFunctionDeclaration(node: FunctionDeclaration): void; - /** - * Hoists a variable declaration to the containing scope. - */ + /** Hoists a variable declaration to the containing scope. */ hoistVariableDeclaration(node: Identifier): void; - /** - * Records a request for a non-scoped emit helper in the current context. - */ + /** Records a request for a non-scoped emit helper in the current context. */ requestEmitHelper(helper: EmitHelper): void; - /** - * Gets and resets the requested non-scoped emit helpers. - */ + /** Gets and resets the requested non-scoped emit helpers. */ readEmitHelpers(): EmitHelper[] | undefined; - /** - * Enables expression substitutions in the pretty printer for the provided SyntaxKind. - */ + /** Enables expression substitutions in the pretty printer for the provided SyntaxKind. */ enableSubstitution(kind: SyntaxKind): void; - /** - * Determines whether expression substitutions are enabled for the provided node. - */ + /** Determines whether expression substitutions are enabled for the provided node. */ isSubstitutionEnabled(node: Node): boolean; /** * Hook used by transformers to substitute expressions just before they * are emitted by the pretty printer. + * + * NOTE: Transformation hooks should only be modified during `Transformer` initialization, + * before returning the `NodeTransformer` callback. */ - onSubstituteNode?: (hint: EmitHint, node: Node) => Node; + onSubstituteNode: (hint: EmitHint, node: Node) => Node; /** * Enables before/after emit notifications in the pretty printer for the provided @@ -3931,25 +3973,27 @@ /** * Hook used to allow transformers to capture state before or after * the printer emits a node. + * + * NOTE: Transformation hooks should only be modified during `Transformer` initialization, + * before returning the `NodeTransformer` callback. */ - onEmitNode?: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void; + onEmitNode: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void; } - /* @internal */ - export interface TransformationResult { - /** - * Gets the transformed source files. - */ - transformed: SourceFile[]; + export interface TransformationResult { + /** Gets the transformed source files. */ + transformed: T[]; + + /** Gets diagnostics for the transformation. */ + diagnostics?: Diagnostic[]; /** - * Emits the substitute for a node, if one is available; otherwise, emits the node. + * Gets a substitute for a node, if one is available; otherwise, returns the original node. * * @param hint A hint as to the intended usage of the node. * @param node The node to substitute. - * @param emitCallback A callback used to emit the node or its substitute. */ - emitNodeWithSubstitution(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void; + substituteNode(hint: EmitHint, node: Node): Node; /** * Emits a node with possible notification. @@ -3959,10 +4003,30 @@ * @param emitCallback A callback used to emit the node. */ emitNodeWithNotification(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void; + + /** + * Clean up EmitNode entries on any parse-tree nodes. + */ + dispose(): void; } - /* @internal */ - export type Transformer = (context: TransformationContext) => (node: SourceFile) => SourceFile; + /** + * A function that is used to initialize and return a `Transformer` callback, which in turn + * will be used to transform one or more nodes. + */ + export type TransformerFactory = (context: TransformationContext) => Transformer; + + /** + * A function that transforms a node. + */ + export type Transformer = (node: T) => T; + + /** + * A function that accepts and possible transforms a node. + */ + export type Visitor = (node: Node) => VisitResult; + + export type VisitResult = T | T[]; export interface Printer { /** @@ -4020,23 +4084,20 @@ /** * A hook used by the Printer to perform just-in-time substitution of a node. This is * primarily used by node transformations that need to substitute one node for another, - * such as replacing `myExportedVar` with `exports.myExportedVar`. A compatible - * implementation **must** invoke `emitCallback` eith the provided `hint` and either - * the provided `node`, or its substitute. + * such as replacing `myExportedVar` with `exports.myExportedVar`. * @param hint A hint indicating the intended purpose of the node. * @param node The node to emit. - * @param emitCallback A callback that, when invoked, will emit the node. * @example * ```ts * var printer = createPrinter(printerOptions, { - * onSubstituteNode(hint, node, emitCallback) { + * substituteNode(hint, node) { * // perform substitution if necessary... - * emitCallback(hint, node); + * return node; * } * }); * ``` */ - onSubstituteNode?(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void; + substituteNode?(hint: EmitHint, node: Node): Node; /*@internal*/ onEmitSourceMapOfNode?: (hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void) => void; /*@internal*/ onEmitSourceMapOfToken?: (node: Node, token: SyntaxKind, pos: number, emitCallback: (token: SyntaxKind, pos: number) => number) => number; /*@internal*/ onEmitSourceMapOfPosition?: (pos: number) => void; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 6b0dec04f50..e460d4ae515 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -960,7 +960,7 @@ namespace ts { return false; } - export function unwrapInnermostStatmentOfLabel(node: LabeledStatement, beforeUnwrapLabelCallback?: (node: LabeledStatement) => void) { + export function unwrapInnermostStatementOfLabel(node: LabeledStatement, beforeUnwrapLabelCallback?: (node: LabeledStatement) => void) { while (true) { if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); @@ -1417,10 +1417,10 @@ namespace ts { * Returns true if the node is a variable declaration whose initializer is a function expression. * This function does not test if the node is in a JavaScript file or not. */ - export function isDeclarationOfFunctionExpression(s: Symbol) { + export function isDeclarationOfFunctionOrClassExpression(s: Symbol) { if (s.valueDeclaration && s.valueDeclaration.kind === SyntaxKind.VariableDeclaration) { const declaration = s.valueDeclaration as VariableDeclaration; - return declaration.initializer && declaration.initializer.kind === SyntaxKind.FunctionExpression; + return declaration.initializer && (declaration.initializer.kind === SyntaxKind.FunctionExpression || declaration.initializer.kind === SyntaxKind.ClassExpression); } return false; } @@ -1449,6 +1449,10 @@ namespace ts { // module.exports = expr return SpecialPropertyAssignmentKind.ModuleExports; } + else { + // F.x = expr + return SpecialPropertyAssignmentKind.Property; + } } else if (lhs.expression.kind === SyntaxKind.ThisKeyword) { return SpecialPropertyAssignmentKind.ThisProperty; @@ -1468,6 +1472,7 @@ namespace ts { } } + return SpecialPropertyAssignmentKind.None; } @@ -1549,7 +1554,10 @@ namespace ts { } } else { - result.push(...filter((doc as JSDoc).tags, tag => tag.kind === kind)); + const tags = (doc as JSDoc).tags; + if (tags) { + result.push(...filter(tags, tag => tag.kind === kind)); + } } } return result; @@ -1945,8 +1953,51 @@ namespace ts { return SyntaxKind.FirstTriviaToken <= token && token <= SyntaxKind.LastTriviaToken; } - export function isAsyncFunctionLike(node: Node): boolean { - return isFunctionLike(node) && hasModifier(node, ModifierFlags.Async) && !isAccessor(node); + export const enum FunctionFlags { + Normal = 0, + Generator = 1 << 0, + Async = 1 << 1, + AsyncOrAsyncGenerator = Async | Generator, + Invalid = 1 << 2, + InvalidAsyncOrAsyncGenerator = AsyncOrAsyncGenerator | Invalid, + InvalidGenerator = Generator | Invalid, + } + + export function getFunctionFlags(node: FunctionLikeDeclaration) { + let flags = FunctionFlags.Normal; + switch (node.kind) { + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.MethodDeclaration: + if (node.asteriskToken) { + flags |= FunctionFlags.Generator; + } + // fall through + case SyntaxKind.ArrowFunction: + if (hasModifier(node, ModifierFlags.Async)) { + flags |= FunctionFlags.Async; + } + break; + } + + if (!node.body) { + flags |= FunctionFlags.Invalid; + } + + return flags; + } + + export function isAsyncFunction(node: Node): boolean { + switch (node.kind) { + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.ArrowFunction: + case SyntaxKind.MethodDeclaration: + return (node).body !== undefined + && (node).asteriskToken === undefined + && hasModifier(node, ModifierFlags.Async); + } + return false; } export function isStringOrNumericLiteral(node: Node): node is StringLiteral | NumericLiteral { @@ -3751,6 +3802,12 @@ namespace ts { return node.kind === SyntaxKind.PropertyAccessExpression; } + export function isPropertyAccessOrQualifiedName(node: Node): node is PropertyAccessExpression | QualifiedName { + const kind = node.kind; + return kind === SyntaxKind.PropertyAccessExpression + || kind === SyntaxKind.QualifiedName; + } + export function isElementAccessExpression(node: Node): node is ElementAccessExpression { return node.kind === SyntaxKind.ElementAccessExpression; } @@ -4101,16 +4158,18 @@ namespace ts { return node.kind === SyntaxKind.JsxAttribute; } - export function isJsxOpeningLikeElement(node: Node): node is JsxOpeningLikeElement { - return node.kind === SyntaxKind.JsxOpeningElement || node.kind === SyntaxKind.JsxSelfClosingElement; - } - export function isStringLiteralOrJsxExpression(node: Node): node is StringLiteral | JsxExpression { const kind = node.kind; return kind === SyntaxKind.StringLiteral || kind === SyntaxKind.JsxExpression; } + export function isJsxOpeningLikeElement(node: Node): node is JsxOpeningLikeElement { + const kind = node.kind; + return kind === SyntaxKind.JsxOpeningElement + || kind === SyntaxKind.JsxSelfClosingElement; + } + // Clauses export function isCaseOrDefaultClause(node: Node): node is CaseOrDefaultClause { @@ -4165,7 +4224,6 @@ namespace ts { return "lib.es2016.d.ts"; case ScriptTarget.ES2015: return "lib.es6.d.ts"; - default: return "lib.d.ts"; } @@ -4561,7 +4619,7 @@ namespace ts { */ export function getParseTreeNode(node: Node, nodeTest?: (node: Node) => node is T): T; export function getParseTreeNode(node: Node, nodeTest?: (node: Node) => boolean): Node { - if (isParseTreeNode(node)) { + if (node == undefined || isParseTreeNode(node)) { return node; } diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts index 7ca71aec0d0..2d75d646128 100644 --- a/src/compiler/visitor.ts +++ b/src/compiler/visitor.ts @@ -2,15 +2,767 @@ /// /// +namespace ts { + /** + * Visits a Node using the supplied visitor, possibly returning a new Node in its place. + * + * @param node The Node to visit. + * @param visitor The callback used to visit the Node. + * @param test A callback to execute to verify the Node is valid. + * @param lift An optional callback to execute to lift a NodeArray into a valid Node. + */ + export function visitNode(node: T, visitor: Visitor, test?: (node: Node) => boolean, lift?: (node: NodeArray) => T): T; + + /** + * Visits a Node using the supplied visitor, possibly returning a new Node in its place. + * + * @param node The Node to visit. + * @param visitor The callback used to visit the Node. + * @param test A callback to execute to verify the Node is valid. + * @param lift An optional callback to execute to lift a NodeArray into a valid Node. + */ + export function visitNode(node: T | undefined, visitor: Visitor, test?: (node: Node) => boolean, lift?: (node: NodeArray) => T): T | undefined; + + export function visitNode(node: T | undefined, visitor: Visitor, test?: (node: Node) => boolean, lift?: (node: NodeArray) => T): T | undefined { + if (node === undefined || visitor === undefined) { + return node; + } + + aggregateTransformFlags(node); + const visited = visitor(node); + if (visited === node) { + return node; + } + + let visitedNode: Node; + if (visited === undefined) { + return undefined; + } + else if (isArray(visited)) { + visitedNode = (lift || extractSingleNode)(visited); + } + else { + visitedNode = visited; + } + + Debug.assertNode(visitedNode, test); + aggregateTransformFlags(visitedNode); + return visitedNode; + } + + /** + * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + * + * @param nodes The NodeArray to visit. + * @param visitor The callback used to visit a Node. + * @param test A node test to execute for each node. + * @param start An optional value indicating the starting offset at which to start visiting. + * @param count An optional value indicating the maximum number of nodes to visit. + */ + export function visitNodes(nodes: NodeArray, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray; + + /** + * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + * + * @param nodes The NodeArray to visit. + * @param visitor The callback used to visit a Node. + * @param test A node test to execute for each node. + * @param start An optional value indicating the starting offset at which to start visiting. + * @param count An optional value indicating the maximum number of nodes to visit. + */ + export function visitNodes(nodes: NodeArray | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray | undefined; + + /** + * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. + * + * @param nodes The NodeArray to visit. + * @param visitor The callback used to visit a Node. + * @param test A node test to execute for each node. + * @param start An optional value indicating the starting offset at which to start visiting. + * @param count An optional value indicating the maximum number of nodes to visit. + */ + export function visitNodes(nodes: NodeArray | undefined, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray | undefined { + if (nodes === undefined || visitor === undefined) { + return nodes; + } + + let updated: NodeArray; + + // Ensure start and count have valid values + const length = nodes.length; + if (start === undefined || start < 0) { + start = 0; + } + + if (count === undefined || count > length - start) { + count = length - start; + } + + if (start > 0 || count < length) { + // If we are not visiting all of the original nodes, we must always create a new array. + // Since this is a fragment of a node array, we do not copy over the previous location + // and will only copy over `hasTrailingComma` if we are including the last element. + updated = createNodeArray([], /*hasTrailingComma*/ nodes.hasTrailingComma && start + count === length); + } + + // Visit each original node. + for (let i = 0; i < count; i++) { + const node = nodes[i + start]; + aggregateTransformFlags(node); + const visited = node !== undefined ? visitor(node) : undefined; + if (updated !== undefined || visited === undefined || visited !== node) { + if (updated === undefined) { + // Ensure we have a copy of `nodes`, up to the current index. + updated = createNodeArray(nodes.slice(0, i), nodes.hasTrailingComma); + setTextRange(updated, nodes); + } + if (visited) { + if (isArray(visited)) { + for (const visitedNode of visited) { + Debug.assertNode(visitedNode, test); + aggregateTransformFlags(visitedNode); + updated.push(visitedNode); + } + } + else { + Debug.assertNode(visited, test); + aggregateTransformFlags(visited); + updated.push(visited); + } + } + } + } + + return updated || nodes; + } + + /** + * Starts a new lexical environment and visits a statement list, ending the lexical environment + * and merging hoisted declarations upon completion. + */ + export function visitLexicalEnvironment(statements: NodeArray, visitor: Visitor, context: TransformationContext, start?: number, ensureUseStrict?: boolean) { + context.startLexicalEnvironment(); + statements = visitNodes(statements, visitor, isStatement, start); + if (ensureUseStrict && !startsWithUseStrict(statements)) { + statements = setTextRange(createNodeArray([createStatement(createLiteral("use strict")), ...statements]), statements); + } + const declarations = context.endLexicalEnvironment(); + return setTextRange(createNodeArray(concatenate(statements, declarations)), statements); + } + + /** + * Starts a new lexical environment and visits a parameter list, suspending the lexical + * environment upon completion. + */ + export function visitParameterList(nodes: NodeArray, visitor: Visitor, context: TransformationContext) { + context.startLexicalEnvironment(); + const updated = visitNodes(nodes, visitor, isParameterDeclaration); + context.suspendLexicalEnvironment(); + return updated; + } + + /** + * Resumes a suspended lexical environment and visits a function body, ending the lexical + * environment and merging hoisted declarations upon completion. + */ + export function visitFunctionBody(node: FunctionBody, visitor: Visitor, context: TransformationContext): FunctionBody; + /** + * Resumes a suspended lexical environment and visits a function body, ending the lexical + * environment and merging hoisted declarations upon completion. + */ + export function visitFunctionBody(node: FunctionBody | undefined, visitor: Visitor, context: TransformationContext): FunctionBody | undefined; + /** + * Resumes a suspended lexical environment and visits a concise body, ending the lexical + * environment and merging hoisted declarations upon completion. + */ + export function visitFunctionBody(node: ConciseBody, visitor: Visitor, context: TransformationContext): ConciseBody; + export function visitFunctionBody(node: ConciseBody, visitor: Visitor, context: TransformationContext): ConciseBody { + context.resumeLexicalEnvironment(); + const updated = visitNode(node, visitor, isConciseBody); + const declarations = context.endLexicalEnvironment(); + if (some(declarations)) { + const block = convertToFunctionBody(updated); + const statements = mergeLexicalEnvironment(block.statements, declarations); + return updateBlock(block, statements); + } + return updated; + } + + /** + * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. + * + * @param node The Node whose children will be visited. + * @param visitor The callback used to visit each child. + * @param context A lexical environment context for the visitor. + */ + export function visitEachChild(node: T, visitor: Visitor, context: TransformationContext): T; + + /** + * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. + * + * @param node The Node whose children will be visited. + * @param visitor The callback used to visit each child. + * @param context A lexical environment context for the visitor. + */ + export function visitEachChild(node: T | undefined, visitor: Visitor, context: TransformationContext): T | undefined; + + export function visitEachChild(node: Node, visitor: Visitor, context: TransformationContext): Node { + if (node === undefined) { + return undefined; + } + + const kind = node.kind; + // No need to visit nodes with no children. + if ((kind > SyntaxKind.FirstToken && kind <= SyntaxKind.LastToken)) { + return node; + } + + // We do not yet support types. + if ((kind >= SyntaxKind.TypePredicate && kind <= SyntaxKind.LiteralType)) { + return node; + } + + switch (node.kind) { + case SyntaxKind.SemicolonClassElement: + case SyntaxKind.EmptyStatement: + case SyntaxKind.OmittedExpression: + case SyntaxKind.DebuggerStatement: + // No need to visit nodes with no children. + return node; + + // Names + case SyntaxKind.QualifiedName: + return updateQualifiedName(node, + visitNode((node).left, visitor, isEntityName), + visitNode((node).right, visitor, isIdentifier)); + + case SyntaxKind.ComputedPropertyName: + return updateComputedPropertyName(node, + visitNode((node).expression, visitor, isExpression)); + + // Signature elements + case SyntaxKind.Parameter: + return updateParameter(node, + visitNodes((node).decorators, visitor, isDecorator), + visitNodes((node).modifiers, visitor, isModifier), + (node).dotDotDotToken, + visitNode((node).name, visitor, isBindingName), + visitNode((node).type, visitor, isTypeNode), + visitNode((node).initializer, visitor, isExpression)); + + case SyntaxKind.Decorator: + return updateDecorator(node, + visitNode((node).expression, visitor, isExpression)); + + // Type member + case SyntaxKind.PropertyDeclaration: + return updateProperty(node, + visitNodes((node).decorators, visitor, isDecorator), + visitNodes((node).modifiers, visitor, isModifier), + visitNode((node).name, visitor, isPropertyName), + visitNode((node).type, visitor, isTypeNode), + visitNode((node).initializer, visitor, isExpression)); + + case SyntaxKind.MethodDeclaration: + return updateMethod(node, + visitNodes((node).decorators, visitor, isDecorator), + visitNodes((node).modifiers, visitor, isModifier), + (node).asteriskToken, + visitNode((node).name, visitor, isPropertyName), + visitNodes((node).typeParameters, visitor, isTypeParameter), + visitParameterList((node).parameters, visitor, context), + visitNode((node).type, visitor, isTypeNode), + visitFunctionBody((node).body, visitor, context)); + + case SyntaxKind.Constructor: + return updateConstructor(node, + visitNodes((node).decorators, visitor, isDecorator), + visitNodes((node).modifiers, visitor, isModifier), + visitParameterList((node).parameters, visitor, context), + visitFunctionBody((node).body, visitor, context)); + + case SyntaxKind.GetAccessor: + return updateGetAccessor(node, + visitNodes((node).decorators, visitor, isDecorator), + visitNodes((node).modifiers, visitor, isModifier), + visitNode((node).name, visitor, isPropertyName), + visitParameterList((node).parameters, visitor, context), + visitNode((node).type, visitor, isTypeNode), + visitFunctionBody((node).body, visitor, context)); + + case SyntaxKind.SetAccessor: + return updateSetAccessor(node, + visitNodes((node).decorators, visitor, isDecorator), + visitNodes((node).modifiers, visitor, isModifier), + visitNode((node).name, visitor, isPropertyName), + visitParameterList((node).parameters, visitor, context), + visitFunctionBody((node).body, visitor, context)); + + // Binding patterns + case SyntaxKind.ObjectBindingPattern: + return updateObjectBindingPattern(node, + visitNodes((node).elements, visitor, isBindingElement)); + + case SyntaxKind.ArrayBindingPattern: + return updateArrayBindingPattern(node, + visitNodes((node).elements, visitor, isArrayBindingElement)); + + case SyntaxKind.BindingElement: + return updateBindingElement(node, + (node).dotDotDotToken, + visitNode((node).propertyName, visitor, isPropertyName), + visitNode((node).name, visitor, isBindingName), + visitNode((node).initializer, visitor, isExpression)); + + // Expression + case SyntaxKind.ArrayLiteralExpression: + return updateArrayLiteral(node, + visitNodes((node).elements, visitor, isExpression)); + + case SyntaxKind.ObjectLiteralExpression: + return updateObjectLiteral(node, + visitNodes((node).properties, visitor, isObjectLiteralElementLike)); + + case SyntaxKind.PropertyAccessExpression: + return updatePropertyAccess(node, + visitNode((node).expression, visitor, isExpression), + visitNode((node).name, visitor, isIdentifier)); + + case SyntaxKind.ElementAccessExpression: + return updateElementAccess(node, + visitNode((node).expression, visitor, isExpression), + visitNode((node).argumentExpression, visitor, isExpression)); + + case SyntaxKind.CallExpression: + return updateCall(node, + visitNode((node).expression, visitor, isExpression), + visitNodes((node).typeArguments, visitor, isTypeNode), + visitNodes((node).arguments, visitor, isExpression)); + + case SyntaxKind.NewExpression: + return updateNew(node, + visitNode((node).expression, visitor, isExpression), + visitNodes((node).typeArguments, visitor, isTypeNode), + visitNodes((node).arguments, visitor, isExpression)); + + case SyntaxKind.TaggedTemplateExpression: + return updateTaggedTemplate(node, + visitNode((node).tag, visitor, isExpression), + visitNode((node).template, visitor, isTemplateLiteral)); + + case SyntaxKind.TypeAssertionExpression: + return updateTypeAssertion(node, + visitNode((node).type, visitor, isTypeNode), + visitNode((node).expression, visitor, isExpression)); + + case SyntaxKind.ParenthesizedExpression: + return updateParen(node, + visitNode((node).expression, visitor, isExpression)); + + case SyntaxKind.FunctionExpression: + return updateFunctionExpression(node, + visitNodes((node).modifiers, visitor, isModifier), + (node).asteriskToken, + visitNode((node).name, visitor, isIdentifier), + visitNodes((node).typeParameters, visitor, isTypeParameter), + visitParameterList((node).parameters, visitor, context), + visitNode((node).type, visitor, isTypeNode), + visitFunctionBody((node).body, visitor, context)); + + case SyntaxKind.ArrowFunction: + return updateArrowFunction(node, + visitNodes((node).modifiers, visitor, isModifier), + visitNodes((node).typeParameters, visitor, isTypeParameter), + visitParameterList((node).parameters, visitor, context), + visitNode((node).type, visitor, isTypeNode), + visitFunctionBody((node).body, visitor, context)); + + case SyntaxKind.DeleteExpression: + return updateDelete(node, + visitNode((node).expression, visitor, isExpression)); + + case SyntaxKind.TypeOfExpression: + return updateTypeOf(node, + visitNode((node).expression, visitor, isExpression)); + + case SyntaxKind.VoidExpression: + return updateVoid(node, + visitNode((node).expression, visitor, isExpression)); + + case SyntaxKind.AwaitExpression: + return updateAwait(node, + visitNode((node).expression, visitor, isExpression)); + + case SyntaxKind.BinaryExpression: + return updateBinary(node, + visitNode((node).left, visitor, isExpression), + visitNode((node).right, visitor, isExpression)); + + case SyntaxKind.PrefixUnaryExpression: + return updatePrefix(node, + visitNode((node).operand, visitor, isExpression)); + + case SyntaxKind.PostfixUnaryExpression: + return updatePostfix(node, + visitNode((node).operand, visitor, isExpression)); + + case SyntaxKind.ConditionalExpression: + return updateConditional(node, + visitNode((node).condition, visitor, isExpression), + visitNode((node).whenTrue, visitor, isExpression), + visitNode((node).whenFalse, visitor, isExpression)); + + case SyntaxKind.TemplateExpression: + return updateTemplateExpression(node, + visitNode((node).head, visitor, isTemplateHead), + visitNodes((node).templateSpans, visitor, isTemplateSpan)); + + case SyntaxKind.YieldExpression: + return updateYield(node, + (node).asteriskToken, + visitNode((node).expression, visitor, isExpression)); + + case SyntaxKind.SpreadElement: + return updateSpread(node, + visitNode((node).expression, visitor, isExpression)); + + case SyntaxKind.ClassExpression: + return updateClassExpression(node, + visitNodes((node).modifiers, visitor, isModifier), + visitNode((node).name, visitor, isIdentifier), + visitNodes((node).typeParameters, visitor, isTypeParameter), + visitNodes((node).heritageClauses, visitor, isHeritageClause), + visitNodes((node).members, visitor, isClassElement)); + + case SyntaxKind.ExpressionWithTypeArguments: + return updateExpressionWithTypeArguments(node, + visitNodes((node).typeArguments, visitor, isTypeNode), + visitNode((node).expression, visitor, isExpression)); + + case SyntaxKind.AsExpression: + return updateAsExpression(node, + visitNode((node).expression, visitor, isExpression), + visitNode((node).type, visitor, isTypeNode)); + + case SyntaxKind.NonNullExpression: + return updateNonNullExpression(node, + visitNode((node).expression, visitor, isExpression)); + + // Misc + case SyntaxKind.TemplateSpan: + return updateTemplateSpan(node, + visitNode((node).expression, visitor, isExpression), + visitNode((node).literal, visitor, isTemplateMiddleOrTemplateTail)); + + // Element + case SyntaxKind.Block: + return updateBlock(node, + visitNodes((node).statements, visitor, isStatement)); + + case SyntaxKind.VariableStatement: + return updateVariableStatement(node, + visitNodes((node).modifiers, visitor, isModifier), + visitNode((node).declarationList, visitor, isVariableDeclarationList)); + + case SyntaxKind.ExpressionStatement: + return updateStatement(node, + visitNode((node).expression, visitor, isExpression)); + + case SyntaxKind.IfStatement: + return updateIf(node, + visitNode((node).expression, visitor, isExpression), + visitNode((node).thenStatement, visitor, isStatement, liftToBlock), + visitNode((node).elseStatement, visitor, isStatement, liftToBlock)); + + case SyntaxKind.DoStatement: + return updateDo(node, + visitNode((node).statement, visitor, isStatement, liftToBlock), + visitNode((node).expression, visitor, isExpression)); + + case SyntaxKind.WhileStatement: + return updateWhile(node, + visitNode((node).expression, visitor, isExpression), + visitNode((node).statement, visitor, isStatement, liftToBlock)); + + case SyntaxKind.ForStatement: + return updateFor(node, + visitNode((node).initializer, visitor, isForInitializer), + visitNode((node).condition, visitor, isExpression), + visitNode((node).incrementor, visitor, isExpression), + visitNode((node).statement, visitor, isStatement, liftToBlock)); + + case SyntaxKind.ForInStatement: + return updateForIn(node, + visitNode((node).initializer, visitor, isForInitializer), + visitNode((node).expression, visitor, isExpression), + visitNode((node).statement, visitor, isStatement, liftToBlock)); + + case SyntaxKind.ForOfStatement: + return updateForOf(node, + (node).awaitModifier, + visitNode((node).initializer, visitor, isForInitializer), + visitNode((node).expression, visitor, isExpression), + visitNode((node).statement, visitor, isStatement, liftToBlock)); + + case SyntaxKind.ContinueStatement: + return updateContinue(node, + visitNode((node).label, visitor, isIdentifier)); + + case SyntaxKind.BreakStatement: + return updateBreak(node, + visitNode((node).label, visitor, isIdentifier)); + + case SyntaxKind.ReturnStatement: + return updateReturn(node, + visitNode((node).expression, visitor, isExpression)); + + case SyntaxKind.WithStatement: + return updateWith(node, + visitNode((node).expression, visitor, isExpression), + visitNode((node).statement, visitor, isStatement, liftToBlock)); + + case SyntaxKind.SwitchStatement: + return updateSwitch(node, + visitNode((node).expression, visitor, isExpression), + visitNode((node).caseBlock, visitor, isCaseBlock)); + + case SyntaxKind.LabeledStatement: + return updateLabel(node, + visitNode((node).label, visitor, isIdentifier), + visitNode((node).statement, visitor, isStatement, liftToBlock)); + + case SyntaxKind.ThrowStatement: + return updateThrow(node, + visitNode((node).expression, visitor, isExpression)); + + case SyntaxKind.TryStatement: + return updateTry(node, + visitNode((node).tryBlock, visitor, isBlock), + visitNode((node).catchClause, visitor, isCatchClause), + visitNode((node).finallyBlock, visitor, isBlock)); + + case SyntaxKind.VariableDeclaration: + return updateVariableDeclaration(node, + visitNode((node).name, visitor, isBindingName), + visitNode((node).type, visitor, isTypeNode), + visitNode((node).initializer, visitor, isExpression)); + + case SyntaxKind.VariableDeclarationList: + return updateVariableDeclarationList(node, + visitNodes((node).declarations, visitor, isVariableDeclaration)); + + case SyntaxKind.FunctionDeclaration: + return updateFunctionDeclaration(node, + visitNodes((node).decorators, visitor, isDecorator), + visitNodes((node).modifiers, visitor, isModifier), + (node).asteriskToken, + visitNode((node).name, visitor, isIdentifier), + visitNodes((node).typeParameters, visitor, isTypeParameter), + visitParameterList((node).parameters, visitor, context), + visitNode((node).type, visitor, isTypeNode), + visitFunctionBody((node).body, visitor, context)); + + case SyntaxKind.ClassDeclaration: + return updateClassDeclaration(node, + visitNodes((node).decorators, visitor, isDecorator), + visitNodes((node).modifiers, visitor, isModifier), + visitNode((node).name, visitor, isIdentifier), + visitNodes((node).typeParameters, visitor, isTypeParameter), + visitNodes((node).heritageClauses, visitor, isHeritageClause), + visitNodes((node).members, visitor, isClassElement)); + + case SyntaxKind.EnumDeclaration: + return updateEnumDeclaration(node, + visitNodes((node).decorators, visitor, isDecorator), + visitNodes((node).modifiers, visitor, isModifier), + visitNode((node).name, visitor, isIdentifier), + visitNodes((node).members, visitor, isEnumMember)); + + case SyntaxKind.ModuleDeclaration: + return updateModuleDeclaration(node, + visitNodes((node).decorators, visitor, isDecorator), + visitNodes((node).modifiers, visitor, isModifier), + visitNode((node).name, visitor, isIdentifier), + visitNode((node).body, visitor, isModuleBody)); + + case SyntaxKind.ModuleBlock: + return updateModuleBlock(node, + visitNodes((node).statements, visitor, isStatement)); + + case SyntaxKind.CaseBlock: + return updateCaseBlock(node, + visitNodes((node).clauses, visitor, isCaseOrDefaultClause)); + + case SyntaxKind.ImportEqualsDeclaration: + return updateImportEqualsDeclaration(node, + visitNodes((node).decorators, visitor, isDecorator), + visitNodes((node).modifiers, visitor, isModifier), + visitNode((node).name, visitor, isIdentifier), + visitNode((node).moduleReference, visitor, isModuleReference)); + + case SyntaxKind.ImportDeclaration: + return updateImportDeclaration(node, + visitNodes((node).decorators, visitor, isDecorator), + visitNodes((node).modifiers, visitor, isModifier), + visitNode((node).importClause, visitor, isImportClause), + visitNode((node).moduleSpecifier, visitor, isExpression)); + + case SyntaxKind.ImportClause: + return updateImportClause(node, + visitNode((node).name, visitor, isIdentifier), + visitNode((node).namedBindings, visitor, isNamedImportBindings)); + + case SyntaxKind.NamespaceImport: + return updateNamespaceImport(node, + visitNode((node).name, visitor, isIdentifier)); + + case SyntaxKind.NamedImports: + return updateNamedImports(node, + visitNodes((node).elements, visitor, isImportSpecifier)); + + case SyntaxKind.ImportSpecifier: + return updateImportSpecifier(node, + visitNode((node).propertyName, visitor, isIdentifier), + visitNode((node).name, visitor, isIdentifier)); + + case SyntaxKind.ExportAssignment: + return updateExportAssignment(node, + visitNodes((node).decorators, visitor, isDecorator), + visitNodes((node).modifiers, visitor, isModifier), + visitNode((node).expression, visitor, isExpression)); + + case SyntaxKind.ExportDeclaration: + return updateExportDeclaration(node, + visitNodes((node).decorators, visitor, isDecorator), + visitNodes((node).modifiers, visitor, isModifier), + visitNode((node).exportClause, visitor, isNamedExports), + visitNode((node).moduleSpecifier, visitor, isExpression)); + + case SyntaxKind.NamedExports: + return updateNamedExports(node, + visitNodes((node).elements, visitor, isExportSpecifier)); + + case SyntaxKind.ExportSpecifier: + return updateExportSpecifier(node, + visitNode((node).propertyName, visitor, isIdentifier), + visitNode((node).name, visitor, isIdentifier)); + + // Module references + case SyntaxKind.ExternalModuleReference: + return updateExternalModuleReference(node, + visitNode((node).expression, visitor, isExpression)); + + // JSX + case SyntaxKind.JsxElement: + return updateJsxElement(node, + visitNode((node).openingElement, visitor, isJsxOpeningElement), + visitNodes((node).children, visitor, isJsxChild), + visitNode((node).closingElement, visitor, isJsxClosingElement)); + + case SyntaxKind.JsxAttributes: + return updateJsxAttributes(node, + visitNodes((node).properties, visitor, isJsxAttributeLike)); + + case SyntaxKind.JsxSelfClosingElement: + return updateJsxSelfClosingElement(node, + visitNode((node).tagName, visitor, isJsxTagNameExpression), + visitNode((node).attributes, visitor, isJsxAttributes)); + + case SyntaxKind.JsxOpeningElement: + return updateJsxOpeningElement(node, + visitNode((node).tagName, visitor, isJsxTagNameExpression), + visitNode((node).attributes, visitor, isJsxAttributes)); + + case SyntaxKind.JsxClosingElement: + return updateJsxClosingElement(node, + visitNode((node).tagName, visitor, isJsxTagNameExpression)); + + case SyntaxKind.JsxAttribute: + return updateJsxAttribute(node, + visitNode((node).name, visitor, isIdentifier), + visitNode((node).initializer, visitor, isStringLiteralOrJsxExpression)); + + case SyntaxKind.JsxSpreadAttribute: + return updateJsxSpreadAttribute(node, + visitNode((node).expression, visitor, isExpression)); + + case SyntaxKind.JsxExpression: + return updateJsxExpression(node, + visitNode((node).expression, visitor, isExpression)); + + // Clauses + case SyntaxKind.CaseClause: + return updateCaseClause(node, + visitNode((node).expression, visitor, isExpression), + visitNodes((node).statements, visitor, isStatement)); + + case SyntaxKind.DefaultClause: + return updateDefaultClause(node, + visitNodes((node).statements, visitor, isStatement)); + + case SyntaxKind.HeritageClause: + return updateHeritageClause(node, + visitNodes((node).types, visitor, isExpressionWithTypeArguments)); + + case SyntaxKind.CatchClause: + return updateCatchClause(node, + visitNode((node).variableDeclaration, visitor, isVariableDeclaration), + visitNode((node).block, visitor, isBlock)); + + // Property assignments + case SyntaxKind.PropertyAssignment: + return updatePropertyAssignment(node, + visitNode((node).name, visitor, isPropertyName), + visitNode((node).initializer, visitor, isExpression)); + + case SyntaxKind.ShorthandPropertyAssignment: + return updateShorthandPropertyAssignment(node, + visitNode((node).name, visitor, isIdentifier), + visitNode((node).objectAssignmentInitializer, visitor, isExpression)); + + case SyntaxKind.SpreadAssignment: + return updateSpreadAssignment(node, + visitNode((node).expression, visitor, isExpression)); + + // Enum + case SyntaxKind.EnumMember: + return updateEnumMember(node, + visitNode((node).name, visitor, isPropertyName), + visitNode((node).initializer, visitor, isExpression)); + + // Top-level nodes + case SyntaxKind.SourceFile: + return updateSourceFileNode(node, + visitLexicalEnvironment((node).statements, visitor, context)); + + // Transformation nodes + case SyntaxKind.PartiallyEmittedExpression: + return updatePartiallyEmittedExpression(node, + visitNode((node).expression, visitor, isExpression)); + + default: + return node; + } + } + + /** + * Extracts the single node from a NodeArray. + * + * @param nodes The NodeArray. + */ + function extractSingleNode(nodes: Node[]): Node { + Debug.assert(nodes.length <= 1, "Too many nodes written to output."); + return singleOrUndefined(nodes); + } +} + /* @internal */ namespace ts { - export type VisitResult = T | T[]; - function reduceNode(node: Node, f: (memo: T, node: Node) => T, initial: T) { return node ? f(initial, node) : initial; } - function reduceNodeArray(nodes: Node[], f: (memo: T, nodes: Node[]) => T, initial: T) { + function reduceNodeArray(nodes: NodeArray, f: (memo: T, nodes: NodeArray) => T, initial: T) { return nodes ? f(initial, nodes) : initial; } @@ -22,12 +774,12 @@ namespace ts { * @param initial The initial value to supply to the reduction. * @param f The callback function */ - export function reduceEachChild(node: Node, initial: T, cbNode: (memo: T, node: Node) => T, cbNodeArray?: (memo: T, nodes: Node[]) => T): T { + export function reduceEachChild(node: Node, initial: T, cbNode: (memo: T, node: Node) => T, cbNodeArray?: (memo: T, nodes: NodeArray) => T): T { if (node === undefined) { return initial; } - const reduceNodes: (nodes: Node[], f: (memo: T, node: Node | Node[]) => T, initial: T) => T = cbNodeArray ? reduceNodeArray : reduceLeft; + const reduceNodes: (nodes: NodeArray, f: (memo: T, node: Node | NodeArray) => T, initial: T) => T = cbNodeArray ? reduceNodeArray : reduceLeft; const cbNodes = cbNodeArray || cbNode; const kind = node.kind; @@ -429,12 +1181,11 @@ namespace ts { result = reduceNode((node).attributes, cbNode, result); break; - case SyntaxKind.JsxClosingElement: - result = reduceNode((node).tagName, cbNode, result); - break; - case SyntaxKind.JsxAttributes: result = reduceNodes((node).properties, cbNodes, result); + + case SyntaxKind.JsxClosingElement: + result = reduceNode((node).tagName, cbNode, result); break; case SyntaxKind.JsxAttribute: @@ -505,703 +1256,11 @@ namespace ts { return result; } - /** - * Visits a Node using the supplied visitor, possibly returning a new Node in its place. - * - * @param node The Node to visit. - * @param visitor The callback used to visit the Node. - * @param test A callback to execute to verify the Node is valid. - * @param optional An optional value indicating whether the Node is itself optional. - * @param lift An optional callback to execute to lift a NodeArray into a valid Node. - */ - export function visitNode(node: T, visitor: (node: Node) => VisitResult, test: (node: Node) => boolean, optional?: boolean, lift?: (node: NodeArray) => T): T { - if (node === undefined || visitor === undefined) { - return node; - } - - aggregateTransformFlags(node); - const visited = visitor(node); - if (visited === node) { - return node; - } - - let visitedNode: Node; - if (visited === undefined) { - if (!optional) { - Debug.failNotOptional(); - } - - return undefined; - } - else if (isArray(visited)) { - visitedNode = (lift || extractSingleNode)(visited); - } - else { - visitedNode = visited; - } - - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); - return visitedNode; - } - - /** - * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place. - * - * @param nodes The NodeArray to visit. - * @param visitor The callback used to visit a Node. - * @param test A node test to execute for each node. - * @param start An optional value indicating the starting offset at which to start visiting. - * @param count An optional value indicating the maximum number of nodes to visit. - */ - export function visitNodes(nodes: NodeArray, visitor: (node: Node) => VisitResult, test: (node: Node) => boolean, start?: number, count?: number): NodeArray { - if (nodes === undefined) { - return undefined; - } - - let updated: NodeArray; - - // Ensure start and count have valid values - const length = nodes.length; - if (start === undefined || start < 0) { - start = 0; - } - - if (count === undefined || count > length - start) { - count = length - start; - } - - if (start > 0 || count < length) { - // If we are not visiting all of the original nodes, we must always create a new array. - // Since this is a fragment of a node array, we do not copy over the previous location - // and will only copy over `hasTrailingComma` if we are including the last element. - updated = createNodeArray([], /*hasTrailingComma*/ nodes.hasTrailingComma && start + count === length); - } - - // Visit each original node. - for (let i = 0; i < count; i++) { - const node = nodes[i + start]; - aggregateTransformFlags(node); - const visited = node !== undefined ? visitor(node) : undefined; - if (updated !== undefined || visited === undefined || visited !== node) { - if (updated === undefined) { - // Ensure we have a copy of `nodes`, up to the current index. - updated = createNodeArray(nodes.slice(0, i), nodes.hasTrailingComma); - setTextRange(updated, nodes); - } - if (visited) { - if (isArray(visited)) { - for (const visitedNode of visited) { - Debug.assertNode(visitedNode, test); - aggregateTransformFlags(visitedNode); - updated.push(visitedNode); - } - } - else { - Debug.assertNode(visited, test); - aggregateTransformFlags(visited); - updated.push(visited); - } - } - } - } - - return updated || nodes; - } - - /** - * Starts a new lexical environment and visits a statement list, ending the lexical environment - * and merging hoisted declarations upon completion. - */ - export function visitLexicalEnvironment(statements: NodeArray, visitor: (node: Node) => VisitResult, context: TransformationContext, start?: number, ensureUseStrict?: boolean) { - context.startLexicalEnvironment(); - statements = visitNodes(statements, visitor, isStatement, start); - if (ensureUseStrict && !startsWithUseStrict(statements)) { - statements = setTextRange(createNodeArray([createStatement(createLiteral("use strict")), ...statements]), statements); - } - const declarations = context.endLexicalEnvironment(); - return setTextRange(createNodeArray(concatenate(statements, declarations)), statements); - } - - /** - * Starts a new lexical environment and visits a parameter list, suspending the lexical - * environment upon completion. - */ - export function visitParameterList(nodes: NodeArray, visitor: (node: Node) => VisitResult, context: TransformationContext) { - context.startLexicalEnvironment(); - const updated = visitNodes(nodes, visitor, isParameterDeclaration); - context.suspendLexicalEnvironment(); - return updated; - } - - /** - * Resumes a suspended lexical environment and visits a function body, ending the lexical - * environment and merging hoisted declarations upon completion. - */ - export function visitFunctionBody(node: FunctionBody, visitor: (node: Node) => VisitResult, context: TransformationContext): FunctionBody; - /** - * Resumes a suspended lexical environment and visits a concise body, ending the lexical - * environment and merging hoisted declarations upon completion. - */ - export function visitFunctionBody(node: ConciseBody, visitor: (node: Node) => VisitResult, context: TransformationContext): ConciseBody; - export function visitFunctionBody(node: ConciseBody, visitor: (node: Node) => VisitResult, context: TransformationContext): ConciseBody { - context.resumeLexicalEnvironment(); - const updated = visitNode(node, visitor, isConciseBody); - const declarations = context.endLexicalEnvironment(); - if (some(declarations)) { - const block = convertToFunctionBody(updated); - const statements = mergeLexicalEnvironment(block.statements, declarations); - return updateBlock(block, statements); - } - return updated; - } - - /** - * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place. - * - * @param node The Node whose children will be visited. - * @param visitor The callback used to visit each child. - * @param context A lexical environment context for the visitor. - */ - export function visitEachChild(node: T, visitor: (node: Node) => VisitResult, context: TransformationContext): T; - export function visitEachChild(node: Node, visitor: (node: Node) => VisitResult, context: TransformationContext): Node { - if (node === undefined) { - return undefined; - } - - const kind = node.kind; - // No need to visit nodes with no children. - if ((kind > SyntaxKind.FirstToken && kind <= SyntaxKind.LastToken)) { - return node; - } - - // We do not yet support types. - if ((kind >= SyntaxKind.TypePredicate && kind <= SyntaxKind.LiteralType)) { - return node; - } - - switch (node.kind) { - case SyntaxKind.SemicolonClassElement: - case SyntaxKind.EmptyStatement: - case SyntaxKind.OmittedExpression: - case SyntaxKind.DebuggerStatement: - // No need to visit nodes with no children. - return node; - - // Names - case SyntaxKind.QualifiedName: - return updateQualifiedName(node, - visitNode((node).left, visitor, isEntityName), - visitNode((node).right, visitor, isIdentifier)); - - case SyntaxKind.ComputedPropertyName: - return updateComputedPropertyName(node, - visitNode((node).expression, visitor, isExpression)); - - // Signature elements - case SyntaxKind.Parameter: - return updateParameter(node, - visitNodes((node).decorators, visitor, isDecorator), - visitNodes((node).modifiers, visitor, isModifier), - (node).dotDotDotToken, - visitNode((node).name, visitor, isBindingName), - visitNode((node).type, visitor, isTypeNode, /*optional*/ true), - visitNode((node).initializer, visitor, isExpression, /*optional*/ true)); - - case SyntaxKind.Decorator: - return updateDecorator(node, - visitNode((node).expression, visitor, isExpression)); - - // Type member - case SyntaxKind.PropertyDeclaration: - return updateProperty(node, - visitNodes((node).decorators, visitor, isDecorator), - visitNodes((node).modifiers, visitor, isModifier), - visitNode((node).name, visitor, isPropertyName), - visitNode((node).type, visitor, isTypeNode, /*optional*/ true), - visitNode((node).initializer, visitor, isExpression, /*optional*/ true)); - - case SyntaxKind.MethodDeclaration: - return updateMethod(node, - visitNodes((node).decorators, visitor, isDecorator), - visitNodes((node).modifiers, visitor, isModifier), - visitNode((node).name, visitor, isPropertyName), - visitNodes((node).typeParameters, visitor, isTypeParameter), - visitParameterList((node).parameters, visitor, context), - visitNode((node).type, visitor, isTypeNode, /*optional*/ true), - visitFunctionBody((node).body, visitor, context)); - - case SyntaxKind.Constructor: - return updateConstructor(node, - visitNodes((node).decorators, visitor, isDecorator), - visitNodes((node).modifiers, visitor, isModifier), - visitParameterList((node).parameters, visitor, context), - visitFunctionBody((node).body, visitor, context)); - - case SyntaxKind.GetAccessor: - return updateGetAccessor(node, - visitNodes((node).decorators, visitor, isDecorator), - visitNodes((node).modifiers, visitor, isModifier), - visitNode((node).name, visitor, isPropertyName), - visitParameterList((node).parameters, visitor, context), - visitNode((node).type, visitor, isTypeNode, /*optional*/ true), - visitFunctionBody((node).body, visitor, context)); - - case SyntaxKind.SetAccessor: - return updateSetAccessor(node, - visitNodes((node).decorators, visitor, isDecorator), - visitNodes((node).modifiers, visitor, isModifier), - visitNode((node).name, visitor, isPropertyName), - visitParameterList((node).parameters, visitor, context), - visitFunctionBody((node).body, visitor, context)); - - // Binding patterns - case SyntaxKind.ObjectBindingPattern: - return updateObjectBindingPattern(node, - visitNodes((node).elements, visitor, isBindingElement)); - - case SyntaxKind.ArrayBindingPattern: - return updateArrayBindingPattern(node, - visitNodes((node).elements, visitor, isArrayBindingElement)); - - case SyntaxKind.BindingElement: - return updateBindingElement(node, - (node).dotDotDotToken, - visitNode((node).propertyName, visitor, isPropertyName, /*optional*/ true), - visitNode((node).name, visitor, isBindingName), - visitNode((node).initializer, visitor, isExpression, /*optional*/ true)); - - // Expression - case SyntaxKind.ArrayLiteralExpression: - return updateArrayLiteral(node, - visitNodes((node).elements, visitor, isExpression)); - - case SyntaxKind.ObjectLiteralExpression: - return updateObjectLiteral(node, - visitNodes((node).properties, visitor, isObjectLiteralElementLike)); - - case SyntaxKind.PropertyAccessExpression: - return updatePropertyAccess(node, - visitNode((node).expression, visitor, isExpression), - visitNode((node).name, visitor, isIdentifier)); - - case SyntaxKind.ElementAccessExpression: - return updateElementAccess(node, - visitNode((node).expression, visitor, isExpression), - visitNode((node).argumentExpression, visitor, isExpression)); - - case SyntaxKind.CallExpression: - return updateCall(node, - visitNode((node).expression, visitor, isExpression), - visitNodes((node).typeArguments, visitor, isTypeNode), - visitNodes((node).arguments, visitor, isExpression)); - - case SyntaxKind.NewExpression: - return updateNew(node, - visitNode((node).expression, visitor, isExpression), - visitNodes((node).typeArguments, visitor, isTypeNode), - visitNodes((node).arguments, visitor, isExpression)); - - case SyntaxKind.TaggedTemplateExpression: - return updateTaggedTemplate(node, - visitNode((node).tag, visitor, isExpression), - visitNode((node).template, visitor, isTemplateLiteral)); - - case SyntaxKind.TypeAssertionExpression: - return updateTypeAssertion(node, - visitNode((node).type, visitor, isTypeNode), - visitNode((node).expression, visitor, isExpression)); - - case SyntaxKind.ParenthesizedExpression: - return updateParen(node, - visitNode((node).expression, visitor, isExpression)); - - case SyntaxKind.FunctionExpression: - return updateFunctionExpression(node, - visitNodes((node).modifiers, visitor, isModifier), - visitNode((node).name, visitor, isPropertyName), - visitNodes((node).typeParameters, visitor, isTypeParameter), - visitParameterList((node).parameters, visitor, context), - visitNode((node).type, visitor, isTypeNode, /*optional*/ true), - visitFunctionBody((node).body, visitor, context)); - - case SyntaxKind.ArrowFunction: - return updateArrowFunction(node, - visitNodes((node).modifiers, visitor, isModifier), - visitNodes((node).typeParameters, visitor, isTypeParameter), - visitParameterList((node).parameters, visitor, context), - visitNode((node).type, visitor, isTypeNode, /*optional*/ true), - visitFunctionBody((node).body, visitor, context)); - - case SyntaxKind.DeleteExpression: - return updateDelete(node, - visitNode((node).expression, visitor, isExpression)); - - case SyntaxKind.TypeOfExpression: - return updateTypeOf(node, - visitNode((node).expression, visitor, isExpression)); - - case SyntaxKind.VoidExpression: - return updateVoid(node, - visitNode((node).expression, visitor, isExpression)); - - case SyntaxKind.AwaitExpression: - return updateAwait(node, - visitNode((node).expression, visitor, isExpression)); - - case SyntaxKind.BinaryExpression: - return updateBinary(node, - visitNode((node).left, visitor, isExpression), - visitNode((node).right, visitor, isExpression)); - - case SyntaxKind.PrefixUnaryExpression: - return updatePrefix(node, - visitNode((node).operand, visitor, isExpression)); - - case SyntaxKind.PostfixUnaryExpression: - return updatePostfix(node, - visitNode((node).operand, visitor, isExpression)); - - case SyntaxKind.ConditionalExpression: - return updateConditional(node, - visitNode((node).condition, visitor, isExpression), - visitNode((node).whenTrue, visitor, isExpression), - visitNode((node).whenFalse, visitor, isExpression)); - - case SyntaxKind.TemplateExpression: - return updateTemplateExpression(node, - visitNode((node).head, visitor, isTemplateHead), - visitNodes((node).templateSpans, visitor, isTemplateSpan)); - - case SyntaxKind.YieldExpression: - return updateYield(node, - visitNode((node).expression, visitor, isExpression)); - - case SyntaxKind.SpreadElement: - return updateSpread(node, - visitNode((node).expression, visitor, isExpression)); - - case SyntaxKind.ClassExpression: - return updateClassExpression(node, - visitNodes((node).modifiers, visitor, isModifier), - visitNode((node).name, visitor, isIdentifier, /*optional*/ true), - visitNodes((node).typeParameters, visitor, isTypeParameter), - visitNodes((node).heritageClauses, visitor, isHeritageClause), - visitNodes((node).members, visitor, isClassElement)); - - case SyntaxKind.ExpressionWithTypeArguments: - return updateExpressionWithTypeArguments(node, - visitNodes((node).typeArguments, visitor, isTypeNode), - visitNode((node).expression, visitor, isExpression)); - - case SyntaxKind.AsExpression: - return updateAsExpression(node, - visitNode((node).expression, visitor, isExpression), - visitNode((node).type, visitor, isTypeNode)); - - case SyntaxKind.NonNullExpression: - return updateNonNullExpression(node, - visitNode((node).expression, visitor, isExpression)); - - // Misc - case SyntaxKind.TemplateSpan: - return updateTemplateSpan(node, - visitNode((node).expression, visitor, isExpression), - visitNode((node).literal, visitor, isTemplateMiddleOrTemplateTail)); - - // Element - case SyntaxKind.Block: - return updateBlock(node, - visitNodes((node).statements, visitor, isStatement)); - - case SyntaxKind.VariableStatement: - return updateVariableStatement(node, - visitNodes((node).modifiers, visitor, isModifier), - visitNode((node).declarationList, visitor, isVariableDeclarationList)); - - case SyntaxKind.ExpressionStatement: - return updateStatement(node, - visitNode((node).expression, visitor, isExpression)); - - case SyntaxKind.IfStatement: - return updateIf(node, - visitNode((node).expression, visitor, isExpression), - visitNode((node).thenStatement, visitor, isStatement, /*optional*/ false, liftToBlock), - visitNode((node).elseStatement, visitor, isStatement, /*optional*/ true, liftToBlock)); - - case SyntaxKind.DoStatement: - return updateDo(node, - visitNode((node).statement, visitor, isStatement, /*optional*/ false, liftToBlock), - visitNode((node).expression, visitor, isExpression)); - - case SyntaxKind.WhileStatement: - return updateWhile(node, - visitNode((node).expression, visitor, isExpression), - visitNode((node).statement, visitor, isStatement, /*optional*/ false, liftToBlock)); - - case SyntaxKind.ForStatement: - return updateFor(node, - visitNode((node).initializer, visitor, isForInitializer), - visitNode((node).condition, visitor, isExpression), - visitNode((node).incrementor, visitor, isExpression), - visitNode((node).statement, visitor, isStatement, /*optional*/ false, liftToBlock)); - - case SyntaxKind.ForInStatement: - return updateForIn(node, - visitNode((node).initializer, visitor, isForInitializer), - visitNode((node).expression, visitor, isExpression), - visitNode((node).statement, visitor, isStatement, /*optional*/ false, liftToBlock)); - - case SyntaxKind.ForOfStatement: - return updateForOf(node, - visitNode((node).initializer, visitor, isForInitializer), - visitNode((node).expression, visitor, isExpression), - visitNode((node).statement, visitor, isStatement, /*optional*/ false, liftToBlock)); - - case SyntaxKind.ContinueStatement: - return updateContinue(node, - visitNode((node).label, visitor, isIdentifier, /*optional*/ true)); - - case SyntaxKind.BreakStatement: - return updateBreak(node, - visitNode((node).label, visitor, isIdentifier, /*optional*/ true)); - - case SyntaxKind.ReturnStatement: - return updateReturn(node, - visitNode((node).expression, visitor, isExpression, /*optional*/ true)); - - case SyntaxKind.WithStatement: - return updateWith(node, - visitNode((node).expression, visitor, isExpression), - visitNode((node).statement, visitor, isStatement, /*optional*/ false, liftToBlock)); - - case SyntaxKind.SwitchStatement: - return updateSwitch(node, - visitNode((node).expression, visitor, isExpression), - visitNode((node).caseBlock, visitor, isCaseBlock)); - - case SyntaxKind.LabeledStatement: - return updateLabel(node, - visitNode((node).label, visitor, isIdentifier), - visitNode((node).statement, visitor, isStatement, /*optional*/ false, liftToBlock)); - - case SyntaxKind.ThrowStatement: - return updateThrow(node, - visitNode((node).expression, visitor, isExpression)); - - case SyntaxKind.TryStatement: - return updateTry(node, - visitNode((node).tryBlock, visitor, isBlock), - visitNode((node).catchClause, visitor, isCatchClause, /*optional*/ true), - visitNode((node).finallyBlock, visitor, isBlock, /*optional*/ true)); - - case SyntaxKind.VariableDeclaration: - return updateVariableDeclaration(node, - visitNode((node).name, visitor, isBindingName), - visitNode((node).type, visitor, isTypeNode, /*optional*/ true), - visitNode((node).initializer, visitor, isExpression, /*optional*/ true)); - - case SyntaxKind.VariableDeclarationList: - return updateVariableDeclarationList(node, - visitNodes((node).declarations, visitor, isVariableDeclaration)); - - case SyntaxKind.FunctionDeclaration: - return updateFunctionDeclaration(node, - visitNodes((node).decorators, visitor, isDecorator), - visitNodes((node).modifiers, visitor, isModifier), - visitNode((node).name, visitor, isPropertyName), - visitNodes((node).typeParameters, visitor, isTypeParameter), - visitParameterList((node).parameters, visitor, context), - visitNode((node).type, visitor, isTypeNode, /*optional*/ true), - visitFunctionBody((node).body, visitor, context)); - - case SyntaxKind.ClassDeclaration: - return updateClassDeclaration(node, - visitNodes((node).decorators, visitor, isDecorator), - visitNodes((node).modifiers, visitor, isModifier), - visitNode((node).name, visitor, isIdentifier, /*optional*/ true), - visitNodes((node).typeParameters, visitor, isTypeParameter), - visitNodes((node).heritageClauses, visitor, isHeritageClause), - visitNodes((node).members, visitor, isClassElement)); - - case SyntaxKind.EnumDeclaration: - return updateEnumDeclaration(node, - visitNodes((node).decorators, visitor, isDecorator), - visitNodes((node).modifiers, visitor, isModifier), - visitNode((node).name, visitor, isIdentifier), - visitNodes((node).members, visitor, isEnumMember)); - - case SyntaxKind.ModuleDeclaration: - return updateModuleDeclaration(node, - visitNodes((node).decorators, visitor, isDecorator), - visitNodes((node).modifiers, visitor, isModifier), - visitNode((node).name, visitor, isIdentifier), - visitNode((node).body, visitor, isModuleBody)); - - case SyntaxKind.ModuleBlock: - return updateModuleBlock(node, - visitNodes((node).statements, visitor, isStatement)); - - case SyntaxKind.CaseBlock: - return updateCaseBlock(node, - visitNodes((node).clauses, visitor, isCaseOrDefaultClause)); - - case SyntaxKind.ImportEqualsDeclaration: - return updateImportEqualsDeclaration(node, - visitNodes((node).decorators, visitor, isDecorator), - visitNodes((node).modifiers, visitor, isModifier), - visitNode((node).name, visitor, isIdentifier), - visitNode((node).moduleReference, visitor, isModuleReference)); - - case SyntaxKind.ImportDeclaration: - return updateImportDeclaration(node, - visitNodes((node).decorators, visitor, isDecorator), - visitNodes((node).modifiers, visitor, isModifier), - visitNode((node).importClause, visitor, isImportClause, /*optional*/ true), - visitNode((node).moduleSpecifier, visitor, isExpression)); - - case SyntaxKind.ImportClause: - return updateImportClause(node, - visitNode((node).name, visitor, isIdentifier, /*optional*/ true), - visitNode((node).namedBindings, visitor, isNamedImportBindings, /*optional*/ true)); - - case SyntaxKind.NamespaceImport: - return updateNamespaceImport(node, - visitNode((node).name, visitor, isIdentifier)); - - case SyntaxKind.NamedImports: - return updateNamedImports(node, - visitNodes((node).elements, visitor, isImportSpecifier)); - - case SyntaxKind.ImportSpecifier: - return updateImportSpecifier(node, - visitNode((node).propertyName, visitor, isIdentifier, /*optional*/ true), - visitNode((node).name, visitor, isIdentifier)); - - case SyntaxKind.ExportAssignment: - return updateExportAssignment(node, - visitNodes((node).decorators, visitor, isDecorator), - visitNodes((node).modifiers, visitor, isModifier), - visitNode((node).expression, visitor, isExpression)); - - case SyntaxKind.ExportDeclaration: - return updateExportDeclaration(node, - visitNodes((node).decorators, visitor, isDecorator), - visitNodes((node).modifiers, visitor, isModifier), - visitNode((node).exportClause, visitor, isNamedExports, /*optional*/ true), - visitNode((node).moduleSpecifier, visitor, isExpression, /*optional*/ true)); - - case SyntaxKind.NamedExports: - return updateNamedExports(node, - visitNodes((node).elements, visitor, isExportSpecifier)); - - case SyntaxKind.ExportSpecifier: - return updateExportSpecifier(node, - visitNode((node).propertyName, visitor, isIdentifier, /*optional*/ true), - visitNode((node).name, visitor, isIdentifier)); - - // Module references - case SyntaxKind.ExternalModuleReference: - return updateExternalModuleReference(node, - visitNode((node).expression, visitor, isExpression)); - - // JSX - case SyntaxKind.JsxElement: - return updateJsxElement(node, - visitNode((node).openingElement, visitor, isJsxOpeningElement), - visitNodes((node).children, visitor, isJsxChild), - visitNode((node).closingElement, visitor, isJsxClosingElement)); - - case SyntaxKind.JsxAttributes: - return updateJsxAttributes(node, - visitNodes((node).properties, visitor, isJsxAttributeLike)); - - case SyntaxKind.JsxSelfClosingElement: - return updateJsxSelfClosingElement(node, - visitNode((node).tagName, visitor, isJsxTagNameExpression), - visitNode((node).attributes, visitor, isJsxAttributes)); - - case SyntaxKind.JsxOpeningElement: - return updateJsxOpeningElement(node, - visitNode((node).tagName, visitor, isJsxTagNameExpression), - visitNode((node).attributes, visitor, isJsxAttributes)); - - case SyntaxKind.JsxClosingElement: - return updateJsxClosingElement(node, - visitNode((node).tagName, visitor, isJsxTagNameExpression)); - - case SyntaxKind.JsxAttribute: - return updateJsxAttribute(node, - visitNode((node).name, visitor, isIdentifier), - visitNode((node).initializer, visitor, isStringLiteralOrJsxExpression)); - - case SyntaxKind.JsxSpreadAttribute: - return updateJsxSpreadAttribute(node, - visitNode((node).expression, visitor, isExpression)); - - case SyntaxKind.JsxExpression: - return updateJsxExpression(node, - visitNode((node).expression, visitor, isExpression)); - - // Clauses - case SyntaxKind.CaseClause: - return updateCaseClause(node, - visitNode((node).expression, visitor, isExpression), - visitNodes((node).statements, visitor, isStatement)); - - case SyntaxKind.DefaultClause: - return updateDefaultClause(node, - visitNodes((node).statements, visitor, isStatement)); - - case SyntaxKind.HeritageClause: - return updateHeritageClause(node, - visitNodes((node).types, visitor, isExpressionWithTypeArguments)); - - case SyntaxKind.CatchClause: - return updateCatchClause(node, - visitNode((node).variableDeclaration, visitor, isVariableDeclaration), - visitNode((node).block, visitor, isBlock)); - - // Property assignments - case SyntaxKind.PropertyAssignment: - return updatePropertyAssignment(node, - visitNode((node).name, visitor, isPropertyName), - visitNode((node).initializer, visitor, isExpression)); - - case SyntaxKind.ShorthandPropertyAssignment: - return updateShorthandPropertyAssignment(node, - visitNode((node).name, visitor, isIdentifier), - visitNode((node).objectAssignmentInitializer, visitor, isExpression)); - - case SyntaxKind.SpreadAssignment: - return updateSpreadAssignment(node, - visitNode((node).expression, visitor, isExpression)); - - // Enum - case SyntaxKind.EnumMember: - return updateEnumMember(node, - visitNode((node).name, visitor, isPropertyName), - visitNode((node).initializer, visitor, isExpression, /*optional*/ true)); - - // Top-level nodes - case SyntaxKind.SourceFile: - return updateSourceFileNode(node, - visitLexicalEnvironment((node).statements, visitor, context)); - - // Transformation nodes - case SyntaxKind.PartiallyEmittedExpression: - return updatePartiallyEmittedExpression(node, - visitNode((node).expression, visitor, isExpression)); - - default: - return node; - } - } - /** * Merges generated lexical declarations into a new statement list. */ export function mergeLexicalEnvironment(statements: NodeArray, declarations: Statement[]): NodeArray; + /** * Appends generated lexical declarations to an array of statements. */ @@ -1210,49 +1269,12 @@ namespace ts { if (!some(declarations)) { return statements; } + return isNodeArray(statements) ? setTextRange(createNodeArray(concatenate(statements, declarations)), statements) : addRange(statements, declarations); } - - /** - * Merges generated lexical declarations into the FunctionBody of a non-arrow function-like declaration. - * - * @param node The ConciseBody of an arrow function. - * @param declarations The lexical declarations to merge. - */ - export function mergeFunctionBodyLexicalEnvironment(body: FunctionBody, declarations: Statement[]): FunctionBody; - - /** - * Merges generated lexical declarations into the ConciseBody of an ArrowFunction. - * - * @param node The ConciseBody of an arrow function. - * @param declarations The lexical declarations to merge. - */ - export function mergeFunctionBodyLexicalEnvironment(body: ConciseBody, declarations: Statement[]): ConciseBody; - - export function mergeFunctionBodyLexicalEnvironment(body: ConciseBody, declarations: Statement[]): ConciseBody { - if (body && declarations !== undefined && declarations.length > 0) { - if (isBlock(body)) { - return updateBlock(body, setTextRange(createNodeArray(concatenate(body.statements, declarations)), body.statements)); - } - else { - return setTextRange( - createBlock( - setTextRange( - createNodeArray([setTextRange(createReturn(body), body), ...declarations]), - body - ), - /*multiLine*/ true - ), - /*location*/ body - ); - } - } - return body; - } - /** * Lifts a NodeArray containing only Statement nodes to a block. * @@ -1263,16 +1285,6 @@ namespace ts { return singleOrUndefined(nodes) || createBlock(>nodes); } - /** - * Extracts the single node from a NodeArray. - * - * @param nodes The NodeArray. - */ - function extractSingleNode(nodes: Node[]): Node { - Debug.assert(nodes.length <= 1, "Too many nodes written to output."); - return singleOrUndefined(nodes); - } - /** * Aggregates the TransformFlags for a Node and its subtree. */ @@ -1340,10 +1352,6 @@ namespace ts { } export namespace Debug { - export const failNotOptional = shouldAssert(AssertionLevel.Normal) - ? (message?: string) => assert(false, message || "Node not optional.") - : noop; - export const failBadSyntaxKind = shouldAssert(AssertionLevel.Normal) ? (node: Node, message?: string) => assert(false, message || "Unexpected node.", () => `Node ${formatSyntaxKind(node.kind)} was unexpected.`) : noop; diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index b78546602d3..81aeb6c59ee 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -2214,7 +2214,7 @@ namespace FourSlash { * Because codefixes are only applied on the working file, it is unsafe * to apply this more than once (consider a refactoring across files). */ - public verifyRangeAfterCodeFix(expectedText: string, errorCode?: number, includeWhiteSpace?: boolean) { + public verifyRangeAfterCodeFix(expectedText: string, includeWhiteSpace?: boolean, errorCode?: number, index?: number) { const ranges = this.getRanges(); if (ranges.length !== 1) { this.raiseError("Exactly one range should be specified in the testfile."); @@ -2222,7 +2222,7 @@ namespace FourSlash { const fileName = this.activeFile.fileName; - this.applyCodeFixActions(fileName, this.getCodeFixActions(fileName, errorCode)); + this.applyCodeAction(fileName, this.getCodeFixActions(fileName, errorCode), index); const actualText = this.rangeText(ranges[0]); @@ -2247,7 +2247,7 @@ namespace FourSlash { public verifyFileAfterCodeFix(expectedContents: string, fileName?: string) { fileName = fileName ? fileName : this.activeFile.fileName; - this.applyCodeFixActions(fileName, this.getCodeFixActions(fileName)); + this.applyCodeAction(fileName, this.getCodeFixActions(fileName)); const actualContents: string = this.getFileContent(fileName); if (this.removeWhitespace(actualContents) !== this.removeWhitespace(expectedContents)) { @@ -2285,12 +2285,20 @@ namespace FourSlash { return actions; } - private applyCodeFixActions(fileName: string, actions: ts.CodeAction[]): void { - if (!(actions && actions.length === 1)) { - this.raiseError(`Should find exactly one codefix, but ${actions ? actions.length : "none"} found.`); + private applyCodeAction(fileName: string, actions: ts.CodeAction[], index?: number): void { + if (index === undefined) { + if (!(actions && actions.length === 1)) { + this.raiseError(`Should find exactly one codefix, but ${actions ? actions.length : "none"} found.`); + } + index = 0; + } + else { + if (!(actions && actions.length >= index + 1)) { + this.raiseError(`Should find at least ${index + 1} codefix(es), but ${actions ? actions.length : "none"} found.`); + } } - const fileChanges = ts.find(actions[0].changes, change => change.fileName === fileName); + const fileChanges = ts.find(actions[index].changes, change => change.fileName === fileName); if (!fileChanges) { this.raiseError("The CodeFix found doesn't provide any changes in this file."); } @@ -3631,8 +3639,8 @@ namespace FourSlashInterface { this.DocCommentTemplate(/*expectedText*/ undefined, /*expectedOffset*/ undefined, /*empty*/ true); } - public rangeAfterCodeFix(expectedText: string, errorCode?: number, includeWhiteSpace?: boolean): void { - this.state.verifyRangeAfterCodeFix(expectedText, errorCode, includeWhiteSpace); + public rangeAfterCodeFix(expectedText: string, includeWhiteSpace?: boolean, errorCode?: number, index?: number): void { + this.state.verifyRangeAfterCodeFix(expectedText, includeWhiteSpace, errorCode, index); } public importFixAtPosition(expectedTextArray: string[], errorCode?: number): void { diff --git a/src/harness/tsconfig.json b/src/harness/tsconfig.json index bea688d358b..32af0eb2601 100644 --- a/src/harness/tsconfig.json +++ b/src/harness/tsconfig.json @@ -77,8 +77,8 @@ "../services/codefixes/helpers.ts", "../services/codefixes/importFixes.ts", "../services/codefixes/unusedIdentifierFixes.ts", - "../services/harness.ts", + "harness.ts", "sourceMapRecorder.ts", "harnessLanguageService.ts", "fourslash.ts", @@ -119,6 +119,8 @@ "./unittests/compileOnSave.ts", "./unittests/typingsInstaller.ts", "./unittests/projectErrors.ts", - "./unittests/printer.ts" + "./unittests/printer.ts", + "./unittests/transform.ts", + "./unittests/customTransforms.ts" ] } diff --git a/src/harness/unittests/commandLineParsing.ts b/src/harness/unittests/commandLineParsing.ts index 1895fe2d60e..61b96d89553 100644 --- a/src/harness/unittests/commandLineParsing.ts +++ b/src/harness/unittests/commandLineParsing.ts @@ -60,7 +60,7 @@ namespace ts { assertParseResult(["--lib", "es5,invalidOption", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string'", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'esnext.asynciterable'.", category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, @@ -87,7 +87,7 @@ namespace ts { start: undefined, length: undefined, }, { - messageText: "Argument for '--jsx' option must be: 'preserve', 'react-native', 'react'", + messageText: "Argument for '--jsx' option must be: 'preserve', 'react-native', 'react'.", category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, @@ -113,7 +113,7 @@ namespace ts { start: undefined, length: undefined, }, { - messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015'", + messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015'.", category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, @@ -139,7 +139,7 @@ namespace ts { start: undefined, length: undefined, }, { - messageText: "Argument for '--newLine' option must be: 'crlf', 'lf'", + messageText: "Argument for '--newLine' option must be: 'crlf', 'lf'.", category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, @@ -165,7 +165,7 @@ namespace ts { start: undefined, length: undefined, }, { - messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'esnext'", + messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'esnext'.", category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, @@ -191,7 +191,7 @@ namespace ts { start: undefined, length: undefined, }, { - messageText: "Argument for '--moduleResolution' option must be: 'node', 'classic'", + messageText: "Argument for '--moduleResolution' option must be: 'node', 'classic'.", category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, @@ -263,7 +263,7 @@ namespace ts { assertParseResult(["--lib", "es5,", "es7", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string'", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'esnext.asynciterable'.", category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, @@ -283,7 +283,7 @@ namespace ts { assertParseResult(["--lib", "es5, ", "es7", "0.ts"], { errors: [{ - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string'", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'esnext.asynciterable'.", category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, diff --git a/src/harness/unittests/convertCompilerOptionsFromJson.ts b/src/harness/unittests/convertCompilerOptionsFromJson.ts index 4e442173883..0409ee19e66 100644 --- a/src/harness/unittests/convertCompilerOptionsFromJson.ts +++ b/src/harness/unittests/convertCompilerOptionsFromJson.ts @@ -94,7 +94,7 @@ namespace ts { file: undefined, start: 0, length: 0, - messageText: "Argument for '--jsx' option must be: 'preserve', 'react-native', 'react'", + messageText: "Argument for '--jsx' option must be: 'preserve', 'react-native', 'react'.", code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category }] @@ -122,7 +122,7 @@ namespace ts { file: undefined, start: 0, length: 0, - messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015'", + messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015'.", code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category }] @@ -150,7 +150,7 @@ namespace ts { file: undefined, start: 0, length: 0, - messageText: "Argument for '--newLine' option must be: 'crlf', 'lf'", + messageText: "Argument for '--newLine' option must be: 'crlf', 'lf'.", code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category }] @@ -176,7 +176,7 @@ namespace ts { file: undefined, start: 0, length: 0, - messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'esnext'", + messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'esnext'.", code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category }] @@ -202,7 +202,7 @@ namespace ts { file: undefined, start: 0, length: 0, - messageText: "Argument for '--moduleResolution' option must be: 'node', 'classic'", + messageText: "Argument for '--moduleResolution' option must be: 'node', 'classic'.", code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category }] @@ -233,7 +233,7 @@ namespace ts { file: undefined, start: 0, length: 0, - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string'", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'esnext.asynciterable'.", code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category }] @@ -264,7 +264,7 @@ namespace ts { file: undefined, start: 0, length: 0, - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string'", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'esnext.asynciterable'.", code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category }] @@ -295,7 +295,7 @@ namespace ts { file: undefined, start: 0, length: 0, - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string'", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'esnext.asynciterable'.", code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category }] @@ -326,7 +326,7 @@ namespace ts { file: undefined, start: 0, length: 0, - messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string'", + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'esnext.asynciterable'.", code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category }] diff --git a/src/harness/unittests/customTransforms.ts b/src/harness/unittests/customTransforms.ts new file mode 100644 index 00000000000..4b05ebb9ea7 --- /dev/null +++ b/src/harness/unittests/customTransforms.ts @@ -0,0 +1,86 @@ +/// +/// + +namespace ts { + describe("customTransforms", () => { + function emitsCorrectly(name: string, sources: { file: string, text: string }[], customTransformers: CustomTransformers) { + it(name, () => { + const roots = sources.map(source => createSourceFile(source.file, source.text, ScriptTarget.ES2015)); + const fileMap = arrayToMap(roots, file => file.fileName); + const outputs = createMap(); + const options: CompilerOptions = {}; + const host: CompilerHost = { + getSourceFile: (fileName) => fileMap.get(fileName), + getDefaultLibFileName: () => "lib.d.ts", + getCurrentDirectory: () => "", + getDirectories: () => [], + getCanonicalFileName: (fileName) => fileName, + useCaseSensitiveFileNames: () => true, + getNewLine: () => "\n", + fileExists: (fileName) => fileMap.has(fileName), + readFile: (fileName) => fileMap.has(fileName) ? fileMap.get(fileName).text : undefined, + writeFile: (fileName, text) => outputs.set(fileName, text), + }; + + const program = createProgram(arrayFrom(fileMap.keys()), options, host); + program.emit(/*targetSourceFile*/ undefined, host.writeFile, /*cancellationToken*/ undefined, /*emitOnlyDtsFiles*/ false, customTransformers); + Harness.Baseline.runBaseline(`customTransforms/${name}.js`, () => { + let content = ""; + for (const [file, text] of arrayFrom(outputs.entries())) { + if (content) content += "\n\n"; + content += `// [${file}]\n`; + content += text; + } + return content; + }); + }); + } + + const sources = [{ + file: "source.ts", + text: ` + function f1() { } + class c() { } + enum e { } + // leading + function f2() { } // trailing + ` + }]; + + const before: TransformerFactory = context => { + return file => visitEachChild(file, visit, context); + function visit(node: Node): VisitResult { + switch (node.kind) { + case SyntaxKind.FunctionDeclaration: + return visitFunction(node); + default: + return visitEachChild(node, visit, context); + } + } + function visitFunction(node: FunctionDeclaration) { + addSyntheticLeadingComment(node, SyntaxKind.MultiLineCommentTrivia, "@before", /*hasTrailingNewLine*/ true); + return node; + } + }; + + const after: TransformerFactory = context => { + return file => visitEachChild(file, visit, context); + function visit(node: Node): VisitResult { + switch (node.kind) { + case SyntaxKind.VariableStatement: + return visitVariableStatement(node); + default: + return visitEachChild(node, visit, context); + } + } + function visitVariableStatement(node: VariableStatement) { + addSyntheticLeadingComment(node, SyntaxKind.SingleLineCommentTrivia, "@after"); + return node; + } + }; + + emitsCorrectly("before", sources, { before: [before] }); + emitsCorrectly("after", sources, { after: [after] }); + emitsCorrectly("both", sources, { before: [before], after: [after] }); + }); +} \ No newline at end of file diff --git a/src/harness/unittests/transform.ts b/src/harness/unittests/transform.ts new file mode 100644 index 00000000000..ae2caf4f23b --- /dev/null +++ b/src/harness/unittests/transform.ts @@ -0,0 +1,43 @@ +/// +/// + +namespace ts { + describe("TransformAPI", () => { + function transformsCorrectly(name: string, source: string, transformers: TransformerFactory[]) { + it(name, () => { + Harness.Baseline.runBaseline(`transformApi/transformsCorrectly.${name}.js`, () => { + const transformed = transform(createSourceFile("source.ts", source, ScriptTarget.ES2015), transformers); + const printer = createPrinter({ newLine: NewLineKind.CarriageReturnLineFeed }, { + onEmitNode: transformed.emitNodeWithNotification, + substituteNode: transformed.substituteNode + }); + const result = printer.printBundle(createBundle(transformed.transformed)); + transformed.dispose(); + return result; + }); + }); + } + + transformsCorrectly("substitution", ` + var a = undefined; + `, [ + context => { + const previousOnSubstituteNode = context.onSubstituteNode; + context.enableSubstitution(SyntaxKind.Identifier); + context.onSubstituteNode = (hint, node) => { + node = previousOnSubstituteNode(hint, node); + if (hint === EmitHint.Expression && node.kind === SyntaxKind.Identifier && (node).text === "undefined") { + node = createPartiallyEmittedExpression( + addSyntheticTrailingComment( + setTextRange( + createVoidZero(), + node), + SyntaxKind.MultiLineCommentTrivia, "undefined")); + } + return node; + }; + return file => file; + } + ]); + }); +} diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 92ec0b4ee0e..7446cc84deb 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -3035,6 +3035,33 @@ namespace ts.projectSystem { const inferredProject = projectService.inferredProjects[0]; assert.isTrue(inferredProject.containsFile(file1.path)); }); + + it("should be able to handle @types if input file list is empty", () => { + const f = { + path: "/a/app.ts", + content: "let x = 1" + }; + const config = { + path: "/a/tsconfig.json", + content: JSON.stringify({ + compiler: {}, + files: [] + }) + }; + const t1 = { + path: "/a/node_modules/@types/typings/index.d.ts", + content: `export * from "./lib"` + }; + const t2 = { + path: "/a/node_modules/@types/typings/lib.d.ts", + content: `export const x: number` + }; + const host = createServerHost([f, config, t1, t2], { currentDirectory: getDirectoryPath(f.path) }); + const projectService = createProjectService(host); + + projectService.openClientFile(f.path); + projectService.checkNumberOfProjects({ configuredProjects: 1, inferredProjects: 1 }); + }); }); describe("reload", () => { diff --git a/src/lib/es2015.iterable.d.ts b/src/lib/es2015.iterable.d.ts index c8b5158bcd6..247017bae7d 100644 --- a/src/lib/es2015.iterable.d.ts +++ b/src/lib/es2015.iterable.d.ts @@ -1,8 +1,8 @@ /// interface SymbolConstructor { - /** - * A method that returns the default iterator for an object. Called by the semantics of the + /** + * A method that returns the default iterator for an object. Called by the semantics of the * for-of statement. */ readonly iterator: symbol; @@ -31,17 +31,17 @@ interface Array { /** Iterator */ [Symbol.iterator](): IterableIterator; - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, T]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -55,7 +55,7 @@ interface ArrayConstructor { * @param thisArg Value of 'this' used to invoke the mapfn. */ from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - + /** * Creates an array from an iterable object. * @param iterable An iterable object to convert to an array. @@ -67,17 +67,17 @@ interface ReadonlyArray { /** Iterator */ [Symbol.iterator](): IterableIterator; - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, T]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -126,15 +126,15 @@ interface Promise { } interface PromiseConstructor { /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises + * Creates a Promise that is resolved with an array of results when all of the provided Promises * resolve, or rejected when any Promise is rejected. * @param values An array of Promises. * @returns A new Promise. */ all(values: Iterable>): Promise; - + /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved * or rejected. * @param values An array of Promises. * @returns A new Promise. @@ -152,20 +152,20 @@ interface String { } /** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Int8Array { [Symbol.iterator](): IterableIterator; - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -184,20 +184,20 @@ interface Int8ArrayConstructor { } /** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint8Array { [Symbol.iterator](): IterableIterator; - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -216,22 +216,22 @@ interface Uint8ArrayConstructor { } /** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. * If the requested number of bytes could not be allocated an exception is raised. */ interface Uint8ClampedArray { [Symbol.iterator](): IterableIterator; - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -251,22 +251,22 @@ interface Uint8ClampedArrayConstructor { } /** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int16Array { [Symbol.iterator](): IterableIterator; - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -285,20 +285,20 @@ interface Int16ArrayConstructor { } /** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint16Array { [Symbol.iterator](): IterableIterator; - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -317,20 +317,20 @@ interface Uint16ArrayConstructor { } /** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int32Array { [Symbol.iterator](): IterableIterator; - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -349,20 +349,20 @@ interface Int32ArrayConstructor { } /** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint32Array { [Symbol.iterator](): IterableIterator; - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -386,15 +386,15 @@ interface Uint32ArrayConstructor { */ interface Float32Array { [Symbol.iterator](): IterableIterator; - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -413,20 +413,20 @@ interface Float32ArrayConstructor { } /** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Float64Array { [Symbol.iterator](): IterableIterator; - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; diff --git a/src/lib/es2017.d.ts b/src/lib/es2017.d.ts index c234a9edb24..7b8c7cbb7d5 100644 --- a/src/lib/es2017.d.ts +++ b/src/lib/es2017.d.ts @@ -1,4 +1,4 @@ /// /// /// -/// +/// \ No newline at end of file diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 8f29deb67db..262c2ba21fe 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -140,7 +140,7 @@ interface ObjectConstructor { * Creates an object that has the specified prototype or that has null prototype. * @param o Object to use as a prototype. May be null. */ - create(o: T | null): T | object; + create(o: object | null): any; /** * Creates an object that has the specified prototype, and that optionally contains specified properties. diff --git a/src/lib/esnext.asynciterable.d.ts b/src/lib/esnext.asynciterable.d.ts new file mode 100644 index 00000000000..8379ba5ba6c --- /dev/null +++ b/src/lib/esnext.asynciterable.d.ts @@ -0,0 +1,24 @@ +/// +/// + +interface SymbolConstructor { + /** + * A method that returns the default async iterator for an object. Called by the semantics of + * the for-await-of statement. + */ + readonly asyncIterator: symbol; +} + +interface AsyncIterator { + next(value?: any): Promise>; + return?(value?: any): Promise>; + throw?(e?: any): Promise>; +} + +interface AsyncIterable { + [Symbol.asyncIterator](): AsyncIterator; +} + +interface AsyncIterableIterator extends AsyncIterator { + [Symbol.asyncIterator](): AsyncIterableIterator; +} \ No newline at end of file diff --git a/src/lib/esnext.d.ts b/src/lib/esnext.d.ts new file mode 100644 index 00000000000..71fab82a866 --- /dev/null +++ b/src/lib/esnext.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 36aa3939c83..d0535e2f528 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -948,9 +948,9 @@ namespace ts.server { private openConfigFile(configFileName: NormalizedPath, clientFileName?: string): OpenConfigFileResult { const conversionResult = this.convertConfigFileContentToProjectOptions(configFileName); - const projectOptions = conversionResult.success + const projectOptions: ProjectOptions = conversionResult.success ? conversionResult.projectOptions - : { files: [], compilerOptions: {} }; + : { files: [], compilerOptions: {}, typeAcquisition: { enable: false } }; const project = this.createAndAddConfiguredProject(configFileName, projectOptions, conversionResult.configFileErrors, clientFileName); return { success: conversionResult.success, diff --git a/src/server/protocol.ts b/src/server/protocol.ts index d8faad28b10..c7d27d80d25 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -820,7 +820,7 @@ namespace ts.server.protocol { * Represents a file in external project. * External project is project whose set of files, compilation options and open\close state * is maintained by the client (i.e. if all this data come from .csproj file in Visual Studio). - * External project will exist even if all files in it are closed and should be closed explicity. + * External project will exist even if all files in it are closed and should be closed explicitly. * If external project includes one or more tsconfig.json/jsconfig.json files then tsserver will * create configured project for every config file but will maintain a link that these projects were created * as a result of opening external project so they should be removed once external project is closed. diff --git a/src/server/server.ts b/src/server/server.ts index d828a717a41..2a5990f4252 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -12,6 +12,7 @@ namespace ts.server { const childProcess: { fork(modulePath: string, args: string[], options?: { execArgv: string[], env?: MapLike }): NodeChildProcess; + execFileSync(file: string, args: string[], options: { stdio: "ignore", env: MapLike }): string | Buffer; } = require("child_process"); const os: { @@ -59,7 +60,7 @@ namespace ts.server { interface NodeChildProcess { send(message: any, sendHandle?: any): void; - on(message: "message", f: (m: any) => void): void; + on(message: "message" | "exit", f: (m: any) => void): void; kill(): void; pid: number; } @@ -576,7 +577,84 @@ namespace ts.server { } } + function extractWatchDirectoryCacheKey(path: string, currentDriveKey: string) { + path = normalizeSlashes(path); + if (isUNCPath(path)) { + // UNC path: extract server name + // //server/location + // ^ <- from 0 to this position + const firstSlash = path.indexOf(directorySeparator, 2); + return firstSlash !== -1 ? path.substring(0, firstSlash).toLowerCase() : path; + } + const rootLength = getRootLength(path); + if (rootLength === 0) { + // relative path - assume file is on the current drive + return currentDriveKey; + } + if (path.charCodeAt(1) === CharacterCodes.colon && path.charCodeAt(2) === CharacterCodes.slash) { + // rooted path that starts with c:/... - extract drive letter + return path.charAt(0).toLowerCase(); + } + if (path.charCodeAt(0) === CharacterCodes.slash && path.charCodeAt(1) !== CharacterCodes.slash) { + // rooted path that starts with slash - /somename - use key for current drive + return currentDriveKey; + } + // do not cache any other cases + return undefined; + } + + function isUNCPath(s: string): boolean { + return s.length > 2 && s.charCodeAt(0) === CharacterCodes.slash && s.charCodeAt(1) === CharacterCodes.slash; + } + const sys = ts.sys; + // use watchGuard process on Windows when node version is 4 or later + const useWatchGuard = process.platform === "win32" && getNodeMajorVersion() >= 4; + if (useWatchGuard) { + const currentDrive = extractWatchDirectoryCacheKey(sys.resolvePath(sys.getCurrentDirectory()), /*currentDriveKey*/ undefined); + const statusCache = createMap(); + const originalWatchDirectory = sys.watchDirectory; + sys.watchDirectory = function (path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher { + const cacheKey = extractWatchDirectoryCacheKey(path, currentDrive); + let status = cacheKey && statusCache.get(cacheKey); + if (status === undefined) { + if (logger.hasLevel(LogLevel.verbose)) { + logger.info(`${cacheKey} for path ${path} not found in cache...`); + } + try { + const args = [combinePaths(__dirname, "watchGuard.js"), path]; + if (logger.hasLevel(LogLevel.verbose)) { + logger.info(`Starting ${process.execPath} with args ${JSON.stringify(args)}`); + } + childProcess.execFileSync(process.execPath, args, { stdio: "ignore", env: { "ELECTRON_RUN_AS_NODE": "1" } }); + status = true; + if (logger.hasLevel(LogLevel.verbose)) { + logger.info(`WatchGuard for path ${path} returned: OK`); + } + } + catch (e) { + status = false; + if (logger.hasLevel(LogLevel.verbose)) { + logger.info(`WatchGuard for path ${path} returned: ${e.message}`); + } + } + if (cacheKey) { + statusCache.set(cacheKey, status); + } + } + else if (logger.hasLevel(LogLevel.verbose)) { + logger.info(`watchDirectory for ${path} uses cached drive information.`); + } + if (status) { + // this drive is safe to use - call real 'watchDirectory' + return originalWatchDirectory.call(sys, path, callback, recursive); + } + else { + // this drive is unsafe - return no-op watcher + return { close() { } }; + } + } + } // Override sys.write because fs.writeSync is not reliable on Node 4 sys.write = (s: string) => writeMessage(new Buffer(s, "utf8")); diff --git a/src/server/session.ts b/src/server/session.ts index 262ba8da1da..f1b373c4a90 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1412,6 +1412,9 @@ namespace ts.server { } private getCodeFixes(args: protocol.CodeFixRequestArgs, simplifiedResult: boolean): protocol.CodeAction[] | CodeAction[] { + if (args.errorCodes.length === 0) { + return undefined; + } const { file, project } = this.getFileAndProjectWithoutRefreshingInferredProjects(args); const scriptInfo = project.getScriptInfoForNormalizedPath(file); diff --git a/src/server/watchGuard/tsconfig.json b/src/server/watchGuard/tsconfig.json new file mode 100644 index 00000000000..ef9b0ab0603 --- /dev/null +++ b/src/server/watchGuard/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig-base", + "compilerOptions": { + "removeComments": true, + "outFile": "../../../built/local/watchGuard.js" + }, + "files": [ + "watchGuard.ts" + ] +} \ No newline at end of file diff --git a/src/server/watchGuard/watchGuard.ts b/src/server/watchGuard/watchGuard.ts new file mode 100644 index 00000000000..7a0307a9120 --- /dev/null +++ b/src/server/watchGuard/watchGuard.ts @@ -0,0 +1,19 @@ +/// + +if (process.argv.length < 3) { + process.exit(1); +} +const directoryName = process.argv[2]; +const fs: { watch(directoryName: string, options: any, callback: () => {}): any } = require("fs"); +// main reason why we need separate process to check if it is safe to watch some path +// is to guard against crashes that cannot be intercepted with protected blocks and +// code in tsserver already can handle normal cases, like non-existing folders. +// This means that here we treat any result (success or exception) from fs.watch as success since it does not tear down the process. +// The only case that should be considered as failure - when watchGuard process crashes. +try { + const watcher = fs.watch(directoryName, { recursive: true }, () => ({})) + watcher.close(); +} +catch (_e) { +} +process.exit(0); \ No newline at end of file diff --git a/src/services/codefixes/fixAddMissingMember.ts b/src/services/codefixes/fixAddMissingMember.ts new file mode 100644 index 00000000000..6ae2ba3f51c --- /dev/null +++ b/src/services/codefixes/fixAddMissingMember.ts @@ -0,0 +1,67 @@ +/* @internal */ +namespace ts.codefix { + registerCodeFix({ + errorCodes: [Diagnostics.Property_0_does_not_exist_on_type_1.code], + getCodeActions: getActionsForAddMissingMember + }); + + function getActionsForAddMissingMember(context: CodeFixContext): CodeAction[] | undefined { + + const sourceFile = context.sourceFile; + const start = context.span.start; + // This is the identifier of the missing property. eg: + // this.missing = 1; + // ^^^^^^^ + const token = getTokenAtPosition(sourceFile, start); + + if (token.kind != SyntaxKind.Identifier) { + return undefined; + } + + const classDeclaration = getContainingClass(token); + if (!classDeclaration) { + return undefined; + } + + if (!(token.parent && token.parent.kind === SyntaxKind.PropertyAccessExpression)) { + return undefined; + } + + if ((token.parent as PropertyAccessExpression).expression.kind !== SyntaxKind.ThisKeyword) { + return undefined; + } + + let typeString = "any"; + + if (token.parent.parent.kind === SyntaxKind.BinaryExpression) { + const binaryExpression = token.parent.parent as BinaryExpression; + + const checker = context.program.getTypeChecker(); + const widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(binaryExpression.right))); + typeString = checker.typeToString(widenedType); + } + + const startPos = classDeclaration.members.pos; + + return [{ + description: formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Add_declaration_for_missing_property_0), [token.getText()]), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: startPos, length: 0 }, + newText: `${token.getFullText(sourceFile)}: ${typeString};` + }] + }] + }, + { + description: formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Add_index_signature_for_missing_property_0), [token.getText()]), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: startPos, length: 0 }, + newText: `[name: string]: ${typeString};` + }] + }] + }]; + } +} \ No newline at end of file diff --git a/src/services/codefixes/fixes.ts b/src/services/codefixes/fixes.ts index 3bd173e04f6..76be34c67cd 100644 --- a/src/services/codefixes/fixes.ts +++ b/src/services/codefixes/fixes.ts @@ -1,4 +1,5 @@ /// +/// /// /// /// diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index 7bee4f5a0ed..3eab994f84c 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -32,7 +32,7 @@ namespace ts.codefix { const declaration = declarations[0] as Declaration; const name = declaration.name ? declaration.name.getText() : undefined; - const visibility = getVisibilityPrefix(getModifierFlags(declaration)); + const visibility = getVisibilityPrefixWithSpace(getModifierFlags(declaration)); switch (declaration.kind) { case SyntaxKind.GetAccessor: @@ -58,7 +58,7 @@ namespace ts.codefix { if (declarations.length === 1) { Debug.assert(signatures.length === 1); const sigString = checker.signatureToString(signatures[0], enclosingDeclaration, TypeFormatFlags.SuppressAnyReturnType, SignatureKind.Call); - return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; + return getStubbedMethod(visibility, name, sigString, newlineChar); } let result = ""; @@ -78,7 +78,7 @@ namespace ts.codefix { bodySig = createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker); } const sigString = checker.signatureToString(bodySig, enclosingDeclaration, TypeFormatFlags.SuppressAnyReturnType, SignatureKind.Call); - result += `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; + result += getStubbedMethod(visibility, name, sigString, newlineChar); return result; default: @@ -138,11 +138,15 @@ namespace ts.codefix { } } - function getMethodBodyStub(newLineChar: string) { - return ` {${newLineChar}throw new Error('Method not implemented.');${newLineChar}}${newLineChar}`; + export function getStubbedMethod(visibility: string, name: string, sigString = "()", newlineChar: string): string { + return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; } - function getVisibilityPrefix(flags: ModifierFlags): string { + function getMethodBodyStub(newlineChar: string) { + return ` {${newlineChar}throw new Error('Method not implemented.');${newlineChar}}${newlineChar}`; + } + + function getVisibilityPrefixWithSpace(flags: ModifierFlags): string { if (flags & ModifierFlags.Public) { return "public "; } diff --git a/src/services/goToDefinition.ts b/src/services/goToDefinition.ts index 0ac6c9f7812..b732d8a1193 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -198,7 +198,11 @@ namespace ts.GoToDefinition { return false; } - function tryAddSignature(signatureDeclarations: Declaration[], selectConstructors: boolean, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) { + function tryAddSignature(signatureDeclarations: Declaration[] | undefined, selectConstructors: boolean, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) { + if (!signatureDeclarations) { + return false; + } + const declarations: Declaration[] = []; let definition: Declaration | undefined; diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 2ad20a7ed0c..43054a10f5d 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -67,10 +67,10 @@ namespace ts.OutliningElementsCollector { // Only outline spans of two or more consecutive single line comments if (count > 1) { - const multipleSingleLineComments = { + const multipleSingleLineComments: CommentRange = { + kind: SyntaxKind.SingleLineCommentTrivia, pos: start, end: end, - kind: SyntaxKind.SingleLineCommentTrivia }; addOutliningSpanComments(multipleSingleLineComments, /*autoCollapse*/ false); diff --git a/src/services/services.ts b/src/services/services.ts index 3df457fe729..2e617f39662 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -411,7 +411,7 @@ namespace ts { getDeclaration(): SignatureDeclaration { return this.declaration; } - getTypeParameters(): Type[] { + getTypeParameters(): TypeParameter[] { return this.typeParameters; } getParameters(): Symbol[] { @@ -1440,7 +1440,8 @@ namespace ts { }); } - const emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles); + const customTransformers = host.getCustomTransformers && host.getCustomTransformers(); + const emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers); return { outputFiles, diff --git a/src/services/transform.ts b/src/services/transform.ts new file mode 100644 index 00000000000..07fc3c759e2 --- /dev/null +++ b/src/services/transform.ts @@ -0,0 +1,18 @@ +/// +/// +namespace ts { + /** + * Transform one or more nodes using the supplied transformers. + * @param source A single `Node` or an array of `Node` objects. + * @param transformers An array of `TransformerFactory` callbacks used to process the transformation. + * @param compilerOptions Optional compiler options. + */ + export function transform(source: T | T[], transformers: TransformerFactory[], compilerOptions?: CompilerOptions) { + const diagnostics: Diagnostic[] = []; + compilerOptions = fixupCompilerOptions(compilerOptions, diagnostics); + const nodes = isArray(source) ? source : [source]; + const result = transformNodes(/*resolver*/ undefined, /*emitHost*/ undefined, compilerOptions, nodes, transformers, /*allowDtsFiles*/ true); + result.diagnostics = concatenate(result.diagnostics, diagnostics); + return result; + } +} \ No newline at end of file diff --git a/src/services/transpile.ts b/src/services/transpile.ts index 0b90e9d030b..86c6a3e8904 100644 --- a/src/services/transpile.ts +++ b/src/services/transpile.ts @@ -123,7 +123,8 @@ let commandLineOptionsStringToEnum: CommandLineOptionOfCustomType[]; /** JS users may pass in string values for enum compiler options (such as ModuleKind), so convert. */ - function fixupCompilerOptions(options: CompilerOptions, diagnostics: Diagnostic[]): CompilerOptions { + /*@internal*/ + export function fixupCompilerOptions(options: CompilerOptions, diagnostics: Diagnostic[]): CompilerOptions { // Lazily create this value to fix module loading errors. commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || filter(optionDeclarations, o => typeof o.type === "object" && !forEachEntry(o.type, v => typeof v !== "number")); diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index 9ebd3102efe..2afdab3b541 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -57,6 +57,7 @@ "preProcess.ts", "rename.ts", "services.ts", + "transform.ts", "transpile.ts", "shims.ts", "signatureHelp.ts", @@ -78,6 +79,7 @@ "formatting/smartIndenter.ts", "formatting/tokenRange.ts", "codeFixProvider.ts", + "codefixes/fixAddMissingMember.ts", "codefixes/fixExtendsInterfaceBecomesImplements.ts", "codefixes/fixClassIncorrectlyImplementsInterface.ts", "codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", diff --git a/src/services/types.ts b/src/services/types.ts index a6ca3852597..9253153c004 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -39,7 +39,7 @@ namespace ts { export interface Signature { getDeclaration(): SignatureDeclaration; - getTypeParameters(): Type[]; + getTypeParameters(): TypeParameter[]; getParameters(): Symbol[]; getReturnType(): Type; getDocumentationComment(): SymbolDisplayPart[]; @@ -170,6 +170,11 @@ namespace ts { * completions will not be provided */ getDirectories?(directoryName: string): string[]; + + /** + * Gets a set of custom transformers to use during emit. + */ + getCustomTransformers?(): CustomTransformers | undefined; } // diff --git a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.errors.txt index 6e65d46b9be..af0c9b14841 100644 --- a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.errors.txt +++ b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged +tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. ==== tests/cases/conformance/internalModules/DeclarationMerging/class.ts (0 errors) ==== @@ -17,7 +17,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): erro module X.Y { export module Point { ~~~~~ -!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged +!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. export var Origin = new Point(0, 0); } } diff --git a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRootES6.errors.txt b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRootES6.errors.txt index 6e65d46b9be..af0c9b14841 100644 --- a/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRootES6.errors.txt +++ b/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRootES6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged +tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. ==== tests/cases/conformance/internalModules/DeclarationMerging/class.ts (0 errors) ==== @@ -17,7 +17,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): erro module X.Y { export module Point { ~~~~~ -!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged +!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. export var Origin = new Point(0, 0); } } diff --git a/tests/baselines/reference/ClassDeclaration24.errors.txt b/tests/baselines/reference/ClassDeclaration24.errors.txt index 62d26eb792a..1584fce4b38 100644 --- a/tests/baselines/reference/ClassDeclaration24.errors.txt +++ b/tests/baselines/reference/ClassDeclaration24.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/ClassDeclaration24.ts(1,7): error TS2414: Class name cannot be 'any' +tests/cases/compiler/ClassDeclaration24.ts(1,7): error TS2414: Class name cannot be 'any'. ==== tests/cases/compiler/ClassDeclaration24.ts (1 errors) ==== class any { ~~~ -!!! error TS2414: Class name cannot be 'any' +!!! error TS2414: Class name cannot be 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of20.errors.txt b/tests/baselines/reference/ES5For-of20.errors.txt index 772d5143a04..d58aa6c781f 100644 --- a/tests/baselines/reference/ES5For-of20.errors.txt +++ b/tests/baselines/reference/ES5For-of20.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts(3,20): error TS2448: Block-scoped variable 'v' used before its declaration. -tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts(4,15): error TS1155: 'const' declarations must be initialized +tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts(4,15): error TS1155: 'const' declarations must be initialized. ==== tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts (2 errors) ==== @@ -10,6 +10,6 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts(4,15): error !!! error TS2448: Block-scoped variable 'v' used before its declaration. const v; ~ -!!! error TS1155: 'const' declarations must be initialized +!!! error TS1155: 'const' declarations must be initialized. } } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of33.errors.txt b/tests/baselines/reference/ES5For-of33.errors.txt new file mode 100644 index 00000000000..02ba889c542 --- /dev/null +++ b/tests/baselines/reference/ES5For-of33.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of33.ts(2,5): error TS2304: Cannot find name 'console'. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of33.ts (1 errors) ==== + for (var v of ['a', 'b', 'c']) { + console.log(v); + ~~~~~~~ +!!! error TS2304: Cannot find name 'console'. + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of33.js b/tests/baselines/reference/ES5For-of33.js new file mode 100644 index 00000000000..729c37b8120 --- /dev/null +++ b/tests/baselines/reference/ES5For-of33.js @@ -0,0 +1,31 @@ +//// [ES5For-of33.ts] +for (var v of ['a', 'b', 'c']) { + console.log(v); +} + +//// [ES5For-of33.js] +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +try { + for (var _a = __values(['a', 'b', 'c']), _b = _a.next(); !_b.done; _b = _a.next()) { + var v = _b.value; + console.log(v); + } +} +catch (e_1_1) { e_1 = { error: e_1_1 }; } +finally { + try { + if (_b && !_b.done && (_c = _a["return"])) _c.call(_a); + } + finally { if (e_1) throw e_1.error; } +} +var e_1, _c; +//# sourceMappingURL=ES5For-of33.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of33.js.map b/tests/baselines/reference/ES5For-of33.js.map new file mode 100644 index 00000000000..5d5969b4585 --- /dev/null +++ b/tests/baselines/reference/ES5For-of33.js.map @@ -0,0 +1,2 @@ +//// [ES5For-of33.js.map] +{"version":3,"file":"ES5For-of33.js","sourceRoot":"","sources":["ES5For-of33.ts"],"names":[],"mappings":";;;;;;;;;;;IAAA,GAAG,CAAC,CAAU,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA;QAAxB,IAAI,CAAC,WAAA;QACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAClB"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of33.sourcemap.txt b/tests/baselines/reference/ES5For-of33.sourcemap.txt new file mode 100644 index 00000000000..12dd243cf0e --- /dev/null +++ b/tests/baselines/reference/ES5For-of33.sourcemap.txt @@ -0,0 +1,128 @@ +=================================================================== +JsFile: ES5For-of33.js +mapUrl: ES5For-of33.js.map +sourceRoot: +sources: ES5For-of33.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of33.js +sourceFile:ES5For-of33.ts +------------------------------------------------------------------- +>>>var __values = (this && this.__values) || function (o) { +>>> var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +>>> if (m) return m.call(o); +>>> return { +>>> next: function () { +>>> if (o && i >= o.length) o = void 0; +>>> return { value: o && o[i++], done: !o }; +>>> } +>>> }; +>>>}; +>>>try { +>>> for (var _a = __values(['a', 'b', 'c']), _b = _a.next(); !_b.done; _b = _a.next()) { +1 >^^^^ +2 > ^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^ +7 > ^^^^^^^^^ +8 > ^ +9 > ^^^ +10> ^^ +11> ^^^ +12> ^^ +13> ^^^ +14> ^ +15> ^ +16> ^^^^^^^^^^^^^^^^ +1 > +2 > for +3 > +4 > (var v of +5 > +6 > +7 > +8 > [ +9 > 'a' +10> , +11> 'b' +12> , +13> 'c' +14> ] +15> +16> +1 >Emitted(12, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(12, 8) Source(1, 4) + SourceIndex(0) +3 >Emitted(12, 9) Source(1, 5) + SourceIndex(0) +4 >Emitted(12, 10) Source(1, 15) + SourceIndex(0) +5 >Emitted(12, 14) Source(1, 15) + SourceIndex(0) +6 >Emitted(12, 19) Source(1, 15) + SourceIndex(0) +7 >Emitted(12, 28) Source(1, 15) + SourceIndex(0) +8 >Emitted(12, 29) Source(1, 16) + SourceIndex(0) +9 >Emitted(12, 32) Source(1, 19) + SourceIndex(0) +10>Emitted(12, 34) Source(1, 21) + SourceIndex(0) +11>Emitted(12, 37) Source(1, 24) + SourceIndex(0) +12>Emitted(12, 39) Source(1, 26) + SourceIndex(0) +13>Emitted(12, 42) Source(1, 29) + SourceIndex(0) +14>Emitted(12, 43) Source(1, 30) + SourceIndex(0) +15>Emitted(12, 44) Source(1, 30) + SourceIndex(0) +16>Emitted(12, 60) Source(1, 30) + SourceIndex(0) +--- +>>> var v = _b.value; +1 >^^^^^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^^^^^^^^^ +1 > +2 > var +3 > v +4 > +1 >Emitted(13, 9) Source(1, 6) + SourceIndex(0) +2 >Emitted(13, 13) Source(1, 10) + SourceIndex(0) +3 >Emitted(13, 14) Source(1, 11) + SourceIndex(0) +4 >Emitted(13, 25) Source(1, 11) + SourceIndex(0) +--- +>>> console.log(v); +1 >^^^^^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +1 > of ['a', 'b', 'c']) { + > +2 > console +3 > . +4 > log +5 > ( +6 > v +7 > ) +8 > ; +1 >Emitted(14, 9) Source(2, 5) + SourceIndex(0) +2 >Emitted(14, 16) Source(2, 12) + SourceIndex(0) +3 >Emitted(14, 17) Source(2, 13) + SourceIndex(0) +4 >Emitted(14, 20) Source(2, 16) + SourceIndex(0) +5 >Emitted(14, 21) Source(2, 17) + SourceIndex(0) +6 >Emitted(14, 22) Source(2, 18) + SourceIndex(0) +7 >Emitted(14, 23) Source(2, 19) + SourceIndex(0) +8 >Emitted(14, 24) Source(2, 20) + SourceIndex(0) +--- +>>> } +1 >^^^^^ +1 > + >} +1 >Emitted(15, 6) Source(3, 2) + SourceIndex(0) +--- +>>>} +>>>catch (e_1_1) { e_1 = { error: e_1_1 }; } +>>>finally { +>>> try { +>>> if (_b && !_b.done && (_c = _a["return"])) _c.call(_a); +>>> } +>>> finally { if (e_1) throw e_1.error; } +>>>} +>>>var e_1, _c; +>>>//# sourceMappingURL=ES5For-of33.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of34.errors.txt b/tests/baselines/reference/ES5For-of34.errors.txt new file mode 100644 index 00000000000..46f9666f776 --- /dev/null +++ b/tests/baselines/reference/ES5For-of34.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of34.ts(4,6): error TS2322: Type 'string' is not assignable to type 'number'. + + +==== tests/cases/conformance/statements/for-ofStatements/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.js new file mode 100644 index 00000000000..307a7505d09 --- /dev/null +++ b/tests/baselines/reference/ES5For-of34.js @@ -0,0 +1,37 @@ +//// [ES5For-of34.ts] +function foo() { + return { x: 0 }; +} +for (foo().x of ['a', 'b', 'c']) { + var p = foo().x; +} + +//// [ES5For-of34.js] +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +function foo() { + return { x: 0 }; +} +try { + for (var _a = __values(['a', 'b', 'c']), _b = _a.next(); !_b.done; _b = _a.next()) { + foo().x = _b.value; + var p = foo().x; + } +} +catch (e_1_1) { e_1 = { error: e_1_1 }; } +finally { + try { + if (_b && !_b.done && (_c = _a["return"])) _c.call(_a); + } + finally { if (e_1) throw e_1.error; } +} +var e_1, _c; +//# sourceMappingURL=ES5For-of34.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of34.js.map b/tests/baselines/reference/ES5For-of34.js.map new file mode 100644 index 00000000000..041fda734b5 --- /dev/null +++ b/tests/baselines/reference/ES5For-of34.js.map @@ -0,0 +1,2 @@ +//// [ES5For-of34.js.map] +{"version":3,"file":"ES5For-of34.js","sourceRoot":"","sources":["ES5For-of34.ts"],"names":[],"mappings":";;;;;;;;;;AAAA;IACI,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;;IACD,GAAG,CAAC,CAAY,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA;QAA1B,GAAG,EAAE,CAAC,CAAC,WAAA;QACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;KACnB"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of34.sourcemap.txt b/tests/baselines/reference/ES5For-of34.sourcemap.txt new file mode 100644 index 00000000000..540d52cc581 --- /dev/null +++ b/tests/baselines/reference/ES5For-of34.sourcemap.txt @@ -0,0 +1,184 @@ +=================================================================== +JsFile: ES5For-of34.js +mapUrl: ES5For-of34.js.map +sourceRoot: +sources: ES5For-of34.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of34.js +sourceFile:ES5For-of34.ts +------------------------------------------------------------------- +>>>var __values = (this && this.__values) || function (o) { +>>> var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +>>> if (m) return m.call(o); +>>> return { +>>> next: function () { +>>> if (o && i >= o.length) o = void 0; +>>> return { value: o && o[i++], done: !o }; +>>> } +>>> }; +>>>}; +>>>function foo() { +1 > +2 >^^^^^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(11, 1) Source(1, 1) + SourceIndex(0) +--- +>>> return { x: 0 }; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +6 > ^^ +7 > ^ +8 > ^^ +9 > ^ +1->function foo() { + > +2 > return +3 > +4 > { +5 > x +6 > : +7 > 0 +8 > } +9 > ; +1->Emitted(12, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(12, 11) Source(2, 11) + SourceIndex(0) +3 >Emitted(12, 12) Source(2, 12) + SourceIndex(0) +4 >Emitted(12, 14) Source(2, 14) + SourceIndex(0) +5 >Emitted(12, 15) Source(2, 15) + SourceIndex(0) +6 >Emitted(12, 17) Source(2, 17) + SourceIndex(0) +7 >Emitted(12, 18) Source(2, 18) + SourceIndex(0) +8 >Emitted(12, 20) Source(2, 20) + SourceIndex(0) +9 >Emitted(12, 21) Source(2, 21) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^-> +1 > + > +2 >} +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(13, 2) Source(3, 2) + SourceIndex(0) +--- +>>>try { +>>> for (var _a = __values(['a', 'b', 'c']), _b = _a.next(); !_b.done; _b = _a.next()) { +1->^^^^ +2 > ^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^ +7 > ^^^^^^^^^ +8 > ^ +9 > ^^^ +10> ^^ +11> ^^^ +12> ^^ +13> ^^^ +14> ^ +15> ^ +16> ^^^^^^^^^^^^^^^^ +1-> + > +2 > for +3 > +4 > (foo().x of +5 > +6 > +7 > +8 > [ +9 > 'a' +10> , +11> 'b' +12> , +13> 'c' +14> ] +15> +16> +1->Emitted(15, 5) Source(4, 1) + SourceIndex(0) +2 >Emitted(15, 8) Source(4, 4) + SourceIndex(0) +3 >Emitted(15, 9) Source(4, 5) + SourceIndex(0) +4 >Emitted(15, 10) Source(4, 17) + SourceIndex(0) +5 >Emitted(15, 14) Source(4, 17) + SourceIndex(0) +6 >Emitted(15, 19) Source(4, 17) + SourceIndex(0) +7 >Emitted(15, 28) Source(4, 17) + SourceIndex(0) +8 >Emitted(15, 29) Source(4, 18) + SourceIndex(0) +9 >Emitted(15, 32) Source(4, 21) + SourceIndex(0) +10>Emitted(15, 34) Source(4, 23) + SourceIndex(0) +11>Emitted(15, 37) Source(4, 26) + SourceIndex(0) +12>Emitted(15, 39) Source(4, 28) + SourceIndex(0) +13>Emitted(15, 42) Source(4, 31) + SourceIndex(0) +14>Emitted(15, 43) Source(4, 32) + SourceIndex(0) +15>Emitted(15, 44) Source(4, 32) + SourceIndex(0) +16>Emitted(15, 60) Source(4, 32) + SourceIndex(0) +--- +>>> foo().x = _b.value; +1 >^^^^^^^^ +2 > ^^^ +3 > ^^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^ +1 > +2 > foo +3 > () +4 > . +5 > x +6 > +1 >Emitted(16, 9) Source(4, 6) + SourceIndex(0) +2 >Emitted(16, 12) Source(4, 9) + SourceIndex(0) +3 >Emitted(16, 14) Source(4, 11) + SourceIndex(0) +4 >Emitted(16, 15) Source(4, 12) + SourceIndex(0) +5 >Emitted(16, 16) Source(4, 13) + SourceIndex(0) +6 >Emitted(16, 27) Source(4, 13) + SourceIndex(0) +--- +>>> var p = foo().x; +1 >^^^^^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^ +5 > ^^^ +6 > ^^ +7 > ^ +8 > ^ +9 > ^ +1 > of ['a', 'b', 'c']) { + > +2 > var +3 > p +4 > = +5 > foo +6 > () +7 > . +8 > x +9 > ; +1 >Emitted(17, 9) Source(5, 5) + SourceIndex(0) +2 >Emitted(17, 13) Source(5, 9) + SourceIndex(0) +3 >Emitted(17, 14) Source(5, 10) + SourceIndex(0) +4 >Emitted(17, 17) Source(5, 13) + SourceIndex(0) +5 >Emitted(17, 20) Source(5, 16) + SourceIndex(0) +6 >Emitted(17, 22) Source(5, 18) + SourceIndex(0) +7 >Emitted(17, 23) Source(5, 19) + SourceIndex(0) +8 >Emitted(17, 24) Source(5, 20) + SourceIndex(0) +9 >Emitted(17, 25) Source(5, 21) + SourceIndex(0) +--- +>>> } +1 >^^^^^ +1 > + >} +1 >Emitted(18, 6) Source(6, 2) + SourceIndex(0) +--- +>>>} +>>>catch (e_1_1) { e_1 = { error: e_1_1 }; } +>>>finally { +>>> try { +>>> if (_b && !_b.done && (_c = _a["return"])) _c.call(_a); +>>> } +>>> finally { if (e_1) throw e_1.error; } +>>>} +>>>var e_1, _c; +>>>//# sourceMappingURL=ES5For-of34.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of35.errors.txt b/tests/baselines/reference/ES5For-of35.errors.txt new file mode 100644 index 00000000000..8c43d959888 --- /dev/null +++ b/tests/baselines/reference/ES5For-of35.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of35.ts(1,13): error TS2459: Type 'number' has no property 'x' and no string index signature. +tests/cases/conformance/statements/for-ofStatements/ES5For-of35.ts(1,23): error TS2459: Type 'number' has no property 'y' and no string index signature. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of35.ts (2 errors) ==== + for (const {x: a = 0, y: b = 1} of [2, 3]) { + ~ +!!! error TS2459: Type 'number' has no property 'x' and no string index signature. + ~ +!!! error TS2459: Type 'number' has no property 'y' and no string index signature. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of35.js b/tests/baselines/reference/ES5For-of35.js new file mode 100644 index 00000000000..597296cacae --- /dev/null +++ b/tests/baselines/reference/ES5For-of35.js @@ -0,0 +1,33 @@ +//// [ES5For-of35.ts] +for (const {x: a = 0, y: b = 1} of [2, 3]) { + a; + b; +} + +//// [ES5For-of35.js] +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +try { + for (var _a = __values([2, 3]), _b = _a.next(); !_b.done; _b = _a.next()) { + var _c = _b.value, _d = _c.x, a = _d === void 0 ? 0 : _d, _e = _c.y, b = _e === void 0 ? 1 : _e; + a; + b; + } +} +catch (e_1_1) { e_1 = { error: e_1_1 }; } +finally { + try { + if (_b && !_b.done && (_f = _a["return"])) _f.call(_a); + } + finally { if (e_1) throw e_1.error; } +} +var e_1, _f; +//# sourceMappingURL=ES5For-of35.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of35.js.map b/tests/baselines/reference/ES5For-of35.js.map new file mode 100644 index 00000000000..f1ee2418d17 --- /dev/null +++ b/tests/baselines/reference/ES5For-of35.js.map @@ -0,0 +1,2 @@ +//// [ES5For-of35.js.map] +{"version":3,"file":"ES5For-of35.js","sourceRoot":"","sources":["ES5For-of35.ts"],"names":[],"mappings":";;;;;;;;;;;IAAA,GAAG,CAAC,CAA+B,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA;QAA9B,IAAA,aAAoB,EAAnB,SAAQ,EAAR,0BAAQ,EAAE,SAAQ,EAAR,0BAAQ;QAC1B,CAAC,CAAC;QACF,CAAC,CAAC;KACL"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of35.sourcemap.txt b/tests/baselines/reference/ES5For-of35.sourcemap.txt new file mode 100644 index 00000000000..1961188da49 --- /dev/null +++ b/tests/baselines/reference/ES5For-of35.sourcemap.txt @@ -0,0 +1,142 @@ +=================================================================== +JsFile: ES5For-of35.js +mapUrl: ES5For-of35.js.map +sourceRoot: +sources: ES5For-of35.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of35.js +sourceFile:ES5For-of35.ts +------------------------------------------------------------------- +>>>var __values = (this && this.__values) || function (o) { +>>> var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +>>> if (m) return m.call(o); +>>> return { +>>> next: function () { +>>> if (o && i >= o.length) o = void 0; +>>> return { value: o && o[i++], done: !o }; +>>> } +>>> }; +>>>}; +>>>try { +>>> for (var _a = __values([2, 3]), _b = _a.next(); !_b.done; _b = _a.next()) { +1 >^^^^ +2 > ^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^ +7 > ^^^^^^^^^ +8 > ^ +9 > ^ +10> ^^ +11> ^ +12> ^ +13> ^ +14> ^^^^^^^^^^^^^^^^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 > for +3 > +4 > (const {x: a = 0, y: b = 1} of +5 > +6 > +7 > +8 > [ +9 > 2 +10> , +11> 3 +12> ] +13> +14> +1 >Emitted(12, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(12, 8) Source(1, 4) + SourceIndex(0) +3 >Emitted(12, 9) Source(1, 5) + SourceIndex(0) +4 >Emitted(12, 10) Source(1, 36) + SourceIndex(0) +5 >Emitted(12, 14) Source(1, 36) + SourceIndex(0) +6 >Emitted(12, 19) Source(1, 36) + SourceIndex(0) +7 >Emitted(12, 28) Source(1, 36) + SourceIndex(0) +8 >Emitted(12, 29) Source(1, 37) + SourceIndex(0) +9 >Emitted(12, 30) Source(1, 38) + SourceIndex(0) +10>Emitted(12, 32) Source(1, 40) + SourceIndex(0) +11>Emitted(12, 33) Source(1, 41) + SourceIndex(0) +12>Emitted(12, 34) Source(1, 42) + SourceIndex(0) +13>Emitted(12, 35) Source(1, 42) + SourceIndex(0) +14>Emitted(12, 51) Source(1, 42) + SourceIndex(0) +--- +>>> var _c = _b.value, _d = _c.x, a = _d === void 0 ? 0 : _d, _e = _c.y, b = _e === void 0 ? 1 : _e; +1->^^^^^^^^ +2 > ^^^^ +3 > ^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > +3 > {x: a = 0, y: b = 1} +4 > +5 > x: a = 0 +6 > +7 > x: a = 0 +8 > , +9 > y: b = 1 +10> +11> y: b = 1 +1->Emitted(13, 9) Source(1, 12) + SourceIndex(0) +2 >Emitted(13, 13) Source(1, 12) + SourceIndex(0) +3 >Emitted(13, 26) Source(1, 32) + SourceIndex(0) +4 >Emitted(13, 28) Source(1, 13) + SourceIndex(0) +5 >Emitted(13, 37) Source(1, 21) + SourceIndex(0) +6 >Emitted(13, 39) Source(1, 13) + SourceIndex(0) +7 >Emitted(13, 65) Source(1, 21) + SourceIndex(0) +8 >Emitted(13, 67) Source(1, 23) + SourceIndex(0) +9 >Emitted(13, 76) Source(1, 31) + SourceIndex(0) +10>Emitted(13, 78) Source(1, 23) + SourceIndex(0) +11>Emitted(13, 104) Source(1, 31) + SourceIndex(0) +--- +>>> a; +1 >^^^^^^^^ +2 > ^ +3 > ^ +4 > ^-> +1 >} of [2, 3]) { + > +2 > a +3 > ; +1 >Emitted(14, 9) Source(2, 5) + SourceIndex(0) +2 >Emitted(14, 10) Source(2, 6) + SourceIndex(0) +3 >Emitted(14, 11) Source(2, 7) + SourceIndex(0) +--- +>>> b; +1->^^^^^^^^ +2 > ^ +3 > ^ +1-> + > +2 > b +3 > ; +1->Emitted(15, 9) Source(3, 5) + SourceIndex(0) +2 >Emitted(15, 10) Source(3, 6) + SourceIndex(0) +3 >Emitted(15, 11) Source(3, 7) + SourceIndex(0) +--- +>>> } +1 >^^^^^ +1 > + >} +1 >Emitted(16, 6) Source(4, 2) + SourceIndex(0) +--- +>>>} +>>>catch (e_1_1) { e_1 = { error: e_1_1 }; } +>>>finally { +>>> try { +>>> if (_b && !_b.done && (_f = _a["return"])) _f.call(_a); +>>> } +>>> finally { if (e_1) throw e_1.error; } +>>>} +>>>var e_1, _f; +>>>//# sourceMappingURL=ES5For-of35.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of36.errors.txt b/tests/baselines/reference/ES5For-of36.errors.txt new file mode 100644 index 00000000000..86a40dcffa5 --- /dev/null +++ b/tests/baselines/reference/ES5For-of36.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of36.ts(1,10): error TS2548: Type 'number' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of36.ts (1 errors) ==== + for (let [a = 0, b = 1] of [2, 3]) { + ~~~~~~~~~~~~~~ +!!! error TS2548: Type 'number' is not an array type or does not 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.js b/tests/baselines/reference/ES5For-of36.js new file mode 100644 index 00000000000..fca89ee922b --- /dev/null +++ b/tests/baselines/reference/ES5For-of36.js @@ -0,0 +1,49 @@ +//// [ES5For-of36.ts] +for (let [a = 0, b = 1] of [2, 3]) { + a; + b; +} + +//// [ES5For-of36.js] +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +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; +}; +try { + for (var _a = __values([2, 3]), _b = _a.next(); !_b.done; _b = _a.next()) { + var _c = __read(_b.value, 2), _d = _c[0], a = _d === void 0 ? 0 : _d, _e = _c[1], b = _e === void 0 ? 1 : _e; + a; + b; + } +} +catch (e_1_1) { e_1 = { error: e_1_1 }; } +finally { + try { + if (_b && !_b.done && (_f = _a["return"])) _f.call(_a); + } + finally { if (e_1) throw e_1.error; } +} +var e_1, _f; +//# sourceMappingURL=ES5For-of36.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of36.js.map b/tests/baselines/reference/ES5For-of36.js.map new file mode 100644 index 00000000000..f53bc850818 --- /dev/null +++ b/tests/baselines/reference/ES5For-of36.js.map @@ -0,0 +1,2 @@ +//// [ES5For-of36.js.map] +{"version":3,"file":"ES5For-of36.js","sourceRoot":"","sources":["ES5For-of36.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA,GAAG,CAAC,CAAuB,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA;QAAxB,IAAA,wBAAc,EAAb,UAAK,EAAL,0BAAK,EAAE,UAAK,EAAL,0BAAK;QAClB,CAAC,CAAC;QACF,CAAC,CAAC;KACL"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of36.sourcemap.txt b/tests/baselines/reference/ES5For-of36.sourcemap.txt new file mode 100644 index 00000000000..4b16e02b3b1 --- /dev/null +++ b/tests/baselines/reference/ES5For-of36.sourcemap.txt @@ -0,0 +1,158 @@ +=================================================================== +JsFile: ES5For-of36.js +mapUrl: ES5For-of36.js.map +sourceRoot: +sources: ES5For-of36.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of36.js +sourceFile:ES5For-of36.ts +------------------------------------------------------------------- +>>>var __values = (this && this.__values) || function (o) { +>>> var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +>>> if (m) return m.call(o); +>>> return { +>>> next: function () { +>>> if (o && i >= o.length) o = void 0; +>>> return { value: o && o[i++], done: !o }; +>>> } +>>> }; +>>>}; +>>>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; +>>>}; +>>>try { +>>> for (var _a = __values([2, 3]), _b = _a.next(); !_b.done; _b = _a.next()) { +1 >^^^^ +2 > ^^^ +3 > ^ +4 > ^ +5 > ^^^^ +6 > ^^^^^ +7 > ^^^^^^^^^ +8 > ^ +9 > ^ +10> ^^ +11> ^ +12> ^ +13> ^ +14> ^^^^^^^^^^^^^^^^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 > for +3 > +4 > (let [a = 0, b = 1] of +5 > +6 > +7 > +8 > [ +9 > 2 +10> , +11> 3 +12> ] +13> +14> +1 >Emitted(28, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(28, 8) Source(1, 4) + SourceIndex(0) +3 >Emitted(28, 9) Source(1, 5) + SourceIndex(0) +4 >Emitted(28, 10) Source(1, 28) + SourceIndex(0) +5 >Emitted(28, 14) Source(1, 28) + SourceIndex(0) +6 >Emitted(28, 19) Source(1, 28) + SourceIndex(0) +7 >Emitted(28, 28) Source(1, 28) + SourceIndex(0) +8 >Emitted(28, 29) Source(1, 29) + SourceIndex(0) +9 >Emitted(28, 30) Source(1, 30) + SourceIndex(0) +10>Emitted(28, 32) Source(1, 32) + SourceIndex(0) +11>Emitted(28, 33) Source(1, 33) + SourceIndex(0) +12>Emitted(28, 34) Source(1, 34) + SourceIndex(0) +13>Emitted(28, 35) Source(1, 34) + SourceIndex(0) +14>Emitted(28, 51) Source(1, 34) + SourceIndex(0) +--- +>>> var _c = __read(_b.value, 2), _d = _c[0], a = _d === void 0 ? 0 : _d, _e = _c[1], b = _e === void 0 ? 1 : _e; +1->^^^^^^^^ +2 > ^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 > +3 > [a = 0, b = 1] +4 > +5 > a = 0 +6 > +7 > a = 0 +8 > , +9 > b = 1 +10> +11> b = 1 +1->Emitted(29, 9) Source(1, 10) + SourceIndex(0) +2 >Emitted(29, 13) Source(1, 10) + SourceIndex(0) +3 >Emitted(29, 37) Source(1, 24) + SourceIndex(0) +4 >Emitted(29, 39) Source(1, 11) + SourceIndex(0) +5 >Emitted(29, 49) Source(1, 16) + SourceIndex(0) +6 >Emitted(29, 51) Source(1, 11) + SourceIndex(0) +7 >Emitted(29, 77) Source(1, 16) + SourceIndex(0) +8 >Emitted(29, 79) Source(1, 18) + SourceIndex(0) +9 >Emitted(29, 89) Source(1, 23) + SourceIndex(0) +10>Emitted(29, 91) Source(1, 18) + SourceIndex(0) +11>Emitted(29, 117) Source(1, 23) + SourceIndex(0) +--- +>>> a; +1 >^^^^^^^^ +2 > ^ +3 > ^ +4 > ^-> +1 >] of [2, 3]) { + > +2 > a +3 > ; +1 >Emitted(30, 9) Source(2, 5) + SourceIndex(0) +2 >Emitted(30, 10) Source(2, 6) + SourceIndex(0) +3 >Emitted(30, 11) Source(2, 7) + SourceIndex(0) +--- +>>> b; +1->^^^^^^^^ +2 > ^ +3 > ^ +1-> + > +2 > b +3 > ; +1->Emitted(31, 9) Source(3, 5) + SourceIndex(0) +2 >Emitted(31, 10) Source(3, 6) + SourceIndex(0) +3 >Emitted(31, 11) Source(3, 7) + SourceIndex(0) +--- +>>> } +1 >^^^^^ +1 > + >} +1 >Emitted(32, 6) Source(4, 2) + SourceIndex(0) +--- +>>>} +>>>catch (e_1_1) { e_1 = { error: e_1_1 }; } +>>>finally { +>>> try { +>>> if (_b && !_b.done && (_f = _a["return"])) _f.call(_a); +>>> } +>>> finally { if (e_1) throw e_1.error; } +>>>} +>>>var e_1, _f; +>>>//# sourceMappingURL=ES5For-of36.js.map \ No newline at end of file diff --git a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt index 4f08e30cd46..20f8e09248a 100644 --- a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt +++ b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged +tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'. tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'. @@ -14,7 +14,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error T module A { export module Point { ~~~~~ -!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged +!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. export var Origin = { x: 0, y: 0 }; } } diff --git a/tests/baselines/reference/FunctionDeclaration10_es6.js b/tests/baselines/reference/FunctionDeclaration10_es6.js index 6ac2ec8d194..aca7c00e58c 100644 --- a/tests/baselines/reference/FunctionDeclaration10_es6.js +++ b/tests/baselines/reference/FunctionDeclaration10_es6.js @@ -3,9 +3,7 @@ function * foo(a = yield => yield) { } //// [FunctionDeclaration10_es6.js] -function* foo(a) { - if (a === void 0) { a = yield; } -} +function* foo(a = yield) { } yield; { } diff --git a/tests/baselines/reference/FunctionDeclaration11_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration11_es6.errors.txt deleted file mode 100644 index 4db3842e91d..00000000000 --- a/tests/baselines/reference/FunctionDeclaration11_es6.errors.txt +++ /dev/null @@ -1,8 +0,0 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts (1 errors) ==== - function * yield() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration11_es6.symbols b/tests/baselines/reference/FunctionDeclaration11_es6.symbols new file mode 100644 index 00000000000..a51b763e4bf --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration11_es6.symbols @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts === +function * yield() { +>yield : Symbol(yield, Decl(FunctionDeclaration11_es6.ts, 0, 0)) +} diff --git a/tests/baselines/reference/FunctionDeclaration11_es6.types b/tests/baselines/reference/FunctionDeclaration11_es6.types new file mode 100644 index 00000000000..0a312c2661c --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration11_es6.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts === +function * yield() { +>yield : () => IterableIterator +} diff --git a/tests/baselines/reference/FunctionDeclaration12_es6.js b/tests/baselines/reference/FunctionDeclaration12_es6.js index 87ea08215fe..5d55d3231b0 100644 --- a/tests/baselines/reference/FunctionDeclaration12_es6.js +++ b/tests/baselines/reference/FunctionDeclaration12_es6.js @@ -2,4 +2,4 @@ var v = function * yield() { } //// [FunctionDeclaration12_es6.js] -var v = function* () { }, yield = function () { }; +var v = function* () { }, yield = () => { }; diff --git a/tests/baselines/reference/FunctionDeclaration13_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration13_es6.errors.txt index fa675446617..1f921475fd3 100644 --- a/tests/baselines/reference/FunctionDeclaration13_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration13_es6.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(3,11): error TS2304: Cannot find name 'yield'. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts (2 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts (1 errors) ==== function * foo() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. // Legal to use 'yield' in a type context. var v: yield; ~~~~~ diff --git a/tests/baselines/reference/FunctionDeclaration1_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration1_es6.errors.txt deleted file mode 100644 index d3dab521926..00000000000 --- a/tests/baselines/reference/FunctionDeclaration1_es6.errors.txt +++ /dev/null @@ -1,8 +0,0 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts (1 errors) ==== - function * foo() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration1_es6.symbols b/tests/baselines/reference/FunctionDeclaration1_es6.symbols new file mode 100644 index 00000000000..7683664cb93 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration1_es6.symbols @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts === +function * foo() { +>foo : Symbol(foo, Decl(FunctionDeclaration1_es6.ts, 0, 0)) +} diff --git a/tests/baselines/reference/FunctionDeclaration1_es6.types b/tests/baselines/reference/FunctionDeclaration1_es6.types new file mode 100644 index 00000000000..548b1eb98d6 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration1_es6.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts === +function * foo() { +>foo : () => IterableIterator +} diff --git a/tests/baselines/reference/FunctionDeclaration3_es6.js b/tests/baselines/reference/FunctionDeclaration3_es6.js index e1df936dd21..eebce92f5b9 100644 --- a/tests/baselines/reference/FunctionDeclaration3_es6.js +++ b/tests/baselines/reference/FunctionDeclaration3_es6.js @@ -3,6 +3,5 @@ function f(yield = yield) { } //// [FunctionDeclaration3_es6.js] -function f(yield) { - if (yield === void 0) { yield = yield; } +function f(yield = yield) { } diff --git a/tests/baselines/reference/FunctionDeclaration6_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration6_es6.errors.txt index 60798f7dbd6..04806c7aae9 100644 --- a/tests/baselines/reference/FunctionDeclaration6_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration6_es6.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,18): error TS2523: 'yield' expressions cannot be used in a parameter initializer. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts (2 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts (1 errors) ==== function*foo(a = yield) { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. ~~~~~ !!! error TS2523: 'yield' expressions cannot be used in a parameter initializer. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration6_es6.js b/tests/baselines/reference/FunctionDeclaration6_es6.js index e0b871a9172..bc8c3b030ae 100644 --- a/tests/baselines/reference/FunctionDeclaration6_es6.js +++ b/tests/baselines/reference/FunctionDeclaration6_es6.js @@ -3,6 +3,5 @@ function*foo(a = yield) { } //// [FunctionDeclaration6_es6.js] -function* foo(a) { - if (a === void 0) { a = yield; } +function* foo(a = yield) { } diff --git a/tests/baselines/reference/FunctionDeclaration7_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration7_es6.errors.txt index 3c1b950bea5..e0273c3bb44 100644 --- a/tests/baselines/reference/FunctionDeclaration7_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration7_es6.errors.txt @@ -1,16 +1,10 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,11): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,20): error TS2523: 'yield' expressions cannot be used in a parameter initializer. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (3 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (1 errors) ==== function*bar() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. // 'yield' here is an identifier, and not a yield expression. function*foo(a = yield) { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. ~~~~~ !!! error TS2523: 'yield' expressions cannot be used in a parameter initializer. } diff --git a/tests/baselines/reference/FunctionDeclaration7_es6.js b/tests/baselines/reference/FunctionDeclaration7_es6.js index 49b43e2a2db..18256461aeb 100644 --- a/tests/baselines/reference/FunctionDeclaration7_es6.js +++ b/tests/baselines/reference/FunctionDeclaration7_es6.js @@ -8,7 +8,6 @@ function*bar() { //// [FunctionDeclaration7_es6.js] function* bar() { // 'yield' here is an identifier, and not a yield expression. - function* foo(a) { - if (a === void 0) { a = yield; } + function* foo(a = yield) { } } diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt deleted file mode 100644 index a2d2121d7fa..00000000000 --- a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (1 errors) ==== - function * foo() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - var v = { [yield]: foo } - } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.js b/tests/baselines/reference/FunctionDeclaration9_es6.js index 720e276ccba..b5be11778ac 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.js +++ b/tests/baselines/reference/FunctionDeclaration9_es6.js @@ -5,6 +5,5 @@ function * foo() { //// [FunctionDeclaration9_es6.js] function* foo() { - var v = (_a = {}, _a[yield] = foo, _a); - var _a; + var v = { [yield]: foo }; } diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.symbols b/tests/baselines/reference/FunctionDeclaration9_es6.symbols new file mode 100644 index 00000000000..0797c51331c --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration9_es6.symbols @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts === +function * foo() { +>foo : Symbol(foo, Decl(FunctionDeclaration9_es6.ts, 0, 0)) + + var v = { [yield]: foo } +>v : Symbol(v, Decl(FunctionDeclaration9_es6.ts, 1, 5)) +>foo : Symbol(foo, Decl(FunctionDeclaration9_es6.ts, 0, 0)) +} diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.types b/tests/baselines/reference/FunctionDeclaration9_es6.types new file mode 100644 index 00000000000..182b90b3f7a --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration9_es6.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts === +function * foo() { +>foo : () => IterableIterator + + var v = { [yield]: foo } +>v : { [x: number]: () => IterableIterator; } +>{ [yield]: foo } : { [x: number]: () => IterableIterator; } +>yield : any +>foo : () => IterableIterator +} diff --git a/tests/baselines/reference/FunctionExpression1_es6.errors.txt b/tests/baselines/reference/FunctionExpression1_es6.errors.txt deleted file mode 100644 index 9c1f798c5ad..00000000000 --- a/tests/baselines/reference/FunctionExpression1_es6.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts(1,18): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts (1 errors) ==== - var v = function * () { } - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionExpression1_es6.symbols b/tests/baselines/reference/FunctionExpression1_es6.symbols new file mode 100644 index 00000000000..4e1ed33ea1c --- /dev/null +++ b/tests/baselines/reference/FunctionExpression1_es6.symbols @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts === +var v = function * () { } +>v : Symbol(v, Decl(FunctionExpression1_es6.ts, 0, 3)) + diff --git a/tests/baselines/reference/FunctionExpression1_es6.types b/tests/baselines/reference/FunctionExpression1_es6.types new file mode 100644 index 00000000000..1bba41f11f2 --- /dev/null +++ b/tests/baselines/reference/FunctionExpression1_es6.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts === +var v = function * () { } +>v : () => IterableIterator +>function * () { } : () => IterableIterator + diff --git a/tests/baselines/reference/FunctionExpression2_es6.errors.txt b/tests/baselines/reference/FunctionExpression2_es6.errors.txt deleted file mode 100644 index 9248962e620..00000000000 --- a/tests/baselines/reference/FunctionExpression2_es6.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts(1,18): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts (1 errors) ==== - var v = function * foo() { } - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionExpression2_es6.symbols b/tests/baselines/reference/FunctionExpression2_es6.symbols new file mode 100644 index 00000000000..1fc8c3c10d6 --- /dev/null +++ b/tests/baselines/reference/FunctionExpression2_es6.symbols @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts === +var v = function * foo() { } +>v : Symbol(v, Decl(FunctionExpression2_es6.ts, 0, 3)) +>foo : Symbol(foo, Decl(FunctionExpression2_es6.ts, 0, 7)) + diff --git a/tests/baselines/reference/FunctionExpression2_es6.types b/tests/baselines/reference/FunctionExpression2_es6.types new file mode 100644 index 00000000000..7a421dd1abf --- /dev/null +++ b/tests/baselines/reference/FunctionExpression2_es6.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts === +var v = function * foo() { } +>v : () => IterableIterator +>function * foo() { } : () => IterableIterator +>foo : () => IterableIterator + diff --git a/tests/baselines/reference/FunctionPropertyAssignments1_es6.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments1_es6.errors.txt deleted file mode 100644 index fd463eed02d..00000000000 --- a/tests/baselines/reference/FunctionPropertyAssignments1_es6.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts(1,11): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts (1 errors) ==== - var v = { *foo() { } } - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments1_es6.js b/tests/baselines/reference/FunctionPropertyAssignments1_es6.js index 5975745391a..be89637c5ea 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments1_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments1_es6.js @@ -2,4 +2,4 @@ var v = { *foo() { } } //// [FunctionPropertyAssignments1_es6.js] -var v = { foo: function* () { } }; +var v = { *foo() { } }; diff --git a/tests/baselines/reference/FunctionPropertyAssignments1_es6.symbols b/tests/baselines/reference/FunctionPropertyAssignments1_es6.symbols new file mode 100644 index 00000000000..79aee0f4700 --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments1_es6.symbols @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts === +var v = { *foo() { } } +>v : Symbol(v, Decl(FunctionPropertyAssignments1_es6.ts, 0, 3)) +>foo : Symbol(foo, Decl(FunctionPropertyAssignments1_es6.ts, 0, 9)) + diff --git a/tests/baselines/reference/FunctionPropertyAssignments1_es6.types b/tests/baselines/reference/FunctionPropertyAssignments1_es6.types new file mode 100644 index 00000000000..90b8615003e --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments1_es6.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts === +var v = { *foo() { } } +>v : { foo(): IterableIterator; } +>{ *foo() { } } : { foo(): IterableIterator; } +>foo : () => IterableIterator + diff --git a/tests/baselines/reference/FunctionPropertyAssignments2_es6.js b/tests/baselines/reference/FunctionPropertyAssignments2_es6.js index b055960b6a8..b0f66e94c78 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments2_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments2_es6.js @@ -2,4 +2,4 @@ var v = { *() { } } //// [FunctionPropertyAssignments2_es6.js] -var v = { : function* () { } }; +var v = { *() { } }; diff --git a/tests/baselines/reference/FunctionPropertyAssignments3_es6.js b/tests/baselines/reference/FunctionPropertyAssignments3_es6.js index 9642c28529d..f13810af3ca 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments3_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments3_es6.js @@ -2,4 +2,4 @@ var v = { *{ } } //// [FunctionPropertyAssignments3_es6.js] -var v = { : function* () { } }; +var v = { *() { } }; diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt index 35185fdb7c6..143b764c08c 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,13): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (2 errors) ==== +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (1 errors) ==== var v = { *[foo()]() { } } - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. ~~~ !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js index ba25922b670..027dc6fb41e 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js @@ -2,5 +2,4 @@ var v = { *[foo()]() { } } //// [FunctionPropertyAssignments5_es6.js] -var v = (_a = {}, _a[foo()] = function* () { }, _a); -var _a; +var v = { *[foo()]() { } }; diff --git a/tests/baselines/reference/FunctionPropertyAssignments6_es6.js b/tests/baselines/reference/FunctionPropertyAssignments6_es6.js index edcd227f7b9..e3f7b7e6332 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments6_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments6_es6.js @@ -2,4 +2,4 @@ var v = { *() { } } //// [FunctionPropertyAssignments6_es6.js] -var v = { : function* () { } }; +var v = { *() { } }; diff --git a/tests/baselines/reference/InterfaceDeclaration8.errors.txt b/tests/baselines/reference/InterfaceDeclaration8.errors.txt index e916947d2bd..15c06f6dd0d 100644 --- a/tests/baselines/reference/InterfaceDeclaration8.errors.txt +++ b/tests/baselines/reference/InterfaceDeclaration8.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/InterfaceDeclaration8.ts(1,11): error TS2427: Interface name cannot be 'string' +tests/cases/compiler/InterfaceDeclaration8.ts(1,11): error TS2427: Interface name cannot be 'string'. ==== tests/cases/compiler/InterfaceDeclaration8.ts (1 errors) ==== interface string { ~~~~~~ -!!! error TS2427: Interface name cannot be 'string' +!!! error TS2427: Interface name cannot be 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration1_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration1_es6.errors.txt deleted file mode 100644 index 25cb4ba4240..00000000000 --- a/tests/baselines/reference/MemberFunctionDeclaration1_es6.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts(2,4): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts (1 errors) ==== - class C { - *foo() { } - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration1_es6.js b/tests/baselines/reference/MemberFunctionDeclaration1_es6.js index ec37b3370b0..3eec7c188cd 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration1_es6.js +++ b/tests/baselines/reference/MemberFunctionDeclaration1_es6.js @@ -4,9 +4,6 @@ class C { } //// [MemberFunctionDeclaration1_es6.js] -var C = (function () { - function C() { - } - C.prototype.foo = function* () { }; - return C; -}()); +class C { + *foo() { } +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration1_es6.symbols b/tests/baselines/reference/MemberFunctionDeclaration1_es6.symbols new file mode 100644 index 00000000000..a1862ea9209 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration1_es6.symbols @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts === +class C { +>C : Symbol(C, Decl(MemberFunctionDeclaration1_es6.ts, 0, 0)) + + *foo() { } +>foo : Symbol(C.foo, Decl(MemberFunctionDeclaration1_es6.ts, 0, 9)) +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration1_es6.types b/tests/baselines/reference/MemberFunctionDeclaration1_es6.types new file mode 100644 index 00000000000..89eec59bb1c --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration1_es6.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts === +class C { +>C : C + + *foo() { } +>foo : () => IterableIterator +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration2_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration2_es6.errors.txt deleted file mode 100644 index 8277d6f1f67..00000000000 --- a/tests/baselines/reference/MemberFunctionDeclaration2_es6.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts(2,11): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts (1 errors) ==== - class C { - public * foo() { } - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration2_es6.js b/tests/baselines/reference/MemberFunctionDeclaration2_es6.js index 54550ef72e7..9dd6bbfb9f9 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration2_es6.js +++ b/tests/baselines/reference/MemberFunctionDeclaration2_es6.js @@ -4,9 +4,6 @@ class C { } //// [MemberFunctionDeclaration2_es6.js] -var C = (function () { - function C() { - } - C.prototype.foo = function* () { }; - return C; -}()); +class C { + *foo() { } +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration2_es6.symbols b/tests/baselines/reference/MemberFunctionDeclaration2_es6.symbols new file mode 100644 index 00000000000..ac380db0268 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration2_es6.symbols @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts === +class C { +>C : Symbol(C, Decl(MemberFunctionDeclaration2_es6.ts, 0, 0)) + + public * foo() { } +>foo : Symbol(C.foo, Decl(MemberFunctionDeclaration2_es6.ts, 0, 9)) +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration2_es6.types b/tests/baselines/reference/MemberFunctionDeclaration2_es6.types new file mode 100644 index 00000000000..bfc83ccfd27 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration2_es6.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts === +class C { +>C : C + + public * foo() { } +>foo : () => IterableIterator +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt index 3fd821bafdf..fdfe7425320 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt +++ b/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,4): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,6): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts (2 errors) ==== +==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts (1 errors) ==== class C { *[foo]() { } - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. ~~~ !!! error TS2304: Cannot find name 'foo'. } \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration3_es6.js b/tests/baselines/reference/MemberFunctionDeclaration3_es6.js index 07d9a021fcd..0cfc1732c99 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration3_es6.js +++ b/tests/baselines/reference/MemberFunctionDeclaration3_es6.js @@ -4,9 +4,6 @@ class C { } //// [MemberFunctionDeclaration3_es6.js] -var C = (function () { - function C() { - } - C.prototype[foo] = function* () { }; - return C; -}()); +class C { + *[foo]() { } +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration4_es6.js b/tests/baselines/reference/MemberFunctionDeclaration4_es6.js index f791d4a1156..73b8f395a92 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration4_es6.js +++ b/tests/baselines/reference/MemberFunctionDeclaration4_es6.js @@ -4,9 +4,6 @@ class C { } //// [MemberFunctionDeclaration4_es6.js] -var C = (function () { - function C() { - } - C.prototype. = function* () { }; - return C; -}()); +class C { + *() { } +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration5_es6.js b/tests/baselines/reference/MemberFunctionDeclaration5_es6.js index 2303c5e0f62..bbba43eae05 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration5_es6.js +++ b/tests/baselines/reference/MemberFunctionDeclaration5_es6.js @@ -4,8 +4,5 @@ class C { } //// [MemberFunctionDeclaration5_es6.js] -var C = (function () { - function C() { - } - return C; -}()); +class C { +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration6_es6.js b/tests/baselines/reference/MemberFunctionDeclaration6_es6.js index b2a753d7ce0..370697051e6 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration6_es6.js +++ b/tests/baselines/reference/MemberFunctionDeclaration6_es6.js @@ -4,8 +4,5 @@ class C { } //// [MemberFunctionDeclaration6_es6.js] -var C = (function () { - function C() { - } - return C; -}()); +class C { +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration7_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration7_es6.errors.txt deleted file mode 100644 index cd4c49bdd6d..00000000000 --- a/tests/baselines/reference/MemberFunctionDeclaration7_es6.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts(2,4): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts (1 errors) ==== - class C { - *foo() { } - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration7_es6.js b/tests/baselines/reference/MemberFunctionDeclaration7_es6.js index 8e19f0db333..78bf55457f7 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration7_es6.js +++ b/tests/baselines/reference/MemberFunctionDeclaration7_es6.js @@ -4,9 +4,6 @@ class C { } //// [MemberFunctionDeclaration7_es6.js] -var C = (function () { - function C() { - } - C.prototype.foo = function* () { }; - return C; -}()); +class C { + *foo() { } +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration7_es6.symbols b/tests/baselines/reference/MemberFunctionDeclaration7_es6.symbols new file mode 100644 index 00000000000..fa07b61e4a6 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration7_es6.symbols @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts === +class C { +>C : Symbol(C, Decl(MemberFunctionDeclaration7_es6.ts, 0, 0)) + + *foo() { } +>foo : Symbol(C.foo, Decl(MemberFunctionDeclaration7_es6.ts, 0, 9)) +>T : Symbol(T, Decl(MemberFunctionDeclaration7_es6.ts, 1, 8)) +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration7_es6.types b/tests/baselines/reference/MemberFunctionDeclaration7_es6.types new file mode 100644 index 00000000000..b5e65110c68 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration7_es6.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts === +class C { +>C : C + + *foo() { } +>foo : () => IterableIterator +>T : T +} diff --git a/tests/baselines/reference/MemberFunctionDeclaration8_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration8_es6.errors.txt index b21af664a69..94198b36c90 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration8_es6.errors.txt +++ b/tests/baselines/reference/MemberFunctionDeclaration8_es6.errors.txt @@ -18,7 +18,7 @@ tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration !!! error TS1109: Expression expected. ~~~ !!! error TS2304: Cannot find name 'bar'. - return bar; + return bar; ~~~ !!! error TS2304: Cannot find name 'bar'. } diff --git a/tests/baselines/reference/MemberFunctionDeclaration8_es6.js b/tests/baselines/reference/MemberFunctionDeclaration8_es6.js index 8000a2d5c42..853310e5a3e 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration8_es6.js +++ b/tests/baselines/reference/MemberFunctionDeclaration8_es6.js @@ -3,20 +3,17 @@ class C { foo() { // Make sure we don't think of *bar as the start of a generator method. if (a) # * bar; - return bar; + return bar; } } //// [MemberFunctionDeclaration8_es6.js] -var C = (function () { - function C() { - } - C.prototype.foo = function () { +class C { + foo() { // Make sure we don't think of *bar as the start of a generator method. if (a) ; * bar; return bar; - }; - return C; -}()); + } +} diff --git a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt index ca840a719c0..2a464e88268 100644 --- a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt +++ b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged -tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(1,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. +tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(1,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. ==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ==== module X.Y { export module Point { ~~~~~ -!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged +!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. export var Origin = new Point(0, 0); } } @@ -27,7 +27,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(1,8): error ==== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts (1 errors) ==== module A { ~ -!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. export var Instance = new A(); } diff --git a/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.errors.txt index 963ddf1ef93..5edbaf28f00 100644 --- a/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.errors.txt +++ b/tests/baselines/reference/ModuleAndFunctionWithSameNameAndCommonRoot.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged -tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(3,19): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. +tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(3,19): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. ==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ==== module A { export module Point { ~~~~~ -!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged +!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. export var Origin = { x: 0, y: 0 }; } } @@ -24,7 +24,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(3,19): erro export module Point { ~~~~~ -!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. export var Origin = { x: 0, y: 0 }; } diff --git a/tests/baselines/reference/VariableDeclaration11_es6.errors.txt b/tests/baselines/reference/VariableDeclaration11_es6.errors.txt index d1e6ab7c154..8fa0a99ab67 100644 --- a/tests/baselines/reference/VariableDeclaration11_es6.errors.txt +++ b/tests/baselines/reference/VariableDeclaration11_es6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/variableDeclarations/VariableDeclaration11_es6.ts(2,1): error TS1212: Identifier expected. 'let' is a reserved word in strict mode +tests/cases/conformance/es6/variableDeclarations/VariableDeclaration11_es6.ts(2,1): error TS1212: Identifier expected. 'let' is a reserved word in strict mode. tests/cases/conformance/es6/variableDeclarations/VariableDeclaration11_es6.ts(2,1): error TS2304: Cannot find name 'let'. @@ -6,6 +6,6 @@ tests/cases/conformance/es6/variableDeclarations/VariableDeclaration11_es6.ts(2, "use strict"; let ~~~ -!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode. ~~~ !!! error TS2304: Cannot find name 'let'. \ No newline at end of file diff --git a/tests/baselines/reference/VariableDeclaration2_es6.errors.txt b/tests/baselines/reference/VariableDeclaration2_es6.errors.txt index 35e0ad2821c..adf56a61f84 100644 --- a/tests/baselines/reference/VariableDeclaration2_es6.errors.txt +++ b/tests/baselines/reference/VariableDeclaration2_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts(1,7): error TS1155: 'const' declarations must be initialized +tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts(1,7): error TS1155: 'const' declarations must be initialized. ==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts (1 errors) ==== const a ~ -!!! error TS1155: 'const' declarations must be initialized \ No newline at end of file +!!! error TS1155: 'const' declarations must be initialized. \ No newline at end of file diff --git a/tests/baselines/reference/VariableDeclaration4_es6.errors.txt b/tests/baselines/reference/VariableDeclaration4_es6.errors.txt index 33d956ee1e5..ddfd6c5302d 100644 --- a/tests/baselines/reference/VariableDeclaration4_es6.errors.txt +++ b/tests/baselines/reference/VariableDeclaration4_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts(1,7): error TS1155: 'const' declarations must be initialized +tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts(1,7): error TS1155: 'const' declarations must be initialized. ==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts (1 errors) ==== const a: number ~ -!!! error TS1155: 'const' declarations must be initialized \ No newline at end of file +!!! error TS1155: 'const' declarations must be initialized. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression10_es6.errors.txt b/tests/baselines/reference/YieldExpression10_es6.errors.txt index 7bf534e4188..9e48fefc10a 100644 --- a/tests/baselines/reference/YieldExpression10_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression10_es6.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(1,11): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(2,11): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts (2 errors) ==== +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts (1 errors) ==== var v = { * foo() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. yield(foo); ~~~ !!! error TS2304: Cannot find name 'foo'. diff --git a/tests/baselines/reference/YieldExpression10_es6.js b/tests/baselines/reference/YieldExpression10_es6.js index e1dd44b676b..f32dd1decf7 100644 --- a/tests/baselines/reference/YieldExpression10_es6.js +++ b/tests/baselines/reference/YieldExpression10_es6.js @@ -6,7 +6,7 @@ var v = { * foo() { //// [YieldExpression10_es6.js] -var v = { foo: function* () { +var v = { *foo() { yield (foo); } }; diff --git a/tests/baselines/reference/YieldExpression11_es6.errors.txt b/tests/baselines/reference/YieldExpression11_es6.errors.txt index f5d3458520f..223389e4e39 100644 --- a/tests/baselines/reference/YieldExpression11_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression11_es6.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(2,3): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,11): error TS2663: Cannot find name 'foo'. Did you mean the instance member 'this.foo'? -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts (2 errors) ==== +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts (1 errors) ==== class C { *foo() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. yield(foo); ~~~ !!! error TS2663: Cannot find name 'foo'. Did you mean the instance member 'this.foo'? diff --git a/tests/baselines/reference/YieldExpression11_es6.js b/tests/baselines/reference/YieldExpression11_es6.js index fb4f83c7197..46adf673634 100644 --- a/tests/baselines/reference/YieldExpression11_es6.js +++ b/tests/baselines/reference/YieldExpression11_es6.js @@ -6,11 +6,8 @@ class C { } //// [YieldExpression11_es6.js] -var C = (function () { - function C() { - } - C.prototype.foo = function* () { +class C { + *foo() { yield (foo); - }; - return C; -}()); + } +} diff --git a/tests/baselines/reference/YieldExpression12_es6.js b/tests/baselines/reference/YieldExpression12_es6.js index 7211d41cb86..d0ff7e9d6b8 100644 --- a/tests/baselines/reference/YieldExpression12_es6.js +++ b/tests/baselines/reference/YieldExpression12_es6.js @@ -6,9 +6,8 @@ class C { } //// [YieldExpression12_es6.js] -var C = (function () { - function C() { +class C { + constructor() { yield foo; } - return C; -}()); +} diff --git a/tests/baselines/reference/YieldExpression13_es6.errors.txt b/tests/baselines/reference/YieldExpression13_es6.errors.txt deleted file mode 100644 index 99088448886..00000000000 --- a/tests/baselines/reference/YieldExpression13_es6.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts (1 errors) ==== - function* foo() { yield } - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression13_es6.symbols b/tests/baselines/reference/YieldExpression13_es6.symbols new file mode 100644 index 00000000000..f2e1b100c9d --- /dev/null +++ b/tests/baselines/reference/YieldExpression13_es6.symbols @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts === +function* foo() { yield } +>foo : Symbol(foo, Decl(YieldExpression13_es6.ts, 0, 0)) + diff --git a/tests/baselines/reference/YieldExpression13_es6.types b/tests/baselines/reference/YieldExpression13_es6.types new file mode 100644 index 00000000000..011ac1e09e8 --- /dev/null +++ b/tests/baselines/reference/YieldExpression13_es6.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts === +function* foo() { yield } +>foo : () => IterableIterator +>yield : any + diff --git a/tests/baselines/reference/YieldExpression14_es6.js b/tests/baselines/reference/YieldExpression14_es6.js index e8c33c2085e..e25a29e606f 100644 --- a/tests/baselines/reference/YieldExpression14_es6.js +++ b/tests/baselines/reference/YieldExpression14_es6.js @@ -6,11 +6,8 @@ class C { } //// [YieldExpression14_es6.js] -var C = (function () { - function C() { - } - C.prototype.foo = function () { +class C { + foo() { yield foo; - }; - return C; -}()); + } +} diff --git a/tests/baselines/reference/YieldExpression15_es6.js b/tests/baselines/reference/YieldExpression15_es6.js index 1e4431d6168..d03699922f6 100644 --- a/tests/baselines/reference/YieldExpression15_es6.js +++ b/tests/baselines/reference/YieldExpression15_es6.js @@ -4,6 +4,6 @@ var v = () => { } //// [YieldExpression15_es6.js] -var v = function () { +var v = () => { yield foo; }; diff --git a/tests/baselines/reference/YieldExpression16_es6.errors.txt b/tests/baselines/reference/YieldExpression16_es6.errors.txt index 0645f5d818a..94e082f4c27 100644 --- a/tests/baselines/reference/YieldExpression16_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression16_es6.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(3,5): error TS1163: A 'yield' expression is only allowed in a generator body. -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts (2 errors) ==== +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts (1 errors) ==== function* foo() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. function bar() { yield foo; ~~~~~ diff --git a/tests/baselines/reference/YieldExpression17_es6.errors.txt b/tests/baselines/reference/YieldExpression17_es6.errors.txt index f987517371f..540b1a889f0 100644 --- a/tests/baselines/reference/YieldExpression17_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression17_es6.errors.txt @@ -1,13 +1,10 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,15): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,15): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): error TS1163: A 'yield' expression is only allowed in a generator body. -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts (3 errors) ==== +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts (2 errors) ==== var v = { get foo() { yield foo; } } ~~~ -!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~ !!! error TS2378: A 'get' accessor must return a value. ~~~~~ !!! error TS1163: A 'yield' expression is only allowed in a generator body. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression18_es6.errors.txt b/tests/baselines/reference/YieldExpression18_es6.errors.txt index 5dd2807716f..dd4e4839894 100644 --- a/tests/baselines/reference/YieldExpression18_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression18_es6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts(2,1): error TS1212: Identifier expected. 'yield' is a reserved word in strict mode +tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts(2,1): error TS1212: Identifier expected. 'yield' is a reserved word in strict mode. tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts(2,1): error TS2304: Cannot find name 'yield'. tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts(2,7): error TS2304: Cannot find name 'foo'. @@ -7,7 +7,7 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts(2,7): erro "use strict"; yield(foo); ~~~~~ -!!! error TS1212: Identifier expected. 'yield' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'yield' is a reserved word in strict mode. ~~~~~ !!! error TS2304: Cannot find name 'yield'. ~~~ diff --git a/tests/baselines/reference/YieldExpression19_es6.errors.txt b/tests/baselines/reference/YieldExpression19_es6.errors.txt deleted file mode 100644 index f07cfc1db78..00000000000 --- a/tests/baselines/reference/YieldExpression19_es6.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. -tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(3,13): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts (2 errors) ==== - function*foo() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - function bar() { - function* quux() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - yield(foo); - } - } - } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression19_es6.symbols b/tests/baselines/reference/YieldExpression19_es6.symbols new file mode 100644 index 00000000000..609102001c4 --- /dev/null +++ b/tests/baselines/reference/YieldExpression19_es6.symbols @@ -0,0 +1,15 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts === +function*foo() { +>foo : Symbol(foo, Decl(YieldExpression19_es6.ts, 0, 0)) + + function bar() { +>bar : Symbol(bar, Decl(YieldExpression19_es6.ts, 0, 16)) + + function* quux() { +>quux : Symbol(quux, Decl(YieldExpression19_es6.ts, 1, 18)) + + yield(foo); +>foo : Symbol(foo, Decl(YieldExpression19_es6.ts, 0, 0)) + } + } +} diff --git a/tests/baselines/reference/YieldExpression19_es6.types b/tests/baselines/reference/YieldExpression19_es6.types new file mode 100644 index 00000000000..f57b175d53c --- /dev/null +++ b/tests/baselines/reference/YieldExpression19_es6.types @@ -0,0 +1,17 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts === +function*foo() { +>foo : () => IterableIterator + + function bar() { +>bar : () => void + + function* quux() { +>quux : () => IterableIterator<() => IterableIterator> + + yield(foo); +>yield(foo) : any +>(foo) : () => IterableIterator +>foo : () => IterableIterator + } + } +} diff --git a/tests/baselines/reference/YieldExpression3_es6.errors.txt b/tests/baselines/reference/YieldExpression3_es6.errors.txt deleted file mode 100644 index 9f07c13184e..00000000000 --- a/tests/baselines/reference/YieldExpression3_es6.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts (1 errors) ==== - function* foo() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - yield - yield - } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression3_es6.symbols b/tests/baselines/reference/YieldExpression3_es6.symbols new file mode 100644 index 00000000000..4ab5b42688f --- /dev/null +++ b/tests/baselines/reference/YieldExpression3_es6.symbols @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts === +function* foo() { +>foo : Symbol(foo, Decl(YieldExpression3_es6.ts, 0, 0)) + + yield + yield +} diff --git a/tests/baselines/reference/YieldExpression3_es6.types b/tests/baselines/reference/YieldExpression3_es6.types new file mode 100644 index 00000000000..9e2f810d911 --- /dev/null +++ b/tests/baselines/reference/YieldExpression3_es6.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts === +function* foo() { +>foo : () => IterableIterator + + yield +>yield : any + + yield +>yield : any +} diff --git a/tests/baselines/reference/YieldExpression4_es6.errors.txt b/tests/baselines/reference/YieldExpression4_es6.errors.txt deleted file mode 100644 index 6c9a5796ee8..00000000000 --- a/tests/baselines/reference/YieldExpression4_es6.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts (1 errors) ==== - function* foo() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - yield; - yield; - } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression4_es6.symbols b/tests/baselines/reference/YieldExpression4_es6.symbols new file mode 100644 index 00000000000..7954fb705e6 --- /dev/null +++ b/tests/baselines/reference/YieldExpression4_es6.symbols @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts === +function* foo() { +>foo : Symbol(foo, Decl(YieldExpression4_es6.ts, 0, 0)) + + yield; + yield; +} diff --git a/tests/baselines/reference/YieldExpression4_es6.types b/tests/baselines/reference/YieldExpression4_es6.types new file mode 100644 index 00000000000..929bef38edd --- /dev/null +++ b/tests/baselines/reference/YieldExpression4_es6.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts === +function* foo() { +>foo : () => IterableIterator + + yield; +>yield : any + + yield; +>yield : any +} diff --git a/tests/baselines/reference/YieldExpression6_es6.errors.txt b/tests/baselines/reference/YieldExpression6_es6.errors.txt index f2fc90b81b4..b8c0967864c 100644 --- a/tests/baselines/reference/YieldExpression6_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression6_es6.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(2,9): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts (2 errors) ==== +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts (1 errors) ==== function* foo() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. yield*foo ~~~ !!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. diff --git a/tests/baselines/reference/YieldExpression7_es6.errors.txt b/tests/baselines/reference/YieldExpression7_es6.errors.txt deleted file mode 100644 index f929dff0a2a..00000000000 --- a/tests/baselines/reference/YieldExpression7_es6.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts (1 errors) ==== - function* foo() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - yield foo - } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression7_es6.symbols b/tests/baselines/reference/YieldExpression7_es6.symbols new file mode 100644 index 00000000000..53737c94be9 --- /dev/null +++ b/tests/baselines/reference/YieldExpression7_es6.symbols @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts === +function* foo() { +>foo : Symbol(foo, Decl(YieldExpression7_es6.ts, 0, 0)) + + yield foo +>foo : Symbol(foo, Decl(YieldExpression7_es6.ts, 0, 0)) +} diff --git a/tests/baselines/reference/YieldExpression7_es6.types b/tests/baselines/reference/YieldExpression7_es6.types new file mode 100644 index 00000000000..44dcc196c3b --- /dev/null +++ b/tests/baselines/reference/YieldExpression7_es6.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts === +function* foo() { +>foo : () => IterableIterator + + yield foo +>yield foo : any +>foo : () => IterableIterator +} diff --git a/tests/baselines/reference/YieldExpression8_es6.errors.txt b/tests/baselines/reference/YieldExpression8_es6.errors.txt index aef1fbc122d..f4dd30b1a19 100644 --- a/tests/baselines/reference/YieldExpression8_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression8_es6.errors.txt @@ -1,13 +1,10 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(1,1): error TS2304: Cannot find name 'yield'. -tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (2 errors) ==== +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (1 errors) ==== yield(foo); ~~~~~ !!! error TS2304: Cannot find name 'yield'. function* foo() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. yield(foo); } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression9_es6.errors.txt b/tests/baselines/reference/YieldExpression9_es6.errors.txt index 2ad925a90a0..1241e615f79 100644 --- a/tests/baselines/reference/YieldExpression9_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression9_es6.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(1,17): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(2,9): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts (2 errors) ==== +==== tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts (1 errors) ==== var v = function*() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. yield(foo); ~~~ !!! error TS2304: Cannot find name 'foo'. diff --git a/tests/baselines/reference/YieldStarExpression4_es6.errors.txt b/tests/baselines/reference/YieldStarExpression4_es6.errors.txt deleted file mode 100644 index c58844a9288..00000000000 --- a/tests/baselines/reference/YieldStarExpression4_es6.errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. -tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts(2,13): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts (2 errors) ==== - function *g() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - yield * []; - ~~ -!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. - } \ No newline at end of file diff --git a/tests/baselines/reference/YieldStarExpression4_es6.symbols b/tests/baselines/reference/YieldStarExpression4_es6.symbols new file mode 100644 index 00000000000..c23e2ac8895 --- /dev/null +++ b/tests/baselines/reference/YieldStarExpression4_es6.symbols @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts === +function *g() { +>g : Symbol(g, Decl(YieldStarExpression4_es6.ts, 0, 0)) + + yield * []; +} diff --git a/tests/baselines/reference/YieldStarExpression4_es6.types b/tests/baselines/reference/YieldStarExpression4_es6.types new file mode 100644 index 00000000000..1d72e6dc506 --- /dev/null +++ b/tests/baselines/reference/YieldStarExpression4_es6.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts === +function *g() { +>g : () => IterableIterator + + yield * []; +>yield * [] : any +>[] : undefined[] +} diff --git a/tests/baselines/reference/ambientDeclarationsPatterns_tooManyAsterisks.errors.txt b/tests/baselines/reference/ambientDeclarationsPatterns_tooManyAsterisks.errors.txt index 7a3ff02aa5e..b40365e9b8e 100644 --- a/tests/baselines/reference/ambientDeclarationsPatterns_tooManyAsterisks.errors.txt +++ b/tests/baselines/reference/ambientDeclarationsPatterns_tooManyAsterisks.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/ambient/ambientDeclarationsPatterns_tooManyAsterisks.ts(1,16): error TS5061: Pattern 'too*many*asterisks' can have at most one '*' character +tests/cases/conformance/ambient/ambientDeclarationsPatterns_tooManyAsterisks.ts(1,16): error TS5061: Pattern 'too*many*asterisks' can have at most one '*' character. ==== tests/cases/conformance/ambient/ambientDeclarationsPatterns_tooManyAsterisks.ts (1 errors) ==== declare module "too*many*asterisks" { } ~~~~~~~~~~~~~~~~~~~~ -!!! error TS5061: Pattern 'too*many*asterisks' can have at most one '*' character +!!! error TS5061: Pattern 'too*many*asterisks' can have at most one '*' character. \ No newline at end of file diff --git a/tests/baselines/reference/arrayLiteralSpreadES5iterable.js b/tests/baselines/reference/arrayLiteralSpreadES5iterable.js new file mode 100644 index 00000000000..d71f49242dd --- /dev/null +++ b/tests/baselines/reference/arrayLiteralSpreadES5iterable.js @@ -0,0 +1,66 @@ +//// [arrayLiteralSpreadES5iterable.ts] +function f0() { + var a = [1, 2, 3]; + 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 = ["hello", ...a, true]; + var b: (string | number | boolean)[]; +} + +function f2() { + var a = [...[...[...[...[...[]]]]]]; + var b = [...[...[...[...[...[5]]]]]]; +} + + +//// [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 __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; +function f0() { + var a = [1, 2, 3]; + var a1 = __spread(a); + var a2 = __spread([1], a); + var a3 = __spread([1, 2], a); + var a4 = __spread(a, [1]); + var a5 = __spread(a, [1, 2]); + var a6 = __spread([1, 2], a, [1, 2]); + var a7 = __spread([1], a, [2], a); + var a8 = __spread(a, a, a); +} +function f1() { + var a = [1, 2, 3]; + var b = __spread(["hello"], a, [true]); + var b; +} +function f2() { + var a = __spread([]); + var b = __spread([5]); +} diff --git a/tests/baselines/reference/arrayLiteralSpreadES5iterable.symbols b/tests/baselines/reference/arrayLiteralSpreadES5iterable.symbols new file mode 100644 index 00000000000..e31cc74e013 --- /dev/null +++ b/tests/baselines/reference/arrayLiteralSpreadES5iterable.symbols @@ -0,0 +1,67 @@ +=== tests/cases/conformance/es6/spread/arrayLiteralSpreadES5iterable.ts === +function f0() { +>f0 : Symbol(f0, Decl(arrayLiteralSpreadES5iterable.ts, 0, 0)) + + var a = [1, 2, 3]; +>a : Symbol(a, Decl(arrayLiteralSpreadES5iterable.ts, 1, 7)) + + var a1 = [...a]; +>a1 : Symbol(a1, Decl(arrayLiteralSpreadES5iterable.ts, 2, 7)) +>a : Symbol(a, Decl(arrayLiteralSpreadES5iterable.ts, 1, 7)) + + var a2 = [1, ...a]; +>a2 : Symbol(a2, Decl(arrayLiteralSpreadES5iterable.ts, 3, 7)) +>a : Symbol(a, Decl(arrayLiteralSpreadES5iterable.ts, 1, 7)) + + var a3 = [1, 2, ...a]; +>a3 : Symbol(a3, Decl(arrayLiteralSpreadES5iterable.ts, 4, 7)) +>a : Symbol(a, Decl(arrayLiteralSpreadES5iterable.ts, 1, 7)) + + var a4 = [...a, 1]; +>a4 : Symbol(a4, Decl(arrayLiteralSpreadES5iterable.ts, 5, 7)) +>a : Symbol(a, Decl(arrayLiteralSpreadES5iterable.ts, 1, 7)) + + var a5 = [...a, 1, 2]; +>a5 : Symbol(a5, Decl(arrayLiteralSpreadES5iterable.ts, 6, 7)) +>a : Symbol(a, Decl(arrayLiteralSpreadES5iterable.ts, 1, 7)) + + var a6 = [1, 2, ...a, 1, 2]; +>a6 : Symbol(a6, Decl(arrayLiteralSpreadES5iterable.ts, 7, 7)) +>a : Symbol(a, Decl(arrayLiteralSpreadES5iterable.ts, 1, 7)) + + var a7 = [1, ...a, 2, ...a]; +>a7 : Symbol(a7, Decl(arrayLiteralSpreadES5iterable.ts, 8, 7)) +>a : Symbol(a, Decl(arrayLiteralSpreadES5iterable.ts, 1, 7)) +>a : Symbol(a, Decl(arrayLiteralSpreadES5iterable.ts, 1, 7)) + + var a8 = [...a, ...a, ...a]; +>a8 : Symbol(a8, Decl(arrayLiteralSpreadES5iterable.ts, 9, 7)) +>a : Symbol(a, Decl(arrayLiteralSpreadES5iterable.ts, 1, 7)) +>a : Symbol(a, Decl(arrayLiteralSpreadES5iterable.ts, 1, 7)) +>a : Symbol(a, Decl(arrayLiteralSpreadES5iterable.ts, 1, 7)) +} + +function f1() { +>f1 : Symbol(f1, Decl(arrayLiteralSpreadES5iterable.ts, 10, 1)) + + var a = [1, 2, 3]; +>a : Symbol(a, Decl(arrayLiteralSpreadES5iterable.ts, 13, 7)) + + var b = ["hello", ...a, true]; +>b : Symbol(b, Decl(arrayLiteralSpreadES5iterable.ts, 14, 7), Decl(arrayLiteralSpreadES5iterable.ts, 15, 7)) +>a : Symbol(a, Decl(arrayLiteralSpreadES5iterable.ts, 13, 7)) + + var b: (string | number | boolean)[]; +>b : Symbol(b, Decl(arrayLiteralSpreadES5iterable.ts, 14, 7), Decl(arrayLiteralSpreadES5iterable.ts, 15, 7)) +} + +function f2() { +>f2 : Symbol(f2, Decl(arrayLiteralSpreadES5iterable.ts, 16, 1)) + + var a = [...[...[...[...[...[]]]]]]; +>a : Symbol(a, Decl(arrayLiteralSpreadES5iterable.ts, 19, 7)) + + var b = [...[...[...[...[...[5]]]]]]; +>b : Symbol(b, Decl(arrayLiteralSpreadES5iterable.ts, 20, 7)) +} + diff --git a/tests/baselines/reference/arrayLiteralSpreadES5iterable.types b/tests/baselines/reference/arrayLiteralSpreadES5iterable.types new file mode 100644 index 00000000000..21c41bb6dce --- /dev/null +++ b/tests/baselines/reference/arrayLiteralSpreadES5iterable.types @@ -0,0 +1,133 @@ +=== tests/cases/conformance/es6/spread/arrayLiteralSpreadES5iterable.ts === +function f0() { +>f0 : () => void + + var a = [1, 2, 3]; +>a : number[] +>[1, 2, 3] : number[] +>1 : 1 +>2 : 2 +>3 : 3 + + var a1 = [...a]; +>a1 : number[] +>[...a] : number[] +>...a : number +>a : number[] + + var a2 = [1, ...a]; +>a2 : number[] +>[1, ...a] : number[] +>1 : 1 +>...a : number +>a : number[] + + var a3 = [1, 2, ...a]; +>a3 : number[] +>[1, 2, ...a] : number[] +>1 : 1 +>2 : 2 +>...a : number +>a : number[] + + var a4 = [...a, 1]; +>a4 : number[] +>[...a, 1] : number[] +>...a : number +>a : number[] +>1 : 1 + + var a5 = [...a, 1, 2]; +>a5 : number[] +>[...a, 1, 2] : number[] +>...a : number +>a : number[] +>1 : 1 +>2 : 2 + + var a6 = [1, 2, ...a, 1, 2]; +>a6 : number[] +>[1, 2, ...a, 1, 2] : number[] +>1 : 1 +>2 : 2 +>...a : number +>a : number[] +>1 : 1 +>2 : 2 + + var a7 = [1, ...a, 2, ...a]; +>a7 : number[] +>[1, ...a, 2, ...a] : number[] +>1 : 1 +>...a : number +>a : number[] +>2 : 2 +>...a : number +>a : number[] + + var a8 = [...a, ...a, ...a]; +>a8 : number[] +>[...a, ...a, ...a] : number[] +>...a : number +>a : number[] +>...a : number +>a : number[] +>...a : number +>a : number[] +} + +function f1() { +>f1 : () => void + + var a = [1, 2, 3]; +>a : number[] +>[1, 2, 3] : number[] +>1 : 1 +>2 : 2 +>3 : 3 + + var b = ["hello", ...a, true]; +>b : (string | number | boolean)[] +>["hello", ...a, true] : (string | number | boolean)[] +>"hello" : "hello" +>...a : number +>a : number[] +>true : true + + var b: (string | number | boolean)[]; +>b : (string | number | boolean)[] +} + +function f2() { +>f2 : () => void + + var a = [...[...[...[...[...[]]]]]]; +>a : any[] +>[...[...[...[...[...[]]]]]] : undefined[] +>...[...[...[...[...[]]]]] : undefined +>[...[...[...[...[]]]]] : undefined[] +>...[...[...[...[]]]] : undefined +>[...[...[...[]]]] : undefined[] +>...[...[...[]]] : undefined +>[...[...[]]] : undefined[] +>...[...[]] : undefined +>[...[]] : undefined[] +>...[] : undefined +>[] : undefined[] + + var b = [...[...[...[...[...[5]]]]]]; +>b : number[] +>[...[...[...[...[...[5]]]]]] : number[] +>...[...[...[...[...[5]]]]] : number +>[...[...[...[...[5]]]]] : number[] +>...[...[...[...[5]]]] : number +>[...[...[...[5]]]] : number[] +>...[...[...[5]]] : number +>[...[...[5]]] : number[] +>...[...[5]] : number +>[...[5]] : number[] +>...[5] : number +>[5] : number[] +>5 : 5 +} + diff --git a/tests/baselines/reference/asiPreventsParsingAsInterface05.errors.txt b/tests/baselines/reference/asiPreventsParsingAsInterface05.errors.txt index e070305fdf8..71f272b4268 100644 --- a/tests/baselines/reference/asiPreventsParsingAsInterface05.errors.txt +++ b/tests/baselines/reference/asiPreventsParsingAsInterface05.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInterface05.ts(3,5): error TS1212: Identifier expected. 'interface' is a reserved word in strict mode -tests/cases/conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInterface05.ts(10,1): error TS1212: Identifier expected. 'interface' is a reserved word in strict mode +tests/cases/conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInterface05.ts(3,5): error TS1212: Identifier expected. 'interface' is a reserved word in strict mode. +tests/cases/conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInterface05.ts(10,1): error TS1212: Identifier expected. 'interface' is a reserved word in strict mode. tests/cases/conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInterface05.ts(11,1): error TS2304: Cannot find name 'I'. @@ -8,7 +8,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInt var interface: number; ~~~~~~~~~ -!!! error TS1212: Identifier expected. 'interface' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'interface' is a reserved word in strict mode. // 'interface' is a strict mode reserved word, and so it would be permissible // to allow 'interface' and the name of the interface to be on separate lines; @@ -17,7 +17,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInt interface // This should be the identifier 'interface' ~~~~~~~~~ -!!! error TS1212: Identifier expected. 'interface' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'interface' is a reserved word in strict mode. I // This should be the identifier 'I' ~ !!! error TS2304: Cannot find name 'I'. diff --git a/tests/baselines/reference/assigningFromObjectToAnythingElse.errors.txt b/tests/baselines/reference/assigningFromObjectToAnythingElse.errors.txt index 070339e4726..d3395c7ebc9 100644 --- a/tests/baselines/reference/assigningFromObjectToAnythingElse.errors.txt +++ b/tests/baselines/reference/assigningFromObjectToAnythingElse.errors.txt @@ -1,11 +1,8 @@ tests/cases/compiler/assigningFromObjectToAnythingElse.ts(3,1): error TS2322: Type 'Object' is not assignable to type 'RegExp'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? Property 'exec' is missing in type 'Object'. -tests/cases/compiler/assigningFromObjectToAnythingElse.ts(5,5): error TS2322: Type 'object | Object' is not assignable to type 'String'. - Type 'object' is not assignable to type 'String'. - Property 'charAt' is missing in type '{}'. -tests/cases/compiler/assigningFromObjectToAnythingElse.ts(6,5): error TS2322: Type 'object | Number' is not assignable to type 'String'. - Type 'object' is not assignable to type 'String'. +tests/cases/compiler/assigningFromObjectToAnythingElse.ts(5,17): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/assigningFromObjectToAnythingElse.ts(6,17): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/compiler/assigningFromObjectToAnythingElse.ts(8,5): error TS2322: Type 'Object' is not assignable to type 'Error'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? Property 'name' is missing in type 'Object'. @@ -21,14 +18,11 @@ tests/cases/compiler/assigningFromObjectToAnythingElse.ts(8,5): error TS2322: Ty !!! error TS2322: Property 'exec' is missing in type 'Object'. var a: String = Object.create(""); - ~ -!!! error TS2322: Type 'object | Object' is not assignable to type 'String'. -!!! error TS2322: Type 'object' is not assignable to type 'String'. -!!! error TS2322: Property 'charAt' is missing in type '{}'. + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. var c: String = Object.create(1); - ~ -!!! error TS2322: Type 'object | Number' is not assignable to type 'String'. -!!! error TS2322: Type 'object' is not assignable to type 'String'. + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. var w: Error = new Object(); ~ diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures.errors.txt index 8e285d414e5..cdf0ee400de 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures.errors.txt @@ -1,19 +1,19 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(28,1): error TS2322: Type 'S2' is not assignable to type 'T'. - Type 'S2' provides no match for the signature 'new (x: number): void' + Type 'S2' provides no match for the signature 'new (x: number): void'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(29,1): error TS2322: Type '(x: string) => void' is not assignable to type 'T'. - Type '(x: string) => void' provides no match for the signature 'new (x: number): void' + Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(30,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T'. - Type '(x: string) => number' provides no match for the signature 'new (x: number): void' + Type '(x: string) => number' provides no match for the signature 'new (x: number): void'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(31,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T'. - Type '(x: string) => string' provides no match for the signature 'new (x: number): void' + Type '(x: string) => string' provides no match for the signature 'new (x: number): void'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(32,1): error TS2322: Type 'S2' is not assignable to type 'new (x: number) => void'. - Type 'S2' provides no match for the signature 'new (x: number): void' + Type 'S2' provides no match for the signature 'new (x: number): void'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(33,1): error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. - Type '(x: string) => void' provides no match for the signature 'new (x: number): void' + Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(34,1): error TS2322: Type '(x: string) => number' is not assignable to type 'new (x: number) => void'. - Type '(x: string) => number' provides no match for the signature 'new (x: number): void' + Type '(x: string) => number' provides no match for the signature 'new (x: number): void'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(35,1): error TS2322: Type '(x: string) => string' is not assignable to type 'new (x: number) => void'. - Type '(x: string) => string' provides no match for the signature 'new (x: number): void' + Type '(x: string) => string' provides no match for the signature 'new (x: number): void'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts (8 errors) ==== @@ -47,33 +47,33 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme t = s2; ~ !!! error TS2322: Type 'S2' is not assignable to type 'T'. -!!! error TS2322: Type 'S2' provides no match for the signature 'new (x: number): void' +!!! error TS2322: Type 'S2' provides no match for the signature 'new (x: number): void'. t = a3; ~ !!! error TS2322: Type '(x: string) => void' is not assignable to type 'T'. -!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void' +!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. t = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type 'T'. -!!! error TS2322: Type '(x: string) => number' provides no match for the signature 'new (x: number): void' +!!! error TS2322: Type '(x: string) => number' provides no match for the signature 'new (x: number): void'. t = function (x: string) { return ''; } ~ !!! error TS2322: Type '(x: string) => string' is not assignable to type 'T'. -!!! error TS2322: Type '(x: string) => string' provides no match for the signature 'new (x: number): void' +!!! error TS2322: Type '(x: string) => string' provides no match for the signature 'new (x: number): void'. a = s2; ~ !!! error TS2322: Type 'S2' is not assignable to type 'new (x: number) => void'. -!!! error TS2322: Type 'S2' provides no match for the signature 'new (x: number): void' +!!! error TS2322: Type 'S2' provides no match for the signature 'new (x: number): void'. a = a3; ~ !!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. -!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void' +!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. a = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type 'new (x: number) => void'. -!!! error TS2322: Type '(x: string) => number' provides no match for the signature 'new (x: number): void' +!!! error TS2322: Type '(x: string) => number' provides no match for the signature 'new (x: number): void'. a = function (x: string) { return ''; } ~ !!! error TS2322: Type '(x: string) => string' is not assignable to type 'new (x: number) => void'. -!!! error TS2322: Type '(x: string) => string' provides no match for the signature 'new (x: number): void' +!!! error TS2322: Type '(x: string) => string' provides no match for the signature 'new (x: number): void'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt index eacf758d935..0155b8611c4 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.errors.txt @@ -9,11 +9,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(34,1): error TS2322: Type 'S2' is not assignable to type 'T'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. - Type '(x: string) => void' provides no match for the signature 'new (x: number): void' + Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(35,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. - Type '(x: string) => void' provides no match for the signature 'new (x: number): void' + Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(36,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T'. Property 'f' is missing in type '(x: string) => number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(37,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T'. @@ -21,11 +21,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(38,1): error TS2322: Type 'S2' is not assignable to type '{ f: new (x: number) => void; }'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. - Type '(x: string) => void' provides no match for the signature 'new (x: number): void' + Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(39,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f: new (x: number) => void; }'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. - Type '(x: string) => void' provides no match for the signature 'new (x: number): void' + Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(40,1): error TS2322: Type '(x: string) => number' is not assignable to type '{ f: new (x: number) => void; }'. Property 'f' is missing in type '(x: string) => number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(41,1): error TS2322: Type '(x: string) => string' is not assignable to type '{ f: new (x: number) => void; }'. @@ -83,13 +83,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'S2' is not assignable to type 'T'. !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. -!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void' +!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. t = a3; ~ !!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T'. !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. -!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void' +!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. t = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type 'T'. @@ -103,13 +103,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'S2' is not assignable to type '{ f: new (x: number) => void; }'. !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. -!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void' +!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. a = a3; ~ !!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f: new (x: number) => void; }'. !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'. -!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void' +!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'. a = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type '{ f: new (x: number) => void; }'. diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt index 3f8111a3244..f6e93e13f04 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt @@ -15,19 +15,19 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(77,9): error TS2322: Type 'new (x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }'. Types of parameters 'x' and 'x' are incompatible. Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'. - Type '{ new (a: number): number; new (a?: number): number; }' provides no match for the signature '(a: any): any' + Type '{ new (a: number): number; new (a?: number): number; }' provides no match for the signature '(a: any): any'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(78,9): error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new (x: (a: T) => T) => T[]'. Types of parameters 'x' and 'x' are incompatible. Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'. - Type '(a: any) => any' provides no match for the signature 'new (a: number): number' + Type '(a: any) => any' provides no match for the signature 'new (a: number): number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(81,9): error TS2322: Type 'new (x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }'. Types of parameters 'x' and 'x' are incompatible. Type '{ new (a: T): T; new (a: T): T; }' is not assignable to type '(a: any) => any'. - Type '{ new (a: T): T; new (a: T): T; }' provides no match for the signature '(a: any): any' + Type '{ new (a: T): T; new (a: T): T; }' provides no match for the signature '(a: any): any'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(82,9): error TS2322: Type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }' is not assignable to type 'new (x: (a: T) => T) => any[]'. Types of parameters 'x' and 'x' are incompatible. Type '(a: any) => any' is not assignable to type '{ new (a: T): T; new (a: T): T; }'. - Type '(a: any) => any' provides no match for the signature 'new (a: T): T' + Type '(a: any) => any' provides no match for the signature 'new (a: T): T'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts (6 errors) ==== @@ -128,13 +128,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'new (x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'. -!!! error TS2322: Type '{ new (a: number): number; new (a?: number): number; }' provides no match for the signature '(a: any): any' +!!! error TS2322: Type '{ new (a: number): number; new (a?: number): number; }' provides no match for the signature '(a: any): any'. b16 = a16; // error ~~~ !!! error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new (x: (a: T) => T) => T[]'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'. -!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: number): number' +!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: number): number'. var b17: new (x: (a: T) => T) => any[]; a17 = b17; // error @@ -142,13 +142,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'new (x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type '{ new (a: T): T; new (a: T): T; }' is not assignable to type '(a: any) => any'. -!!! error TS2322: Type '{ new (a: T): T; new (a: T): T; }' provides no match for the signature '(a: any): any' +!!! error TS2322: Type '{ new (a: T): T; new (a: T): T; }' provides no match for the signature '(a: any): any'. b17 = a17; // error ~~~ !!! error TS2322: Type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }' is not assignable to type 'new (x: (a: T) => T) => any[]'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: T): T; new (a: T): T; }'. -!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: T): T' +!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: T): T'. } module WithGenericSignaturesInBaseType { diff --git a/tests/baselines/reference/assignmentCompatability24.errors.txt b/tests/baselines/reference/assignmentCompatability24.errors.txt index e49f0803b04..9d200272b31 100644 --- a/tests/baselines/reference/assignmentCompatability24.errors.txt +++ b/tests/baselines/reference/assignmentCompatability24.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatability24.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. - Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tstring): Tstring' + Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tstring): Tstring'. ==== tests/cases/compiler/assignmentCompatability24.ts (1 errors) ==== @@ -14,4 +14,4 @@ tests/cases/compiler/assignmentCompatability24.ts(9,1): error TS2322: Type 'inte __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. -!!! error TS2322: Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tstring): Tstring' \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tstring): Tstring'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability33.errors.txt b/tests/baselines/reference/assignmentCompatability33.errors.txt index 386b3c5e292..a67e0c2ae07 100644 --- a/tests/baselines/reference/assignmentCompatability33.errors.txt +++ b/tests/baselines/reference/assignmentCompatability33.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatability33.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. - Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tstring): Tstring' + Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tstring): Tstring'. ==== tests/cases/compiler/assignmentCompatability33.ts (1 errors) ==== @@ -14,4 +14,4 @@ tests/cases/compiler/assignmentCompatability33.ts(9,1): error TS2322: Type 'inte __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tstring) => Tstring'. -!!! error TS2322: Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tstring): Tstring' \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tstring): Tstring'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability34.errors.txt b/tests/baselines/reference/assignmentCompatability34.errors.txt index fa91456b286..1dced22968b 100644 --- a/tests/baselines/reference/assignmentCompatability34.errors.txt +++ b/tests/baselines/reference/assignmentCompatability34.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatability34.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tnumber) => Tnumber'. - Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tnumber): Tnumber' + Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tnumber): Tnumber'. ==== tests/cases/compiler/assignmentCompatability34.ts (1 errors) ==== @@ -14,4 +14,4 @@ tests/cases/compiler/assignmentCompatability34.ts(9,1): error TS2322: Type 'inte __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '(a: Tnumber) => Tnumber'. -!!! error TS2322: Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tnumber): Tnumber' \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' provides no match for the signature '(a: Tnumber): Tnumber'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability37.errors.txt b/tests/baselines/reference/assignmentCompatability37.errors.txt index 194e216f1ee..b007955968f 100644 --- a/tests/baselines/reference/assignmentCompatability37.errors.txt +++ b/tests/baselines/reference/assignmentCompatability37.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatability37.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tnumber) => any'. - Type 'interfaceWithPublicAndOptional' provides no match for the signature 'new (param: Tnumber): any' + Type 'interfaceWithPublicAndOptional' provides no match for the signature 'new (param: Tnumber): any'. ==== tests/cases/compiler/assignmentCompatability37.ts (1 errors) ==== @@ -14,4 +14,4 @@ tests/cases/compiler/assignmentCompatability37.ts(9,1): error TS2322: Type 'inte __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tnumber) => any'. -!!! error TS2322: Type 'interfaceWithPublicAndOptional' provides no match for the signature 'new (param: Tnumber): any' \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' provides no match for the signature 'new (param: Tnumber): any'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability38.errors.txt b/tests/baselines/reference/assignmentCompatability38.errors.txt index c15e5e31230..9b5aebca8e3 100644 --- a/tests/baselines/reference/assignmentCompatability38.errors.txt +++ b/tests/baselines/reference/assignmentCompatability38.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatability38.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tstring) => any'. - Type 'interfaceWithPublicAndOptional' provides no match for the signature 'new (param: Tstring): any' + Type 'interfaceWithPublicAndOptional' provides no match for the signature 'new (param: Tstring): any'. ==== tests/cases/compiler/assignmentCompatability38.ts (1 errors) ==== @@ -14,4 +14,4 @@ tests/cases/compiler/assignmentCompatability38.ts(9,1): error TS2322: Type 'inte __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'new (param: Tstring) => any'. -!!! error TS2322: Type 'interfaceWithPublicAndOptional' provides no match for the signature 'new (param: Tstring): any' \ No newline at end of file +!!! error TS2322: Type 'interfaceWithPublicAndOptional' provides no match for the signature 'new (param: Tstring): any'. \ No newline at end of file diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js b/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js index bd05f90a26e..335bd8a340e 100644 --- a/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js @@ -50,8 +50,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; 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; - return { next: verb(0), "throw": verb(1), "return": verb(2) }; + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "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."); diff --git a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js index 6d167a00089..edceab4cf96 100644 --- a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js +++ b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js @@ -58,7 +58,7 @@ function fn1() { _a.label = 1; case 1: if (!(i < 1)) return [3 /*break*/, 4]; - return [5 /*yield**/, _loop_1(i)]; + return [5 /*yield**/, __values(_loop_1(i))]; case 2: _a.sent(); _a.label = 3; @@ -92,7 +92,7 @@ function fn2() { _a.label = 1; case 1: if (!(i < 1)) return [3 /*break*/, 4]; - return [5 /*yield**/, _loop_2(i)]; + return [5 /*yield**/, __values(_loop_2(i))]; case 2: state_1 = _a.sent(); if (state_1 === "break") @@ -128,7 +128,7 @@ function fn3() { _a.label = 1; case 1: if (!(i < 1)) return [3 /*break*/, 4]; - return [5 /*yield**/, _loop_3(i)]; + return [5 /*yield**/, __values(_loop_3(i))]; case 2: _a.sent(); _a.label = 3; @@ -162,7 +162,7 @@ function fn4() { _a.label = 1; case 1: if (!(i < 1)) return [3 /*break*/, 4]; - return [5 /*yield**/, _loop_4(i)]; + return [5 /*yield**/, __values(_loop_4(i))]; case 2: state_2 = _a.sent(); if (typeof state_2 === "object") diff --git a/tests/baselines/reference/asyncAwait_es5.js b/tests/baselines/reference/asyncAwait_es5.js index e4dc62ea1cf..f49f4472b13 100644 --- a/tests/baselines/reference/asyncAwait_es5.js +++ b/tests/baselines/reference/asyncAwait_es5.js @@ -49,8 +49,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; 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; - return { next: verb(0), "throw": verb(1), "return": verb(2) }; + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "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."); diff --git a/tests/baselines/reference/asyncFunctionDeclaration12_es5.js b/tests/baselines/reference/asyncFunctionDeclaration12_es5.js index 4123175b22c..21651a42796 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration12_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration12_es5.js @@ -2,4 +2,8 @@ var v = async function await(): Promise { } //// [asyncFunctionDeclaration12_es5.js] -var v = , await = function () { }; +var v = function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); +}, await = function () { }; diff --git a/tests/baselines/reference/asyncFunctionDeclaration12_es6.js b/tests/baselines/reference/asyncFunctionDeclaration12_es6.js index dae33682ce6..9943c3896b6 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration12_es6.js +++ b/tests/baselines/reference/asyncFunctionDeclaration12_es6.js @@ -2,4 +2,6 @@ var v = async function await(): Promise { } //// [asyncFunctionDeclaration12_es6.js] -var v = , await = () => { }; +var v = function () { + return __awaiter(this, void 0, void 0, function* () { }); +}, await = () => { }; diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt index a5334d5b9d7..f8029687fb1 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt +++ b/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt @@ -8,8 +8,8 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1 Types of property 'then' are incompatible. Type '() => void' is not assignable to type '(onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. Type 'void' is not assignable to type 'PromiseLike'. -tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(17,16): error TS1059: Return expression in async function does not have a valid callable 'then' member. -tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(23,25): error TS1058: Operand for 'await' does not have a valid callable 'then' member. +tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(17,16): error TS1058: Type used as operand to 'await' or the return type of an async function must either be a valid promise or must not contain a callable 'then' member. +tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(23,25): error TS1058: Type used as operand to 'await' or the return type of an async function must either be a valid promise or must not contain a callable 'then' member. ==== tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts (8 errors) ==== @@ -47,7 +47,7 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1 async function fn12() { return obj; } // valid: Promise<{ then: string; }> async function fn13() { return thenable; } // error ~~~~ -!!! error TS1059: Return expression in async function does not have a valid callable 'then' member. +!!! error TS1058: Type used as operand to 'await' or 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 @@ -55,5 +55,5 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1 async function fn18() { await obj; } // valid: Promise async function fn19() { await thenable; } // error ~~~~~~~~~~~~~~ -!!! error TS1058: Operand for 'await' does not have a valid callable 'then' member. +!!! error TS1058: Type used as operand to 'await' or the return type of an async function 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_es6.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration15_es6.errors.txt index e8d3e7d79b1..60f57f3dfbf 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration15_es6.errors.txt +++ b/tests/baselines/reference/asyncFunctionDeclaration15_es6.errors.txt @@ -3,8 +3,8 @@ tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1 tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(8,23): error TS1064: The return type of an async function or method must be the global Promise type. tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(9,23): error TS1064: The return type of an async function or method must be the global Promise type. tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(10,23): error TS1064: The return type of an async function or method must be the global Promise type. -tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(17,16): error TS1059: Return expression in async function does not have a valid callable 'then' member. -tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(23,25): error TS1058: Operand for 'await' does not have a valid callable 'then' member. +tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(17,16): error TS1058: Type used as operand to 'await' or the return type of an async function must either be a valid promise or must not contain a callable 'then' member. +tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(23,25): error TS1058: Type used as operand to 'await' or the return type of an async function must either be a valid promise or must not contain a callable 'then' member. ==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts (7 errors) ==== @@ -36,7 +36,7 @@ tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1 async function fn12() { return obj; } // valid: Promise<{ then: string; }> async function fn13() { return thenable; } // error ~~~~ -!!! error TS1059: Return expression in async function does not have a valid callable 'then' member. +!!! error TS1058: Type used as operand to 'await' or 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 @@ -44,5 +44,5 @@ tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1 async function fn18() { await obj; } // valid: Promise async function fn19() { await thenable; } // error ~~~~~~~~~~~~~~ -!!! error TS1058: Operand for 'await' does not have a valid callable 'then' member. +!!! error TS1058: Type used as operand to 'await' or the return type of an async function 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/asyncFunctionNoReturnType.js b/tests/baselines/reference/asyncFunctionNoReturnType.js index b1c55416566..6f4a3795118 100644 --- a/tests/baselines/reference/asyncFunctionNoReturnType.js +++ b/tests/baselines/reference/asyncFunctionNoReturnType.js @@ -15,8 +15,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; 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; - return { next: verb(0), "throw": verb(1), "return": verb(2) }; + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "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."); diff --git a/tests/baselines/reference/asyncImportedPromise_es5.js b/tests/baselines/reference/asyncImportedPromise_es5.js index 550f0d2357e..8a6ec4240ca 100644 --- a/tests/baselines/reference/asyncImportedPromise_es5.js +++ b/tests/baselines/reference/asyncImportedPromise_es5.js @@ -41,8 +41,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; 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; - return { next: verb(0), "throw": verb(1), "return": verb(2) }; + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "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."); diff --git a/tests/baselines/reference/asyncMultiFile_es5.js b/tests/baselines/reference/asyncMultiFile_es5.js index 547135e5c19..67a3ce258b4 100644 --- a/tests/baselines/reference/asyncMultiFile_es5.js +++ b/tests/baselines/reference/asyncMultiFile_es5.js @@ -15,8 +15,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; 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; - return { next: verb(0), "throw": verb(1), "return": verb(2) }; + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "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."); diff --git a/tests/baselines/reference/augmentedTypesModules.errors.txt b/tests/baselines/reference/augmentedTypesModules.errors.txt index 5ece0710e43..627df184644 100644 --- a/tests/baselines/reference/augmentedTypesModules.errors.txt +++ b/tests/baselines/reference/augmentedTypesModules.errors.txt @@ -4,9 +4,9 @@ tests/cases/compiler/augmentedTypesModules.ts(8,8): error TS2300: Duplicate iden tests/cases/compiler/augmentedTypesModules.ts(9,5): error TS2300: Duplicate identifier 'm1b'. tests/cases/compiler/augmentedTypesModules.ts(16,8): error TS2300: Duplicate identifier 'm1d'. tests/cases/compiler/augmentedTypesModules.ts(19,5): error TS2300: Duplicate identifier 'm1d'. -tests/cases/compiler/augmentedTypesModules.ts(25,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged -tests/cases/compiler/augmentedTypesModules.ts(28,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged -tests/cases/compiler/augmentedTypesModules.ts(51,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +tests/cases/compiler/augmentedTypesModules.ts(25,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. +tests/cases/compiler/augmentedTypesModules.ts(28,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. +tests/cases/compiler/augmentedTypesModules.ts(51,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. ==== tests/cases/compiler/augmentedTypesModules.ts (9 errors) ==== @@ -48,12 +48,12 @@ tests/cases/compiler/augmentedTypesModules.ts(51,8): error TS2434: A namespace d module m2a { var y = 2; } ~~~ -!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. function m2a() { }; // error since the module is instantiated module m2b { export var y = 2; } ~~~ -!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. function m2b() { }; // error since the module is instantiated // should be errors to have function first @@ -78,7 +78,7 @@ tests/cases/compiler/augmentedTypesModules.ts(51,8): error TS2434: A namespace d module m3a { var y = 2; } ~~~ -!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. class m3a { foo() { } } // error, class isn't ambient or declared before the module class m3b { foo() { } } diff --git a/tests/baselines/reference/augmentedTypesModules2.errors.txt b/tests/baselines/reference/augmentedTypesModules2.errors.txt index be847d88830..788e55d805b 100644 --- a/tests/baselines/reference/augmentedTypesModules2.errors.txt +++ b/tests/baselines/reference/augmentedTypesModules2.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/augmentedTypesModules2.ts(5,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged -tests/cases/compiler/augmentedTypesModules2.ts(8,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged -tests/cases/compiler/augmentedTypesModules2.ts(14,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +tests/cases/compiler/augmentedTypesModules2.ts(5,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. +tests/cases/compiler/augmentedTypesModules2.ts(8,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. +tests/cases/compiler/augmentedTypesModules2.ts(14,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. ==== tests/cases/compiler/augmentedTypesModules2.ts (3 errors) ==== @@ -10,12 +10,12 @@ tests/cases/compiler/augmentedTypesModules2.ts(14,8): error TS2434: A namespace module m2a { var y = 2; } ~~~ -!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. function m2a() { }; // error since the module is instantiated module m2b { export var y = 2; } ~~~ -!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. function m2b() { }; // error since the module is instantiated function m2c() { }; @@ -23,7 +23,7 @@ tests/cases/compiler/augmentedTypesModules2.ts(14,8): error TS2434: A namespace module m2cc { export var y = 2; } ~~~~ -!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. function m2cc() { }; // error to have module first module m2d { } diff --git a/tests/baselines/reference/augmentedTypesModules3.errors.txt b/tests/baselines/reference/augmentedTypesModules3.errors.txt index 8e1bd706271..46b27da0bec 100644 --- a/tests/baselines/reference/augmentedTypesModules3.errors.txt +++ b/tests/baselines/reference/augmentedTypesModules3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/augmentedTypesModules3.ts(5,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +tests/cases/compiler/augmentedTypesModules3.ts(5,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. ==== tests/cases/compiler/augmentedTypesModules3.ts (1 errors) ==== @@ -8,5 +8,5 @@ tests/cases/compiler/augmentedTypesModules3.ts(5,8): error TS2434: A namespace d module m3a { var y = 2; } ~~~ -!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. class m3a { foo() { } } // error, class isn't ambient or declared before the module \ No newline at end of file diff --git a/tests/baselines/reference/awaitCallExpression2_es5.js b/tests/baselines/reference/awaitCallExpression2_es5.js index 6b0d6e4b648..d9c51e84822 100644 --- a/tests/baselines/reference/awaitCallExpression2_es5.js +++ b/tests/baselines/reference/awaitCallExpression2_es5.js @@ -16,15 +16,15 @@ async function func(): Promise { //// [awaitCallExpression2_es5.js] function func() { return __awaiter(this, void 0, void 0, function () { - var b, _a, _b; - return __generator(this, function (_c) { - switch (_c.label) { + var b, _a; + return __generator(this, function (_b) { + switch (_b.label) { case 0: before(); _a = fn; return [4 /*yield*/, p]; case 1: - b = _a.apply(void 0, [_c.sent(), a, a]); + b = _a.apply(void 0, [_b.sent(), a, a]); after(); return [2 /*return*/]; } diff --git a/tests/baselines/reference/awaitCallExpression6_es5.js b/tests/baselines/reference/awaitCallExpression6_es5.js index acc4261eacb..23def82fee7 100644 --- a/tests/baselines/reference/awaitCallExpression6_es5.js +++ b/tests/baselines/reference/awaitCallExpression6_es5.js @@ -16,15 +16,15 @@ async function func(): Promise { //// [awaitCallExpression6_es5.js] function func() { return __awaiter(this, void 0, void 0, function () { - var b, _a, _b, _c; - return __generator(this, function (_d) { - switch (_d.label) { + var b, _a, _b; + return __generator(this, function (_c) { + switch (_c.label) { case 0: before(); _b = (_a = o).fn; return [4 /*yield*/, p]; case 1: - b = _b.apply(_a, [_d.sent(), a, a]); + b = _b.apply(_a, [_c.sent(), a, a]); after(); return [2 /*return*/]; } diff --git a/tests/baselines/reference/awaitClassExpression_es5.js b/tests/baselines/reference/awaitClassExpression_es5.js index 9cb8ce22f63..1ef7338fb12 100644 --- a/tests/baselines/reference/awaitClassExpression_es5.js +++ b/tests/baselines/reference/awaitClassExpression_es5.js @@ -10,9 +10,9 @@ async function func(): Promise { //// [awaitClassExpression_es5.js] function func() { return __awaiter(this, void 0, void 0, function () { - var D, _a, _b; - return __generator(this, function (_c) { - switch (_c.label) { + var D, _a; + return __generator(this, function (_b) { + switch (_b.label) { case 0: _a = function (_super) { __extends(D, _super); @@ -23,7 +23,7 @@ function func() { }; return [4 /*yield*/, p]; case 1: - D = (_a.apply(void 0, [(_c.sent())])); + D = (_a.apply(void 0, [(_b.sent())])); return [2 /*return*/]; } }); diff --git a/tests/baselines/reference/await_unaryExpression_es2017_1.errors.txt b/tests/baselines/reference/await_unaryExpression_es2017_1.errors.txt index 4a38371829d..afc9ac40f1e 100644 --- a/tests/baselines/reference/await_unaryExpression_es2017_1.errors.txt +++ b/tests/baselines/reference/await_unaryExpression_es2017_1.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts(7,12): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts(11,12): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts(7,12): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts(11,12): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts (2 errors) ==== @@ -11,13 +11,13 @@ tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts(11,12): e async function bar1() { delete await 42; // OK ~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. } async function bar2() { delete await 42; // OK ~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. } async function bar3() { diff --git a/tests/baselines/reference/await_unaryExpression_es2017_2.errors.txt b/tests/baselines/reference/await_unaryExpression_es2017_2.errors.txt index 0f80ec02334..e9966847189 100644 --- a/tests/baselines/reference/await_unaryExpression_es2017_2.errors.txt +++ b/tests/baselines/reference/await_unaryExpression_es2017_2.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts(3,12): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts(7,12): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts(3,12): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts(7,12): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts (2 errors) ==== @@ -7,13 +7,13 @@ tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts(7,12): er async function bar1() { delete await 42; ~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. } async function bar2() { delete await 42; ~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. } async function bar3() { diff --git a/tests/baselines/reference/await_unaryExpression_es6_1.errors.txt b/tests/baselines/reference/await_unaryExpression_es6_1.errors.txt index 8212c2dd291..b4f866ff0ec 100644 --- a/tests/baselines/reference/await_unaryExpression_es6_1.errors.txt +++ b/tests/baselines/reference/await_unaryExpression_es6_1.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts(7,12): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts(11,12): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts(7,12): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts(11,12): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts (2 errors) ==== @@ -11,13 +11,13 @@ tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts(11,12): error T async function bar1() { delete await 42; // OK ~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. } async function bar2() { delete await 42; // OK ~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. } async function bar3() { diff --git a/tests/baselines/reference/await_unaryExpression_es6_2.errors.txt b/tests/baselines/reference/await_unaryExpression_es6_2.errors.txt index cde22cc5549..989e96c7d3f 100644 --- a/tests/baselines/reference/await_unaryExpression_es6_2.errors.txt +++ b/tests/baselines/reference/await_unaryExpression_es6_2.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts(3,12): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts(7,12): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts(3,12): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts(7,12): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts (2 errors) ==== @@ -7,13 +7,13 @@ tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts(7,12): error TS async function bar1() { delete await 42; ~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. } async function bar2() { delete await 42; ~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. } async function bar3() { diff --git a/tests/baselines/reference/baseConstraintOfDecorator.errors.txt b/tests/baselines/reference/baseConstraintOfDecorator.errors.txt new file mode 100644 index 00000000000..efc0c59f9ee --- /dev/null +++ b/tests/baselines/reference/baseConstraintOfDecorator.errors.txt @@ -0,0 +1,23 @@ +tests/cases/compiler/baseConstraintOfDecorator.ts(2,5): error TS2322: Type 'typeof decoratorFunc' is not assignable to type 'TFunction'. +tests/cases/compiler/baseConstraintOfDecorator.ts(2,40): error TS2507: Type 'TFunction' is not a constructor function type. + + +==== tests/cases/compiler/baseConstraintOfDecorator.ts (2 errors) ==== + export function classExtender(superClass: TFunction, _instanceModifier: (instance: any, args: any[]) => void): TFunction { + return class decoratorFunc extends superClass { + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~ +!!! error TS2507: Type 'TFunction' is not a constructor function type. + constructor(...args: any[]) { + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + super(...args); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + _instanceModifier(this, args); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~~~~~ + }; + ~~~~~~ +!!! error TS2322: Type 'typeof decoratorFunc' is not assignable to type 'TFunction'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/baseConstraintOfDecorator.js b/tests/baselines/reference/baseConstraintOfDecorator.js new file mode 100644 index 00000000000..0bceaca2509 --- /dev/null +++ b/tests/baselines/reference/baseConstraintOfDecorator.js @@ -0,0 +1,40 @@ +//// [baseConstraintOfDecorator.ts] +export function classExtender(superClass: TFunction, _instanceModifier: (instance: any, args: any[]) => void): TFunction { + return class decoratorFunc extends superClass { + constructor(...args: any[]) { + super(...args); + _instanceModifier(this, args); + } + }; +} + + +//// [baseConstraintOfDecorator.js] +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +exports.__esModule = true; +function classExtender(superClass, _instanceModifier) { + return (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; + } + return decoratorFunc; + }(superClass)); +} +exports.classExtender = classExtender; diff --git a/tests/baselines/reference/cachedModuleResolution1.trace.json b/tests/baselines/reference/cachedModuleResolution1.trace.json index ba59e8df8e8..c9f40c56796 100644 --- a/tests/baselines/reference/cachedModuleResolution1.trace.json +++ b/tests/baselines/reference/cachedModuleResolution1.trace.json @@ -8,12 +8,12 @@ "File '/a/b/node_modules/foo.ts' does not exist.", "File '/a/b/node_modules/foo.tsx' does not exist.", "File '/a/b/node_modules/foo.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'", + "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'.", "======== 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: 'NodeJs'.", "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", "Resolution for module 'foo' was found in cache.", - "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'", + "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'.", "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution2.trace.json b/tests/baselines/reference/cachedModuleResolution2.trace.json index eb18792122a..a7fc2414f03 100644 --- a/tests/baselines/reference/cachedModuleResolution2.trace.json +++ b/tests/baselines/reference/cachedModuleResolution2.trace.json @@ -6,7 +6,7 @@ "File '/a/b/node_modules/foo.ts' does not exist.", "File '/a/b/node_modules/foo.tsx' does not exist.", "File '/a/b/node_modules/foo.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'", + "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'.", "======== 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: 'NodeJs'.", @@ -14,6 +14,6 @@ "Directory '/a/b/c/d/e/node_modules' does not exist, skipping all lookups in it.", "Directory '/a/b/c/d/node_modules' does not exist, skipping all lookups in it.", "Resolution for module 'foo' was found in cache.", - "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'", + "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'.", "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution5.trace.json b/tests/baselines/reference/cachedModuleResolution5.trace.json index f489afffbe9..b09cc7a35be 100644 --- a/tests/baselines/reference/cachedModuleResolution5.trace.json +++ b/tests/baselines/reference/cachedModuleResolution5.trace.json @@ -8,12 +8,12 @@ "File '/a/b/node_modules/foo.ts' does not exist.", "File '/a/b/node_modules/foo.tsx' does not exist.", "File '/a/b/node_modules/foo.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'", + "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'.", "======== 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: 'NodeJs'.", "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", "Resolution for module 'foo' was found in cache.", - "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'", + "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'.", "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/callConstructAssignment.errors.txt b/tests/baselines/reference/callConstructAssignment.errors.txt index fc36e472151..62a529daeb1 100644 --- a/tests/baselines/reference/callConstructAssignment.errors.txt +++ b/tests/baselines/reference/callConstructAssignment.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/callConstructAssignment.ts(7,1): error TS2322: Type 'new () => any' is not assignable to type '() => void'. - Type 'new () => any' provides no match for the signature '(): void' + Type 'new () => any' provides no match for the signature '(): void'. tests/cases/compiler/callConstructAssignment.ts(8,1): error TS2322: Type '() => void' is not assignable to type 'new () => any'. - Type '() => void' provides no match for the signature 'new (): any' + Type '() => void' provides no match for the signature 'new (): any'. ==== tests/cases/compiler/callConstructAssignment.ts (2 errors) ==== @@ -14,8 +14,8 @@ tests/cases/compiler/callConstructAssignment.ts(8,1): error TS2322: Type '() => foo = bar; // error ~~~ !!! error TS2322: Type 'new () => any' is not assignable to type '() => void'. -!!! error TS2322: Type 'new () => any' provides no match for the signature '(): void' +!!! error TS2322: Type 'new () => any' provides no match for the signature '(): void'. bar = foo; // error ~~~ !!! error TS2322: Type '() => void' is not assignable to type 'new () => any'. -!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any' \ No newline at end of file +!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any'. \ No newline at end of file diff --git a/tests/baselines/reference/castOfAwait.types b/tests/baselines/reference/castOfAwait.types index 805affe49db..afe075b67d9 100644 --- a/tests/baselines/reference/castOfAwait.types +++ b/tests/baselines/reference/castOfAwait.types @@ -18,7 +18,7 @@ async function f() { >0 : 0 await void typeof void await 0; ->await void typeof void await 0 : any +>await void typeof void await 0 : undefined >void typeof void await 0 : undefined > typeof void await 0 : string >typeof void await 0 : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" diff --git a/tests/baselines/reference/castOfYield.errors.txt b/tests/baselines/reference/castOfYield.errors.txt index abafe678784..0d40a4dcd98 100644 --- a/tests/baselines/reference/castOfYield.errors.txt +++ b/tests/baselines/reference/castOfYield.errors.txt @@ -1,6 +1,8 @@ +error TS2318: Cannot find global type 'IterableIterator'. tests/cases/compiler/castOfYield.ts(4,14): error TS1109: Expression expected. +!!! error TS2318: Cannot find global type 'IterableIterator'. ==== tests/cases/compiler/castOfYield.ts (1 errors) ==== function* f() { (yield 0); diff --git a/tests/baselines/reference/castOfYield.js b/tests/baselines/reference/castOfYield.js index 633f780a6a1..9ad9ec52a31 100644 --- a/tests/baselines/reference/castOfYield.js +++ b/tests/baselines/reference/castOfYield.js @@ -7,9 +7,45 @@ function* f() { //// [castOfYield.js] -function* f() { - (yield 0); - // Unlike await, yield is not allowed to appear in a simple unary expression. - ; - yield 0; +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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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*/]; + } + }); } diff --git a/tests/baselines/reference/classExpression3.symbols b/tests/baselines/reference/classExpression3.symbols index bc1b263a000..fbd5f7b5331 100644 --- a/tests/baselines/reference/classExpression3.symbols +++ b/tests/baselines/reference/classExpression3.symbols @@ -3,7 +3,7 @@ let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 }; >C : Symbol(C, Decl(classExpression3.ts, 0, 3)) >a : Symbol((Anonymous class).a, Decl(classExpression3.ts, 0, 43)) >b : Symbol((Anonymous class).b, Decl(classExpression3.ts, 0, 53)) ->c : Symbol((Anonymous class).c, Decl(classExpression3.ts, 0, 63)) +>c : Symbol(C.c, Decl(classExpression3.ts, 0, 63)) let c = new C(); >c : Symbol(c, Decl(classExpression3.ts, 1, 3)) @@ -20,7 +20,7 @@ c.b; >b : Symbol((Anonymous class).b, Decl(classExpression3.ts, 0, 53)) c.c; ->c.c : Symbol((Anonymous class).c, Decl(classExpression3.ts, 0, 63)) +>c.c : Symbol(C.c, Decl(classExpression3.ts, 0, 63)) >c : Symbol(c, Decl(classExpression3.ts, 1, 3)) ->c : Symbol((Anonymous class).c, Decl(classExpression3.ts, 0, 63)) +>c : Symbol(C.c, Decl(classExpression3.ts, 0, 63)) diff --git a/tests/baselines/reference/classExpression3.types b/tests/baselines/reference/classExpression3.types index 51798f300d4..713407fa8d4 100644 --- a/tests/baselines/reference/classExpression3.types +++ b/tests/baselines/reference/classExpression3.types @@ -1,7 +1,7 @@ === tests/cases/conformance/classes/classExpressions/classExpression3.ts === let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 }; ->C : typeof (Anonymous class) ->class extends class extends class { a = 1 } { b = 2 } { c = 3 } : typeof (Anonymous class) +>C : typeof C +>class extends class extends class { a = 1 } { b = 2 } { c = 3 } : typeof C >class extends class { a = 1 } { b = 2 } : (Anonymous class) >class { a = 1 } : (Anonymous class) >a : number @@ -12,22 +12,22 @@ let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 }; >3 : 3 let c = new C(); ->c : (Anonymous class) ->new C() : (Anonymous class) ->C : typeof (Anonymous class) +>c : C +>new C() : C +>C : typeof C c.a; >c.a : number ->c : (Anonymous class) +>c : C >a : number c.b; >c.b : number ->c : (Anonymous class) +>c : C >b : number c.c; >c.c : number ->c : (Anonymous class) +>c : C >c : number diff --git a/tests/baselines/reference/classExpression4.symbols b/tests/baselines/reference/classExpression4.symbols index 4df5302cecc..47a03bc4c96 100644 --- a/tests/baselines/reference/classExpression4.symbols +++ b/tests/baselines/reference/classExpression4.symbols @@ -3,7 +3,7 @@ let C = class { >C : Symbol(C, Decl(classExpression4.ts, 0, 3)) foo() { ->foo : Symbol((Anonymous class).foo, Decl(classExpression4.ts, 0, 15)) +>foo : Symbol(C.foo, Decl(classExpression4.ts, 0, 15)) return new C(); >C : Symbol(C, Decl(classExpression4.ts, 0, 3)) @@ -11,7 +11,7 @@ let C = class { }; let x = (new C).foo(); >x : Symbol(x, Decl(classExpression4.ts, 5, 3)) ->(new C).foo : Symbol((Anonymous class).foo, Decl(classExpression4.ts, 0, 15)) +>(new C).foo : Symbol(C.foo, Decl(classExpression4.ts, 0, 15)) >C : Symbol(C, Decl(classExpression4.ts, 0, 3)) ->foo : Symbol((Anonymous class).foo, Decl(classExpression4.ts, 0, 15)) +>foo : Symbol(C.foo, Decl(classExpression4.ts, 0, 15)) diff --git a/tests/baselines/reference/classExpression4.types b/tests/baselines/reference/classExpression4.types index 066f169ae74..849a7459bbe 100644 --- a/tests/baselines/reference/classExpression4.types +++ b/tests/baselines/reference/classExpression4.types @@ -1,22 +1,22 @@ === tests/cases/conformance/classes/classExpressions/classExpression4.ts === let C = class { ->C : typeof (Anonymous class) ->class { foo() { return new C(); }} : typeof (Anonymous class) +>C : typeof C +>class { foo() { return new C(); }} : typeof C foo() { ->foo : () => (Anonymous class) +>foo : () => C return new C(); ->new C() : (Anonymous class) ->C : typeof (Anonymous class) +>new C() : C +>C : typeof C } }; let x = (new C).foo(); ->x : (Anonymous class) ->(new C).foo() : (Anonymous class) ->(new C).foo : () => (Anonymous class) ->(new C) : (Anonymous class) ->new C : (Anonymous class) ->C : typeof (Anonymous class) ->foo : () => (Anonymous class) +>x : C +>(new C).foo() : C +>(new C).foo : () => C +>(new C) : C +>new C : C +>C : typeof C +>foo : () => C diff --git a/tests/baselines/reference/classExpressionES63.symbols b/tests/baselines/reference/classExpressionES63.symbols index 4e52d5ee9dd..f74b2893f73 100644 --- a/tests/baselines/reference/classExpressionES63.symbols +++ b/tests/baselines/reference/classExpressionES63.symbols @@ -3,7 +3,7 @@ let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 }; >C : Symbol(C, Decl(classExpressionES63.ts, 0, 3)) >a : Symbol((Anonymous class).a, Decl(classExpressionES63.ts, 0, 43)) >b : Symbol((Anonymous class).b, Decl(classExpressionES63.ts, 0, 53)) ->c : Symbol((Anonymous class).c, Decl(classExpressionES63.ts, 0, 63)) +>c : Symbol(C.c, Decl(classExpressionES63.ts, 0, 63)) let c = new C(); >c : Symbol(c, Decl(classExpressionES63.ts, 1, 3)) @@ -20,7 +20,7 @@ c.b; >b : Symbol((Anonymous class).b, Decl(classExpressionES63.ts, 0, 53)) c.c; ->c.c : Symbol((Anonymous class).c, Decl(classExpressionES63.ts, 0, 63)) +>c.c : Symbol(C.c, Decl(classExpressionES63.ts, 0, 63)) >c : Symbol(c, Decl(classExpressionES63.ts, 1, 3)) ->c : Symbol((Anonymous class).c, Decl(classExpressionES63.ts, 0, 63)) +>c : Symbol(C.c, Decl(classExpressionES63.ts, 0, 63)) diff --git a/tests/baselines/reference/classExpressionES63.types b/tests/baselines/reference/classExpressionES63.types index c5c8de91c17..f597edab9db 100644 --- a/tests/baselines/reference/classExpressionES63.types +++ b/tests/baselines/reference/classExpressionES63.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/classExpressions/classExpressionES63.ts === let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 }; ->C : typeof (Anonymous class) ->class extends class extends class { a = 1 } { b = 2 } { c = 3 } : typeof (Anonymous class) +>C : typeof C +>class extends class extends class { a = 1 } { b = 2 } { c = 3 } : typeof C >class extends class { a = 1 } { b = 2 } : (Anonymous class) >class { a = 1 } : (Anonymous class) >a : number @@ -12,22 +12,22 @@ let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 }; >3 : 3 let c = new C(); ->c : (Anonymous class) ->new C() : (Anonymous class) ->C : typeof (Anonymous class) +>c : C +>new C() : C +>C : typeof C c.a; >c.a : number ->c : (Anonymous class) +>c : C >a : number c.b; >c.b : number ->c : (Anonymous class) +>c : C >b : number c.c; >c.c : number ->c : (Anonymous class) +>c : C >c : number diff --git a/tests/baselines/reference/classExtendsNull.errors.txt b/tests/baselines/reference/classExtendsNull.errors.txt index 905c90c42fd..7fcd5d8f2a9 100644 --- a/tests/baselines/reference/classExtendsNull.errors.txt +++ b/tests/baselines/reference/classExtendsNull.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/classExtendsNull.ts(3,9): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null' +tests/cases/compiler/classExtendsNull.ts(3,9): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null'. ==== tests/cases/compiler/classExtendsNull.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/compiler/classExtendsNull.ts(3,9): error TS17005: A constructor cann constructor() { super(); ~~~~~~~ -!!! error TS17005: A constructor cannot contain a 'super' call when its class extends 'null' +!!! error TS17005: A constructor cannot contain a 'super' call when its class extends 'null'. return Object.create(null); } } diff --git a/tests/baselines/reference/classWithPredefinedTypesAsNames.errors.txt b/tests/baselines/reference/classWithPredefinedTypesAsNames.errors.txt index a0dfb5d62c1..e2bada55be8 100644 --- a/tests/baselines/reference/classWithPredefinedTypesAsNames.errors.txt +++ b/tests/baselines/reference/classWithPredefinedTypesAsNames.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts(3,7): error TS2414: Class name cannot be 'any' -tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts(4,7): error TS2414: Class name cannot be 'number' -tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts(5,7): error TS2414: Class name cannot be 'boolean' -tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts(6,7): error TS2414: Class name cannot be 'string' +tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts(3,7): error TS2414: Class name cannot be 'any'. +tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts(4,7): error TS2414: Class name cannot be 'number'. +tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts(5,7): error TS2414: Class name cannot be 'boolean'. +tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts(6,7): error TS2414: Class name cannot be 'string'. ==== tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames.ts (4 errors) ==== @@ -9,13 +9,13 @@ tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsName class any { } ~~~ -!!! error TS2414: Class name cannot be 'any' +!!! error TS2414: Class name cannot be 'any'. class number { } ~~~~~~ -!!! error TS2414: Class name cannot be 'number' +!!! error TS2414: Class name cannot be 'number'. class boolean { } ~~~~~~~ -!!! error TS2414: Class name cannot be 'boolean' +!!! error TS2414: Class name cannot be 'boolean'. class string { } ~~~~~~ -!!! error TS2414: Class name cannot be 'string' \ No newline at end of file +!!! error TS2414: Class name cannot be 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/cloduleSplitAcrossFiles.errors.txt b/tests/baselines/reference/cloduleSplitAcrossFiles.errors.txt index 2de3141da54..699d133d7ac 100644 --- a/tests/baselines/reference/cloduleSplitAcrossFiles.errors.txt +++ b/tests/baselines/reference/cloduleSplitAcrossFiles.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/cloduleSplitAcrossFiles_module.ts(1,8): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged +tests/cases/compiler/cloduleSplitAcrossFiles_module.ts(1,8): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. ==== tests/cases/compiler/cloduleSplitAcrossFiles_class.ts (0 errors) ==== @@ -7,7 +7,7 @@ tests/cases/compiler/cloduleSplitAcrossFiles_module.ts(1,8): error TS2433: A nam ==== tests/cases/compiler/cloduleSplitAcrossFiles_module.ts (1 errors) ==== module D { ~ -!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged +!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. export var y = "hi"; } D.y; \ No newline at end of file diff --git a/tests/baselines/reference/cloduleWithPriorInstantiatedModule.errors.txt b/tests/baselines/reference/cloduleWithPriorInstantiatedModule.errors.txt index 0f23d5c9a15..c3160562a17 100644 --- a/tests/baselines/reference/cloduleWithPriorInstantiatedModule.errors.txt +++ b/tests/baselines/reference/cloduleWithPriorInstantiatedModule.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/cloduleWithPriorInstantiatedModule.ts(2,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +tests/cases/compiler/cloduleWithPriorInstantiatedModule.ts(2,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. ==== tests/cases/compiler/cloduleWithPriorInstantiatedModule.ts (1 errors) ==== // Non-ambient & instantiated module. module Moclodule { ~~~~~~~~~ -!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. export interface Someinterface { foo(): void; } diff --git a/tests/baselines/reference/compileOnSaveWorksWhenEmitBlockingErrorOnOtherFile.baseline b/tests/baselines/reference/compileOnSaveWorksWhenEmitBlockingErrorOnOtherFile.baseline index f8b479e6d7b..e01194874bf 100644 --- a/tests/baselines/reference/compileOnSaveWorksWhenEmitBlockingErrorOnOtherFile.baseline +++ b/tests/baselines/reference/compileOnSaveWorksWhenEmitBlockingErrorOnOtherFile.baseline @@ -1,7 +1,7 @@ EmitSkipped: true Diagnostics: Cannot write file '/tests/cases/fourslash/b.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. EmitSkipped: false FileName : /tests/cases/fourslash/a.js diff --git a/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt index 4c54e9ad61f..7caab39885e 100644 --- a/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,1 tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,17): error TS1102: 'delete' cannot be called on an identifier in strict mode. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,17): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,17): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. @@ -23,7 +23,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,1 ~~ !!! error TS1102: 'delete' cannot be called on an identifier in strict mode. ~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. set [[0, 1]](v) { } ~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. diff --git a/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt index 9b7221563c2..9db937313e3 100644 --- a/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(4,1 tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,17): error TS1102: 'delete' cannot be called on an identifier in strict mode. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,17): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,17): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. @@ -23,7 +23,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,1 ~~ !!! error TS1102: 'delete' cannot be called on an identifier in strict mode. ~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. set [[0, 1]](v) { } ~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. diff --git a/tests/baselines/reference/constDeclarations-errors.errors.txt b/tests/baselines/reference/constDeclarations-errors.errors.txt index 83031e0aa79..14a3de1bf81 100644 --- a/tests/baselines/reference/constDeclarations-errors.errors.txt +++ b/tests/baselines/reference/constDeclarations-errors.errors.txt @@ -1,12 +1,12 @@ -tests/cases/compiler/constDeclarations-errors.ts(3,7): error TS1155: 'const' declarations must be initialized -tests/cases/compiler/constDeclarations-errors.ts(4,7): error TS1155: 'const' declarations must be initialized -tests/cases/compiler/constDeclarations-errors.ts(5,7): error TS1155: 'const' declarations must be initialized -tests/cases/compiler/constDeclarations-errors.ts(5,11): error TS1155: 'const' declarations must be initialized -tests/cases/compiler/constDeclarations-errors.ts(5,15): error TS1155: 'const' declarations must be initialized -tests/cases/compiler/constDeclarations-errors.ts(5,27): error TS1155: 'const' declarations must be initialized +tests/cases/compiler/constDeclarations-errors.ts(3,7): error TS1155: 'const' declarations must be initialized. +tests/cases/compiler/constDeclarations-errors.ts(4,7): error TS1155: 'const' declarations must be initialized. +tests/cases/compiler/constDeclarations-errors.ts(5,7): error TS1155: 'const' declarations must be initialized. +tests/cases/compiler/constDeclarations-errors.ts(5,11): error TS1155: 'const' declarations must be initialized. +tests/cases/compiler/constDeclarations-errors.ts(5,15): error TS1155: 'const' declarations must be initialized. +tests/cases/compiler/constDeclarations-errors.ts(5,27): error TS1155: 'const' declarations must be initialized. tests/cases/compiler/constDeclarations-errors.ts(10,27): error TS2540: Cannot assign to 'c8' because it is a constant or a read-only property. -tests/cases/compiler/constDeclarations-errors.ts(13,11): error TS1155: 'const' declarations must be initialized -tests/cases/compiler/constDeclarations-errors.ts(16,20): error TS1155: 'const' declarations must be initialized +tests/cases/compiler/constDeclarations-errors.ts(13,11): error TS1155: 'const' declarations must be initialized. +tests/cases/compiler/constDeclarations-errors.ts(16,20): error TS1155: 'const' declarations must be initialized. ==== tests/cases/compiler/constDeclarations-errors.ts (9 errors) ==== @@ -14,19 +14,19 @@ tests/cases/compiler/constDeclarations-errors.ts(16,20): error TS1155: 'const' d // error, missing intialicer const c1; ~~ -!!! error TS1155: 'const' declarations must be initialized +!!! error TS1155: 'const' declarations must be initialized. const c2: number; ~~ -!!! error TS1155: 'const' declarations must be initialized +!!! error TS1155: 'const' declarations must be initialized. const c3, c4, c5 :string, c6; // error, missing initialicer ~~ -!!! error TS1155: 'const' declarations must be initialized +!!! error TS1155: 'const' declarations must be initialized. ~~ -!!! error TS1155: 'const' declarations must be initialized +!!! error TS1155: 'const' declarations must be initialized. ~~ -!!! error TS1155: 'const' declarations must be initialized +!!! error TS1155: 'const' declarations must be initialized. ~~ -!!! error TS1155: 'const' declarations must be initialized +!!! error TS1155: 'const' declarations must be initialized. for(const c in {}) { } @@ -38,9 +38,9 @@ tests/cases/compiler/constDeclarations-errors.ts(16,20): error TS1155: 'const' d // error, can not be unintalized for(const c9; c9 < 1;) { } ~~ -!!! error TS1155: 'const' declarations must be initialized +!!! error TS1155: 'const' declarations must be initialized. // error, can not be unintalized for(const c10 = 0, c11; c10 < 1;) { } ~~~ -!!! error TS1155: 'const' declarations must be initialized \ No newline at end of file +!!! error TS1155: 'const' declarations must be initialized. \ No newline at end of file diff --git a/tests/baselines/reference/constructorAsType.errors.txt b/tests/baselines/reference/constructorAsType.errors.txt index 7865a5ecac5..780abecc1bc 100644 --- a/tests/baselines/reference/constructorAsType.errors.txt +++ b/tests/baselines/reference/constructorAsType.errors.txt @@ -1,12 +1,12 @@ tests/cases/compiler/constructorAsType.ts(1,5): error TS2322: Type '() => { name: string; }' is not assignable to type 'new () => { name: string; }'. - Type '() => { name: string; }' provides no match for the signature 'new (): { name: string; }' + Type '() => { name: string; }' provides no match for the signature 'new (): { name: string; }'. ==== tests/cases/compiler/constructorAsType.ts (1 errors) ==== var Person:new () => {name: string;} = function () {return {name:"joe"};}; ~~~~~~ !!! error TS2322: Type '() => { name: string; }' is not assignable to type 'new () => { name: string; }'. -!!! error TS2322: Type '() => { name: string; }' provides no match for the signature 'new (): { name: string; }' +!!! error TS2322: Type '() => { name: string; }' provides no match for the signature 'new (): { name: string; }'. var Person2:{new() : {name:string;};}; diff --git a/tests/baselines/reference/constructorReturnsInvalidType.errors.txt b/tests/baselines/reference/constructorReturnsInvalidType.errors.txt index a615d7177cf..faab8a55145 100644 --- a/tests/baselines/reference/constructorReturnsInvalidType.errors.txt +++ b/tests/baselines/reference/constructorReturnsInvalidType.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/constructorReturnsInvalidType.ts(3,9): error TS2322: Type '1' is not assignable to type 'X'. -tests/cases/compiler/constructorReturnsInvalidType.ts(3,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/compiler/constructorReturnsInvalidType.ts(3,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. ==== tests/cases/compiler/constructorReturnsInvalidType.ts (2 errors) ==== @@ -9,7 +9,7 @@ tests/cases/compiler/constructorReturnsInvalidType.ts(3,9): error TS2409: Return ~~~~~~~~~ !!! error TS2322: Type '1' is not assignable to type 'X'. ~~~~~~~~~ -!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class +!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. } foo() { } } diff --git a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt index f5948382d64..ef1765eb017 100644 --- a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt +++ b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2322: Type '1' is not assignable to type 'D'. -tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,9): error TS2322: Type '{ x: number; }' is not assignable to type 'F'. Types of property 'x' are incompatible. Type 'number' is not assignable to type 'T'. -tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. ==== tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts (4 errors) ==== @@ -22,7 +22,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignabl ~~~~~~~~~ !!! error TS2322: Type '1' is not assignable to type 'D'. ~~~~~~~~~ -!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class +!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. } } @@ -42,7 +42,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignabl !!! error TS2322: Types of property 'x' are incompatible. !!! error TS2322: Type 'number' is not assignable to type 'T'. ~~~~~~~~~~~~~~~~ -!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class +!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. } } diff --git a/tests/baselines/reference/controlFlowDeleteOperator.errors.txt b/tests/baselines/reference/controlFlowDeleteOperator.errors.txt index de84d602c95..a8cf358a29a 100644 --- a/tests/baselines/reference/controlFlowDeleteOperator.errors.txt +++ b/tests/baselines/reference/controlFlowDeleteOperator.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts(15,12): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts(15,12): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts (1 errors) ==== @@ -18,6 +18,6 @@ tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts(15,12): error T x; delete x; // No effect ~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. x; } \ No newline at end of file diff --git a/tests/baselines/reference/customTransforms/after.js b/tests/baselines/reference/customTransforms/after.js new file mode 100644 index 00000000000..63c95725f43 --- /dev/null +++ b/tests/baselines/reference/customTransforms/after.js @@ -0,0 +1,15 @@ +// [source.js] +function f1() { } +//@after +var c = (function () { + function c() { + } + return c; +}()); +(function () { }); +//@after +var e; +(function (e) { +})(e || (e = {})); +// leading +function f2() { } // trailing diff --git a/tests/baselines/reference/customTransforms/before.js b/tests/baselines/reference/customTransforms/before.js new file mode 100644 index 00000000000..4ee133afdbc --- /dev/null +++ b/tests/baselines/reference/customTransforms/before.js @@ -0,0 +1,15 @@ +// [source.js] +/*@before*/ +function f1() { } +var c = (function () { + function c() { + } + return c; +}()); +(function () { }); +var e; +(function (e) { +})(e || (e = {})); +// leading +/*@before*/ +function f2() { } // trailing diff --git a/tests/baselines/reference/customTransforms/both.js b/tests/baselines/reference/customTransforms/both.js new file mode 100644 index 00000000000..3013e7f8780 --- /dev/null +++ b/tests/baselines/reference/customTransforms/both.js @@ -0,0 +1,17 @@ +// [source.js] +/*@before*/ +function f1() { } +//@after +var c = (function () { + function c() { + } + return c; +}()); +(function () { }); +//@after +var e; +(function (e) { +})(e || (e = {})); +// leading +/*@before*/ +function f2() { } // trailing diff --git a/tests/baselines/reference/declarationFileOverwriteError.errors.txt b/tests/baselines/reference/declarationFileOverwriteError.errors.txt index 211469778b1..846f2387dc1 100644 --- a/tests/baselines/reference/declarationFileOverwriteError.errors.txt +++ b/tests/baselines/reference/declarationFileOverwriteError.errors.txt @@ -1,9 +1,9 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.d.ts' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.d.ts' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.d.ts (0 errors) ==== declare class c { diff --git a/tests/baselines/reference/declarationFileOverwriteErrorWithOut.errors.txt b/tests/baselines/reference/declarationFileOverwriteErrorWithOut.errors.txt index ea4a93b3b12..b3c9fd4780d 100644 --- a/tests/baselines/reference/declarationFileOverwriteErrorWithOut.errors.txt +++ b/tests/baselines/reference/declarationFileOverwriteErrorWithOut.errors.txt @@ -1,9 +1,9 @@ error TS5055: Cannot write file 'tests/cases/compiler/out.d.ts' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS5055: Cannot write file 'tests/cases/compiler/out.d.ts' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/out.d.ts (0 errors) ==== declare class c { diff --git a/tests/baselines/reference/deleteOperator1.errors.txt b/tests/baselines/reference/deleteOperator1.errors.txt index 09a839d10b4..c316a6e06a9 100644 --- a/tests/baselines/reference/deleteOperator1.errors.txt +++ b/tests/baselines/reference/deleteOperator1.errors.txt @@ -1,19 +1,19 @@ -tests/cases/compiler/deleteOperator1.ts(2,25): error TS2703: The operand of a delete operator must be a property reference -tests/cases/compiler/deleteOperator1.ts(3,21): error TS2703: The operand of a delete operator must be a property reference +tests/cases/compiler/deleteOperator1.ts(2,25): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/compiler/deleteOperator1.ts(3,21): error TS2703: The operand of a delete operator must be a property reference. tests/cases/compiler/deleteOperator1.ts(4,5): error TS2322: Type 'boolean' is not assignable to type 'number'. -tests/cases/compiler/deleteOperator1.ts(4,24): error TS2703: The operand of a delete operator must be a property reference +tests/cases/compiler/deleteOperator1.ts(4,24): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/compiler/deleteOperator1.ts (4 errors) ==== var a; var x: boolean = delete a; ~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var y: any = delete a; ~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var z: number = delete a; ~ !!! error TS2322: Type 'boolean' is not assignable to type 'number'. ~ -!!! error TS2703: The operand of a delete operator must be a property reference \ No newline at end of file +!!! error TS2703: The operand of a delete operator must be a property reference. \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt b/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt index 16d3b772351..754406dbc6c 100644 --- a/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt +++ b/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/deleteOperatorInStrictMode.ts(3,8): error TS1102: 'delete' cannot be called on an identifier in strict mode. -tests/cases/compiler/deleteOperatorInStrictMode.ts(3,8): error TS2703: The operand of a delete operator must be a property reference +tests/cases/compiler/deleteOperatorInStrictMode.ts(3,8): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/compiler/deleteOperatorInStrictMode.ts (2 errors) ==== @@ -9,4 +9,4 @@ tests/cases/compiler/deleteOperatorInStrictMode.ts(3,8): error TS2703: The opera ~ !!! error TS1102: 'delete' cannot be called on an identifier in strict mode. ~ -!!! error TS2703: The operand of a delete operator must be a property reference \ No newline at end of file +!!! error TS2703: The operand of a delete operator must be a property reference. \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt b/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt index 3e581f5a77b..3994654c523 100644 --- a/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt +++ b/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt @@ -1,10 +1,10 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(5,20): error TS1005: ',' expected. -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(5,26): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(5,26): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(5,27): error TS1109: Expression expected. -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(8,22): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(8,22): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(8,23): error TS1109: Expression expected. tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(13,16): error TS1102: 'delete' cannot be called on an identifier in strict mode. -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(13,16): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(13,16): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts (7 errors) ==== @@ -16,14 +16,14 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~~~~~~ !!! error TS1005: ',' expected. -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~ !!! error TS1109: Expression expected. // miss an operand var BOOLEAN2 = delete ; -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~ !!! error TS1109: Expression expected. @@ -34,6 +34,6 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~ !!! error TS1102: 'delete' cannot be called on an identifier in strict mode. ~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. } } \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt index 819f1c39050..f2260b11036 100644 --- a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt @@ -1,31 +1,31 @@ -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(25,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(26,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(27,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(28,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(29,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(30,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(33,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(34,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(42,32): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(43,32): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(44,33): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(25,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(26,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(27,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(28,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(29,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(30,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(33,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(34,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(42,32): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(43,32): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(44,33): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,33): error TS2531: Object is possibly 'null'. -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,33): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,33): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,40): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,33): error TS2531: Object is possibly 'null'. -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,33): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,33): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,40): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,33): error TS2532: Object is possibly 'undefined'. -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,33): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,33): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,45): error TS2532: Object is possibly 'undefined'. -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(50,32): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(50,39): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,32): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,39): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,47): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(54,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(55,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(57,8): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(50,32): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(50,39): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,32): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,39): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,47): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(54,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(55,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(57,8): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts (28 errors) ==== @@ -55,30 +55,30 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator // any type var var ResultIsBoolean1 = delete ANY1; ~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean2 = delete ANY2; ~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean3 = delete A; ~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean4 = delete M; ~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean5 = delete obj; ~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean6 = delete obj1; ~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // any type literal var ResultIsBoolean7 = delete undefined; ~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean8 = delete null; ~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // any type expressions var ResultIsBoolean9 = delete ANY2[0]; @@ -88,60 +88,60 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator var ResultIsBoolean13 = delete M.n; var ResultIsBoolean14 = delete foo(); ~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean15 = delete A.foo(); ~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean16 = delete (ANY + ANY1); ~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean17 = delete (null + undefined); ~~~~ !!! error TS2531: Object is possibly 'null'. ~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~~~~~~~ !!! error TS2532: Object is possibly 'undefined'. var ResultIsBoolean18 = delete (null + null); ~~~~ !!! error TS2531: Object is possibly 'null'. ~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~~ !!! error TS2531: Object is possibly 'null'. var ResultIsBoolean19 = delete (undefined + undefined); ~~~~~~~~~ !!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~~~~~~~ !!! error TS2532: Object is possibly 'undefined'. // multiple delete operators var ResultIsBoolean20 = delete delete ANY; ~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean21 = delete delete delete (ANY + ANY1); ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // miss assignment operators delete ANY; ~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete ANY1; ~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete ANY2[0]; delete ANY, ANY1; ~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete obj1.x; delete obj1.y; delete objA.a; diff --git a/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt b/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt index 83ce7db9f33..3dfc6672997 100644 --- a/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt @@ -1,14 +1,14 @@ -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(17,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(20,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(21,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(26,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(27,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(30,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(30,38): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(33,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(34,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(35,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(36,8): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(17,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(20,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(21,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(26,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(27,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(30,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(30,38): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(33,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(34,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(35,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(36,8): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts (11 errors) ==== @@ -30,45 +30,45 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator // boolean type var var ResultIsBoolean1 = delete BOOLEAN; ~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // boolean type literal var ResultIsBoolean2 = delete true; ~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean3 = delete { x: true, y: false }; ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // boolean type expressions var ResultIsBoolean4 = delete objA.a; var ResultIsBoolean5 = delete M.n; var ResultIsBoolean6 = delete foo(); ~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean7 = delete A.foo(); ~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // multiple delete operator var ResultIsBoolean8 = delete delete BOOLEAN; ~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // miss assignment operators delete true; ~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete BOOLEAN; ~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete foo(); ~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete true, false; ~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete objA.a; delete M.n; \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt b/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt index 84c1ed48017..e952ce0fdc9 100644 --- a/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt @@ -1,16 +1,16 @@ -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(7,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(8,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(11,31): error TS2704: The operand of a delete operator cannot be a read-only property -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(12,32): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,38): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,38): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,46): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(19,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(20,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(21,8): error TS2704: The operand of a delete operator cannot be a read-only property -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(22,8): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(7,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(8,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(11,31): error TS2704: The operand of a delete operator cannot be a read-only property. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(12,32): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,38): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,38): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,46): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(19,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(20,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(21,8): error TS2704: The operand of a delete operator cannot be a read-only property. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(22,8): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts (13 errors) ==== @@ -22,43 +22,43 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator // enum type var var ResultIsBoolean1 = delete ENUM; ~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean2 = delete ENUM1; ~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // enum type expressions var ResultIsBoolean3 = delete ENUM1["A"]; ~~~~~~~~~~ -!!! error TS2704: The operand of a delete operator cannot be a read-only property +!!! error TS2704: The operand of a delete operator cannot be a read-only property. var ResultIsBoolean4 = delete (ENUM[0] + ENUM1["B"]); ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // multiple delete operators var ResultIsBoolean5 = delete delete ENUM; ~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // miss assignment operators delete ENUM; ~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete ENUM1; ~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete ENUM1.B; ~~~~~~~ -!!! error TS2704: The operand of a delete operator cannot be a read-only property +!!! error TS2704: The operand of a delete operator cannot be a read-only property. delete ENUM, ENUM1; ~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference \ No newline at end of file +!!! error TS2703: The operand of a delete operator must be a property reference. \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt b/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt index b43c7aa8e3d..0f4a783d983 100644 --- a/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt @@ -1,20 +1,20 @@ -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(18,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(19,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(22,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(23,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(24,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(30,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(31,32): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(32,33): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(35,32): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(35,39): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,32): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,39): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,47): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(39,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(40,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(41,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(42,8): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(18,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(19,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(22,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(23,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(24,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(30,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(31,32): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(32,33): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(35,32): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(35,39): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,32): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,39): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,47): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(39,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(40,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(41,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(42,8): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts (17 errors) ==== @@ -37,21 +37,21 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator // number type var var ResultIsBoolean1 = delete NUMBER; ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean2 = delete NUMBER1; ~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // number type literal var ResultIsBoolean3 = delete 1; ~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean4 = delete { x: 1, y: 2}; ~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean5 = delete { x: 1, y: (n: number) => { return n; } }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // number type expressions var ResultIsBoolean6 = delete objA.a; @@ -59,41 +59,41 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator var ResultIsBoolean8 = delete NUMBER1[0]; var ResultIsBoolean9 = delete foo(); ~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean10 = delete A.foo(); ~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean11 = delete (NUMBER + NUMBER); ~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // multiple delete operator var ResultIsBoolean12 = delete delete NUMBER; ~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // miss assignment operators delete 1; ~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete NUMBER; ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete NUMBER1; ~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete foo(); ~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete objA.a; delete M.n; delete objA.a, M.n; \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithStringType.errors.txt b/tests/baselines/reference/deleteOperatorWithStringType.errors.txt index 37859d3ab24..fd46679d81a 100644 --- a/tests/baselines/reference/deleteOperatorWithStringType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithStringType.errors.txt @@ -1,21 +1,21 @@ -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(18,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(19,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(22,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(23,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(24,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(30,31): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(31,32): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(32,33): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(33,32): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(36,32): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(36,39): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,32): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,39): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,47): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(40,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(41,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(42,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(43,8): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(18,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(19,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(22,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(23,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(24,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(30,31): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(31,32): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(32,33): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(33,32): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(36,32): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(36,39): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,32): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,39): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,47): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(40,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(41,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(42,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(43,8): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts (18 errors) ==== @@ -38,21 +38,21 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator // string type var var ResultIsBoolean1 = delete STRING; ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean2 = delete STRING1; ~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // string type literal var ResultIsBoolean3 = delete ""; ~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean4 = delete { x: "", y: "" }; ~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean5 = delete { x: "", y: (s: string) => { return s; } }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // string type expressions var ResultIsBoolean6 = delete objA.a; @@ -60,42 +60,42 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator var ResultIsBoolean8 = delete STRING1[0]; var ResultIsBoolean9 = delete foo(); ~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean10 = delete A.foo(); ~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean11 = delete (STRING + STRING); ~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean12 = delete STRING.charAt(0); ~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // multiple delete operator var ResultIsBoolean13 = delete delete STRING; ~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. var ResultIsBoolean14 = delete delete delete (STRING + STRING); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. ~~~~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. // miss assignment operators delete ""; ~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete STRING; ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete STRING1; ~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete foo(); ~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete objA.a,M.n; \ No newline at end of file diff --git a/tests/baselines/reference/deleteReadonly.errors.txt b/tests/baselines/reference/deleteReadonly.errors.txt index 4e5a3275b80..fbcfbc3bbc9 100644 --- a/tests/baselines/reference/deleteReadonly.errors.txt +++ b/tests/baselines/reference/deleteReadonly.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/deleteReadonly.ts(8,8): error TS2704: The operand of a delete operator cannot be a read-only property +tests/cases/compiler/deleteReadonly.ts(8,8): error TS2704: The operand of a delete operator cannot be a read-only property. tests/cases/compiler/deleteReadonly.ts(18,8): error TS2542: Index signature in type 'B' only permits reading. tests/cases/compiler/deleteReadonly.ts(20,12): error TS2542: Index signature in type 'B' only permits reading. @@ -13,7 +13,7 @@ tests/cases/compiler/deleteReadonly.ts(20,12): error TS2542: Index signature in delete a.b; ~~~ -!!! error TS2704: The operand of a delete operator cannot be a read-only property +!!! error TS2704: The operand of a delete operator cannot be a read-only property. interface B { readonly [k: string]: string diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5iterable.errors.txt b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5iterable.errors.txt new file mode 100644 index 00000000000..6a2647013fb --- /dev/null +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5iterable.errors.txt @@ -0,0 +1,65 @@ +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5iterable.ts(43,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5iterable.ts(44,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5iterable.ts(44,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + + +==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment1ES5iterable.ts (3 errors) ==== + /* AssignmentPattern: + * ObjectAssignmentPattern + * ArrayAssignmentPattern + * ArrayAssignmentPattern: + * [Elision AssignmentRestElementopt ] + * [AssignmentElementList] + * [AssignmentElementList, Elision AssignmentRestElementopt ] + * AssignmentElementList: + * Elision AssignmentElement + * AssignmentElementList, Elisionopt AssignmentElement + * AssignmentElement: + * LeftHandSideExpression Initialiseropt + * AssignmentPattern Initialiseropt + * AssignmentRestElement: + * ... LeftHandSideExpression + */ + + // In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left. + // An expression of type S is considered assignable to an assignment target V if one of the following is true + + // V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, + // S is the type Any, or + + var [a0, a1]: any = undefined; + var [a2 = false, a3 = 1]: any = undefined; + + // V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, + // S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E, + // where N is the numeric index of E in the array assignment pattern, or + var [b0, b1, b2] = [2, 3, 4]; + var [b3, b4, b5]: [number, number, string] = [1, 2, "string"]; + + function foo() { + return [1, 2, 3]; + } + + var [b6, b7] = foo(); + var [...b8] = foo(); + + // S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E. + var temp = [1,2,3] + var [c0, c1] = [...temp]; + var [c2] = []; + ~~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]] + ~~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + ~~ +!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. + var [[c5], c6]: [[string|number], boolean] = [[1], true]; + var [, c7] = [1, 2, 3]; + var [,,, c8] = [1, 2, 3, 4]; + var [,,, c9] = [1, 2, 3, 4]; + var [,,,...c10] = [1, 2, 3, 4, "hello"]; + var [c11, c12, ...c13] = [1, 2, "string"]; + var [c14, c15, c16] = [1, 2, "string"]; + + \ No newline at end of file diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5iterable.js b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5iterable.js new file mode 100644 index 00000000000..acb56cfb8ad --- /dev/null +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5iterable.js @@ -0,0 +1,120 @@ +//// [destructuringArrayBindingPatternAndAssignment1ES5iterable.ts] +/* AssignmentPattern: + * ObjectAssignmentPattern + * ArrayAssignmentPattern + * ArrayAssignmentPattern: + * [Elision AssignmentRestElementopt ] + * [AssignmentElementList] + * [AssignmentElementList, Elision AssignmentRestElementopt ] + * AssignmentElementList: + * Elision AssignmentElement + * AssignmentElementList, Elisionopt AssignmentElement + * AssignmentElement: + * LeftHandSideExpression Initialiseropt + * AssignmentPattern Initialiseropt + * AssignmentRestElement: + * ... LeftHandSideExpression + */ + +// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left. +// An expression of type S is considered assignable to an assignment target V if one of the following is true + +// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, +// S is the type Any, or + +var [a0, a1]: any = undefined; +var [a2 = false, a3 = 1]: any = undefined; + +// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, +// S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E, +// where N is the numeric index of E in the array assignment pattern, or +var [b0, b1, b2] = [2, 3, 4]; +var [b3, b4, b5]: [number, number, string] = [1, 2, "string"]; + +function foo() { + return [1, 2, 3]; +} + +var [b6, b7] = foo(); +var [...b8] = foo(); + +// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E. +var temp = [1,2,3] +var [c0, c1] = [...temp]; +var [c2] = []; +var [[[c3]], [[[[c4]]]]] = [[[]], [[[[]]]]] +var [[c5], c6]: [[string|number], boolean] = [[1], true]; +var [, c7] = [1, 2, 3]; +var [,,, c8] = [1, 2, 3, 4]; +var [,,, c9] = [1, 2, 3, 4]; +var [,,,...c10] = [1, 2, 3, 4, "hello"]; +var [c11, c12, ...c13] = [1, 2, "string"]; +var [c14, c15, c16] = [1, 2, "string"]; + + + +//// [destructuringArrayBindingPatternAndAssignment1ES5iterable.js] +/* AssignmentPattern: + * ObjectAssignmentPattern + * ArrayAssignmentPattern + * ArrayAssignmentPattern: + * [Elision AssignmentRestElementopt ] + * [AssignmentElementList] + * [AssignmentElementList, Elision AssignmentRestElementopt ] + * AssignmentElementList: + * Elision AssignmentElement + * AssignmentElementList, Elisionopt AssignmentElement + * AssignmentElement: + * LeftHandSideExpression Initialiseropt + * AssignmentPattern Initialiseropt + * AssignmentRestElement: + * ... LeftHandSideExpression + */ +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 __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; +// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left. +// An expression of type S is considered assignable to an assignment target V if one of the following is true +// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, +// S is the type Any, or +var _a = __read(undefined, 2), a0 = _a[0], a1 = _a[1]; +var _b = __read(undefined, 2), _c = _b[0], a2 = _c === void 0 ? false : _c, _d = _b[1], a3 = _d === void 0 ? 1 : _d; +// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, +// S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E, +// where N is the numeric index of E in the array assignment pattern, or +var _e = __read([2, 3, 4], 3), b0 = _e[0], b1 = _e[1], b2 = _e[2]; +var _f = __read([1, 2, "string"], 3), b3 = _f[0], b4 = _f[1], b5 = _f[2]; +function foo() { + return [1, 2, 3]; +} +var _g = __read(foo(), 2), b6 = _g[0], b7 = _g[1]; +var _h = __read(foo()), b8 = _h.slice(0); +// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E. +var temp = [1, 2, 3]; +var _j = __read(__spread(temp), 2), c0 = _j[0], c1 = _j[1]; +var _k = __read([], 1), c2 = _k[0]; +var _l = __read([[[]], [[[[]]]]], 2), _m = __read(_l[0], 1), _o = __read(_m[0], 1), c3 = _o[0], _p = __read(_l[1], 1), _q = __read(_p[0], 1), _r = __read(_q[0], 1), _s = __read(_r[0], 1), c4 = _s[0]; +var _t = __read([[1], true], 2), _u = __read(_t[0], 1), c5 = _u[0], c6 = _t[1]; +var _v = __read([1, 2, 3], 2), c7 = _v[1]; +var _w = __read([1, 2, 3, 4], 4), c8 = _w[3]; +var _x = __read([1, 2, 3, 4], 4), c9 = _x[3]; +var _y = __read([1, 2, 3, 4, "hello"]), c10 = _y.slice(3); +var _z = __read([1, 2, "string"]), c11 = _z[0], c12 = _z[1], c13 = _z.slice(2); +var _0 = __read([1, 2, "string"], 3), c14 = _0[0], c15 = _0[1], c16 = _0[2]; diff --git a/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.errors.txt new file mode 100644 index 00000000000..101a37fc84a --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.errors.txt @@ -0,0 +1,106 @@ +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES5iterable.ts(62,10): error TS2393: Duplicate function implementation. +tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES5iterable.ts(63,10): error TS2393: Duplicate function implementation. + + +==== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES5iterable.ts (2 errors) ==== + // A parameter declaration may specify either an identifier or a binding pattern. + // The identifiers specified in parameter declarations and binding patterns + // in a parameter list must be unique within that parameter list. + + // If the declaration includes a type annotation, the parameter is of that type + function a1([a, b, [[c]]]: [number, number, string[][]]) { } + function a2(o: { x: number, a: number }) { } + function a3({j, k, l: {m, n}, q: [a, b, c]}: { j: number, k: string, l: { m: boolean, n: number }, q: (number|string)[] }) { }; + function a4({x, a}: { x: number, a: number }) { } + + a1([1, 2, [["world"]]]); + a1([1, 2, [["world"]], 3]); + + // If the declaration includes an initializer expression (which is permitted only + // when the parameter list occurs in conjunction with a function body), + // the parameter type is the widened form (section 3.11) of the type of the initializer expression. + + function b1(z = [undefined, null]) { }; + function b2(z = null, o = { x: 0, y: undefined }) { } + function b3({z: {x, y: {j}}} = { z: { x: "hi", y: { j: 1 } } }) { } + + interface F1 { + b5(z, y, [, a, b], {p, m: { q, r}}); + } + + function b6([a, z, y] = [undefined, null, undefined]) { } + function b7([[a], b, [[c, d]]] = [[undefined], undefined, [[undefined, undefined]]]) { } + + b1([1, 2, 3]); // z is widen to the type any[] + b2("string", { x: 200, y: "string" }); + b2("string", { x: 200, y: true }); + b6(["string", 1, 2]); // Shouldn't be an error + b7([["string"], 1, [[true, false]]]); // Shouldn't be an error + + + // If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) + enum Foo { a } + function c0({z: {x, y: {j}}}) { } + function c1({z} = { z: 10 }) { } + function c2({z = 10}) { } + function c3({b}: { b: number|string} = { b: "hello" }) { } + function c5([a, b, [[c]]]) { } + function c6([a, b, [[c=1]]]) { } + + c0({z : { x: 1, y: { j: "world" } }}); // Implied type is { z: {x: any, y: {j: any}} } + c0({z : { x: "string", y: { j: true } }}); // Implied type is { z: {x: any, y: {j: any}} } + + c1(); // Implied type is {z:number}? + c1({ z: 1 }) // Implied type is {z:number}? + + c2({}); // Implied type is {z?: number} + c2({z:1}); // Implied type is {z?: number} + + c3({ b: 1 }); // Implied type is { b: number|string }. + + c5([1, 2, [["string"]]]); // Implied type is is [any, any, [[any]]] + c5([1, 2, [["string"]], false, true]); // Implied type is is [any, any, [[any]]] + + // A parameter can be marked optional by following its name or binding pattern with a question mark (?) + // or by including an initializer. + + function d0(x?) { } + ~~ +!!! error TS2393: Duplicate function implementation. + function d0(x = 10) { } + ~~ +!!! error TS2393: Duplicate function implementation. + + interface F2 { + d3([a, b, c]?); + d4({x, y, z}?); + e0([a, b, c]); + } + + class C2 implements F2 { + constructor() { } + d3() { } + d4() { } + e0([a, b, c]) { } + } + + class C3 implements F2 { + d3([a, b, c]) { } + d4({x, y, z}) { } + e0([a, b, c]) { } + } + + + function d5({x, y} = { x: 1, y: 2 }) { } + d5(); // Parameter is optional as its declaration included an initializer + + // Destructuring parameter declarations do not permit type annotations on the individual binding patterns, + // as such annotations would conflict with the already established meaning of colons in object literals. + // Type annotations must instead be written on the top- level parameter declaration + + function e1({x: number}) { } // x has type any NOT number + function e2({x}: { x: number }) { } // x is type number + function e3({x}: { x?: number }) { } // x is an optional with type number + function e4({x: [number,string,any] }) { } // x has type [any, any, any] + function e5({x: [a, b, c]}: { x: [number, number, number] }) { } // x has type [any, any, any] + \ No newline at end of file diff --git a/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.js b/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.js new file mode 100644 index 00000000000..d9036186035 --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.js @@ -0,0 +1,242 @@ +//// [destructuringParameterDeclaration1ES5iterable.ts] +// A parameter declaration may specify either an identifier or a binding pattern. +// The identifiers specified in parameter declarations and binding patterns +// in a parameter list must be unique within that parameter list. + +// If the declaration includes a type annotation, the parameter is of that type +function a1([a, b, [[c]]]: [number, number, string[][]]) { } +function a2(o: { x: number, a: number }) { } +function a3({j, k, l: {m, n}, q: [a, b, c]}: { j: number, k: string, l: { m: boolean, n: number }, q: (number|string)[] }) { }; +function a4({x, a}: { x: number, a: number }) { } + +a1([1, 2, [["world"]]]); +a1([1, 2, [["world"]], 3]); + +// If the declaration includes an initializer expression (which is permitted only +// when the parameter list occurs in conjunction with a function body), +// the parameter type is the widened form (section 3.11) of the type of the initializer expression. + +function b1(z = [undefined, null]) { }; +function b2(z = null, o = { x: 0, y: undefined }) { } +function b3({z: {x, y: {j}}} = { z: { x: "hi", y: { j: 1 } } }) { } + +interface F1 { + b5(z, y, [, a, b], {p, m: { q, r}}); +} + +function b6([a, z, y] = [undefined, null, undefined]) { } +function b7([[a], b, [[c, d]]] = [[undefined], undefined, [[undefined, undefined]]]) { } + +b1([1, 2, 3]); // z is widen to the type any[] +b2("string", { x: 200, y: "string" }); +b2("string", { x: 200, y: true }); +b6(["string", 1, 2]); // Shouldn't be an error +b7([["string"], 1, [[true, false]]]); // Shouldn't be an error + + +// If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) +enum Foo { a } +function c0({z: {x, y: {j}}}) { } +function c1({z} = { z: 10 }) { } +function c2({z = 10}) { } +function c3({b}: { b: number|string} = { b: "hello" }) { } +function c5([a, b, [[c]]]) { } +function c6([a, b, [[c=1]]]) { } + +c0({z : { x: 1, y: { j: "world" } }}); // Implied type is { z: {x: any, y: {j: any}} } +c0({z : { x: "string", y: { j: true } }}); // Implied type is { z: {x: any, y: {j: any}} } + +c1(); // Implied type is {z:number}? +c1({ z: 1 }) // Implied type is {z:number}? + +c2({}); // Implied type is {z?: number} +c2({z:1}); // Implied type is {z?: number} + +c3({ b: 1 }); // Implied type is { b: number|string }. + +c5([1, 2, [["string"]]]); // Implied type is is [any, any, [[any]]] +c5([1, 2, [["string"]], false, true]); // Implied type is is [any, any, [[any]]] + +// A parameter can be marked optional by following its name or binding pattern with a question mark (?) +// or by including an initializer. + +function d0(x?) { } +function d0(x = 10) { } + +interface F2 { + d3([a, b, c]?); + d4({x, y, z}?); + e0([a, b, c]); +} + +class C2 implements F2 { + constructor() { } + d3() { } + d4() { } + e0([a, b, c]) { } +} + +class C3 implements F2 { + d3([a, b, c]) { } + d4({x, y, z}) { } + e0([a, b, c]) { } +} + + +function d5({x, y} = { x: 1, y: 2 }) { } +d5(); // Parameter is optional as its declaration included an initializer + +// Destructuring parameter declarations do not permit type annotations on the individual binding patterns, +// as such annotations would conflict with the already established meaning of colons in object literals. +// Type annotations must instead be written on the top- level parameter declaration + +function e1({x: number}) { } // x has type any NOT number +function e2({x}: { x: number }) { } // x is type number +function e3({x}: { x?: number }) { } // x is an optional with type number +function e4({x: [number,string,any] }) { } // x has type [any, any, any] +function e5({x: [a, b, c]}: { x: [number, number, number] }) { } // x has type [any, any, any] + + +//// [destructuringParameterDeclaration1ES5iterable.js] +// A parameter declaration may specify either an identifier or a binding pattern. +// The identifiers specified in parameter declarations and binding patterns +// in a parameter list must be unique within that parameter list. +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; +}; +// If the declaration includes a type annotation, the parameter is of that type +function a1(_a) { + var _b = __read(_a, 3), a = _b[0], b = _b[1], _c = __read(_b[2], 1), _d = __read(_c[0], 1), c = _d[0]; +} +function a2(o) { } +function a3(_a) { + var j = _a.j, k = _a.k, _b = _a.l, m = _b.m, n = _b.n, _c = __read(_a.q, 3), a = _c[0], b = _c[1], c = _c[2]; +} +; +function a4(_a) { + var x = _a.x, a = _a.a; +} +a1([1, 2, [["world"]]]); +a1([1, 2, [["world"]], 3]); +// If the declaration includes an initializer expression (which is permitted only +// when the parameter list occurs in conjunction with a function body), +// the parameter type is the widened form (section 3.11) of the type of the initializer expression. +function b1(z) { + if (z === void 0) { z = [undefined, null]; } +} +; +function b2(z, o) { + if (z === void 0) { z = null; } + if (o === void 0) { o = { x: 0, y: undefined }; } +} +function b3(_a) { + var _b = (_a === void 0 ? { z: { x: "hi", y: { j: 1 } } } : _a).z, x = _b.x, j = _b.y.j; +} +function b6(_a) { + var _b = __read(_a === void 0 ? [undefined, null, undefined] : _a, 3), a = _b[0], z = _b[1], y = _b[2]; +} +function b7(_a) { + var _b = __read(_a === void 0 ? [[undefined], undefined, [[undefined, undefined]]] : _a, 3), _c = __read(_b[0], 1), a = _c[0], b = _b[1], _d = __read(_b[2], 1), _e = __read(_d[0], 2), c = _e[0], d = _e[1]; +} +b1([1, 2, 3]); // z is widen to the type any[] +b2("string", { x: 200, y: "string" }); +b2("string", { x: 200, y: true }); +b6(["string", 1, 2]); // Shouldn't be an error +b7([["string"], 1, [[true, false]]]); // Shouldn't be an error +// If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) +var Foo; +(function (Foo) { + Foo[Foo["a"] = 0] = "a"; +})(Foo || (Foo = {})); +function c0(_a) { + var _b = _a.z, x = _b.x, j = _b.y.j; +} +function c1(_a) { + var z = (_a === void 0 ? { z: 10 } : _a).z; +} +function c2(_a) { + var _b = _a.z, z = _b === void 0 ? 10 : _b; +} +function c3(_a) { + var b = (_a === void 0 ? { b: "hello" } : _a).b; +} +function c5(_a) { + var _b = __read(_a, 3), a = _b[0], b = _b[1], _c = __read(_b[2], 1), _d = __read(_c[0], 1), c = _d[0]; +} +function c6(_a) { + var _b = __read(_a, 3), a = _b[0], b = _b[1], _c = __read(_b[2], 1), _d = __read(_c[0], 1), _e = _d[0], c = _e === void 0 ? 1 : _e; +} +c0({ z: { x: 1, y: { j: "world" } } }); // Implied type is { z: {x: any, y: {j: any}} } +c0({ z: { x: "string", y: { j: true } } }); // Implied type is { z: {x: any, y: {j: any}} } +c1(); // Implied type is {z:number}? +c1({ z: 1 }); // Implied type is {z:number}? +c2({}); // Implied type is {z?: number} +c2({ z: 1 }); // Implied type is {z?: number} +c3({ b: 1 }); // Implied type is { b: number|string }. +c5([1, 2, [["string"]]]); // Implied type is is [any, any, [[any]]] +c5([1, 2, [["string"]], false, true]); // Implied type is is [any, any, [[any]]] +// A parameter can be marked optional by following its name or binding pattern with a question mark (?) +// or by including an initializer. +function d0(x) { } +function d0(x) { + if (x === void 0) { x = 10; } +} +var C2 = (function () { + function C2() { + } + C2.prototype.d3 = function () { }; + C2.prototype.d4 = function () { }; + C2.prototype.e0 = function (_a) { + var _b = __read(_a, 3), a = _b[0], b = _b[1], c = _b[2]; + }; + return C2; +}()); +var C3 = (function () { + function C3() { + } + C3.prototype.d3 = function (_a) { + var _b = __read(_a, 3), a = _b[0], b = _b[1], c = _b[2]; + }; + C3.prototype.d4 = function (_a) { + var x = _a.x, y = _a.y, z = _a.z; + }; + C3.prototype.e0 = function (_a) { + var _b = __read(_a, 3), a = _b[0], b = _b[1], c = _b[2]; + }; + return C3; +}()); +function d5(_a) { + var _b = _a === void 0 ? { x: 1, y: 2 } : _a, x = _b.x, y = _b.y; +} +d5(); // Parameter is optional as its declaration included an initializer +// Destructuring parameter declarations do not permit type annotations on the individual binding patterns, +// as such annotations would conflict with the already established meaning of colons in object literals. +// Type annotations must instead be written on the top- level parameter declaration +function e1(_a) { + var number = _a.x; +} // x has type any NOT number +function e2(_a) { + var x = _a.x; +} // x is type number +function e3(_a) { + var x = _a.x; +} // x is an optional with type number +function e4(_a) { + var _b = __read(_a.x, 3), number = _b[0], string = _b[1], any = _b[2]; +} // x has type [any, any, any] +function e5(_a) { + var _b = __read(_a.x, 3), a = _b[0], b = _b[1], c = _b[2]; +} // x has type [any, any, any] diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.js b/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.js new file mode 100644 index 00000000000..ab00e874e3e --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.js @@ -0,0 +1,141 @@ +//// [destructuringParameterDeclaration3ES5iterable.ts] + +// If the parameter is a rest parameter, the parameter type is any[] +// A type annotation for a rest parameter must denote an array type. + +// RestParameter: +// ... Identifier TypeAnnotation(opt) + +type arrayString = Array +type someArray = Array | number[]; +type stringOrNumArray = Array; + +function a1(...x: (number|string)[]) { } +function a2(...a) { } +function a3(...a: Array) { } +function a4(...a: arrayString) { } +function a5(...a: stringOrNumArray) { } +function a9([a, b, [[c]]]) { } +function a10([a, b, [[c]], ...x]) { } +function a11([a, b, c, ...x]: number[]) { } + + +var array = [1, 2, 3]; +var array2 = [true, false, "hello"]; +a2([...array]); +a1(...array); + +a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]]] + +a10([1, 2, [["string"]], false, true]); // Parameter type is any[] +a10([1, 2, 3, false, true]); // Parameter type is any[] +a10([1, 2]); // Parameter type is any[] +a11([1, 2]); // Parameter type is number[] + +// Rest parameter with generic +function foo(...a: T[]) { } +foo("hello", 1, 2); +foo("hello", "world"); + +enum E { a, b } +const enum E1 { a, b } +function foo1(...a: T[]) { } +foo1(1, 2, 3, E.a); +foo1(1, 2, 3, E1.a, E.b); + + + + +//// [destructuringParameterDeclaration3ES5iterable.js] +// If the parameter is a rest parameter, the parameter type is any[] +// A type annotation for a rest parameter must denote an array type. +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 __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; +function a1() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i] = arguments[_i]; + } +} +function a2() { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i] = arguments[_i]; + } +} +function a3() { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i] = arguments[_i]; + } +} +function a4() { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i] = arguments[_i]; + } +} +function a5() { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i] = arguments[_i]; + } +} +function a9(_a) { + var _b = __read(_a, 3), a = _b[0], b = _b[1], _c = __read(_b[2], 1), _d = __read(_c[0], 1), c = _d[0]; +} +function a10(_a) { + var _b = __read(_a), a = _b[0], b = _b[1], _c = __read(_b[2], 1), _d = __read(_c[0], 1), c = _d[0], x = _b.slice(3); +} +function a11(_a) { + var _b = __read(_a), a = _b[0], b = _b[1], c = _b[2], x = _b.slice(3); +} +var array = [1, 2, 3]; +var array2 = [true, false, "hello"]; +a2(__spread(array)); +a1.apply(void 0, __spread(array)); +a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]]] +a10([1, 2, [["string"]], false, true]); // Parameter type is any[] +a10([1, 2, 3, false, true]); // Parameter type is any[] +a10([1, 2]); // Parameter type is any[] +a11([1, 2]); // Parameter type is number[] +// Rest parameter with generic +function foo() { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i] = arguments[_i]; + } +} +foo("hello", 1, 2); +foo("hello", "world"); +var E; +(function (E) { + E[E["a"] = 0] = "a"; + E[E["b"] = 1] = "b"; +})(E || (E = {})); +function foo1() { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i] = arguments[_i]; + } +} +foo1(1, 2, 3, E.a); +foo1(1, 2, 3, 0 /* a */, E.b); diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.symbols b/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.symbols new file mode 100644 index 00000000000..52b2d290fa0 --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.symbols @@ -0,0 +1,145 @@ +=== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration3ES5iterable.ts === + +// If the parameter is a rest parameter, the parameter type is any[] +// A type annotation for a rest parameter must denote an array type. + +// RestParameter: +// ... Identifier TypeAnnotation(opt) + +type arrayString = Array +>arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES5iterable.ts, 0, 0)) +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +type someArray = Array | number[]; +>someArray : Symbol(someArray, Decl(destructuringParameterDeclaration3ES5iterable.ts, 7, 32)) +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +type stringOrNumArray = Array; +>stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES5iterable.ts, 8, 42)) +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +function a1(...x: (number|string)[]) { } +>a1 : Symbol(a1, Decl(destructuringParameterDeclaration3ES5iterable.ts, 9, 45)) +>x : Symbol(x, Decl(destructuringParameterDeclaration3ES5iterable.ts, 11, 12)) + +function a2(...a) { } +>a2 : Symbol(a2, Decl(destructuringParameterDeclaration3ES5iterable.ts, 11, 40)) +>a : Symbol(a, Decl(destructuringParameterDeclaration3ES5iterable.ts, 12, 12)) + +function a3(...a: Array) { } +>a3 : Symbol(a3, Decl(destructuringParameterDeclaration3ES5iterable.ts, 12, 21)) +>a : Symbol(a, Decl(destructuringParameterDeclaration3ES5iterable.ts, 13, 12)) +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +function a4(...a: arrayString) { } +>a4 : Symbol(a4, Decl(destructuringParameterDeclaration3ES5iterable.ts, 13, 36)) +>a : Symbol(a, Decl(destructuringParameterDeclaration3ES5iterable.ts, 14, 12)) +>arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES5iterable.ts, 0, 0)) + +function a5(...a: stringOrNumArray) { } +>a5 : Symbol(a5, Decl(destructuringParameterDeclaration3ES5iterable.ts, 14, 34)) +>a : Symbol(a, Decl(destructuringParameterDeclaration3ES5iterable.ts, 15, 12)) +>stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES5iterable.ts, 8, 42)) + +function a9([a, b, [[c]]]) { } +>a9 : Symbol(a9, Decl(destructuringParameterDeclaration3ES5iterable.ts, 15, 39)) +>a : Symbol(a, Decl(destructuringParameterDeclaration3ES5iterable.ts, 16, 13)) +>b : Symbol(b, Decl(destructuringParameterDeclaration3ES5iterable.ts, 16, 15)) +>c : Symbol(c, Decl(destructuringParameterDeclaration3ES5iterable.ts, 16, 21)) + +function a10([a, b, [[c]], ...x]) { } +>a10 : Symbol(a10, Decl(destructuringParameterDeclaration3ES5iterable.ts, 16, 30)) +>a : Symbol(a, Decl(destructuringParameterDeclaration3ES5iterable.ts, 17, 14)) +>b : Symbol(b, Decl(destructuringParameterDeclaration3ES5iterable.ts, 17, 16)) +>c : Symbol(c, Decl(destructuringParameterDeclaration3ES5iterable.ts, 17, 22)) +>x : Symbol(x, Decl(destructuringParameterDeclaration3ES5iterable.ts, 17, 26)) + +function a11([a, b, c, ...x]: number[]) { } +>a11 : Symbol(a11, Decl(destructuringParameterDeclaration3ES5iterable.ts, 17, 37)) +>a : Symbol(a, Decl(destructuringParameterDeclaration3ES5iterable.ts, 18, 14)) +>b : Symbol(b, Decl(destructuringParameterDeclaration3ES5iterable.ts, 18, 16)) +>c : Symbol(c, Decl(destructuringParameterDeclaration3ES5iterable.ts, 18, 19)) +>x : Symbol(x, Decl(destructuringParameterDeclaration3ES5iterable.ts, 18, 22)) + + +var array = [1, 2, 3]; +>array : Symbol(array, Decl(destructuringParameterDeclaration3ES5iterable.ts, 21, 3)) + +var array2 = [true, false, "hello"]; +>array2 : Symbol(array2, Decl(destructuringParameterDeclaration3ES5iterable.ts, 22, 3)) + +a2([...array]); +>a2 : Symbol(a2, Decl(destructuringParameterDeclaration3ES5iterable.ts, 11, 40)) +>array : Symbol(array, Decl(destructuringParameterDeclaration3ES5iterable.ts, 21, 3)) + +a1(...array); +>a1 : Symbol(a1, Decl(destructuringParameterDeclaration3ES5iterable.ts, 9, 45)) +>array : Symbol(array, Decl(destructuringParameterDeclaration3ES5iterable.ts, 21, 3)) + +a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]]] +>a9 : Symbol(a9, Decl(destructuringParameterDeclaration3ES5iterable.ts, 15, 39)) + +a10([1, 2, [["string"]], false, true]); // Parameter type is any[] +>a10 : Symbol(a10, Decl(destructuringParameterDeclaration3ES5iterable.ts, 16, 30)) + +a10([1, 2, 3, false, true]); // Parameter type is any[] +>a10 : Symbol(a10, Decl(destructuringParameterDeclaration3ES5iterable.ts, 16, 30)) + +a10([1, 2]); // Parameter type is any[] +>a10 : Symbol(a10, Decl(destructuringParameterDeclaration3ES5iterable.ts, 16, 30)) + +a11([1, 2]); // Parameter type is number[] +>a11 : Symbol(a11, Decl(destructuringParameterDeclaration3ES5iterable.ts, 17, 37)) + +// Rest parameter with generic +function foo(...a: T[]) { } +>foo : Symbol(foo, Decl(destructuringParameterDeclaration3ES5iterable.ts, 31, 12)) +>T : Symbol(T, Decl(destructuringParameterDeclaration3ES5iterable.ts, 34, 13)) +>a : Symbol(a, Decl(destructuringParameterDeclaration3ES5iterable.ts, 34, 16)) +>T : Symbol(T, Decl(destructuringParameterDeclaration3ES5iterable.ts, 34, 13)) + +foo("hello", 1, 2); +>foo : Symbol(foo, Decl(destructuringParameterDeclaration3ES5iterable.ts, 31, 12)) + +foo("hello", "world"); +>foo : Symbol(foo, Decl(destructuringParameterDeclaration3ES5iterable.ts, 31, 12)) + +enum E { a, b } +>E : Symbol(E, Decl(destructuringParameterDeclaration3ES5iterable.ts, 36, 22)) +>a : Symbol(E.a, Decl(destructuringParameterDeclaration3ES5iterable.ts, 38, 8)) +>b : Symbol(E.b, Decl(destructuringParameterDeclaration3ES5iterable.ts, 38, 11)) + +const enum E1 { a, b } +>E1 : Symbol(E1, Decl(destructuringParameterDeclaration3ES5iterable.ts, 38, 15)) +>a : Symbol(E1.a, Decl(destructuringParameterDeclaration3ES5iterable.ts, 39, 15)) +>b : Symbol(E1.b, Decl(destructuringParameterDeclaration3ES5iterable.ts, 39, 18)) + +function foo1(...a: T[]) { } +>foo1 : Symbol(foo1, Decl(destructuringParameterDeclaration3ES5iterable.ts, 39, 22)) +>T : Symbol(T, Decl(destructuringParameterDeclaration3ES5iterable.ts, 40, 14)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>a : Symbol(a, Decl(destructuringParameterDeclaration3ES5iterable.ts, 40, 32)) +>T : Symbol(T, Decl(destructuringParameterDeclaration3ES5iterable.ts, 40, 14)) + +foo1(1, 2, 3, E.a); +>foo1 : Symbol(foo1, Decl(destructuringParameterDeclaration3ES5iterable.ts, 39, 22)) +>E.a : Symbol(E.a, Decl(destructuringParameterDeclaration3ES5iterable.ts, 38, 8)) +>E : Symbol(E, Decl(destructuringParameterDeclaration3ES5iterable.ts, 36, 22)) +>a : Symbol(E.a, Decl(destructuringParameterDeclaration3ES5iterable.ts, 38, 8)) + +foo1(1, 2, 3, E1.a, E.b); +>foo1 : Symbol(foo1, Decl(destructuringParameterDeclaration3ES5iterable.ts, 39, 22)) +>E1.a : Symbol(E1.a, Decl(destructuringParameterDeclaration3ES5iterable.ts, 39, 15)) +>E1 : Symbol(E1, Decl(destructuringParameterDeclaration3ES5iterable.ts, 38, 15)) +>a : Symbol(E1.a, Decl(destructuringParameterDeclaration3ES5iterable.ts, 39, 15)) +>E.b : Symbol(E.b, Decl(destructuringParameterDeclaration3ES5iterable.ts, 38, 11)) +>E : Symbol(E, Decl(destructuringParameterDeclaration3ES5iterable.ts, 36, 22)) +>b : Symbol(E.b, Decl(destructuringParameterDeclaration3ES5iterable.ts, 38, 11)) + + + diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.types b/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.types new file mode 100644 index 00000000000..d003531c67b --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.types @@ -0,0 +1,206 @@ +=== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration3ES5iterable.ts === + +// If the parameter is a rest parameter, the parameter type is any[] +// A type annotation for a rest parameter must denote an array type. + +// RestParameter: +// ... Identifier TypeAnnotation(opt) + +type arrayString = Array +>arrayString : String[] +>Array : T[] +>String : String + +type someArray = Array | number[]; +>someArray : someArray +>Array : T[] +>String : String + +type stringOrNumArray = Array; +>stringOrNumArray : (String | Number)[] +>Array : T[] +>String : String +>Number : Number + +function a1(...x: (number|string)[]) { } +>a1 : (...x: (string | number)[]) => void +>x : (string | number)[] + +function a2(...a) { } +>a2 : (...a: any[]) => void +>a : any[] + +function a3(...a: Array) { } +>a3 : (...a: String[]) => void +>a : String[] +>Array : T[] +>String : String + +function a4(...a: arrayString) { } +>a4 : (...a: String[]) => void +>a : String[] +>arrayString : String[] + +function a5(...a: stringOrNumArray) { } +>a5 : (...a: (String | Number)[]) => void +>a : (String | Number)[] +>stringOrNumArray : (String | Number)[] + +function a9([a, b, [[c]]]) { } +>a9 : ([a, b, [[c]]]: [any, any, [[any]]]) => void +>a : any +>b : any +>c : any + +function a10([a, b, [[c]], ...x]) { } +>a10 : ([a, b, [[c]], ...x]: any[]) => void +>a : any +>b : any +>c : any +>x : any[] + +function a11([a, b, c, ...x]: number[]) { } +>a11 : ([a, b, c, ...x]: number[]) => void +>a : number +>b : number +>c : number +>x : number[] + + +var array = [1, 2, 3]; +>array : number[] +>[1, 2, 3] : number[] +>1 : 1 +>2 : 2 +>3 : 3 + +var array2 = [true, false, "hello"]; +>array2 : (string | boolean)[] +>[true, false, "hello"] : (string | boolean)[] +>true : true +>false : false +>"hello" : "hello" + +a2([...array]); +>a2([...array]) : void +>a2 : (...a: any[]) => void +>[...array] : number[] +>...array : number +>array : number[] + +a1(...array); +>a1(...array) : void +>a1 : (...x: (string | number)[]) => void +>...array : number +>array : number[] + +a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]]] +>a9([1, 2, [["string"]], false, true]) : void +>a9 : ([a, b, [[c]]]: [any, any, [[any]]]) => void +>[1, 2, [["string"]], false, true] : [number, number, [[string]], boolean, boolean] +>1 : 1 +>2 : 2 +>[["string"]] : [[string]] +>["string"] : [string] +>"string" : "string" +>false : false +>true : true + +a10([1, 2, [["string"]], false, true]); // Parameter type is any[] +>a10([1, 2, [["string"]], false, true]) : void +>a10 : ([a, b, [[c]], ...x]: any[]) => void +>[1, 2, [["string"]], false, true] : (number | boolean | string[][])[] +>1 : 1 +>2 : 2 +>[["string"]] : string[][] +>["string"] : string[] +>"string" : "string" +>false : false +>true : true + +a10([1, 2, 3, false, true]); // Parameter type is any[] +>a10([1, 2, 3, false, true]) : void +>a10 : ([a, b, [[c]], ...x]: any[]) => void +>[1, 2, 3, false, true] : (number | boolean)[] +>1 : 1 +>2 : 2 +>3 : 3 +>false : false +>true : true + +a10([1, 2]); // Parameter type is any[] +>a10([1, 2]) : void +>a10 : ([a, b, [[c]], ...x]: any[]) => void +>[1, 2] : number[] +>1 : 1 +>2 : 2 + +a11([1, 2]); // Parameter type is number[] +>a11([1, 2]) : void +>a11 : ([a, b, c, ...x]: number[]) => void +>[1, 2] : number[] +>1 : 1 +>2 : 2 + +// Rest parameter with generic +function foo(...a: T[]) { } +>foo : (...a: T[]) => void +>T : T +>a : T[] +>T : T + +foo("hello", 1, 2); +>foo("hello", 1, 2) : void +>foo : (...a: T[]) => void +>"hello" : "hello" +>1 : 1 +>2 : 2 + +foo("hello", "world"); +>foo("hello", "world") : void +>foo : (...a: T[]) => void +>"hello" : "hello" +>"world" : "world" + +enum E { a, b } +>E : E +>a : E.a +>b : E.b + +const enum E1 { a, b } +>E1 : E1 +>a : E1.a +>b : E1.b + +function foo1(...a: T[]) { } +>foo1 : (...a: T[]) => void +>T : T +>Number : Number +>a : T[] +>T : T + +foo1(1, 2, 3, E.a); +>foo1(1, 2, 3, E.a) : void +>foo1 : (...a: T[]) => void +>1 : 1 +>2 : 2 +>3 : 3 +>E.a : E.a +>E : typeof E +>a : E.a + +foo1(1, 2, 3, E1.a, E.b); +>foo1(1, 2, 3, E1.a, E.b) : void +>foo1 : (...a: T[]) => void +>1 : 1 +>2 : 2 +>3 : 3 +>E1.a : E1.a +>E1 : typeof E1 +>a : E1.a +>E.b : E.b +>E : typeof E +>b : E.b + + + diff --git a/tests/baselines/reference/destructuringParameterDeclaration7ES5iterable.js b/tests/baselines/reference/destructuringParameterDeclaration7ES5iterable.js new file mode 100644 index 00000000000..818ea428c1d --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration7ES5iterable.js @@ -0,0 +1,43 @@ +//// [destructuringParameterDeclaration7ES5iterable.ts] + +interface ISomething { + foo: string, + bar: string +} + +function foo({}, {foo, bar}: ISomething) {} + +function baz([], {foo, bar}: ISomething) {} + +function one([], {}) {} + +function two([], [a, b, c]: number[]) {} + + +//// [destructuringParameterDeclaration7ES5iterable.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; +}; +function foo(_a, _b) { + var foo = _b.foo, bar = _b.bar; +} +function baz(_a, _b) { + var foo = _b.foo, bar = _b.bar; +} +function one(_a, _b) { } +function two(_a, _b) { + var _c = __read(_b, 3), a = _c[0], b = _c[1], c = _c[2]; +} diff --git a/tests/baselines/reference/destructuringParameterDeclaration7ES5iterable.symbols b/tests/baselines/reference/destructuringParameterDeclaration7ES5iterable.symbols new file mode 100644 index 00000000000..0548f1247f6 --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration7ES5iterable.symbols @@ -0,0 +1,33 @@ +=== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration7ES5iterable.ts === + +interface ISomething { +>ISomething : Symbol(ISomething, Decl(destructuringParameterDeclaration7ES5iterable.ts, 0, 0)) + + foo: string, +>foo : Symbol(ISomething.foo, Decl(destructuringParameterDeclaration7ES5iterable.ts, 1, 22)) + + bar: string +>bar : Symbol(ISomething.bar, Decl(destructuringParameterDeclaration7ES5iterable.ts, 2, 16)) +} + +function foo({}, {foo, bar}: ISomething) {} +>foo : Symbol(foo, Decl(destructuringParameterDeclaration7ES5iterable.ts, 4, 1)) +>foo : Symbol(foo, Decl(destructuringParameterDeclaration7ES5iterable.ts, 6, 18)) +>bar : Symbol(bar, Decl(destructuringParameterDeclaration7ES5iterable.ts, 6, 22)) +>ISomething : Symbol(ISomething, Decl(destructuringParameterDeclaration7ES5iterable.ts, 0, 0)) + +function baz([], {foo, bar}: ISomething) {} +>baz : Symbol(baz, Decl(destructuringParameterDeclaration7ES5iterable.ts, 6, 43)) +>foo : Symbol(foo, Decl(destructuringParameterDeclaration7ES5iterable.ts, 8, 18)) +>bar : Symbol(bar, Decl(destructuringParameterDeclaration7ES5iterable.ts, 8, 22)) +>ISomething : Symbol(ISomething, Decl(destructuringParameterDeclaration7ES5iterable.ts, 0, 0)) + +function one([], {}) {} +>one : Symbol(one, Decl(destructuringParameterDeclaration7ES5iterable.ts, 8, 43)) + +function two([], [a, b, c]: number[]) {} +>two : Symbol(two, Decl(destructuringParameterDeclaration7ES5iterable.ts, 10, 23)) +>a : Symbol(a, Decl(destructuringParameterDeclaration7ES5iterable.ts, 12, 18)) +>b : Symbol(b, Decl(destructuringParameterDeclaration7ES5iterable.ts, 12, 20)) +>c : Symbol(c, Decl(destructuringParameterDeclaration7ES5iterable.ts, 12, 23)) + diff --git a/tests/baselines/reference/destructuringParameterDeclaration7ES5iterable.types b/tests/baselines/reference/destructuringParameterDeclaration7ES5iterable.types new file mode 100644 index 00000000000..402ea7ac5e1 --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration7ES5iterable.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration7ES5iterable.ts === + +interface ISomething { +>ISomething : ISomething + + foo: string, +>foo : string + + bar: string +>bar : string +} + +function foo({}, {foo, bar}: ISomething) {} +>foo : ({}: {}, {foo, bar}: ISomething) => void +>foo : string +>bar : string +>ISomething : ISomething + +function baz([], {foo, bar}: ISomething) {} +>baz : ([]: any[], {foo, bar}: ISomething) => void +>foo : string +>bar : string +>ISomething : ISomething + +function one([], {}) {} +>one : ([]: any[], {}: {}) => void + +function two([], [a, b, c]: number[]) {} +>two : ([]: any[], [a, b, c]: number[]) => void +>a : number +>b : number +>c : number + diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.js b/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.js new file mode 100644 index 00000000000..83fb3de04fc --- /dev/null +++ b/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.js @@ -0,0 +1,97 @@ +//// [destructuringVariableDeclaration1ES5iterable.ts] +// The type T associated with a destructuring variable declaration is determined as follows: +// If the declaration includes a type annotation, T is that type. +var {a1, a2}: { a1: number, a2: string } = { a1: 10, a2: "world" } +var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [["hello"]], true]; + +// The type T associated with a destructuring variable declaration is determined as follows: +// Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression. +var { b1: { b11 } = { b11: "string" } } = { b1: { b11: "world" } }; +var temp = { t1: true, t2: "false" }; +var [b2 = 3, b3 = true, b4 = temp] = [3, false, { t1: false, t2: "hello" }]; +var [b5 = 3, b6 = true, b7 = temp] = [undefined, undefined, undefined]; + +// The type T associated with a binding element is determined as follows: +// If the binding element is a rest element, T is an array type with +// an element type E, where E is the type of the numeric index signature of S. +var [...c1] = [1,2,3]; +var [...c2] = [1,2,3, "string"]; + +// The type T associated with a binding element is determined as follows: +// Otherwise, if S is a tuple- like type (section 3.3.3): +// Let N be the zero-based index of the binding element in the array binding pattern. +// If S has a property with the numerical name N, T is the type of that property. +var [d1,d2] = [1,"string"] + +// The type T associated with a binding element is determined as follows: +// Otherwise, if S is a tuple- like type (section 3.3.3): +// Otherwise, if S has a numeric index signature, T is the type of the numeric index signature. +var temp1 = [true, false, true] +var [d3, d4] = [1, "string", ...temp1]; + +// Combining both forms of destructuring, +var {e: [e1, e2, e3 = { b1: 1000, b4: 200 }]} = { e: [1, 2, { b1: 4, b4: 0 }] }; +var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] }; + +// When a destructuring variable declaration, binding property, or binding element specifies +// an initializer expression, the type of the initializer expression is required to be assignable +// to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element. +var {g: {g1 = [undefined, null]}}: { g: { g1: any[] } } = { g: { g1: [1, 2] } }; +var {h: {h1 = [undefined, null]}}: { h: { h1: number[] } } = { h: { h1: [1, 2] } }; + + + +//// [destructuringVariableDeclaration1ES5iterable.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 __spread = (this && this.__spread) || function () { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); + return ar; +}; +// The type T associated with a destructuring variable declaration is determined as follows: +// If the declaration includes a type annotation, T is that type. +var _a = { a1: 10, a2: "world" }, a1 = _a.a1, a2 = _a.a2; +var _b = __read([1, [["hello"]], true], 3), a3 = _b[0], _c = __read(_b[1], 1), _d = __read(_c[0], 1), a4 = _d[0], a5 = _b[2]; +// The type T associated with a destructuring variable declaration is determined as follows: +// Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression. +var _e = { b1: { b11: "world" } }.b1, b11 = (_e === void 0 ? { b11: "string" } : _e).b11; +var temp = { t1: true, t2: "false" }; +var _f = __read([3, false, { t1: false, t2: "hello" }], 3), _g = _f[0], b2 = _g === void 0 ? 3 : _g, _h = _f[1], b3 = _h === void 0 ? true : _h, _j = _f[2], b4 = _j === void 0 ? temp : _j; +var _k = __read([undefined, undefined, undefined], 3), _l = _k[0], b5 = _l === void 0 ? 3 : _l, _m = _k[1], b6 = _m === void 0 ? true : _m, _o = _k[2], b7 = _o === void 0 ? temp : _o; +// The type T associated with a binding element is determined as follows: +// If the binding element is a rest element, T is an array type with +// an element type E, where E is the type of the numeric index signature of S. +var _p = __read([1, 2, 3]), c1 = _p.slice(0); +var _q = __read([1, 2, 3, "string"]), c2 = _q.slice(0); +// The type T associated with a binding element is determined as follows: +// Otherwise, if S is a tuple- like type (section 3.3.3): +// Let N be the zero-based index of the binding element in the array binding pattern. +// If S has a property with the numerical name N, T is the type of that property. +var _r = __read([1, "string"], 2), d1 = _r[0], d2 = _r[1]; +// The type T associated with a binding element is determined as follows: +// Otherwise, if S is a tuple- like type (section 3.3.3): +// Otherwise, if S has a numeric index signature, T is the type of the numeric index signature. +var temp1 = [true, false, true]; +var _s = __read(__spread([1, "string"], temp1), 2), d3 = _s[0], d4 = _s[1]; +// Combining both forms of destructuring, +var _t = __read({ e: [1, 2, { b1: 4, b4: 0 }] }.e, 3), e1 = _t[0], e2 = _t[1], _u = _t[2], e3 = _u === void 0 ? { b1: 1000, b4: 200 } : _u; +var _v = __read({ f: [1, 2, { f3: 4, f5: 0 }] }.f, 4), f1 = _v[0], f2 = _v[1], _w = _v[2], f4 = _w.f3, f5 = _w.f5; +// When a destructuring variable declaration, binding property, or binding element specifies +// an initializer expression, the type of the initializer expression is required to be assignable +// to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element. +var _x = { g: { g1: [1, 2] } }.g.g1, g1 = _x === void 0 ? [undefined, null] : _x; +var _y = { h: { h1: [1, 2] } }.h.h1, h1 = _y === void 0 ? [undefined, null] : _y; diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.symbols b/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.symbols new file mode 100644 index 00000000000..b0ed4280cb6 --- /dev/null +++ b/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.symbols @@ -0,0 +1,120 @@ +=== tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration1ES5iterable.ts === +// The type T associated with a destructuring variable declaration is determined as follows: +// If the declaration includes a type annotation, T is that type. +var {a1, a2}: { a1: number, a2: string } = { a1: 10, a2: "world" } +>a1 : Symbol(a1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 2, 5)) +>a2 : Symbol(a2, Decl(destructuringVariableDeclaration1ES5iterable.ts, 2, 8)) +>a1 : Symbol(a1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 2, 15)) +>a2 : Symbol(a2, Decl(destructuringVariableDeclaration1ES5iterable.ts, 2, 27)) +>a1 : Symbol(a1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 2, 44)) +>a2 : Symbol(a2, Decl(destructuringVariableDeclaration1ES5iterable.ts, 2, 52)) + +var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [["hello"]], true]; +>a3 : Symbol(a3, Decl(destructuringVariableDeclaration1ES5iterable.ts, 3, 5)) +>a4 : Symbol(a4, Decl(destructuringVariableDeclaration1ES5iterable.ts, 3, 11)) +>a5 : Symbol(a5, Decl(destructuringVariableDeclaration1ES5iterable.ts, 3, 16)) + +// The type T associated with a destructuring variable declaration is determined as follows: +// Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression. +var { b1: { b11 } = { b11: "string" } } = { b1: { b11: "world" } }; +>b1 : Symbol(b1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 7, 44)) +>b11 : Symbol(b11, Decl(destructuringVariableDeclaration1ES5iterable.ts, 7, 11)) +>b11 : Symbol(b11, Decl(destructuringVariableDeclaration1ES5iterable.ts, 7, 21)) +>b1 : Symbol(b1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 7, 44)) +>b11 : Symbol(b11, Decl(destructuringVariableDeclaration1ES5iterable.ts, 7, 50)) + +var temp = { t1: true, t2: "false" }; +>temp : Symbol(temp, Decl(destructuringVariableDeclaration1ES5iterable.ts, 8, 3)) +>t1 : Symbol(t1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 8, 12)) +>t2 : Symbol(t2, Decl(destructuringVariableDeclaration1ES5iterable.ts, 8, 22)) + +var [b2 = 3, b3 = true, b4 = temp] = [3, false, { t1: false, t2: "hello" }]; +>b2 : Symbol(b2, Decl(destructuringVariableDeclaration1ES5iterable.ts, 9, 5)) +>b3 : Symbol(b3, Decl(destructuringVariableDeclaration1ES5iterable.ts, 9, 12)) +>b4 : Symbol(b4, Decl(destructuringVariableDeclaration1ES5iterable.ts, 9, 23)) +>temp : Symbol(temp, Decl(destructuringVariableDeclaration1ES5iterable.ts, 8, 3)) +>t1 : Symbol(t1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 9, 49)) +>t2 : Symbol(t2, Decl(destructuringVariableDeclaration1ES5iterable.ts, 9, 60)) + +var [b5 = 3, b6 = true, b7 = temp] = [undefined, undefined, undefined]; +>b5 : Symbol(b5, Decl(destructuringVariableDeclaration1ES5iterable.ts, 10, 5)) +>b6 : Symbol(b6, Decl(destructuringVariableDeclaration1ES5iterable.ts, 10, 12)) +>b7 : Symbol(b7, Decl(destructuringVariableDeclaration1ES5iterable.ts, 10, 23)) +>temp : Symbol(temp, Decl(destructuringVariableDeclaration1ES5iterable.ts, 8, 3)) +>undefined : Symbol(undefined) +>undefined : Symbol(undefined) +>undefined : Symbol(undefined) + +// The type T associated with a binding element is determined as follows: +// If the binding element is a rest element, T is an array type with +// an element type E, where E is the type of the numeric index signature of S. +var [...c1] = [1,2,3]; +>c1 : Symbol(c1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 15, 5)) + +var [...c2] = [1,2,3, "string"]; +>c2 : Symbol(c2, Decl(destructuringVariableDeclaration1ES5iterable.ts, 16, 5)) + +// The type T associated with a binding element is determined as follows: +// Otherwise, if S is a tuple- like type (section 3.3.3): +// Let N be the zero-based index of the binding element in the array binding pattern. +// If S has a property with the numerical name N, T is the type of that property. +var [d1,d2] = [1,"string"] +>d1 : Symbol(d1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 22, 5)) +>d2 : Symbol(d2, Decl(destructuringVariableDeclaration1ES5iterable.ts, 22, 8)) + +// The type T associated with a binding element is determined as follows: +// Otherwise, if S is a tuple- like type (section 3.3.3): +// Otherwise, if S has a numeric index signature, T is the type of the numeric index signature. +var temp1 = [true, false, true] +>temp1 : Symbol(temp1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 27, 3)) + +var [d3, d4] = [1, "string", ...temp1]; +>d3 : Symbol(d3, Decl(destructuringVariableDeclaration1ES5iterable.ts, 28, 5)) +>d4 : Symbol(d4, Decl(destructuringVariableDeclaration1ES5iterable.ts, 28, 8)) +>temp1 : Symbol(temp1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 27, 3)) + +// Combining both forms of destructuring, +var {e: [e1, e2, e3 = { b1: 1000, b4: 200 }]} = { e: [1, 2, { b1: 4, b4: 0 }] }; +>e : Symbol(e, Decl(destructuringVariableDeclaration1ES5iterable.ts, 31, 49)) +>e1 : Symbol(e1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 31, 9)) +>e2 : Symbol(e2, Decl(destructuringVariableDeclaration1ES5iterable.ts, 31, 12)) +>e3 : Symbol(e3, Decl(destructuringVariableDeclaration1ES5iterable.ts, 31, 16)) +>b1 : Symbol(b1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 31, 23)) +>b4 : Symbol(b4, Decl(destructuringVariableDeclaration1ES5iterable.ts, 31, 33)) +>e : Symbol(e, Decl(destructuringVariableDeclaration1ES5iterable.ts, 31, 49)) +>b1 : Symbol(b1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 31, 61)) +>b4 : Symbol(b4, Decl(destructuringVariableDeclaration1ES5iterable.ts, 31, 68)) + +var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] }; +>f : Symbol(f, Decl(destructuringVariableDeclaration1ES5iterable.ts, 32, 41)) +>f1 : Symbol(f1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 32, 9)) +>f2 : Symbol(f2, Decl(destructuringVariableDeclaration1ES5iterable.ts, 32, 12)) +>f3 : Symbol(f3, Decl(destructuringVariableDeclaration1ES5iterable.ts, 32, 53)) +>f4 : Symbol(f4, Decl(destructuringVariableDeclaration1ES5iterable.ts, 32, 18)) +>f5 : Symbol(f5, Decl(destructuringVariableDeclaration1ES5iterable.ts, 32, 26)) +>f : Symbol(f, Decl(destructuringVariableDeclaration1ES5iterable.ts, 32, 41)) +>f3 : Symbol(f3, Decl(destructuringVariableDeclaration1ES5iterable.ts, 32, 53)) +>f5 : Symbol(f5, Decl(destructuringVariableDeclaration1ES5iterable.ts, 32, 60)) + +// When a destructuring variable declaration, binding property, or binding element specifies +// an initializer expression, the type of the initializer expression is required to be assignable +// to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element. +var {g: {g1 = [undefined, null]}}: { g: { g1: any[] } } = { g: { g1: [1, 2] } }; +>g : Symbol(g, Decl(destructuringVariableDeclaration1ES5iterable.ts, 37, 36)) +>g1 : Symbol(g1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 37, 9)) +>undefined : Symbol(undefined) +>g : Symbol(g, Decl(destructuringVariableDeclaration1ES5iterable.ts, 37, 36)) +>g1 : Symbol(g1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 37, 41)) +>g : Symbol(g, Decl(destructuringVariableDeclaration1ES5iterable.ts, 37, 59)) +>g1 : Symbol(g1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 37, 64)) + +var {h: {h1 = [undefined, null]}}: { h: { h1: number[] } } = { h: { h1: [1, 2] } }; +>h : Symbol(h, Decl(destructuringVariableDeclaration1ES5iterable.ts, 38, 36)) +>h1 : Symbol(h1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 38, 9)) +>undefined : Symbol(undefined) +>h : Symbol(h, Decl(destructuringVariableDeclaration1ES5iterable.ts, 38, 36)) +>h1 : Symbol(h1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 38, 41)) +>h : Symbol(h, Decl(destructuringVariableDeclaration1ES5iterable.ts, 38, 62)) +>h1 : Symbol(h1, Decl(destructuringVariableDeclaration1ES5iterable.ts, 38, 67)) + + diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.types b/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.types new file mode 100644 index 00000000000..6ef4c3d5749 --- /dev/null +++ b/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.types @@ -0,0 +1,200 @@ +=== tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration1ES5iterable.ts === +// The type T associated with a destructuring variable declaration is determined as follows: +// If the declaration includes a type annotation, T is that type. +var {a1, a2}: { a1: number, a2: string } = { a1: 10, a2: "world" } +>a1 : number +>a2 : string +>a1 : number +>a2 : string +>{ a1: 10, a2: "world" } : { a1: number; a2: string; } +>a1 : number +>10 : 10 +>a2 : string +>"world" : "world" + +var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [["hello"]], true]; +>a3 : number +>a4 : string +>a5 : boolean +>[1, [["hello"]], true] : [number, [[string]], true] +>1 : 1 +>[["hello"]] : [[string]] +>["hello"] : [string] +>"hello" : "hello" +>true : true + +// The type T associated with a destructuring variable declaration is determined as follows: +// Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression. +var { b1: { b11 } = { b11: "string" } } = { b1: { b11: "world" } }; +>b1 : any +>b11 : string +>{ b11: "string" } : { b11: string; } +>b11 : string +>"string" : "string" +>{ b1: { b11: "world" } } : { b1?: { b11: string; }; } +>b1 : { b11: string; } +>{ b11: "world" } : { b11: string; } +>b11 : string +>"world" : "world" + +var temp = { t1: true, t2: "false" }; +>temp : { t1: boolean; t2: string; } +>{ t1: true, t2: "false" } : { t1: boolean; t2: string; } +>t1 : boolean +>true : true +>t2 : string +>"false" : "false" + +var [b2 = 3, b3 = true, b4 = temp] = [3, false, { t1: false, t2: "hello" }]; +>b2 : number +>3 : 3 +>b3 : boolean +>true : true +>b4 : { t1: boolean; t2: string; } +>temp : { t1: boolean; t2: string; } +>[3, false, { t1: false, t2: "hello" }] : [number, false, { t1: false; t2: string; }] +>3 : 3 +>false : false +>{ t1: false, t2: "hello" } : { t1: false; t2: string; } +>t1 : boolean +>false : false +>t2 : string +>"hello" : "hello" + +var [b5 = 3, b6 = true, b7 = temp] = [undefined, undefined, undefined]; +>b5 : 3 +>3 : 3 +>b6 : true +>true : true +>b7 : { t1: boolean; t2: string; } +>temp : { t1: boolean; t2: string; } +>[undefined, undefined, undefined] : [undefined, undefined, undefined] +>undefined : undefined +>undefined : undefined +>undefined : undefined + +// The type T associated with a binding element is determined as follows: +// If the binding element is a rest element, T is an array type with +// an element type E, where E is the type of the numeric index signature of S. +var [...c1] = [1,2,3]; +>c1 : number[] +>[1,2,3] : number[] +>1 : 1 +>2 : 2 +>3 : 3 + +var [...c2] = [1,2,3, "string"]; +>c2 : (string | number)[] +>[1,2,3, "string"] : (string | number)[] +>1 : 1 +>2 : 2 +>3 : 3 +>"string" : "string" + +// The type T associated with a binding element is determined as follows: +// Otherwise, if S is a tuple- like type (section 3.3.3): +// Let N be the zero-based index of the binding element in the array binding pattern. +// If S has a property with the numerical name N, T is the type of that property. +var [d1,d2] = [1,"string"] +>d1 : number +>d2 : string +>[1,"string"] : [number, string] +>1 : 1 +>"string" : "string" + +// The type T associated with a binding element is determined as follows: +// Otherwise, if S is a tuple- like type (section 3.3.3): +// Otherwise, if S has a numeric index signature, T is the type of the numeric index signature. +var temp1 = [true, false, true] +>temp1 : boolean[] +>[true, false, true] : boolean[] +>true : true +>false : false +>true : true + +var [d3, d4] = [1, "string", ...temp1]; +>d3 : string | number | boolean +>d4 : string | number | boolean +>[1, "string", ...temp1] : (string | number | boolean)[] +>1 : 1 +>"string" : "string" +>...temp1 : boolean +>temp1 : boolean[] + +// Combining both forms of destructuring, +var {e: [e1, e2, e3 = { b1: 1000, b4: 200 }]} = { e: [1, 2, { b1: 4, b4: 0 }] }; +>e : any +>e1 : number +>e2 : number +>e3 : { b1: number; b4: number; } +>{ b1: 1000, b4: 200 } : { b1: number; b4: number; } +>b1 : number +>1000 : 1000 +>b4 : number +>200 : 200 +>{ e: [1, 2, { b1: 4, b4: 0 }] } : { e: [number, number, { b1: number; b4: number; }]; } +>e : [number, number, { b1: number; b4: number; }] +>[1, 2, { b1: 4, b4: 0 }] : [number, number, { b1: number; b4: number; }] +>1 : 1 +>2 : 2 +>{ b1: 4, b4: 0 } : { b1: number; b4: number; } +>b1 : number +>4 : 4 +>b4 : number +>0 : 0 + +var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] }; +>f : any +>f1 : number +>f2 : number +>f3 : any +>f4 : number +>f5 : number +> : undefined +>{ f: [1, 2, { f3: 4, f5: 0 }] } : { f: [number, number, { f3: number; f5: number; }, any]; } +>f : [number, number, { f3: number; f5: number; }, any] +>[1, 2, { f3: 4, f5: 0 }] : [number, number, { f3: number; f5: number; }, any] +>1 : 1 +>2 : 2 +>{ f3: 4, f5: 0 } : { f3: number; f5: number; } +>f3 : number +>4 : 4 +>f5 : number +>0 : 0 + +// When a destructuring variable declaration, binding property, or binding element specifies +// an initializer expression, the type of the initializer expression is required to be assignable +// to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element. +var {g: {g1 = [undefined, null]}}: { g: { g1: any[] } } = { g: { g1: [1, 2] } }; +>g : any +>g1 : any[] +>[undefined, null] : null[] +>undefined : undefined +>null : null +>g : { g1: any[]; } +>g1 : any[] +>{ g: { g1: [1, 2] } } : { g: { g1: number[]; }; } +>g : { g1: number[]; } +>{ g1: [1, 2] } : { g1: number[]; } +>g1 : number[] +>[1, 2] : number[] +>1 : 1 +>2 : 2 + +var {h: {h1 = [undefined, null]}}: { h: { h1: number[] } } = { h: { h1: [1, 2] } }; +>h : any +>h1 : number[] +>[undefined, null] : null[] +>undefined : undefined +>null : null +>h : { h1: number[]; } +>h1 : number[] +>{ h: { h1: [1, 2] } } : { h: { h1: number[]; }; } +>h : { h1: number[]; } +>{ h1: [1, 2] } : { h1: number[]; } +>h1 : number[] +>[1, 2] : number[] +>1 : 1 +>2 : 2 + + diff --git a/tests/baselines/reference/downlevelLetConst11.errors.txt b/tests/baselines/reference/downlevelLetConst11.errors.txt index 29932f55c1f..08456c61624 100644 --- a/tests/baselines/reference/downlevelLetConst11.errors.txt +++ b/tests/baselines/reference/downlevelLetConst11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/downlevelLetConst11.ts(2,1): error TS1212: Identifier expected. 'let' is a reserved word in strict mode +tests/cases/compiler/downlevelLetConst11.ts(2,1): error TS1212: Identifier expected. 'let' is a reserved word in strict mode. tests/cases/compiler/downlevelLetConst11.ts(2,1): error TS2304: Cannot find name 'let'. @@ -6,6 +6,6 @@ tests/cases/compiler/downlevelLetConst11.ts(2,1): error TS2304: Cannot find name "use strict"; let ~~~ -!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode. ~~~ !!! error TS2304: Cannot find name 'let'. \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst2.errors.txt b/tests/baselines/reference/downlevelLetConst2.errors.txt index 9da0c94a12e..57108d9348d 100644 --- a/tests/baselines/reference/downlevelLetConst2.errors.txt +++ b/tests/baselines/reference/downlevelLetConst2.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/downlevelLetConst2.ts(1,7): error TS1155: 'const' declarations must be initialized +tests/cases/compiler/downlevelLetConst2.ts(1,7): error TS1155: 'const' declarations must be initialized. ==== tests/cases/compiler/downlevelLetConst2.ts (1 errors) ==== const a ~ -!!! error TS1155: 'const' declarations must be initialized \ No newline at end of file +!!! error TS1155: 'const' declarations must be initialized. \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst4.errors.txt b/tests/baselines/reference/downlevelLetConst4.errors.txt index 3bf3e58cecc..93ab865e1ca 100644 --- a/tests/baselines/reference/downlevelLetConst4.errors.txt +++ b/tests/baselines/reference/downlevelLetConst4.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/downlevelLetConst4.ts(1,7): error TS1155: 'const' declarations must be initialized +tests/cases/compiler/downlevelLetConst4.ts(1,7): error TS1155: 'const' declarations must be initialized. ==== tests/cases/compiler/downlevelLetConst4.ts (1 errors) ==== const a: number ~ -!!! error TS1155: 'const' declarations must be initialized \ No newline at end of file +!!! error TS1155: 'const' declarations must be initialized. \ No newline at end of file diff --git a/tests/baselines/reference/duplicateIdentifiersAcrossFileBoundaries.errors.txt b/tests/baselines/reference/duplicateIdentifiersAcrossFileBoundaries.errors.txt index db7d0205fc9..7ef43dc6470 100644 --- a/tests/baselines/reference/duplicateIdentifiersAcrossFileBoundaries.errors.txt +++ b/tests/baselines/reference/duplicateIdentifiersAcrossFileBoundaries.errors.txt @@ -3,7 +3,7 @@ tests/cases/compiler/file1.ts(5,10): error TS2300: Duplicate identifier 'f'. tests/cases/compiler/file1.ts(9,12): error TS2300: Duplicate identifier 'x'. tests/cases/compiler/file2.ts(3,10): error TS2300: Duplicate identifier 'C2'. tests/cases/compiler/file2.ts(4,7): error TS2300: Duplicate identifier 'f'. -tests/cases/compiler/file2.ts(7,8): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged +tests/cases/compiler/file2.ts(7,8): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. tests/cases/compiler/file2.ts(8,16): error TS2300: Duplicate identifier 'x'. @@ -44,7 +44,7 @@ tests/cases/compiler/file2.ts(8,16): error TS2300: Duplicate identifier 'x'. module Foo { ~~~ -!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged +!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. export var x: number; // error for redeclaring var in a different parent ~ !!! error TS2300: Duplicate identifier 'x'. diff --git a/tests/baselines/reference/duplicateLabel1.errors.txt b/tests/baselines/reference/duplicateLabel1.errors.txt index cf116f656fc..03d4e999597 100644 --- a/tests/baselines/reference/duplicateLabel1.errors.txt +++ b/tests/baselines/reference/duplicateLabel1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/duplicateLabel1.ts(3,1): error TS1114: Duplicate label 'target' +tests/cases/compiler/duplicateLabel1.ts(3,1): error TS1114: Duplicate label 'target'. ==== tests/cases/compiler/duplicateLabel1.ts (1 errors) ==== @@ -6,6 +6,6 @@ tests/cases/compiler/duplicateLabel1.ts(3,1): error TS1114: Duplicate label 'tar target: target: ~~~~~~ -!!! error TS1114: Duplicate label 'target' +!!! error TS1114: Duplicate label 'target'. while (true) { } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateLabel2.errors.txt b/tests/baselines/reference/duplicateLabel2.errors.txt index 2a87ed96648..d178a8ffe5c 100644 --- a/tests/baselines/reference/duplicateLabel2.errors.txt +++ b/tests/baselines/reference/duplicateLabel2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/duplicateLabel2.ts(4,3): error TS1114: Duplicate label 'target' +tests/cases/compiler/duplicateLabel2.ts(4,3): error TS1114: Duplicate label 'target'. ==== tests/cases/compiler/duplicateLabel2.ts (1 errors) ==== @@ -7,7 +7,7 @@ tests/cases/compiler/duplicateLabel2.ts(4,3): error TS1114: Duplicate label 'tar while (true) { target: ~~~~~~ -!!! error TS1114: Duplicate label 'target' +!!! error TS1114: Duplicate label 'target'. while (true) { } } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateSymbolsExportMatching.errors.txt b/tests/baselines/reference/duplicateSymbolsExportMatching.errors.txt index 85dd29b78a3..dde5940539c 100644 --- a/tests/baselines/reference/duplicateSymbolsExportMatching.errors.txt +++ b/tests/baselines/reference/duplicateSymbolsExportMatching.errors.txt @@ -9,7 +9,7 @@ tests/cases/compiler/duplicateSymbolsExportMatching.ts(43,16): error TS2395: Ind tests/cases/compiler/duplicateSymbolsExportMatching.ts(44,9): error TS2395: Individual declarations in merged declaration 'w' must be all exported or all local. tests/cases/compiler/duplicateSymbolsExportMatching.ts(45,16): error TS2395: Individual declarations in merged declaration 'w' must be all exported or all local. tests/cases/compiler/duplicateSymbolsExportMatching.ts(49,12): error TS2395: Individual declarations in merged declaration 'F' must be all exported or all local. -tests/cases/compiler/duplicateSymbolsExportMatching.ts(49,12): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +tests/cases/compiler/duplicateSymbolsExportMatching.ts(49,12): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. tests/cases/compiler/duplicateSymbolsExportMatching.ts(52,21): error TS2395: Individual declarations in merged declaration 'F' must be all exported or all local. tests/cases/compiler/duplicateSymbolsExportMatching.ts(56,11): error TS2395: Individual declarations in merged declaration 'C' must be all exported or all local. tests/cases/compiler/duplicateSymbolsExportMatching.ts(57,12): error TS2395: Individual declarations in merged declaration 'C' must be all exported or all local. @@ -91,7 +91,7 @@ tests/cases/compiler/duplicateSymbolsExportMatching.ts(65,18): error TS2395: Ind ~ !!! error TS2395: Individual declarations in merged declaration 'F' must be all exported or all local. ~ -!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. var t; } export function F() { } // Only one error for duplicate identifier (don't consider visibility) diff --git a/tests/baselines/reference/duplicateVarAndImport2.errors.txt b/tests/baselines/reference/duplicateVarAndImport2.errors.txt index 192b16eaab9..e537eac9afb 100644 --- a/tests/baselines/reference/duplicateVarAndImport2.errors.txt +++ b/tests/baselines/reference/duplicateVarAndImport2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/duplicateVarAndImport2.ts(4,1): error TS2440: Import declaration conflicts with local declaration of 'a' +tests/cases/compiler/duplicateVarAndImport2.ts(4,1): error TS2440: Import declaration conflicts with local declaration of 'a'. ==== tests/cases/compiler/duplicateVarAndImport2.ts (1 errors) ==== @@ -7,4 +7,4 @@ tests/cases/compiler/duplicateVarAndImport2.ts(4,1): error TS2440: Import declar module M { export var x = 1; } import a = M; ~~~~~~~~~~~~~ -!!! error TS2440: Import declaration conflicts with local declaration of 'a' \ No newline at end of file +!!! error TS2440: Import declaration conflicts with local declaration of 'a'. \ No newline at end of file diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.js b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.js new file mode 100644 index 00000000000..ba4902102b1 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.js @@ -0,0 +1,266 @@ +//// [tests/cases/conformance/emitter/es2015/asyncGenerators/emitter.asyncGenerators.classMethods.es2015.ts] //// + +//// [C1.ts] +class C1 { + async * f() { + } +} +//// [C2.ts] +class C2 { + async * f() { + const x = yield; + } +} +//// [C3.ts] +class C3 { + async * f() { + const x = yield 1; + } +} +//// [C4.ts] +class C4 { + async * f() { + const x = yield* [1]; + } +} +//// [C5.ts] +class C5 { + async * f() { + const x = yield* (async function*() { yield 1; })(); + } +} +//// [C6.ts] +class C6 { + async * f() { + const x = await 1; + } +} +//// [C7.ts] +class C7 { + async * f() { + return 1; + } +} +//// [C8.ts] +class C8 { + g() { + } + async * f() { + this.g(); + } +} +//// [C9.ts] +class B9 { + g() {} +} +class C9 extends B9 { + async * f() { + super.g(); + } +} + + +//// [C1.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +class C1 { + f() { + return __asyncGenerator(this, arguments, function* f_1() { + }); + } +} +//// [C2.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +class C2 { + f() { + return __asyncGenerator(this, arguments, function* f_1() { + const x = yield ["yield"]; + }); + } +} +//// [C3.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +class C3 { + f() { + return __asyncGenerator(this, arguments, function* f_1() { + const x = yield ["yield", 1]; + }); + } +} +//// [C4.js] +var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +class C4 { + f() { + return __asyncGenerator(this, arguments, function* f_1() { + const x = yield* __asyncDelegator([1]); + }); + } +} +//// [C5.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +class C5 { + f() { + return __asyncGenerator(this, arguments, function* f_1() { + const x = yield* __asyncDelegator((function () { return __asyncGenerator(this, arguments, function* () { yield ["yield", 1]; }); })()); + }); + } +} +//// [C6.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +class C6 { + f() { + return __asyncGenerator(this, arguments, function* f_1() { + const x = yield ["await", 1]; + }); + } +} +//// [C7.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +class C7 { + f() { + return __asyncGenerator(this, arguments, function* f_1() { + return 1; + }); + } +} +//// [C8.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +class C8 { + g() { + } + f() { + return __asyncGenerator(this, arguments, function* f_1() { + this.g(); + }); + } +} +//// [C9.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +class B9 { + g() { } +} +class C9 extends B9 { + f() { + const _super = name => super[name]; + return __asyncGenerator(this, arguments, function* f_1() { + _super("g").call(this); + }); + } +} diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.symbols b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.symbols new file mode 100644 index 00000000000..5db32d5c4d8 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.symbols @@ -0,0 +1,110 @@ +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C1.ts === +class C1 { +>C1 : Symbol(C1, Decl(C1.ts, 0, 0)) + + async * f() { +>f : Symbol(C1.f, Decl(C1.ts, 0, 10)) + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C2.ts === +class C2 { +>C2 : Symbol(C2, Decl(C2.ts, 0, 0)) + + async * f() { +>f : Symbol(C2.f, Decl(C2.ts, 0, 10)) + + const x = yield; +>x : Symbol(x, Decl(C2.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C3.ts === +class C3 { +>C3 : Symbol(C3, Decl(C3.ts, 0, 0)) + + async * f() { +>f : Symbol(C3.f, Decl(C3.ts, 0, 10)) + + const x = yield 1; +>x : Symbol(x, Decl(C3.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C4.ts === +class C4 { +>C4 : Symbol(C4, Decl(C4.ts, 0, 0)) + + async * f() { +>f : Symbol(C4.f, Decl(C4.ts, 0, 10)) + + const x = yield* [1]; +>x : Symbol(x, Decl(C4.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C5.ts === +class C5 { +>C5 : Symbol(C5, Decl(C5.ts, 0, 0)) + + async * f() { +>f : Symbol(C5.f, Decl(C5.ts, 0, 10)) + + const x = yield* (async function*() { yield 1; })(); +>x : Symbol(x, Decl(C5.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C6.ts === +class C6 { +>C6 : Symbol(C6, Decl(C6.ts, 0, 0)) + + async * f() { +>f : Symbol(C6.f, Decl(C6.ts, 0, 10)) + + const x = await 1; +>x : Symbol(x, Decl(C6.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C7.ts === +class C7 { +>C7 : Symbol(C7, Decl(C7.ts, 0, 0)) + + async * f() { +>f : Symbol(C7.f, Decl(C7.ts, 0, 10)) + + return 1; + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C8.ts === +class C8 { +>C8 : Symbol(C8, Decl(C8.ts, 0, 0)) + + g() { +>g : Symbol(C8.g, Decl(C8.ts, 0, 10)) + } + async * f() { +>f : Symbol(C8.f, Decl(C8.ts, 2, 5)) + + this.g(); +>this.g : Symbol(C8.g, Decl(C8.ts, 0, 10)) +>this : Symbol(C8, Decl(C8.ts, 0, 0)) +>g : Symbol(C8.g, Decl(C8.ts, 0, 10)) + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C9.ts === +class B9 { +>B9 : Symbol(B9, Decl(C9.ts, 0, 0)) + + g() {} +>g : Symbol(B9.g, Decl(C9.ts, 0, 10)) +} +class C9 extends B9 { +>C9 : Symbol(C9, Decl(C9.ts, 2, 1)) +>B9 : Symbol(B9, Decl(C9.ts, 0, 0)) + + async * f() { +>f : Symbol(C9.f, Decl(C9.ts, 3, 21)) + + super.g(); +>super.g : Symbol(B9.g, Decl(C9.ts, 0, 10)) +>super : Symbol(B9, Decl(C9.ts, 0, 0)) +>g : Symbol(B9.g, Decl(C9.ts, 0, 10)) + } +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.types b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.types new file mode 100644 index 00000000000..524f7c9b71b --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.types @@ -0,0 +1,127 @@ +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C1.ts === +class C1 { +>C1 : C1 + + async * f() { +>f : () => AsyncIterableIterator + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C2.ts === +class C2 { +>C2 : C2 + + async * f() { +>f : () => AsyncIterableIterator + + const x = yield; +>x : any +>yield : any + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C3.ts === +class C3 { +>C3 : C3 + + async * f() { +>f : () => AsyncIterableIterator<1> + + const x = yield 1; +>x : any +>yield 1 : any +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C4.ts === +class C4 { +>C4 : C4 + + async * f() { +>f : () => AsyncIterableIterator + + const x = yield* [1]; +>x : any +>yield* [1] : any +>[1] : number[] +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C5.ts === +class C5 { +>C5 : C5 + + async * f() { +>f : () => AsyncIterableIterator<1> + + const x = yield* (async function*() { yield 1; })(); +>x : any +>yield* (async function*() { yield 1; })() : any +>(async function*() { yield 1; })() : AsyncIterableIterator<1> +>(async function*() { yield 1; }) : () => AsyncIterableIterator<1> +>async function*() { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C6.ts === +class C6 { +>C6 : C6 + + async * f() { +>f : () => AsyncIterableIterator + + const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C7.ts === +class C7 { +>C7 : C7 + + async * f() { +>f : () => AsyncIterableIterator + + return 1; +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C8.ts === +class C8 { +>C8 : C8 + + g() { +>g : () => void + } + async * f() { +>f : () => AsyncIterableIterator + + this.g(); +>this.g() : void +>this.g : () => void +>this : this +>g : () => void + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/C9.ts === +class B9 { +>B9 : B9 + + g() {} +>g : () => void +} +class C9 extends B9 { +>C9 : C9 +>B9 : B9 + + async * f() { +>f : () => AsyncIterableIterator + + super.g(); +>super.g() : void +>super.g : () => void +>super : B9 +>g : () => void + } +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.js b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.js new file mode 100644 index 00000000000..74a65673e5a --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.js @@ -0,0 +1,628 @@ +//// [tests/cases/conformance/emitter/es5/asyncGenerators/emitter.asyncGenerators.classMethods.es5.ts] //// + +//// [C1.ts] +class C1 { + async * f() { + } +} +//// [C2.ts] +class C2 { + async * f() { + const x = yield; + } +} +//// [C3.ts] +class C3 { + async * f() { + const x = yield 1; + } +} +//// [C4.ts] +class C4 { + async * f() { + const x = yield* [1]; + } +} +//// [C5.ts] +class C5 { + async * f() { + const x = yield* (async function*() { yield 1; })(); + } +} +//// [C6.ts] +class C6 { + async * f() { + const x = await 1; + } +} +//// [C7.ts] +class C7 { + async * f() { + return 1; + } +} +//// [C8.ts] +class C8 { + g() { + } + async * f() { + this.g(); + } +} +//// [C9.ts] +class B9 { + g() {} +} +class C9 extends B9 { + async * f() { + super.g(); + } +} + + +//// [C1.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var C1 = (function () { + function C1() { + } + C1.prototype.f = function () { + return __asyncGenerator(this, arguments, function f_1() { + return __generator(this, function (_a) { + return [2 /*return*/]; + }); + }); + }; + return C1; +}()); +//// [C2.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var C2 = (function () { + function C2() { + } + C2.prototype.f = function () { + return __asyncGenerator(this, arguments, function f_1() { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["yield"]]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); + }; + return C2; +}()); +//// [C3.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var C3 = (function () { + function C3() { + } + C3.prototype.f = function () { + return __asyncGenerator(this, arguments, function f_1() { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["yield", 1]]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); + }; + return C3; +}()); +//// [C4.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +var C4 = (function () { + function C4() { + } + C4.prototype.f = function () { + return __asyncGenerator(this, arguments, function f_1() { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(__asyncDelegator([1]))]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); + }; + return C4; +}()); +//// [C5.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +var C5 = (function () { + function C5() { + } + C5.prototype.f = function () { + return __asyncGenerator(this, arguments, function f_1() { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(__asyncDelegator((function () { return __asyncGenerator(this, arguments, function () { return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["yield", 1]]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); }); })()))]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); + }; + return C5; +}()); +//// [C6.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var C6 = (function () { + function C6() { + } + C6.prototype.f = function () { + return __asyncGenerator(this, arguments, function f_1() { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["await", 1]]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); + }; + return C6; +}()); +//// [C7.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var C7 = (function () { + function C7() { + } + C7.prototype.f = function () { + return __asyncGenerator(this, arguments, function f_1() { + return __generator(this, function (_a) { + return [2 /*return*/, 1]; + }); + }); + }; + return C7; +}()); +//// [C8.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var C8 = (function () { + function C8() { + } + C8.prototype.g = function () { + }; + C8.prototype.f = function () { + return __asyncGenerator(this, arguments, function f_1() { + return __generator(this, function (_a) { + this.g(); + return [2 /*return*/]; + }); + }); + }; + return C8; +}()); +//// [C9.js] +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var B9 = (function () { + function B9() { + } + B9.prototype.g = function () { }; + return B9; +}()); +var C9 = (function (_super) { + __extends(C9, _super); + function C9() { + return _super !== null && _super.apply(this, arguments) || this; + } + C9.prototype.f = function () { + return __asyncGenerator(this, arguments, function f_1() { + return __generator(this, function (_a) { + _super.prototype.g.call(this); + return [2 /*return*/]; + }); + }); + }; + return C9; +}(B9)); diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.symbols b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.symbols new file mode 100644 index 00000000000..de82f07faac --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.symbols @@ -0,0 +1,110 @@ +=== tests/cases/conformance/emitter/es5/asyncGenerators/C1.ts === +class C1 { +>C1 : Symbol(C1, Decl(C1.ts, 0, 0)) + + async * f() { +>f : Symbol(C1.f, Decl(C1.ts, 0, 10)) + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C2.ts === +class C2 { +>C2 : Symbol(C2, Decl(C2.ts, 0, 0)) + + async * f() { +>f : Symbol(C2.f, Decl(C2.ts, 0, 10)) + + const x = yield; +>x : Symbol(x, Decl(C2.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C3.ts === +class C3 { +>C3 : Symbol(C3, Decl(C3.ts, 0, 0)) + + async * f() { +>f : Symbol(C3.f, Decl(C3.ts, 0, 10)) + + const x = yield 1; +>x : Symbol(x, Decl(C3.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C4.ts === +class C4 { +>C4 : Symbol(C4, Decl(C4.ts, 0, 0)) + + async * f() { +>f : Symbol(C4.f, Decl(C4.ts, 0, 10)) + + const x = yield* [1]; +>x : Symbol(x, Decl(C4.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C5.ts === +class C5 { +>C5 : Symbol(C5, Decl(C5.ts, 0, 0)) + + async * f() { +>f : Symbol(C5.f, Decl(C5.ts, 0, 10)) + + const x = yield* (async function*() { yield 1; })(); +>x : Symbol(x, Decl(C5.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C6.ts === +class C6 { +>C6 : Symbol(C6, Decl(C6.ts, 0, 0)) + + async * f() { +>f : Symbol(C6.f, Decl(C6.ts, 0, 10)) + + const x = await 1; +>x : Symbol(x, Decl(C6.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C7.ts === +class C7 { +>C7 : Symbol(C7, Decl(C7.ts, 0, 0)) + + async * f() { +>f : Symbol(C7.f, Decl(C7.ts, 0, 10)) + + return 1; + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C8.ts === +class C8 { +>C8 : Symbol(C8, Decl(C8.ts, 0, 0)) + + g() { +>g : Symbol(C8.g, Decl(C8.ts, 0, 10)) + } + async * f() { +>f : Symbol(C8.f, Decl(C8.ts, 2, 5)) + + this.g(); +>this.g : Symbol(C8.g, Decl(C8.ts, 0, 10)) +>this : Symbol(C8, Decl(C8.ts, 0, 0)) +>g : Symbol(C8.g, Decl(C8.ts, 0, 10)) + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C9.ts === +class B9 { +>B9 : Symbol(B9, Decl(C9.ts, 0, 0)) + + g() {} +>g : Symbol(B9.g, Decl(C9.ts, 0, 10)) +} +class C9 extends B9 { +>C9 : Symbol(C9, Decl(C9.ts, 2, 1)) +>B9 : Symbol(B9, Decl(C9.ts, 0, 0)) + + async * f() { +>f : Symbol(C9.f, Decl(C9.ts, 3, 21)) + + super.g(); +>super.g : Symbol(B9.g, Decl(C9.ts, 0, 10)) +>super : Symbol(B9, Decl(C9.ts, 0, 0)) +>g : Symbol(B9.g, Decl(C9.ts, 0, 10)) + } +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.types b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.types new file mode 100644 index 00000000000..c20e0d35010 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.types @@ -0,0 +1,127 @@ +=== tests/cases/conformance/emitter/es5/asyncGenerators/C1.ts === +class C1 { +>C1 : C1 + + async * f() { +>f : () => AsyncIterableIterator + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C2.ts === +class C2 { +>C2 : C2 + + async * f() { +>f : () => AsyncIterableIterator + + const x = yield; +>x : any +>yield : any + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C3.ts === +class C3 { +>C3 : C3 + + async * f() { +>f : () => AsyncIterableIterator<1> + + const x = yield 1; +>x : any +>yield 1 : any +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C4.ts === +class C4 { +>C4 : C4 + + async * f() { +>f : () => AsyncIterableIterator + + const x = yield* [1]; +>x : any +>yield* [1] : any +>[1] : number[] +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C5.ts === +class C5 { +>C5 : C5 + + async * f() { +>f : () => AsyncIterableIterator<1> + + const x = yield* (async function*() { yield 1; })(); +>x : any +>yield* (async function*() { yield 1; })() : any +>(async function*() { yield 1; })() : AsyncIterableIterator<1> +>(async function*() { yield 1; }) : () => AsyncIterableIterator<1> +>async function*() { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C6.ts === +class C6 { +>C6 : C6 + + async * f() { +>f : () => AsyncIterableIterator + + const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C7.ts === +class C7 { +>C7 : C7 + + async * f() { +>f : () => AsyncIterableIterator + + return 1; +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C8.ts === +class C8 { +>C8 : C8 + + g() { +>g : () => void + } + async * f() { +>f : () => AsyncIterableIterator + + this.g(); +>this.g() : void +>this.g : () => void +>this : this +>g : () => void + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/C9.ts === +class B9 { +>B9 : B9 + + g() {} +>g : () => void +} +class C9 extends B9 { +>C9 : C9 +>B9 : B9 + + async * f() { +>f : () => AsyncIterableIterator + + super.g(); +>super.g() : void +>super.g : () => void +>super : B9 +>g : () => void + } +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.js b/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.js new file mode 100644 index 00000000000..84c8aaf009b --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.js @@ -0,0 +1,120 @@ +//// [tests/cases/conformance/emitter/esnext/asyncGenerators/emitter.asyncGenerators.classMethods.esnext.ts] //// + +//// [C1.ts] +class C1 { + async * f() { + } +} +//// [C2.ts] +class C2 { + async * f() { + const x = yield; + } +} +//// [C3.ts] +class C3 { + async * f() { + const x = yield 1; + } +} +//// [C4.ts] +class C4 { + async * f() { + const x = yield* [1]; + } +} +//// [C5.ts] +class C5 { + async * f() { + const x = yield* (async function*() { yield 1; })(); + } +} +//// [C6.ts] +class C6 { + async * f() { + const x = await 1; + } +} +//// [C7.ts] +class C7 { + async * f() { + return 1; + } +} +//// [C8.ts] +class C8 { + g() { + } + async * f() { + this.g(); + } +} +//// [C9.ts] +class B9 { + g() {} +} +class C9 extends B9 { + async * f() { + super.g(); + } +} + + +//// [C1.js] +class C1 { + async *f() { + } +} +//// [C2.js] +class C2 { + async *f() { + const x = yield; + } +} +//// [C3.js] +class C3 { + async *f() { + const x = yield 1; + } +} +//// [C4.js] +class C4 { + async *f() { + const x = yield* [1]; + } +} +//// [C5.js] +class C5 { + async *f() { + const x = yield* (async function* () { yield 1; })(); + } +} +//// [C6.js] +class C6 { + async *f() { + const x = await 1; + } +} +//// [C7.js] +class C7 { + async *f() { + return 1; + } +} +//// [C8.js] +class C8 { + g() { + } + async *f() { + this.g(); + } +} +//// [C9.js] +class B9 { + g() { } +} +class C9 extends B9 { + async *f() { + super.g(); + } +} diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.symbols b/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.symbols new file mode 100644 index 00000000000..99450781f82 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.symbols @@ -0,0 +1,110 @@ +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C1.ts === +class C1 { +>C1 : Symbol(C1, Decl(C1.ts, 0, 0)) + + async * f() { +>f : Symbol(C1.f, Decl(C1.ts, 0, 10)) + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C2.ts === +class C2 { +>C2 : Symbol(C2, Decl(C2.ts, 0, 0)) + + async * f() { +>f : Symbol(C2.f, Decl(C2.ts, 0, 10)) + + const x = yield; +>x : Symbol(x, Decl(C2.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C3.ts === +class C3 { +>C3 : Symbol(C3, Decl(C3.ts, 0, 0)) + + async * f() { +>f : Symbol(C3.f, Decl(C3.ts, 0, 10)) + + const x = yield 1; +>x : Symbol(x, Decl(C3.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C4.ts === +class C4 { +>C4 : Symbol(C4, Decl(C4.ts, 0, 0)) + + async * f() { +>f : Symbol(C4.f, Decl(C4.ts, 0, 10)) + + const x = yield* [1]; +>x : Symbol(x, Decl(C4.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C5.ts === +class C5 { +>C5 : Symbol(C5, Decl(C5.ts, 0, 0)) + + async * f() { +>f : Symbol(C5.f, Decl(C5.ts, 0, 10)) + + const x = yield* (async function*() { yield 1; })(); +>x : Symbol(x, Decl(C5.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C6.ts === +class C6 { +>C6 : Symbol(C6, Decl(C6.ts, 0, 0)) + + async * f() { +>f : Symbol(C6.f, Decl(C6.ts, 0, 10)) + + const x = await 1; +>x : Symbol(x, Decl(C6.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C7.ts === +class C7 { +>C7 : Symbol(C7, Decl(C7.ts, 0, 0)) + + async * f() { +>f : Symbol(C7.f, Decl(C7.ts, 0, 10)) + + return 1; + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C8.ts === +class C8 { +>C8 : Symbol(C8, Decl(C8.ts, 0, 0)) + + g() { +>g : Symbol(C8.g, Decl(C8.ts, 0, 10)) + } + async * f() { +>f : Symbol(C8.f, Decl(C8.ts, 2, 5)) + + this.g(); +>this.g : Symbol(C8.g, Decl(C8.ts, 0, 10)) +>this : Symbol(C8, Decl(C8.ts, 0, 0)) +>g : Symbol(C8.g, Decl(C8.ts, 0, 10)) + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C9.ts === +class B9 { +>B9 : Symbol(B9, Decl(C9.ts, 0, 0)) + + g() {} +>g : Symbol(B9.g, Decl(C9.ts, 0, 10)) +} +class C9 extends B9 { +>C9 : Symbol(C9, Decl(C9.ts, 2, 1)) +>B9 : Symbol(B9, Decl(C9.ts, 0, 0)) + + async * f() { +>f : Symbol(C9.f, Decl(C9.ts, 3, 21)) + + super.g(); +>super.g : Symbol(B9.g, Decl(C9.ts, 0, 10)) +>super : Symbol(B9, Decl(C9.ts, 0, 0)) +>g : Symbol(B9.g, Decl(C9.ts, 0, 10)) + } +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.types b/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.types new file mode 100644 index 00000000000..b5230006f1b --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.types @@ -0,0 +1,127 @@ +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C1.ts === +class C1 { +>C1 : C1 + + async * f() { +>f : () => AsyncIterableIterator + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C2.ts === +class C2 { +>C2 : C2 + + async * f() { +>f : () => AsyncIterableIterator + + const x = yield; +>x : any +>yield : any + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C3.ts === +class C3 { +>C3 : C3 + + async * f() { +>f : () => AsyncIterableIterator<1> + + const x = yield 1; +>x : any +>yield 1 : any +>1 : 1 + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C4.ts === +class C4 { +>C4 : C4 + + async * f() { +>f : () => AsyncIterableIterator + + const x = yield* [1]; +>x : any +>yield* [1] : any +>[1] : number[] +>1 : 1 + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C5.ts === +class C5 { +>C5 : C5 + + async * f() { +>f : () => AsyncIterableIterator<1> + + const x = yield* (async function*() { yield 1; })(); +>x : any +>yield* (async function*() { yield 1; })() : any +>(async function*() { yield 1; })() : AsyncIterableIterator<1> +>(async function*() { yield 1; }) : () => AsyncIterableIterator<1> +>async function*() { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C6.ts === +class C6 { +>C6 : C6 + + async * f() { +>f : () => AsyncIterableIterator + + const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C7.ts === +class C7 { +>C7 : C7 + + async * f() { +>f : () => AsyncIterableIterator + + return 1; +>1 : 1 + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C8.ts === +class C8 { +>C8 : C8 + + g() { +>g : () => void + } + async * f() { +>f : () => AsyncIterableIterator + + this.g(); +>this.g() : void +>this.g : () => void +>this : this +>g : () => void + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/C9.ts === +class B9 { +>B9 : B9 + + g() {} +>g : () => void +} +class C9 extends B9 { +>C9 : C9 +>B9 : B9 + + async * f() { +>f : () => AsyncIterableIterator + + super.g(); +>super.g() : void +>super.g : () => void +>super : B9 +>g : () => void + } +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.js b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.js new file mode 100644 index 00000000000..2b0d6db5353 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.js @@ -0,0 +1,173 @@ +//// [tests/cases/conformance/emitter/es2015/asyncGenerators/emitter.asyncGenerators.functionDeclarations.es2015.ts] //// + +//// [F1.ts] +async function * f1() { +} +//// [F2.ts] +async function * f2() { + const x = yield; +} +//// [F3.ts] +async function * f3() { + const x = yield 1; +} +//// [F4.ts] +async function * f4() { + const x = yield* [1]; +} +//// [F5.ts] +async function * f5() { + const x = yield* (async function*() { yield 1; })(); +} +//// [F6.ts] +async function * f6() { + const x = await 1; +} +//// [F7.ts] +async function * f7() { + return 1; +} + + +//// [F1.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +function f1() { + return __asyncGenerator(this, arguments, function* f1_1() { + }); +} +//// [F2.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +function f2() { + return __asyncGenerator(this, arguments, function* f2_1() { + const x = yield ["yield"]; + }); +} +//// [F3.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +function f3() { + return __asyncGenerator(this, arguments, function* f3_1() { + const x = yield ["yield", 1]; + }); +} +//// [F4.js] +var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +function f4() { + return __asyncGenerator(this, arguments, function* f4_1() { + const x = yield* __asyncDelegator([1]); + }); +} +//// [F5.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +function f5() { + return __asyncGenerator(this, arguments, function* f5_1() { + const x = yield* __asyncDelegator((function () { return __asyncGenerator(this, arguments, function* () { yield ["yield", 1]; }); })()); + }); +} +//// [F6.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +function f6() { + return __asyncGenerator(this, arguments, function* f6_1() { + const x = yield ["await", 1]; + }); +} +//// [F7.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +function f7() { + return __asyncGenerator(this, arguments, function* f7_1() { + return 1; + }); +} diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.symbols b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.symbols new file mode 100644 index 00000000000..8c2c8b1aead --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.symbols @@ -0,0 +1,46 @@ +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F1.ts === +async function * f1() { +>f1 : Symbol(f1, Decl(F1.ts, 0, 0)) +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F2.ts === +async function * f2() { +>f2 : Symbol(f2, Decl(F2.ts, 0, 0)) + + const x = yield; +>x : Symbol(x, Decl(F2.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F3.ts === +async function * f3() { +>f3 : Symbol(f3, Decl(F3.ts, 0, 0)) + + const x = yield 1; +>x : Symbol(x, Decl(F3.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F4.ts === +async function * f4() { +>f4 : Symbol(f4, Decl(F4.ts, 0, 0)) + + const x = yield* [1]; +>x : Symbol(x, Decl(F4.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F5.ts === +async function * f5() { +>f5 : Symbol(f5, Decl(F5.ts, 0, 0)) + + const x = yield* (async function*() { yield 1; })(); +>x : Symbol(x, Decl(F5.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F6.ts === +async function * f6() { +>f6 : Symbol(f6, Decl(F6.ts, 0, 0)) + + const x = await 1; +>x : Symbol(x, Decl(F6.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F7.ts === +async function * f7() { +>f7 : Symbol(f7, Decl(F7.ts, 0, 0)) + + return 1; +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.types b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.types new file mode 100644 index 00000000000..5d57519d140 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.types @@ -0,0 +1,61 @@ +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F1.ts === +async function * f1() { +>f1 : () => AsyncIterableIterator +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F2.ts === +async function * f2() { +>f2 : () => AsyncIterableIterator + + const x = yield; +>x : any +>yield : any +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F3.ts === +async function * f3() { +>f3 : () => AsyncIterableIterator<1> + + const x = yield 1; +>x : any +>yield 1 : any +>1 : 1 +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F4.ts === +async function * f4() { +>f4 : () => AsyncIterableIterator + + const x = yield* [1]; +>x : any +>yield* [1] : any +>[1] : number[] +>1 : 1 +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F5.ts === +async function * f5() { +>f5 : () => AsyncIterableIterator<1> + + const x = yield* (async function*() { yield 1; })(); +>x : any +>yield* (async function*() { yield 1; })() : any +>(async function*() { yield 1; })() : AsyncIterableIterator<1> +>(async function*() { yield 1; }) : () => AsyncIterableIterator<1> +>async function*() { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F6.ts === +async function * f6() { +>f6 : () => AsyncIterableIterator + + const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F7.ts === +async function * f7() { +>f7 : () => AsyncIterableIterator + + return 1; +>1 : 1 +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.js b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.js new file mode 100644 index 00000000000..42098455ed1 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.js @@ -0,0 +1,434 @@ +//// [tests/cases/conformance/emitter/es5/asyncGenerators/emitter.asyncGenerators.functionDeclarations.es5.ts] //// + +//// [F1.ts] +async function * f1() { +} +//// [F2.ts] +async function * f2() { + const x = yield; +} +//// [F3.ts] +async function * f3() { + const x = yield 1; +} +//// [F4.ts] +async function * f4() { + const x = yield* [1]; +} +//// [F5.ts] +async function * f5() { + const x = yield* (async function*() { yield 1; })(); +} +//// [F6.ts] +async function * f6() { + const x = await 1; +} +//// [F7.ts] +async function * f7() { + return 1; +} + + +//// [F1.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +function f1() { + return __asyncGenerator(this, arguments, function f1_1() { + return __generator(this, function (_a) { + return [2 /*return*/]; + }); + }); +} +//// [F2.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +function f2() { + return __asyncGenerator(this, arguments, function f2_1() { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["yield"]]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); +} +//// [F3.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +function f3() { + return __asyncGenerator(this, arguments, function f3_1() { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["yield", 1]]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); +} +//// [F4.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +function f4() { + return __asyncGenerator(this, arguments, function f4_1() { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(__asyncDelegator([1]))]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); +} +//// [F5.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +function f5() { + return __asyncGenerator(this, arguments, function f5_1() { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(__asyncDelegator((function () { return __asyncGenerator(this, arguments, function () { return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["yield", 1]]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); }); })()))]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); +} +//// [F6.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +function f6() { + return __asyncGenerator(this, arguments, function f6_1() { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["await", 1]]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); +} +//// [F7.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +function f7() { + return __asyncGenerator(this, arguments, function f7_1() { + return __generator(this, function (_a) { + return [2 /*return*/, 1]; + }); + }); +} diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.symbols b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.symbols new file mode 100644 index 00000000000..416d5349811 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.symbols @@ -0,0 +1,46 @@ +=== tests/cases/conformance/emitter/es5/asyncGenerators/F1.ts === +async function * f1() { +>f1 : Symbol(f1, Decl(F1.ts, 0, 0)) +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F2.ts === +async function * f2() { +>f2 : Symbol(f2, Decl(F2.ts, 0, 0)) + + const x = yield; +>x : Symbol(x, Decl(F2.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F3.ts === +async function * f3() { +>f3 : Symbol(f3, Decl(F3.ts, 0, 0)) + + const x = yield 1; +>x : Symbol(x, Decl(F3.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F4.ts === +async function * f4() { +>f4 : Symbol(f4, Decl(F4.ts, 0, 0)) + + const x = yield* [1]; +>x : Symbol(x, Decl(F4.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F5.ts === +async function * f5() { +>f5 : Symbol(f5, Decl(F5.ts, 0, 0)) + + const x = yield* (async function*() { yield 1; })(); +>x : Symbol(x, Decl(F5.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F6.ts === +async function * f6() { +>f6 : Symbol(f6, Decl(F6.ts, 0, 0)) + + const x = await 1; +>x : Symbol(x, Decl(F6.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F7.ts === +async function * f7() { +>f7 : Symbol(f7, Decl(F7.ts, 0, 0)) + + return 1; +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.types b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.types new file mode 100644 index 00000000000..2c3063eca59 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.types @@ -0,0 +1,61 @@ +=== tests/cases/conformance/emitter/es5/asyncGenerators/F1.ts === +async function * f1() { +>f1 : () => AsyncIterableIterator +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F2.ts === +async function * f2() { +>f2 : () => AsyncIterableIterator + + const x = yield; +>x : any +>yield : any +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F3.ts === +async function * f3() { +>f3 : () => AsyncIterableIterator<1> + + const x = yield 1; +>x : any +>yield 1 : any +>1 : 1 +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F4.ts === +async function * f4() { +>f4 : () => AsyncIterableIterator + + const x = yield* [1]; +>x : any +>yield* [1] : any +>[1] : number[] +>1 : 1 +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F5.ts === +async function * f5() { +>f5 : () => AsyncIterableIterator<1> + + const x = yield* (async function*() { yield 1; })(); +>x : any +>yield* (async function*() { yield 1; })() : any +>(async function*() { yield 1; })() : AsyncIterableIterator<1> +>(async function*() { yield 1; }) : () => AsyncIterableIterator<1> +>async function*() { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F6.ts === +async function * f6() { +>f6 : () => AsyncIterableIterator + + const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F7.ts === +async function * f7() { +>f7 : () => AsyncIterableIterator + + return 1; +>1 : 1 +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.js b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.js new file mode 100644 index 00000000000..57708e027a3 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.js @@ -0,0 +1,58 @@ +//// [tests/cases/conformance/emitter/esnext/asyncGenerators/emitter.asyncGenerators.functionDeclarations.esnext.ts] //// + +//// [F1.ts] +async function * f1() { +} +//// [F2.ts] +async function * f2() { + const x = yield; +} +//// [F3.ts] +async function * f3() { + const x = yield 1; +} +//// [F4.ts] +async function * f4() { + const x = yield* [1]; +} +//// [F5.ts] +async function * f5() { + const x = yield* (async function*() { yield 1; })(); +} +//// [F6.ts] +async function * f6() { + const x = await 1; +} +//// [F7.ts] +async function * f7() { + return 1; +} + + +//// [F1.js] +async function* f1() { +} +//// [F2.js] +async function* f2() { + const x = yield; +} +//// [F3.js] +async function* f3() { + const x = yield 1; +} +//// [F4.js] +async function* f4() { + const x = yield* [1]; +} +//// [F5.js] +async function* f5() { + const x = yield* (async function* () { yield 1; })(); +} +//// [F6.js] +async function* f6() { + const x = await 1; +} +//// [F7.js] +async function* f7() { + return 1; +} diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.symbols b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.symbols new file mode 100644 index 00000000000..018b7d7e07a --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.symbols @@ -0,0 +1,46 @@ +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F1.ts === +async function * f1() { +>f1 : Symbol(f1, Decl(F1.ts, 0, 0)) +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F2.ts === +async function * f2() { +>f2 : Symbol(f2, Decl(F2.ts, 0, 0)) + + const x = yield; +>x : Symbol(x, Decl(F2.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F3.ts === +async function * f3() { +>f3 : Symbol(f3, Decl(F3.ts, 0, 0)) + + const x = yield 1; +>x : Symbol(x, Decl(F3.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F4.ts === +async function * f4() { +>f4 : Symbol(f4, Decl(F4.ts, 0, 0)) + + const x = yield* [1]; +>x : Symbol(x, Decl(F4.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F5.ts === +async function * f5() { +>f5 : Symbol(f5, Decl(F5.ts, 0, 0)) + + const x = yield* (async function*() { yield 1; })(); +>x : Symbol(x, Decl(F5.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F6.ts === +async function * f6() { +>f6 : Symbol(f6, Decl(F6.ts, 0, 0)) + + const x = await 1; +>x : Symbol(x, Decl(F6.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F7.ts === +async function * f7() { +>f7 : Symbol(f7, Decl(F7.ts, 0, 0)) + + return 1; +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.types b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.types new file mode 100644 index 00000000000..5eb09901ac8 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.types @@ -0,0 +1,61 @@ +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F1.ts === +async function * f1() { +>f1 : () => AsyncIterableIterator +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F2.ts === +async function * f2() { +>f2 : () => AsyncIterableIterator + + const x = yield; +>x : any +>yield : any +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F3.ts === +async function * f3() { +>f3 : () => AsyncIterableIterator<1> + + const x = yield 1; +>x : any +>yield 1 : any +>1 : 1 +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F4.ts === +async function * f4() { +>f4 : () => AsyncIterableIterator + + const x = yield* [1]; +>x : any +>yield* [1] : any +>[1] : number[] +>1 : 1 +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F5.ts === +async function * f5() { +>f5 : () => AsyncIterableIterator<1> + + const x = yield* (async function*() { yield 1; })(); +>x : any +>yield* (async function*() { yield 1; })() : any +>(async function*() { yield 1; })() : AsyncIterableIterator<1> +>(async function*() { yield 1; }) : () => AsyncIterableIterator<1> +>async function*() { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F6.ts === +async function * f6() { +>f6 : () => AsyncIterableIterator + + const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F7.ts === +async function * f7() { +>f7 : () => AsyncIterableIterator + + return 1; +>1 : 1 +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.js b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.js new file mode 100644 index 00000000000..90f4b70e9bd --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.js @@ -0,0 +1,173 @@ +//// [tests/cases/conformance/emitter/es2015/asyncGenerators/emitter.asyncGenerators.functionExpressions.es2015.ts] //// + +//// [F1.ts] +const f1 = async function * () { +} +//// [F2.ts] +const f2 = async function * () { + const x = yield; +} +//// [F3.ts] +const f3 = async function * () { + const x = yield 1; +} +//// [F4.ts] +const f4 = async function * () { + const x = yield* [1]; +} +//// [F5.ts] +const f5 = async function * () { + const x = yield* (async function*() { yield 1; })(); +} +//// [F6.ts] +const f6 = async function * () { + const x = await 1; +} +//// [F7.ts] +const f7 = async function * () { + return 1; +} + + +//// [F1.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +const f1 = function () { + return __asyncGenerator(this, arguments, function* () { + }); +}; +//// [F2.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +const f2 = function () { + return __asyncGenerator(this, arguments, function* () { + const x = yield ["yield"]; + }); +}; +//// [F3.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +const f3 = function () { + return __asyncGenerator(this, arguments, function* () { + const x = yield ["yield", 1]; + }); +}; +//// [F4.js] +var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +const f4 = function () { + return __asyncGenerator(this, arguments, function* () { + const x = yield* __asyncDelegator([1]); + }); +}; +//// [F5.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +const f5 = function () { + return __asyncGenerator(this, arguments, function* () { + const x = yield* __asyncDelegator((function () { return __asyncGenerator(this, arguments, function* () { yield ["yield", 1]; }); })()); + }); +}; +//// [F6.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +const f6 = function () { + return __asyncGenerator(this, arguments, function* () { + const x = yield ["await", 1]; + }); +}; +//// [F7.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +const f7 = function () { + return __asyncGenerator(this, arguments, function* () { + return 1; + }); +}; diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.symbols b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.symbols new file mode 100644 index 00000000000..ff315c7f82e --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.symbols @@ -0,0 +1,46 @@ +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F1.ts === +const f1 = async function * () { +>f1 : Symbol(f1, Decl(F1.ts, 0, 5)) +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F2.ts === +const f2 = async function * () { +>f2 : Symbol(f2, Decl(F2.ts, 0, 5)) + + const x = yield; +>x : Symbol(x, Decl(F2.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F3.ts === +const f3 = async function * () { +>f3 : Symbol(f3, Decl(F3.ts, 0, 5)) + + const x = yield 1; +>x : Symbol(x, Decl(F3.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F4.ts === +const f4 = async function * () { +>f4 : Symbol(f4, Decl(F4.ts, 0, 5)) + + const x = yield* [1]; +>x : Symbol(x, Decl(F4.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F5.ts === +const f5 = async function * () { +>f5 : Symbol(f5, Decl(F5.ts, 0, 5)) + + const x = yield* (async function*() { yield 1; })(); +>x : Symbol(x, Decl(F5.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F6.ts === +const f6 = async function * () { +>f6 : Symbol(f6, Decl(F6.ts, 0, 5)) + + const x = await 1; +>x : Symbol(x, Decl(F6.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F7.ts === +const f7 = async function * () { +>f7 : Symbol(f7, Decl(F7.ts, 0, 5)) + + return 1; +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.types b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.types new file mode 100644 index 00000000000..ab41ffd9c71 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.types @@ -0,0 +1,68 @@ +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F1.ts === +const f1 = async function * () { +>f1 : () => AsyncIterableIterator +>async function * () {} : () => AsyncIterableIterator +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F2.ts === +const f2 = async function * () { +>f2 : () => AsyncIterableIterator +>async function * () { const x = yield;} : () => AsyncIterableIterator + + const x = yield; +>x : any +>yield : any +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F3.ts === +const f3 = async function * () { +>f3 : () => AsyncIterableIterator<1> +>async function * () { const x = yield 1;} : () => AsyncIterableIterator<1> + + const x = yield 1; +>x : any +>yield 1 : any +>1 : 1 +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F4.ts === +const f4 = async function * () { +>f4 : () => AsyncIterableIterator +>async function * () { const x = yield* [1];} : () => AsyncIterableIterator + + const x = yield* [1]; +>x : any +>yield* [1] : any +>[1] : number[] +>1 : 1 +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F5.ts === +const f5 = async function * () { +>f5 : () => AsyncIterableIterator<1> +>async function * () { const x = yield* (async function*() { yield 1; })();} : () => AsyncIterableIterator<1> + + const x = yield* (async function*() { yield 1; })(); +>x : any +>yield* (async function*() { yield 1; })() : any +>(async function*() { yield 1; })() : AsyncIterableIterator<1> +>(async function*() { yield 1; }) : () => AsyncIterableIterator<1> +>async function*() { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F6.ts === +const f6 = async function * () { +>f6 : () => AsyncIterableIterator +>async function * () { const x = await 1;} : () => AsyncIterableIterator + + const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/F7.ts === +const f7 = async function * () { +>f7 : () => AsyncIterableIterator +>async function * () { return 1;} : () => AsyncIterableIterator + + return 1; +>1 : 1 +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.js b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.js new file mode 100644 index 00000000000..a6265063fde --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.js @@ -0,0 +1,434 @@ +//// [tests/cases/conformance/emitter/es5/asyncGenerators/emitter.asyncGenerators.functionExpressions.es5.ts] //// + +//// [F1.ts] +const f1 = async function * () { +} +//// [F2.ts] +const f2 = async function * () { + const x = yield; +} +//// [F3.ts] +const f3 = async function * () { + const x = yield 1; +} +//// [F4.ts] +const f4 = async function * () { + const x = yield* [1]; +} +//// [F5.ts] +const f5 = async function * () { + const x = yield* (async function*() { yield 1; })(); +} +//// [F6.ts] +const f6 = async function * () { + const x = await 1; +} +//// [F7.ts] +const f7 = async function * () { + return 1; +} + + +//// [F1.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var f1 = function () { + return __asyncGenerator(this, arguments, function () { + return __generator(this, function (_a) { + return [2 /*return*/]; + }); + }); +}; +//// [F2.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var f2 = function () { + return __asyncGenerator(this, arguments, function () { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["yield"]]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); +}; +//// [F3.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var f3 = function () { + return __asyncGenerator(this, arguments, function () { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["yield", 1]]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); +}; +//// [F4.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +var f4 = function () { + return __asyncGenerator(this, arguments, function () { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(__asyncDelegator([1]))]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); +}; +//// [F5.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +var f5 = function () { + return __asyncGenerator(this, arguments, function () { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(__asyncDelegator((function () { return __asyncGenerator(this, arguments, function () { return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["yield", 1]]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); }); })()))]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); +}; +//// [F6.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var f6 = function () { + return __asyncGenerator(this, arguments, function () { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["await", 1]]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); +}; +//// [F7.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var f7 = function () { + return __asyncGenerator(this, arguments, function () { + return __generator(this, function (_a) { + return [2 /*return*/, 1]; + }); + }); +}; diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.symbols b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.symbols new file mode 100644 index 00000000000..88a9631c0bb --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.symbols @@ -0,0 +1,46 @@ +=== tests/cases/conformance/emitter/es5/asyncGenerators/F1.ts === +const f1 = async function * () { +>f1 : Symbol(f1, Decl(F1.ts, 0, 5)) +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F2.ts === +const f2 = async function * () { +>f2 : Symbol(f2, Decl(F2.ts, 0, 5)) + + const x = yield; +>x : Symbol(x, Decl(F2.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F3.ts === +const f3 = async function * () { +>f3 : Symbol(f3, Decl(F3.ts, 0, 5)) + + const x = yield 1; +>x : Symbol(x, Decl(F3.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F4.ts === +const f4 = async function * () { +>f4 : Symbol(f4, Decl(F4.ts, 0, 5)) + + const x = yield* [1]; +>x : Symbol(x, Decl(F4.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F5.ts === +const f5 = async function * () { +>f5 : Symbol(f5, Decl(F5.ts, 0, 5)) + + const x = yield* (async function*() { yield 1; })(); +>x : Symbol(x, Decl(F5.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F6.ts === +const f6 = async function * () { +>f6 : Symbol(f6, Decl(F6.ts, 0, 5)) + + const x = await 1; +>x : Symbol(x, Decl(F6.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F7.ts === +const f7 = async function * () { +>f7 : Symbol(f7, Decl(F7.ts, 0, 5)) + + return 1; +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.types b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.types new file mode 100644 index 00000000000..424f09cf53b --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.types @@ -0,0 +1,68 @@ +=== tests/cases/conformance/emitter/es5/asyncGenerators/F1.ts === +const f1 = async function * () { +>f1 : () => AsyncIterableIterator +>async function * () {} : () => AsyncIterableIterator +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F2.ts === +const f2 = async function * () { +>f2 : () => AsyncIterableIterator +>async function * () { const x = yield;} : () => AsyncIterableIterator + + const x = yield; +>x : any +>yield : any +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F3.ts === +const f3 = async function * () { +>f3 : () => AsyncIterableIterator<1> +>async function * () { const x = yield 1;} : () => AsyncIterableIterator<1> + + const x = yield 1; +>x : any +>yield 1 : any +>1 : 1 +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F4.ts === +const f4 = async function * () { +>f4 : () => AsyncIterableIterator +>async function * () { const x = yield* [1];} : () => AsyncIterableIterator + + const x = yield* [1]; +>x : any +>yield* [1] : any +>[1] : number[] +>1 : 1 +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F5.ts === +const f5 = async function * () { +>f5 : () => AsyncIterableIterator<1> +>async function * () { const x = yield* (async function*() { yield 1; })();} : () => AsyncIterableIterator<1> + + const x = yield* (async function*() { yield 1; })(); +>x : any +>yield* (async function*() { yield 1; })() : any +>(async function*() { yield 1; })() : AsyncIterableIterator<1> +>(async function*() { yield 1; }) : () => AsyncIterableIterator<1> +>async function*() { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F6.ts === +const f6 = async function * () { +>f6 : () => AsyncIterableIterator +>async function * () { const x = await 1;} : () => AsyncIterableIterator + + const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/F7.ts === +const f7 = async function * () { +>f7 : () => AsyncIterableIterator +>async function * () { return 1;} : () => AsyncIterableIterator + + return 1; +>1 : 1 +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.js b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.js new file mode 100644 index 00000000000..349fea53b7a --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.js @@ -0,0 +1,58 @@ +//// [tests/cases/conformance/emitter/esnext/asyncGenerators/emitter.asyncGenerators.functionExpressions.esnext.ts] //// + +//// [F1.ts] +const f1 = async function * () { +} +//// [F2.ts] +const f2 = async function * () { + const x = yield; +} +//// [F3.ts] +const f3 = async function * () { + const x = yield 1; +} +//// [F4.ts] +const f4 = async function * () { + const x = yield* [1]; +} +//// [F5.ts] +const f5 = async function * () { + const x = yield* (async function*() { yield 1; })(); +} +//// [F6.ts] +const f6 = async function * () { + const x = await 1; +} +//// [F7.ts] +const f7 = async function * () { + return 1; +} + + +//// [F1.js] +const f1 = async function* () { +}; +//// [F2.js] +const f2 = async function* () { + const x = yield; +}; +//// [F3.js] +const f3 = async function* () { + const x = yield 1; +}; +//// [F4.js] +const f4 = async function* () { + const x = yield* [1]; +}; +//// [F5.js] +const f5 = async function* () { + const x = yield* (async function* () { yield 1; })(); +}; +//// [F6.js] +const f6 = async function* () { + const x = await 1; +}; +//// [F7.js] +const f7 = async function* () { + return 1; +}; diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.symbols b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.symbols new file mode 100644 index 00000000000..e59d8429fb7 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.symbols @@ -0,0 +1,46 @@ +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F1.ts === +const f1 = async function * () { +>f1 : Symbol(f1, Decl(F1.ts, 0, 5)) +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F2.ts === +const f2 = async function * () { +>f2 : Symbol(f2, Decl(F2.ts, 0, 5)) + + const x = yield; +>x : Symbol(x, Decl(F2.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F3.ts === +const f3 = async function * () { +>f3 : Symbol(f3, Decl(F3.ts, 0, 5)) + + const x = yield 1; +>x : Symbol(x, Decl(F3.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F4.ts === +const f4 = async function * () { +>f4 : Symbol(f4, Decl(F4.ts, 0, 5)) + + const x = yield* [1]; +>x : Symbol(x, Decl(F4.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F5.ts === +const f5 = async function * () { +>f5 : Symbol(f5, Decl(F5.ts, 0, 5)) + + const x = yield* (async function*() { yield 1; })(); +>x : Symbol(x, Decl(F5.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F6.ts === +const f6 = async function * () { +>f6 : Symbol(f6, Decl(F6.ts, 0, 5)) + + const x = await 1; +>x : Symbol(x, Decl(F6.ts, 1, 9)) +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F7.ts === +const f7 = async function * () { +>f7 : Symbol(f7, Decl(F7.ts, 0, 5)) + + return 1; +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.types b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.types new file mode 100644 index 00000000000..e4559e3ecef --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.types @@ -0,0 +1,68 @@ +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F1.ts === +const f1 = async function * () { +>f1 : () => AsyncIterableIterator +>async function * () {} : () => AsyncIterableIterator +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F2.ts === +const f2 = async function * () { +>f2 : () => AsyncIterableIterator +>async function * () { const x = yield;} : () => AsyncIterableIterator + + const x = yield; +>x : any +>yield : any +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F3.ts === +const f3 = async function * () { +>f3 : () => AsyncIterableIterator<1> +>async function * () { const x = yield 1;} : () => AsyncIterableIterator<1> + + const x = yield 1; +>x : any +>yield 1 : any +>1 : 1 +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F4.ts === +const f4 = async function * () { +>f4 : () => AsyncIterableIterator +>async function * () { const x = yield* [1];} : () => AsyncIterableIterator + + const x = yield* [1]; +>x : any +>yield* [1] : any +>[1] : number[] +>1 : 1 +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F5.ts === +const f5 = async function * () { +>f5 : () => AsyncIterableIterator<1> +>async function * () { const x = yield* (async function*() { yield 1; })();} : () => AsyncIterableIterator<1> + + const x = yield* (async function*() { yield 1; })(); +>x : any +>yield* (async function*() { yield 1; })() : any +>(async function*() { yield 1; })() : AsyncIterableIterator<1> +>(async function*() { yield 1; }) : () => AsyncIterableIterator<1> +>async function*() { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F6.ts === +const f6 = async function * () { +>f6 : () => AsyncIterableIterator +>async function * () { const x = await 1;} : () => AsyncIterableIterator + + const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/F7.ts === +const f7 = async function * () { +>f7 : () => AsyncIterableIterator +>async function * () { return 1;} : () => AsyncIterableIterator + + return 1; +>1 : 1 +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.js b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.js new file mode 100644 index 00000000000..817b3904f02 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.js @@ -0,0 +1,201 @@ +//// [tests/cases/conformance/emitter/es2015/asyncGenerators/emitter.asyncGenerators.objectLiteralMethods.es2015.ts] //// + +//// [O1.ts] +const o1 = { + async * f() { + } +} +//// [O2.ts] +const o2 = { + async * f() { + const x = yield; + } +} +//// [O3.ts] +const o3 = { + async * f() { + const x = yield 1; + } +} +//// [O4.ts] +const o4 = { + async * f() { + const x = yield* [1]; + } +} +//// [O5.ts] +const o5 = { + async * f() { + const x = yield* (async function*() { yield 1; })(); + } +} +//// [O6.ts] +const o6 = { + async * f() { + const x = await 1; + } +} +//// [O7.ts] +const o7 = { + async * f() { + return 1; + } +} + + +//// [O1.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +const o1 = { + f() { + return __asyncGenerator(this, arguments, function* f_1() { + }); + } +}; +//// [O2.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +const o2 = { + f() { + return __asyncGenerator(this, arguments, function* f_1() { + const x = yield ["yield"]; + }); + } +}; +//// [O3.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +const o3 = { + f() { + return __asyncGenerator(this, arguments, function* f_1() { + const x = yield ["yield", 1]; + }); + } +}; +//// [O4.js] +var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +const o4 = { + f() { + return __asyncGenerator(this, arguments, function* f_1() { + const x = yield* __asyncDelegator([1]); + }); + } +}; +//// [O5.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +const o5 = { + f() { + return __asyncGenerator(this, arguments, function* f_1() { + const x = yield* __asyncDelegator((function () { return __asyncGenerator(this, arguments, function* () { yield ["yield", 1]; }); })()); + }); + } +}; +//// [O6.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +const o6 = { + f() { + return __asyncGenerator(this, arguments, function* f_1() { + const x = yield ["await", 1]; + }); + } +}; +//// [O7.js] +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +const o7 = { + f() { + return __asyncGenerator(this, arguments, function* f_1() { + return 1; + }); + } +}; diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.symbols b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.symbols new file mode 100644 index 00000000000..7f03bf6eef0 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.symbols @@ -0,0 +1,74 @@ +=== tests/cases/conformance/emitter/es2015/asyncGenerators/O1.ts === +const o1 = { +>o1 : Symbol(o1, Decl(O1.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O1.ts, 0, 12)) + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/O2.ts === +const o2 = { +>o2 : Symbol(o2, Decl(O2.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O2.ts, 0, 12)) + + const x = yield; +>x : Symbol(x, Decl(O2.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/O3.ts === +const o3 = { +>o3 : Symbol(o3, Decl(O3.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O3.ts, 0, 12)) + + const x = yield 1; +>x : Symbol(x, Decl(O3.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/O4.ts === +const o4 = { +>o4 : Symbol(o4, Decl(O4.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O4.ts, 0, 12)) + + const x = yield* [1]; +>x : Symbol(x, Decl(O4.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/O5.ts === +const o5 = { +>o5 : Symbol(o5, Decl(O5.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O5.ts, 0, 12)) + + const x = yield* (async function*() { yield 1; })(); +>x : Symbol(x, Decl(O5.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/O6.ts === +const o6 = { +>o6 : Symbol(o6, Decl(O6.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O6.ts, 0, 12)) + + const x = await 1; +>x : Symbol(x, Decl(O6.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/O7.ts === +const o7 = { +>o7 : Symbol(o7, Decl(O7.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O7.ts, 0, 12)) + + return 1; + } +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.types b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.types new file mode 100644 index 00000000000..0e89d9a1ca6 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.types @@ -0,0 +1,96 @@ +=== tests/cases/conformance/emitter/es2015/asyncGenerators/O1.ts === +const o1 = { +>o1 : { f(): AsyncIterableIterator; } +>{ async * f() { }} : { f(): AsyncIterableIterator; } + + async * f() { +>f : () => AsyncIterableIterator + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/O2.ts === +const o2 = { +>o2 : { f(): AsyncIterableIterator; } +>{ async * f() { const x = yield; }} : { f(): AsyncIterableIterator; } + + async * f() { +>f : () => AsyncIterableIterator + + const x = yield; +>x : any +>yield : any + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/O3.ts === +const o3 = { +>o3 : { f(): AsyncIterableIterator<1>; } +>{ async * f() { const x = yield 1; }} : { f(): AsyncIterableIterator<1>; } + + async * f() { +>f : () => AsyncIterableIterator<1> + + const x = yield 1; +>x : any +>yield 1 : any +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/O4.ts === +const o4 = { +>o4 : { f(): AsyncIterableIterator; } +>{ async * f() { const x = yield* [1]; }} : { f(): AsyncIterableIterator; } + + async * f() { +>f : () => AsyncIterableIterator + + const x = yield* [1]; +>x : any +>yield* [1] : any +>[1] : number[] +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/O5.ts === +const o5 = { +>o5 : { f(): AsyncIterableIterator<1>; } +>{ async * f() { const x = yield* (async function*() { yield 1; })(); }} : { f(): AsyncIterableIterator<1>; } + + async * f() { +>f : () => AsyncIterableIterator<1> + + const x = yield* (async function*() { yield 1; })(); +>x : any +>yield* (async function*() { yield 1; })() : any +>(async function*() { yield 1; })() : AsyncIterableIterator<1> +>(async function*() { yield 1; }) : () => AsyncIterableIterator<1> +>async function*() { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/O6.ts === +const o6 = { +>o6 : { f(): AsyncIterableIterator; } +>{ async * f() { const x = await 1; }} : { f(): AsyncIterableIterator; } + + async * f() { +>f : () => AsyncIterableIterator + + const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es2015/asyncGenerators/O7.ts === +const o7 = { +>o7 : { f(): AsyncIterableIterator; } +>{ async * f() { return 1; }} : { f(): AsyncIterableIterator; } + + async * f() { +>f : () => AsyncIterableIterator + + return 1; +>1 : 1 + } +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.js b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.js new file mode 100644 index 00000000000..a0839d8258d --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.js @@ -0,0 +1,462 @@ +//// [tests/cases/conformance/emitter/es5/asyncGenerators/emitter.asyncGenerators.objectLiteralMethods.es5.ts] //// + +//// [O1.ts] +const o1 = { + async * f() { + } +} +//// [O2.ts] +const o2 = { + async * f() { + const x = yield; + } +} +//// [O3.ts] +const o3 = { + async * f() { + const x = yield 1; + } +} +//// [O4.ts] +const o4 = { + async * f() { + const x = yield* [1]; + } +} +//// [O5.ts] +const o5 = { + async * f() { + const x = yield* (async function*() { yield 1; })(); + } +} +//// [O6.ts] +const o6 = { + async * f() { + const x = await 1; + } +} +//// [O7.ts] +const o7 = { + async * f() { + return 1; + } +} + + +//// [O1.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var o1 = { + f: function () { + return __asyncGenerator(this, arguments, function f_1() { + return __generator(this, function (_a) { + return [2 /*return*/]; + }); + }); + } +}; +//// [O2.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var o2 = { + f: function () { + return __asyncGenerator(this, arguments, function f_1() { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["yield"]]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); + } +}; +//// [O3.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var o3 = { + f: function () { + return __asyncGenerator(this, arguments, function f_1() { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["yield", 1]]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); + } +}; +//// [O4.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +var o4 = { + f: function () { + return __asyncGenerator(this, arguments, function f_1() { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(__asyncDelegator([1]))]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); + } +}; +//// [O5.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { + var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) }; + return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } +}; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +var o5 = { + f: function () { + return __asyncGenerator(this, arguments, function f_1() { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(__asyncDelegator((function () { return __asyncGenerator(this, arguments, function () { return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["yield", 1]]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); }); })()))]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); + } +}; +//// [O6.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var o6 = { + f: function () { + return __asyncGenerator(this, arguments, function f_1() { + var x; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, ["await", 1]]; + case 1: + x = _a.sent(); + return [2 /*return*/]; + } + }); + }); + } +}; +//// [O7.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +var o7 = { + f: function () { + return __asyncGenerator(this, arguments, function f_1() { + return __generator(this, function (_a) { + return [2 /*return*/, 1]; + }); + }); + } +}; diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.symbols b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.symbols new file mode 100644 index 00000000000..fbf78969742 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.symbols @@ -0,0 +1,74 @@ +=== tests/cases/conformance/emitter/es5/asyncGenerators/O1.ts === +const o1 = { +>o1 : Symbol(o1, Decl(O1.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O1.ts, 0, 12)) + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/O2.ts === +const o2 = { +>o2 : Symbol(o2, Decl(O2.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O2.ts, 0, 12)) + + const x = yield; +>x : Symbol(x, Decl(O2.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/O3.ts === +const o3 = { +>o3 : Symbol(o3, Decl(O3.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O3.ts, 0, 12)) + + const x = yield 1; +>x : Symbol(x, Decl(O3.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/O4.ts === +const o4 = { +>o4 : Symbol(o4, Decl(O4.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O4.ts, 0, 12)) + + const x = yield* [1]; +>x : Symbol(x, Decl(O4.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/O5.ts === +const o5 = { +>o5 : Symbol(o5, Decl(O5.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O5.ts, 0, 12)) + + const x = yield* (async function*() { yield 1; })(); +>x : Symbol(x, Decl(O5.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/O6.ts === +const o6 = { +>o6 : Symbol(o6, Decl(O6.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O6.ts, 0, 12)) + + const x = await 1; +>x : Symbol(x, Decl(O6.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/O7.ts === +const o7 = { +>o7 : Symbol(o7, Decl(O7.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O7.ts, 0, 12)) + + return 1; + } +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.types b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.types new file mode 100644 index 00000000000..4c8ae47b6a2 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.types @@ -0,0 +1,96 @@ +=== tests/cases/conformance/emitter/es5/asyncGenerators/O1.ts === +const o1 = { +>o1 : { f(): AsyncIterableIterator; } +>{ async * f() { }} : { f(): AsyncIterableIterator; } + + async * f() { +>f : () => AsyncIterableIterator + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/O2.ts === +const o2 = { +>o2 : { f(): AsyncIterableIterator; } +>{ async * f() { const x = yield; }} : { f(): AsyncIterableIterator; } + + async * f() { +>f : () => AsyncIterableIterator + + const x = yield; +>x : any +>yield : any + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/O3.ts === +const o3 = { +>o3 : { f(): AsyncIterableIterator<1>; } +>{ async * f() { const x = yield 1; }} : { f(): AsyncIterableIterator<1>; } + + async * f() { +>f : () => AsyncIterableIterator<1> + + const x = yield 1; +>x : any +>yield 1 : any +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/O4.ts === +const o4 = { +>o4 : { f(): AsyncIterableIterator; } +>{ async * f() { const x = yield* [1]; }} : { f(): AsyncIterableIterator; } + + async * f() { +>f : () => AsyncIterableIterator + + const x = yield* [1]; +>x : any +>yield* [1] : any +>[1] : number[] +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/O5.ts === +const o5 = { +>o5 : { f(): AsyncIterableIterator<1>; } +>{ async * f() { const x = yield* (async function*() { yield 1; })(); }} : { f(): AsyncIterableIterator<1>; } + + async * f() { +>f : () => AsyncIterableIterator<1> + + const x = yield* (async function*() { yield 1; })(); +>x : any +>yield* (async function*() { yield 1; })() : any +>(async function*() { yield 1; })() : AsyncIterableIterator<1> +>(async function*() { yield 1; }) : () => AsyncIterableIterator<1> +>async function*() { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/O6.ts === +const o6 = { +>o6 : { f(): AsyncIterableIterator; } +>{ async * f() { const x = await 1; }} : { f(): AsyncIterableIterator; } + + async * f() { +>f : () => AsyncIterableIterator + + const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 + } +} +=== tests/cases/conformance/emitter/es5/asyncGenerators/O7.ts === +const o7 = { +>o7 : { f(): AsyncIterableIterator; } +>{ async * f() { return 1; }} : { f(): AsyncIterableIterator; } + + async * f() { +>f : () => AsyncIterableIterator + + return 1; +>1 : 1 + } +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.js b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.js new file mode 100644 index 00000000000..a1877b38184 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.js @@ -0,0 +1,86 @@ +//// [tests/cases/conformance/emitter/esnext/asyncGenerators/emitter.asyncGenerators.objectLiteralMethods.esnext.ts] //// + +//// [O1.ts] +const o1 = { + async * f() { + } +} +//// [O2.ts] +const o2 = { + async * f() { + const x = yield; + } +} +//// [O3.ts] +const o3 = { + async * f() { + const x = yield 1; + } +} +//// [O4.ts] +const o4 = { + async * f() { + const x = yield* [1]; + } +} +//// [O5.ts] +const o5 = { + async * f() { + const x = yield* (async function*() { yield 1; })(); + } +} +//// [O6.ts] +const o6 = { + async * f() { + const x = await 1; + } +} +//// [O7.ts] +const o7 = { + async * f() { + return 1; + } +} + + +//// [O1.js] +const o1 = { + async *f() { + } +}; +//// [O2.js] +const o2 = { + async *f() { + const x = yield; + } +}; +//// [O3.js] +const o3 = { + async *f() { + const x = yield 1; + } +}; +//// [O4.js] +const o4 = { + async *f() { + const x = yield* [1]; + } +}; +//// [O5.js] +const o5 = { + async *f() { + const x = yield* (async function* () { yield 1; })(); + } +}; +//// [O6.js] +const o6 = { + async *f() { + const x = await 1; + } +}; +//// [O7.js] +const o7 = { + async *f() { + return 1; + } +}; diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.symbols b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.symbols new file mode 100644 index 00000000000..c1c7847c592 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.symbols @@ -0,0 +1,74 @@ +=== tests/cases/conformance/emitter/esnext/asyncGenerators/O1.ts === +const o1 = { +>o1 : Symbol(o1, Decl(O1.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O1.ts, 0, 12)) + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/O2.ts === +const o2 = { +>o2 : Symbol(o2, Decl(O2.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O2.ts, 0, 12)) + + const x = yield; +>x : Symbol(x, Decl(O2.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/O3.ts === +const o3 = { +>o3 : Symbol(o3, Decl(O3.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O3.ts, 0, 12)) + + const x = yield 1; +>x : Symbol(x, Decl(O3.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/O4.ts === +const o4 = { +>o4 : Symbol(o4, Decl(O4.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O4.ts, 0, 12)) + + const x = yield* [1]; +>x : Symbol(x, Decl(O4.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/O5.ts === +const o5 = { +>o5 : Symbol(o5, Decl(O5.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O5.ts, 0, 12)) + + const x = yield* (async function*() { yield 1; })(); +>x : Symbol(x, Decl(O5.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/O6.ts === +const o6 = { +>o6 : Symbol(o6, Decl(O6.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O6.ts, 0, 12)) + + const x = await 1; +>x : Symbol(x, Decl(O6.ts, 2, 13)) + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/O7.ts === +const o7 = { +>o7 : Symbol(o7, Decl(O7.ts, 0, 5)) + + async * f() { +>f : Symbol(f, Decl(O7.ts, 0, 12)) + + return 1; + } +} + diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.types b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.types new file mode 100644 index 00000000000..511cd7ec9e0 --- /dev/null +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.types @@ -0,0 +1,96 @@ +=== tests/cases/conformance/emitter/esnext/asyncGenerators/O1.ts === +const o1 = { +>o1 : { f(): AsyncIterableIterator; } +>{ async * f() { }} : { f(): AsyncIterableIterator; } + + async * f() { +>f : () => AsyncIterableIterator + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/O2.ts === +const o2 = { +>o2 : { f(): AsyncIterableIterator; } +>{ async * f() { const x = yield; }} : { f(): AsyncIterableIterator; } + + async * f() { +>f : () => AsyncIterableIterator + + const x = yield; +>x : any +>yield : any + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/O3.ts === +const o3 = { +>o3 : { f(): AsyncIterableIterator<1>; } +>{ async * f() { const x = yield 1; }} : { f(): AsyncIterableIterator<1>; } + + async * f() { +>f : () => AsyncIterableIterator<1> + + const x = yield 1; +>x : any +>yield 1 : any +>1 : 1 + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/O4.ts === +const o4 = { +>o4 : { f(): AsyncIterableIterator; } +>{ async * f() { const x = yield* [1]; }} : { f(): AsyncIterableIterator; } + + async * f() { +>f : () => AsyncIterableIterator + + const x = yield* [1]; +>x : any +>yield* [1] : any +>[1] : number[] +>1 : 1 + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/O5.ts === +const o5 = { +>o5 : { f(): AsyncIterableIterator<1>; } +>{ async * f() { const x = yield* (async function*() { yield 1; })(); }} : { f(): AsyncIterableIterator<1>; } + + async * f() { +>f : () => AsyncIterableIterator<1> + + const x = yield* (async function*() { yield 1; })(); +>x : any +>yield* (async function*() { yield 1; })() : any +>(async function*() { yield 1; })() : AsyncIterableIterator<1> +>(async function*() { yield 1; }) : () => AsyncIterableIterator<1> +>async function*() { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/O6.ts === +const o6 = { +>o6 : { f(): AsyncIterableIterator; } +>{ async * f() { const x = await 1; }} : { f(): AsyncIterableIterator; } + + async * f() { +>f : () => AsyncIterableIterator + + const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 + } +} +=== tests/cases/conformance/emitter/esnext/asyncGenerators/O7.ts === +const o7 = { +>o7 : { f(): AsyncIterableIterator; } +>{ async * f() { return 1; }} : { f(): AsyncIterableIterator; } + + async * f() { +>f : () => AsyncIterableIterator + + return 1; +>1 : 1 + } +} + diff --git a/tests/baselines/reference/emitter.forAwait.es2015.js b/tests/baselines/reference/emitter.forAwait.es2015.js new file mode 100644 index 00000000000..a76c3e0b545 --- /dev/null +++ b/tests/baselines/reference/emitter.forAwait.es2015.js @@ -0,0 +1,165 @@ +//// [tests/cases/conformance/emitter/es2015/forAwait/emitter.forAwait.es2015.ts] //// + +//// [file1.ts] +async function f1() { + let y: any; + for await (const x of y) { + } +} +//// [file2.ts] +async function f2() { + let x: any, y: any; + for await (x of y) { + } +} +//// [file3.ts] +async function* f3() { + let y: any; + for await (const x of y) { + } +} +//// [file4.ts] +async function* f4() { + let x: any, y: any; + for await (x of y) { + } +} + +//// [file1.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + 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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __asyncValues = (this && this.__asyncIterator) || function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator]; + return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; +function f1() { + return __awaiter(this, void 0, void 0, function* () { + let y; + try { + for (var y_1 = __asyncValues(y), y_1_1 = yield y_1.next(); !y_1_1.done; y_1_1 = yield y_1.next()) { + const x = y_1_1.value; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (y_1_1 && !y_1_1.done && (_a = y_1.return)) yield _a.call(y_1); + } + finally { if (e_1) throw e_1.error; } + } + var e_1, _a; + }); +} +//// [file2.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + 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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __asyncValues = (this && this.__asyncIterator) || function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator]; + return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; +function f2() { + return __awaiter(this, void 0, void 0, function* () { + let x, y; + try { + for (var y_1 = __asyncValues(y), y_1_1 = yield y_1.next(); !y_1_1.done; y_1_1 = yield y_1.next()) { + x = y_1_1.value; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (y_1_1 && !y_1_1.done && (_a = y_1.return)) yield _a.call(y_1); + } + finally { if (e_1) throw e_1.error; } + } + var e_1, _a; + }); +} +//// [file3.js] +var __asyncValues = (this && this.__asyncIterator) || function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator]; + return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +function f3() { + return __asyncGenerator(this, arguments, function* f3_1() { + let y; + try { + for (var y_1 = __asyncValues(y), y_1_1 = yield ["await", y_1.next()]; !y_1_1.done; y_1_1 = yield ["await", y_1.next()]) { + const x = y_1_1.value; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (y_1_1 && !y_1_1.done && (_a = y_1.return)) yield ["await", _a.call(y_1)]; + } + finally { if (e_1) throw e_1.error; } + } + var e_1, _a; + }); +} +//// [file4.js] +var __asyncValues = (this && this.__asyncIterator) || function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator]; + return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +function f4() { + return __asyncGenerator(this, arguments, function* f4_1() { + let x, y; + try { + for (var y_1 = __asyncValues(y), y_1_1 = yield ["await", y_1.next()]; !y_1_1.done; y_1_1 = yield ["await", y_1.next()]) { + x = y_1_1.value; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (y_1_1 && !y_1_1.done && (_a = y_1.return)) yield ["await", _a.call(y_1)]; + } + finally { if (e_1) throw e_1.error; } + } + var e_1, _a; + }); +} diff --git a/tests/baselines/reference/emitter.forAwait.es2015.symbols b/tests/baselines/reference/emitter.forAwait.es2015.symbols new file mode 100644 index 00000000000..6c4ed3b10e9 --- /dev/null +++ b/tests/baselines/reference/emitter.forAwait.es2015.symbols @@ -0,0 +1,50 @@ +=== tests/cases/conformance/emitter/es2015/forAwait/file1.ts === +async function f1() { +>f1 : Symbol(f1, Decl(file1.ts, 0, 0)) + + let y: any; +>y : Symbol(y, Decl(file1.ts, 1, 7)) + + for await (const x of y) { +>x : Symbol(x, Decl(file1.ts, 2, 20)) +>y : Symbol(y, Decl(file1.ts, 1, 7)) + } +} +=== tests/cases/conformance/emitter/es2015/forAwait/file2.ts === +async function f2() { +>f2 : Symbol(f2, Decl(file2.ts, 0, 0)) + + let x: any, y: any; +>x : Symbol(x, Decl(file2.ts, 1, 7)) +>y : Symbol(y, Decl(file2.ts, 1, 15)) + + for await (x of y) { +>x : Symbol(x, Decl(file2.ts, 1, 7)) +>y : Symbol(y, Decl(file2.ts, 1, 15)) + } +} +=== tests/cases/conformance/emitter/es2015/forAwait/file3.ts === +async function* f3() { +>f3 : Symbol(f3, Decl(file3.ts, 0, 0)) + + let y: any; +>y : Symbol(y, Decl(file3.ts, 1, 7)) + + for await (const x of y) { +>x : Symbol(x, Decl(file3.ts, 2, 20)) +>y : Symbol(y, Decl(file3.ts, 1, 7)) + } +} +=== tests/cases/conformance/emitter/es2015/forAwait/file4.ts === +async function* f4() { +>f4 : Symbol(f4, Decl(file4.ts, 0, 0)) + + let x: any, y: any; +>x : Symbol(x, Decl(file4.ts, 1, 7)) +>y : Symbol(y, Decl(file4.ts, 1, 15)) + + for await (x of y) { +>x : Symbol(x, Decl(file4.ts, 1, 7)) +>y : Symbol(y, Decl(file4.ts, 1, 15)) + } +} diff --git a/tests/baselines/reference/emitter.forAwait.es2015.types b/tests/baselines/reference/emitter.forAwait.es2015.types new file mode 100644 index 00000000000..ac7321e43b4 --- /dev/null +++ b/tests/baselines/reference/emitter.forAwait.es2015.types @@ -0,0 +1,50 @@ +=== tests/cases/conformance/emitter/es2015/forAwait/file1.ts === +async function f1() { +>f1 : () => Promise + + let y: any; +>y : any + + for await (const x of y) { +>x : any +>y : any + } +} +=== tests/cases/conformance/emitter/es2015/forAwait/file2.ts === +async function f2() { +>f2 : () => Promise + + let x: any, y: any; +>x : any +>y : any + + for await (x of y) { +>x : any +>y : any + } +} +=== tests/cases/conformance/emitter/es2015/forAwait/file3.ts === +async function* f3() { +>f3 : () => AsyncIterableIterator + + let y: any; +>y : any + + for await (const x of y) { +>x : any +>y : any + } +} +=== tests/cases/conformance/emitter/es2015/forAwait/file4.ts === +async function* f4() { +>f4 : () => AsyncIterableIterator + + let x: any, y: any; +>x : any +>y : any + + for await (x of y) { +>x : any +>y : any + } +} diff --git a/tests/baselines/reference/emitter.forAwait.es5.js b/tests/baselines/reference/emitter.forAwait.es5.js new file mode 100644 index 00000000000..14b70e933bb --- /dev/null +++ b/tests/baselines/reference/emitter.forAwait.es5.js @@ -0,0 +1,369 @@ +//// [tests/cases/conformance/emitter/es5/forAwait/emitter.forAwait.es5.ts] //// + +//// [file1.ts] +async function f1() { + let y: any; + for await (const x of y) { + } +} +//// [file2.ts] +async function f2() { + let x: any, y: any; + for await (x of y) { + } +} +//// [file3.ts] +async function* f3() { + let y: any; + for await (const x of y) { + } +} +//// [file4.ts] +async function* f4() { + let x: any, y: any; + for await (x of y) { + } +} + +//// [file1.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + 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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + 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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __asyncValues = (this && this.__asyncIterator) || function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator]; + return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; +function f1() { + return __awaiter(this, void 0, void 0, function () { + var y, y_1, y_1_1, x, e_1_1, e_1, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + _b.trys.push([0, 6, 7, 12]); + y_1 = __asyncValues(y); + return [4 /*yield*/, y_1.next()]; + case 1: + y_1_1 = _b.sent(); + _b.label = 2; + case 2: + if (!!y_1_1.done) return [3 /*break*/, 5]; + x = y_1_1.value; + _b.label = 3; + case 3: return [4 /*yield*/, y_1.next()]; + case 4: + y_1_1 = _b.sent(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 12]; + case 6: + e_1_1 = _b.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 12]; + case 7: + _b.trys.push([7, , 10, 11]); + if (!(y_1_1 && !y_1_1.done && (_a = y_1.return))) return [3 /*break*/, 9]; + return [4 /*yield*/, _a.call(y_1)]; + case 8: + _b.sent(); + _b.label = 9; + case 9: return [3 /*break*/, 11]; + case 10: + if (e_1) throw e_1.error; + return [7 /*endfinally*/]; + case 11: return [7 /*endfinally*/]; + case 12: return [2 /*return*/]; + } + }); + }); +} +//// [file2.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + 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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + 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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __asyncValues = (this && this.__asyncIterator) || function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator]; + return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; +function f2() { + return __awaiter(this, void 0, void 0, function () { + var x, y, y_1, y_1_1, e_1_1, e_1, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + _b.trys.push([0, 6, 7, 12]); + y_1 = __asyncValues(y); + return [4 /*yield*/, y_1.next()]; + case 1: + y_1_1 = _b.sent(); + _b.label = 2; + case 2: + if (!!y_1_1.done) return [3 /*break*/, 5]; + x = y_1_1.value; + _b.label = 3; + case 3: return [4 /*yield*/, y_1.next()]; + case 4: + y_1_1 = _b.sent(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 12]; + case 6: + e_1_1 = _b.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 12]; + case 7: + _b.trys.push([7, , 10, 11]); + if (!(y_1_1 && !y_1_1.done && (_a = y_1.return))) return [3 /*break*/, 9]; + return [4 /*yield*/, _a.call(y_1)]; + case 8: + _b.sent(); + _b.label = 9; + case 9: return [3 /*break*/, 11]; + case 10: + if (e_1) throw e_1.error; + return [7 /*endfinally*/]; + case 11: return [7 /*endfinally*/]; + case 12: return [2 /*return*/]; + } + }); + }); +} +//// [file3.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __asyncValues = (this && this.__asyncIterator) || function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator]; + return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +function f3() { + return __asyncGenerator(this, arguments, function f3_1() { + var y, y_1, y_1_1, x, e_1_1, e_1, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + _b.trys.push([0, 6, 7, 12]); + y_1 = __asyncValues(y); + return [4 /*yield*/, ["await", y_1.next()]]; + case 1: + y_1_1 = _b.sent(); + _b.label = 2; + case 2: + if (!!y_1_1.done) return [3 /*break*/, 5]; + x = y_1_1.value; + _b.label = 3; + case 3: return [4 /*yield*/, ["await", y_1.next()]]; + case 4: + y_1_1 = _b.sent(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 12]; + case 6: + e_1_1 = _b.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 12]; + case 7: + _b.trys.push([7, , 10, 11]); + if (!(y_1_1 && !y_1_1.done && (_a = y_1.return))) return [3 /*break*/, 9]; + return [4 /*yield*/, ["await", _a.call(y_1)]]; + case 8: + _b.sent(); + _b.label = 9; + case 9: return [3 /*break*/, 11]; + case 10: + if (e_1) throw e_1.error; + return [7 /*endfinally*/]; + case 11: return [7 /*endfinally*/]; + case 12: return [2 /*return*/]; + } + }); + }); +} +//// [file4.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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 __asyncValues = (this && this.__asyncIterator) || function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator]; + return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; +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 || []), q = [], c, i; + return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; } + function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } } + function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); } + function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { c = void 0, f(v), next(); } +}; +function f4() { + return __asyncGenerator(this, arguments, function f4_1() { + var x, y, y_1, y_1_1, e_1_1, e_1, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + _b.trys.push([0, 6, 7, 12]); + y_1 = __asyncValues(y); + return [4 /*yield*/, ["await", y_1.next()]]; + case 1: + y_1_1 = _b.sent(); + _b.label = 2; + case 2: + if (!!y_1_1.done) return [3 /*break*/, 5]; + x = y_1_1.value; + _b.label = 3; + case 3: return [4 /*yield*/, ["await", y_1.next()]]; + case 4: + y_1_1 = _b.sent(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 12]; + case 6: + e_1_1 = _b.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 12]; + case 7: + _b.trys.push([7, , 10, 11]); + if (!(y_1_1 && !y_1_1.done && (_a = y_1.return))) return [3 /*break*/, 9]; + return [4 /*yield*/, ["await", _a.call(y_1)]]; + case 8: + _b.sent(); + _b.label = 9; + case 9: return [3 /*break*/, 11]; + case 10: + if (e_1) throw e_1.error; + return [7 /*endfinally*/]; + case 11: return [7 /*endfinally*/]; + case 12: return [2 /*return*/]; + } + }); + }); +} diff --git a/tests/baselines/reference/emitter.forAwait.es5.symbols b/tests/baselines/reference/emitter.forAwait.es5.symbols new file mode 100644 index 00000000000..40c5562453c --- /dev/null +++ b/tests/baselines/reference/emitter.forAwait.es5.symbols @@ -0,0 +1,50 @@ +=== tests/cases/conformance/emitter/es5/forAwait/file1.ts === +async function f1() { +>f1 : Symbol(f1, Decl(file1.ts, 0, 0)) + + let y: any; +>y : Symbol(y, Decl(file1.ts, 1, 7)) + + for await (const x of y) { +>x : Symbol(x, Decl(file1.ts, 2, 20)) +>y : Symbol(y, Decl(file1.ts, 1, 7)) + } +} +=== tests/cases/conformance/emitter/es5/forAwait/file2.ts === +async function f2() { +>f2 : Symbol(f2, Decl(file2.ts, 0, 0)) + + let x: any, y: any; +>x : Symbol(x, Decl(file2.ts, 1, 7)) +>y : Symbol(y, Decl(file2.ts, 1, 15)) + + for await (x of y) { +>x : Symbol(x, Decl(file2.ts, 1, 7)) +>y : Symbol(y, Decl(file2.ts, 1, 15)) + } +} +=== tests/cases/conformance/emitter/es5/forAwait/file3.ts === +async function* f3() { +>f3 : Symbol(f3, Decl(file3.ts, 0, 0)) + + let y: any; +>y : Symbol(y, Decl(file3.ts, 1, 7)) + + for await (const x of y) { +>x : Symbol(x, Decl(file3.ts, 2, 20)) +>y : Symbol(y, Decl(file3.ts, 1, 7)) + } +} +=== tests/cases/conformance/emitter/es5/forAwait/file4.ts === +async function* f4() { +>f4 : Symbol(f4, Decl(file4.ts, 0, 0)) + + let x: any, y: any; +>x : Symbol(x, Decl(file4.ts, 1, 7)) +>y : Symbol(y, Decl(file4.ts, 1, 15)) + + for await (x of y) { +>x : Symbol(x, Decl(file4.ts, 1, 7)) +>y : Symbol(y, Decl(file4.ts, 1, 15)) + } +} diff --git a/tests/baselines/reference/emitter.forAwait.es5.types b/tests/baselines/reference/emitter.forAwait.es5.types new file mode 100644 index 00000000000..8c8f6dec723 --- /dev/null +++ b/tests/baselines/reference/emitter.forAwait.es5.types @@ -0,0 +1,50 @@ +=== tests/cases/conformance/emitter/es5/forAwait/file1.ts === +async function f1() { +>f1 : () => Promise + + let y: any; +>y : any + + for await (const x of y) { +>x : any +>y : any + } +} +=== tests/cases/conformance/emitter/es5/forAwait/file2.ts === +async function f2() { +>f2 : () => Promise + + let x: any, y: any; +>x : any +>y : any + + for await (x of y) { +>x : any +>y : any + } +} +=== tests/cases/conformance/emitter/es5/forAwait/file3.ts === +async function* f3() { +>f3 : () => AsyncIterableIterator + + let y: any; +>y : any + + for await (const x of y) { +>x : any +>y : any + } +} +=== tests/cases/conformance/emitter/es5/forAwait/file4.ts === +async function* f4() { +>f4 : () => AsyncIterableIterator + + let x: any, y: any; +>x : any +>y : any + + for await (x of y) { +>x : any +>y : any + } +} diff --git a/tests/baselines/reference/emitter.forAwait.esnext.js b/tests/baselines/reference/emitter.forAwait.esnext.js new file mode 100644 index 00000000000..7a6c6837c9a --- /dev/null +++ b/tests/baselines/reference/emitter.forAwait.esnext.js @@ -0,0 +1,51 @@ +//// [tests/cases/conformance/emitter/esnext/forAwait/emitter.forAwait.esnext.ts] //// + +//// [file1.ts] +async function f1() { + let y: any; + for await (const x of y) { + } +} +//// [file2.ts] +async function f2() { + let x: any, y: any; + for await (x of y) { + } +} +//// [file3.ts] +async function* f3() { + let y: any; + for await (const x of y) { + } +} +//// [file4.ts] +async function* f4() { + let x: any, y: any; + for await (x of y) { + } +} + +//// [file1.js] +async function f1() { + let y; + for await (const x of y) { + } +} +//// [file2.js] +async function f2() { + let x, y; + for await (x of y) { + } +} +//// [file3.js] +async function* f3() { + let y; + for await (const x of y) { + } +} +//// [file4.js] +async function* f4() { + let x, y; + for await (x of y) { + } +} diff --git a/tests/baselines/reference/emitter.forAwait.esnext.symbols b/tests/baselines/reference/emitter.forAwait.esnext.symbols new file mode 100644 index 00000000000..137ebed0802 --- /dev/null +++ b/tests/baselines/reference/emitter.forAwait.esnext.symbols @@ -0,0 +1,50 @@ +=== tests/cases/conformance/emitter/esnext/forAwait/file1.ts === +async function f1() { +>f1 : Symbol(f1, Decl(file1.ts, 0, 0)) + + let y: any; +>y : Symbol(y, Decl(file1.ts, 1, 7)) + + for await (const x of y) { +>x : Symbol(x, Decl(file1.ts, 2, 20)) +>y : Symbol(y, Decl(file1.ts, 1, 7)) + } +} +=== tests/cases/conformance/emitter/esnext/forAwait/file2.ts === +async function f2() { +>f2 : Symbol(f2, Decl(file2.ts, 0, 0)) + + let x: any, y: any; +>x : Symbol(x, Decl(file2.ts, 1, 7)) +>y : Symbol(y, Decl(file2.ts, 1, 15)) + + for await (x of y) { +>x : Symbol(x, Decl(file2.ts, 1, 7)) +>y : Symbol(y, Decl(file2.ts, 1, 15)) + } +} +=== tests/cases/conformance/emitter/esnext/forAwait/file3.ts === +async function* f3() { +>f3 : Symbol(f3, Decl(file3.ts, 0, 0)) + + let y: any; +>y : Symbol(y, Decl(file3.ts, 1, 7)) + + for await (const x of y) { +>x : Symbol(x, Decl(file3.ts, 2, 20)) +>y : Symbol(y, Decl(file3.ts, 1, 7)) + } +} +=== tests/cases/conformance/emitter/esnext/forAwait/file4.ts === +async function* f4() { +>f4 : Symbol(f4, Decl(file4.ts, 0, 0)) + + let x: any, y: any; +>x : Symbol(x, Decl(file4.ts, 1, 7)) +>y : Symbol(y, Decl(file4.ts, 1, 15)) + + for await (x of y) { +>x : Symbol(x, Decl(file4.ts, 1, 7)) +>y : Symbol(y, Decl(file4.ts, 1, 15)) + } +} diff --git a/tests/baselines/reference/emitter.forAwait.esnext.types b/tests/baselines/reference/emitter.forAwait.esnext.types new file mode 100644 index 00000000000..ae52bd1080d --- /dev/null +++ b/tests/baselines/reference/emitter.forAwait.esnext.types @@ -0,0 +1,50 @@ +=== tests/cases/conformance/emitter/esnext/forAwait/file1.ts === +async function f1() { +>f1 : () => Promise + + let y: any; +>y : any + + for await (const x of y) { +>x : any +>y : any + } +} +=== tests/cases/conformance/emitter/esnext/forAwait/file2.ts === +async function f2() { +>f2 : () => Promise + + let x: any, y: any; +>x : any +>y : any + + for await (x of y) { +>x : any +>y : any + } +} +=== tests/cases/conformance/emitter/esnext/forAwait/file3.ts === +async function* f3() { +>f3 : () => AsyncIterableIterator + + let y: any; +>y : any + + for await (const x of y) { +>x : any +>y : any + } +} +=== tests/cases/conformance/emitter/esnext/forAwait/file4.ts === +async function* f4() { +>f4 : () => AsyncIterableIterator + + let x: any, y: any; +>x : any +>y : any + + for await (x of y) { +>x : any +>y : any + } +} diff --git a/tests/baselines/reference/emptyAssignmentPatterns01_ES5iterable.js b/tests/baselines/reference/emptyAssignmentPatterns01_ES5iterable.js new file mode 100644 index 00000000000..7123841025f --- /dev/null +++ b/tests/baselines/reference/emptyAssignmentPatterns01_ES5iterable.js @@ -0,0 +1,15 @@ +//// [emptyAssignmentPatterns01_ES5iterable.ts] + +var a: any; + +({} = a); +([] = a); + +//// [emptyAssignmentPatterns01_ES5iterable.js] +var a; +(a); +(a); + + +//// [emptyAssignmentPatterns01_ES5iterable.d.ts] +declare var a: any; diff --git a/tests/baselines/reference/emptyAssignmentPatterns01_ES5iterable.symbols b/tests/baselines/reference/emptyAssignmentPatterns01_ES5iterable.symbols new file mode 100644 index 00000000000..8811c61dd9e --- /dev/null +++ b/tests/baselines/reference/emptyAssignmentPatterns01_ES5iterable.symbols @@ -0,0 +1,11 @@ +=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns01_ES5iterable.ts === + +var a: any; +>a : Symbol(a, Decl(emptyAssignmentPatterns01_ES5iterable.ts, 1, 3)) + +({} = a); +>a : Symbol(a, Decl(emptyAssignmentPatterns01_ES5iterable.ts, 1, 3)) + +([] = a); +>a : Symbol(a, Decl(emptyAssignmentPatterns01_ES5iterable.ts, 1, 3)) + diff --git a/tests/baselines/reference/emptyAssignmentPatterns01_ES5iterable.types b/tests/baselines/reference/emptyAssignmentPatterns01_ES5iterable.types new file mode 100644 index 00000000000..4a5e17d7cde --- /dev/null +++ b/tests/baselines/reference/emptyAssignmentPatterns01_ES5iterable.types @@ -0,0 +1,17 @@ +=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns01_ES5iterable.ts === + +var a: any; +>a : any + +({} = a); +>({} = a) : any +>{} = a : any +>{} : {} +>a : any + +([] = a); +>([] = a) : any +>[] = a : any +>[] : undefined[] +>a : any + diff --git a/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.js b/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.js new file mode 100644 index 00000000000..45cd426549e --- /dev/null +++ b/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.js @@ -0,0 +1,35 @@ +//// [emptyAssignmentPatterns02_ES5iterable.ts] + +var a: any; +let x, y, z, a1, a2, a3; + +({} = { x, y, z } = a); +([] = [ a1, a2, a3] = a); + +//// [emptyAssignmentPatterns02_ES5iterable.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 a; +var x, y, z, a1, a2, a3; +(x = a.x, y = a.y, z = a.z); +(_a = __read(a, 3), a1 = _a[0], a2 = _a[1], a3 = _a[2]); +var _a; + + +//// [emptyAssignmentPatterns02_ES5iterable.d.ts] +declare var a: any; +declare let x: any, y: any, z: any, a1: any, a2: any, a3: any; diff --git a/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.symbols b/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.symbols new file mode 100644 index 00000000000..fc90df74d1d --- /dev/null +++ b/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.symbols @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns02_ES5iterable.ts === + +var a: any; +>a : Symbol(a, Decl(emptyAssignmentPatterns02_ES5iterable.ts, 1, 3)) + +let x, y, z, a1, a2, a3; +>x : Symbol(x, Decl(emptyAssignmentPatterns02_ES5iterable.ts, 2, 3)) +>y : Symbol(y, Decl(emptyAssignmentPatterns02_ES5iterable.ts, 2, 6)) +>z : Symbol(z, Decl(emptyAssignmentPatterns02_ES5iterable.ts, 2, 9)) +>a1 : Symbol(a1, Decl(emptyAssignmentPatterns02_ES5iterable.ts, 2, 12)) +>a2 : Symbol(a2, Decl(emptyAssignmentPatterns02_ES5iterable.ts, 2, 16)) +>a3 : Symbol(a3, Decl(emptyAssignmentPatterns02_ES5iterable.ts, 2, 20)) + +({} = { x, y, z } = a); +>x : Symbol(x, Decl(emptyAssignmentPatterns02_ES5iterable.ts, 4, 7)) +>y : Symbol(y, Decl(emptyAssignmentPatterns02_ES5iterable.ts, 4, 10)) +>z : Symbol(z, Decl(emptyAssignmentPatterns02_ES5iterable.ts, 4, 13)) +>a : Symbol(a, Decl(emptyAssignmentPatterns02_ES5iterable.ts, 1, 3)) + +([] = [ a1, a2, a3] = a); +>a1 : Symbol(a1, Decl(emptyAssignmentPatterns02_ES5iterable.ts, 2, 12)) +>a2 : Symbol(a2, Decl(emptyAssignmentPatterns02_ES5iterable.ts, 2, 16)) +>a3 : Symbol(a3, Decl(emptyAssignmentPatterns02_ES5iterable.ts, 2, 20)) +>a : Symbol(a, Decl(emptyAssignmentPatterns02_ES5iterable.ts, 1, 3)) + diff --git a/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.types b/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.types new file mode 100644 index 00000000000..5f19cd98ec4 --- /dev/null +++ b/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.types @@ -0,0 +1,35 @@ +=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns02_ES5iterable.ts === + +var a: any; +>a : any + +let x, y, z, a1, a2, a3; +>x : any +>y : any +>z : any +>a1 : any +>a2 : any +>a3 : any + +({} = { x, y, z } = a); +>({} = { x, y, z } = a) : any +>{} = { x, y, z } = a : any +>{} : {} +>{ x, y, z } = a : any +>{ x, y, z } : { x: any; y: any; z: any; } +>x : any +>y : any +>z : any +>a : any + +([] = [ a1, a2, a3] = a); +>([] = [ a1, a2, a3] = a) : any +>[] = [ a1, a2, a3] = a : any +>[] : undefined[] +>[ a1, a2, a3] = a : any +>[ a1, a2, a3] : [any, any, any] +>a1 : any +>a2 : any +>a3 : any +>a : any + diff --git a/tests/baselines/reference/emptyAssignmentPatterns03_ES5iterable.js b/tests/baselines/reference/emptyAssignmentPatterns03_ES5iterable.js new file mode 100644 index 00000000000..79806e5994d --- /dev/null +++ b/tests/baselines/reference/emptyAssignmentPatterns03_ES5iterable.js @@ -0,0 +1,15 @@ +//// [emptyAssignmentPatterns03_ES5iterable.ts] + +var a: any; + +({} = {} = a); +([] = [] = a); + +//// [emptyAssignmentPatterns03_ES5iterable.js] +var a; +(a); +(a); + + +//// [emptyAssignmentPatterns03_ES5iterable.d.ts] +declare var a: any; diff --git a/tests/baselines/reference/emptyAssignmentPatterns03_ES5iterable.symbols b/tests/baselines/reference/emptyAssignmentPatterns03_ES5iterable.symbols new file mode 100644 index 00000000000..e1ac0ea4c5c --- /dev/null +++ b/tests/baselines/reference/emptyAssignmentPatterns03_ES5iterable.symbols @@ -0,0 +1,11 @@ +=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns03_ES5iterable.ts === + +var a: any; +>a : Symbol(a, Decl(emptyAssignmentPatterns03_ES5iterable.ts, 1, 3)) + +({} = {} = a); +>a : Symbol(a, Decl(emptyAssignmentPatterns03_ES5iterable.ts, 1, 3)) + +([] = [] = a); +>a : Symbol(a, Decl(emptyAssignmentPatterns03_ES5iterable.ts, 1, 3)) + diff --git a/tests/baselines/reference/emptyAssignmentPatterns03_ES5iterable.types b/tests/baselines/reference/emptyAssignmentPatterns03_ES5iterable.types new file mode 100644 index 00000000000..273d360d92f --- /dev/null +++ b/tests/baselines/reference/emptyAssignmentPatterns03_ES5iterable.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns03_ES5iterable.ts === + +var a: any; +>a : any + +({} = {} = a); +>({} = {} = a) : any +>{} = {} = a : any +>{} : {} +>{} = a : any +>{} : {} +>a : any + +([] = [] = a); +>([] = [] = a) : any +>[] = [] = a : any +>[] : undefined[] +>[] = a : any +>[] : undefined[] +>a : any + diff --git a/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.js b/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.js new file mode 100644 index 00000000000..5cb4a63b03d --- /dev/null +++ b/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.js @@ -0,0 +1,35 @@ +//// [emptyAssignmentPatterns04_ES5iterable.ts] + +var a: any; +let x, y, z, a1, a2, a3; + +({ x, y, z } = {} = a); +([ a1, a2, a3] = [] = a); + +//// [emptyAssignmentPatterns04_ES5iterable.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 a; +var x, y, z, a1, a2, a3; +(x = a.x, y = a.y, z = a.z); +(_a = __read(a, 3), a1 = _a[0], a2 = _a[1], a3 = _a[2]); +var _a; + + +//// [emptyAssignmentPatterns04_ES5iterable.d.ts] +declare var a: any; +declare let x: any, y: any, z: any, a1: any, a2: any, a3: any; diff --git a/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.symbols b/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.symbols new file mode 100644 index 00000000000..d433a0f125c --- /dev/null +++ b/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.symbols @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns04_ES5iterable.ts === + +var a: any; +>a : Symbol(a, Decl(emptyAssignmentPatterns04_ES5iterable.ts, 1, 3)) + +let x, y, z, a1, a2, a3; +>x : Symbol(x, Decl(emptyAssignmentPatterns04_ES5iterable.ts, 2, 3)) +>y : Symbol(y, Decl(emptyAssignmentPatterns04_ES5iterable.ts, 2, 6)) +>z : Symbol(z, Decl(emptyAssignmentPatterns04_ES5iterable.ts, 2, 9)) +>a1 : Symbol(a1, Decl(emptyAssignmentPatterns04_ES5iterable.ts, 2, 12)) +>a2 : Symbol(a2, Decl(emptyAssignmentPatterns04_ES5iterable.ts, 2, 16)) +>a3 : Symbol(a3, Decl(emptyAssignmentPatterns04_ES5iterable.ts, 2, 20)) + +({ x, y, z } = {} = a); +>x : Symbol(x, Decl(emptyAssignmentPatterns04_ES5iterable.ts, 4, 2)) +>y : Symbol(y, Decl(emptyAssignmentPatterns04_ES5iterable.ts, 4, 5)) +>z : Symbol(z, Decl(emptyAssignmentPatterns04_ES5iterable.ts, 4, 8)) +>a : Symbol(a, Decl(emptyAssignmentPatterns04_ES5iterable.ts, 1, 3)) + +([ a1, a2, a3] = [] = a); +>a1 : Symbol(a1, Decl(emptyAssignmentPatterns04_ES5iterable.ts, 2, 12)) +>a2 : Symbol(a2, Decl(emptyAssignmentPatterns04_ES5iterable.ts, 2, 16)) +>a3 : Symbol(a3, Decl(emptyAssignmentPatterns04_ES5iterable.ts, 2, 20)) +>a : Symbol(a, Decl(emptyAssignmentPatterns04_ES5iterable.ts, 1, 3)) + diff --git a/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.types b/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.types new file mode 100644 index 00000000000..c926ec31bfa --- /dev/null +++ b/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.types @@ -0,0 +1,35 @@ +=== tests/cases/conformance/es6/destructuring/emptyAssignmentPatterns04_ES5iterable.ts === + +var a: any; +>a : any + +let x, y, z, a1, a2, a3; +>x : any +>y : any +>z : any +>a1 : any +>a2 : any +>a3 : any + +({ x, y, z } = {} = a); +>({ x, y, z } = {} = a) : any +>{ x, y, z } = {} = a : any +>{ x, y, z } : { x: any; y: any; z: any; } +>x : any +>y : any +>z : any +>{} = a : any +>{} : {} +>a : any + +([ a1, a2, a3] = [] = a); +>([ a1, a2, a3] = [] = a) : any +>[ a1, a2, a3] = [] = a : any +>[ a1, a2, a3] : [any, any, any] +>a1 : any +>a2 : any +>a3 : any +>[] = a : any +>[] : undefined[] +>a : any + diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.js new file mode 100644 index 00000000000..c4eeb9994e6 --- /dev/null +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.js @@ -0,0 +1,182 @@ +//// [emptyVariableDeclarationBindingPatterns01_ES5iterable.ts] + +(function () { + var a: any; + + var {} = a; + let {} = a; + const {} = a; + + var [] = a; + let [] = a; + const [] = a; + + var {} = a, [] = a; + let {} = a, [] = a; + const {} = a, [] = a; + + var { p1: {}, p2: [] } = a; + let { p1: {}, p2: [] } = a; + const { p1: {}, p2: [] } = a; + + for (var {} = {}, {} = {}; false; void 0) { + } + + function f({} = a, [] = a, { p: {} = a} = a) { + return ({} = a, [] = a, { p: {} = a } = a) => a; + } +})(); + +(function () { + const ns: number[][] = []; + + for (var {} of ns) { + } + + for (let {} of ns) { + } + + for (const {} of ns) { + } + + for (var [] of ns) { + } + + for (let [] of ns) { + } + + for (const [] of ns) { + } +})(); + +//// [emptyVariableDeclarationBindingPatterns01_ES5iterable.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 __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; +(function () { + var a; + var _a = a; + var _b = a; + var _c = a; + var _d = __read(a, 0); + var _e = __read(a, 0); + var _f = __read(a, 0); + var _g = a, _h = __read(a, 0); + var _j = a, _k = __read(a, 0); + var _l = a, _m = __read(a, 0); + var _o = a.p1, _p = __read(a.p2, 0); + var _q = a.p1, _r = __read(a.p2, 0); + var _s = a.p1, _t = __read(a.p2, 0); + for (var _u = {}, _v = {}; false; void 0) { + } + function f(_a, _b, _c) { + _a = a; + _b = a; + var _d = (_c === void 0 ? a : _c).p, _e = _d === void 0 ? a : _d; + return function (_a, _b, _c) { + _a = a; + _b = a; + var _d = (_c === void 0 ? a : _c).p, _e = _d === void 0 ? a : _d; + return a; + }; + } +})(); +(function () { + var ns = []; + try { + for (var ns_1 = __values(ns), ns_1_1 = ns_1.next(); !ns_1_1.done; ns_1_1 = ns_1.next()) { + var _a = ns_1_1.value; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (ns_1_1 && !ns_1_1.done && (_b = ns_1.return)) _b.call(ns_1); + } + finally { if (e_1) throw e_1.error; } + } + try { + for (var ns_2 = __values(ns), ns_2_1 = ns_2.next(); !ns_2_1.done; ns_2_1 = ns_2.next()) { + var _c = ns_2_1.value; + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (ns_2_1 && !ns_2_1.done && (_d = ns_2.return)) _d.call(ns_2); + } + finally { if (e_2) throw e_2.error; } + } + try { + for (var ns_3 = __values(ns), ns_3_1 = ns_3.next(); !ns_3_1.done; ns_3_1 = ns_3.next()) { + var _e = ns_3_1.value; + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (ns_3_1 && !ns_3_1.done && (_f = ns_3.return)) _f.call(ns_3); + } + finally { if (e_3) throw e_3.error; } + } + try { + for (var ns_4 = __values(ns), ns_4_1 = ns_4.next(); !ns_4_1.done; ns_4_1 = ns_4.next()) { + var _g = __read(ns_4_1.value, 0); + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (ns_4_1 && !ns_4_1.done && (_h = ns_4.return)) _h.call(ns_4); + } + finally { if (e_4) throw e_4.error; } + } + try { + for (var ns_5 = __values(ns), ns_5_1 = ns_5.next(); !ns_5_1.done; ns_5_1 = ns_5.next()) { + var _j = __read(ns_5_1.value, 0); + } + } + catch (e_5_1) { e_5 = { error: e_5_1 }; } + finally { + try { + if (ns_5_1 && !ns_5_1.done && (_k = ns_5.return)) _k.call(ns_5); + } + finally { if (e_5) throw e_5.error; } + } + try { + for (var ns_6 = __values(ns), ns_6_1 = ns_6.next(); !ns_6_1.done; ns_6_1 = ns_6.next()) { + var _l = __read(ns_6_1.value, 0); + } + } + catch (e_6_1) { e_6 = { error: e_6_1 }; } + finally { + try { + if (ns_6_1 && !ns_6_1.done && (_m = ns_6.return)) _m.call(ns_6); + } + finally { if (e_6) throw e_6.error; } + } + var e_1, _b, e_2, _d, e_3, _f, e_4, _h, e_5, _k, e_6, _m; +})(); diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.symbols b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.symbols new file mode 100644 index 00000000000..d77525cf767 --- /dev/null +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.symbols @@ -0,0 +1,92 @@ +=== tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5iterable.ts === + +(function () { + var a: any; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) + + var {} = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) + + let {} = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) + + const {} = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) + + var [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) + + let [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) + + const [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) + + var {} = a, [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) + + let {} = a, [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) + + const {} = a, [] = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) + + var { p1: {}, p2: [] } = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) + + let { p1: {}, p2: [] } = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) + + const { p1: {}, p2: [] } = a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) + + for (var {} = {}, {} = {}; false; void 0) { + } + + function f({} = a, [] = a, { p: {} = a} = a) { +>f : Symbol(f, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 21, 5)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) + + return ({} = a, [] = a, { p: {} = a } = a) => a; +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) +>a : Symbol(a, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 2, 7)) + } +})(); + +(function () { + const ns: number[][] = []; +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 29, 9)) + + for (var {} of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 29, 9)) + } + + for (let {} of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 29, 9)) + } + + for (const {} of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 29, 9)) + } + + for (var [] of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 29, 9)) + } + + for (let [] of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 29, 9)) + } + + for (const [] of ns) { +>ns : Symbol(ns, Decl(emptyVariableDeclarationBindingPatterns01_ES5iterable.ts, 29, 9)) + } +})(); diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.types b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.types new file mode 100644 index 00000000000..591b149ac07 --- /dev/null +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.types @@ -0,0 +1,115 @@ +=== tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns01_ES5iterable.ts === + +(function () { +>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { } function f({} = a, [] = a, { p: {} = a} = a) { return ({} = a, [] = a, { p: {} = a } = a) => a; }})() : void +>(function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { } function f({} = a, [] = a, { p: {} = a} = a) { return ({} = a, [] = a, { p: {} = a } = a) => a; }}) : () => void +>function () { var a: any; var {} = a; let {} = a; const {} = a; var [] = a; let [] = a; const [] = a; var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; var { p1: {}, p2: [] } = a; let { p1: {}, p2: [] } = a; const { p1: {}, p2: [] } = a; for (var {} = {}, {} = {}; false; void 0) { } function f({} = a, [] = a, { p: {} = a} = a) { return ({} = a, [] = a, { p: {} = a } = a) => a; }} : () => void + + var a: any; +>a : any + + var {} = a; +>a : any + + let {} = a; +>a : any + + const {} = a; +>a : any + + var [] = a; +>a : any + + let [] = a; +>a : any + + const [] = a; +>a : any + + var {} = a, [] = a; +>a : any +>a : any + + let {} = a, [] = a; +>a : any +>a : any + + const {} = a, [] = a; +>a : any +>a : any + + var { p1: {}, p2: [] } = a; +>p1 : any +>p2 : any +>a : any + + let { p1: {}, p2: [] } = a; +>p1 : any +>p2 : any +>a : any + + const { p1: {}, p2: [] } = a; +>p1 : any +>p2 : any +>a : any + + for (var {} = {}, {} = {}; false; void 0) { +>{} : {} +>{} : {} +>false : false +>void 0 : undefined +>0 : 0 + } + + function f({} = a, [] = a, { p: {} = a} = a) { +>f : ({}?: any, []?: any, {p: {}}?: any) => ({}?: any, []?: any, {p: {}}?: any) => any +>a : any +>a : any +>p : any +>a : any +>a : any + + return ({} = a, [] = a, { p: {} = a } = a) => a; +>({} = a, [] = a, { p: {} = a } = a) => a : ({}?: any, []?: any, {p: {}}?: any) => any +>a : any +>a : any +>p : any +>a : any +>a : any +>a : any + } +})(); + +(function () { +>(function () { const ns: number[][] = []; for (var {} of ns) { } for (let {} of ns) { } for (const {} of ns) { } for (var [] of ns) { } for (let [] of ns) { } for (const [] of ns) { }})() : void +>(function () { const ns: number[][] = []; for (var {} of ns) { } for (let {} of ns) { } for (const {} of ns) { } for (var [] of ns) { } for (let [] of ns) { } for (const [] of ns) { }}) : () => void +>function () { const ns: number[][] = []; for (var {} of ns) { } for (let {} of ns) { } for (const {} of ns) { } for (var [] of ns) { } for (let [] of ns) { } for (const [] of ns) { }} : () => void + + const ns: number[][] = []; +>ns : number[][] +>[] : undefined[] + + for (var {} of ns) { +>ns : number[][] + } + + for (let {} of ns) { +>ns : number[][] + } + + for (const {} of ns) { +>ns : number[][] + } + + for (var [] of ns) { +>ns : number[][] + } + + for (let [] of ns) { +>ns : number[][] + } + + for (const [] of ns) { +>ns : number[][] + } +})(); diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5iterable.errors.txt b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5iterable.errors.txt new file mode 100644 index 00000000000..453f44be10c --- /dev/null +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5iterable.errors.txt @@ -0,0 +1,31 @@ +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5iterable.ts(3,9): error TS1182: A destructuring declaration must have an initializer. +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5iterable.ts(4,9): error TS1182: A destructuring declaration must have an initializer. +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5iterable.ts(5,11): error TS1182: A destructuring declaration must have an initializer. +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5iterable.ts(7,9): error TS1182: A destructuring declaration must have an initializer. +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5iterable.ts(8,9): error TS1182: A destructuring declaration must have an initializer. +tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5iterable.ts(9,11): error TS1182: A destructuring declaration must have an initializer. + + +==== tests/cases/conformance/es6/destructuring/emptyVariableDeclarationBindingPatterns02_ES5iterable.ts (6 errors) ==== + + (function () { + var {}; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + let {}; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + const {}; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + + var []; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + let []; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + const []; + ~~ +!!! error TS1182: A destructuring declaration must have an initializer. + })(); \ No newline at end of file diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5iterable.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5iterable.js new file mode 100644 index 00000000000..b5457d0a2ec --- /dev/null +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5iterable.js @@ -0,0 +1,40 @@ +//// [emptyVariableDeclarationBindingPatterns02_ES5iterable.ts] + +(function () { + var {}; + let {}; + const {}; + + var []; + let []; + const []; +})(); + +//// [emptyVariableDeclarationBindingPatterns02_ES5iterable.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; +}; +(function () { + var _a = void 0; + var _b = void 0; + var _c = void 0; + var _d = __read(void 0, 0); + var _e = __read(void 0, 0); + var _f = __read(void 0, 0); +})(); + + +//// [emptyVariableDeclarationBindingPatterns02_ES5iterable.d.ts] diff --git a/tests/baselines/reference/enumErrors.errors.txt b/tests/baselines/reference/enumErrors.errors.txt index f0978df709c..3efa042ff38 100644 --- a/tests/baselines/reference/enumErrors.errors.txt +++ b/tests/baselines/reference/enumErrors.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/enums/enumErrors.ts(2,6): error TS2431: Enum name cannot be 'any' -tests/cases/conformance/enums/enumErrors.ts(3,6): error TS2431: Enum name cannot be 'number' -tests/cases/conformance/enums/enumErrors.ts(4,6): error TS2431: Enum name cannot be 'string' -tests/cases/conformance/enums/enumErrors.ts(5,6): error TS2431: Enum name cannot be 'boolean' +tests/cases/conformance/enums/enumErrors.ts(2,6): error TS2431: Enum name cannot be 'any'. +tests/cases/conformance/enums/enumErrors.ts(3,6): error TS2431: Enum name cannot be 'number'. +tests/cases/conformance/enums/enumErrors.ts(4,6): error TS2431: Enum name cannot be 'string'. +tests/cases/conformance/enums/enumErrors.ts(5,6): error TS2431: Enum name cannot be 'boolean'. tests/cases/conformance/enums/enumErrors.ts(9,9): error TS2322: Type 'Number' is not assignable to type 'E5'. tests/cases/conformance/enums/enumErrors.ts(26,9): error TS2322: Type '""' is not assignable to type 'E11'. tests/cases/conformance/enums/enumErrors.ts(27,9): error TS2322: Type 'Date' is not assignable to type 'E11'. @@ -13,16 +13,16 @@ tests/cases/conformance/enums/enumErrors.ts(29,9): error TS2322: Type '{}' is no // Enum named with PredefinedTypes enum any { } ~~~ -!!! error TS2431: Enum name cannot be 'any' +!!! error TS2431: Enum name cannot be 'any'. enum number { } ~~~~~~ -!!! error TS2431: Enum name cannot be 'number' +!!! error TS2431: Enum name cannot be 'number'. enum string { } ~~~~~~ -!!! error TS2431: Enum name cannot be 'string' +!!! error TS2431: Enum name cannot be 'string'. enum boolean { } ~~~~~~~ -!!! error TS2431: Enum name cannot be 'boolean' +!!! error TS2431: Enum name cannot be 'boolean'. // Enum with computed member initializer of type Number enum E5 { diff --git a/tests/baselines/reference/enumWithPrimitiveName.errors.txt b/tests/baselines/reference/enumWithPrimitiveName.errors.txt index 403c0855ebb..babcc69adea 100644 --- a/tests/baselines/reference/enumWithPrimitiveName.errors.txt +++ b/tests/baselines/reference/enumWithPrimitiveName.errors.txt @@ -1,15 +1,15 @@ -tests/cases/compiler/enumWithPrimitiveName.ts(1,6): error TS2431: Enum name cannot be 'string' -tests/cases/compiler/enumWithPrimitiveName.ts(2,6): error TS2431: Enum name cannot be 'number' -tests/cases/compiler/enumWithPrimitiveName.ts(3,6): error TS2431: Enum name cannot be 'any' +tests/cases/compiler/enumWithPrimitiveName.ts(1,6): error TS2431: Enum name cannot be 'string'. +tests/cases/compiler/enumWithPrimitiveName.ts(2,6): error TS2431: Enum name cannot be 'number'. +tests/cases/compiler/enumWithPrimitiveName.ts(3,6): error TS2431: Enum name cannot be 'any'. ==== tests/cases/compiler/enumWithPrimitiveName.ts (3 errors) ==== enum string { } ~~~~~~ -!!! error TS2431: Enum name cannot be 'string' +!!! error TS2431: Enum name cannot be 'string'. enum number { } ~~~~~~ -!!! error TS2431: Enum name cannot be 'number' +!!! error TS2431: Enum name cannot be 'number'. enum any { } ~~~ -!!! error TS2431: Enum name cannot be 'any' \ No newline at end of file +!!! error TS2431: Enum name cannot be 'any'. \ No newline at end of file diff --git a/tests/baselines/reference/es5-asyncFunction.js b/tests/baselines/reference/es5-asyncFunction.js index 6f04c7ed7ef..21bd517adc2 100644 --- a/tests/baselines/reference/es5-asyncFunction.js +++ b/tests/baselines/reference/es5-asyncFunction.js @@ -18,8 +18,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; 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; - return { next: verb(0), "throw": verb(1), "return": verb(2) }; + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "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."); diff --git a/tests/baselines/reference/es5-asyncFunctionArrayLiterals.js b/tests/baselines/reference/es5-asyncFunctionArrayLiterals.js index c8a4733aa94..d3f570d5882 100644 --- a/tests/baselines/reference/es5-asyncFunctionArrayLiterals.js +++ b/tests/baselines/reference/es5-asyncFunctionArrayLiterals.js @@ -36,12 +36,11 @@ async function arrayLiteral7() { //// [es5-asyncFunctionArrayLiterals.js] function arrayLiteral0() { return __awaiter(this, void 0, void 0, function () { - var _a; - return __generator(this, function (_b) { - switch (_b.label) { + return __generator(this, function (_a) { + switch (_a.label) { case 0: return [4 /*yield*/, y]; case 1: - x = [_b.sent(), z]; + x = [_a.sent(), z]; return [2 /*return*/]; } }); @@ -76,14 +75,14 @@ function arrayLiteral2() { } function arrayLiteral3() { return __awaiter(this, void 0, void 0, function () { - var _a, _b, _c, _d; - return __generator(this, function (_e) { - switch (_e.label) { + var _a, _b; + return __generator(this, function (_c) { + switch (_c.label) { case 0: _b = (_a = y).concat; return [4 /*yield*/, z]; case 1: - x = _b.apply(_a, [[_e.sent()]]); + x = _b.apply(_a, [[_c.sent()]]); return [2 /*return*/]; } }); @@ -91,12 +90,11 @@ function arrayLiteral3() { } function arrayLiteral4() { return __awaiter(this, void 0, void 0, function () { - var _a; - return __generator(this, function (_b) { - switch (_b.label) { + return __generator(this, function (_a) { + switch (_a.label) { case 0: return [4 /*yield*/, y]; case 1: - x = [_b.sent()].concat(z); + x = [_a.sent()].concat(z); return [2 /*return*/]; } }); @@ -104,14 +102,14 @@ function arrayLiteral4() { } function arrayLiteral5() { return __awaiter(this, void 0, void 0, function () { - var _a, _b, _c; - return __generator(this, function (_d) { - switch (_d.label) { + var _a, _b; + return __generator(this, function (_c) { + switch (_c.label) { case 0: _b = (_a = [y]).concat; return [4 /*yield*/, z]; case 1: - x = _b.apply(_a, [(_d.sent())]); + x = _b.apply(_a, [(_c.sent())]); return [2 /*return*/]; } }); diff --git a/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js b/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js index 23a79cef343..809f6254f08 100644 --- a/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js +++ b/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js @@ -518,19 +518,19 @@ function binaryCompoundAssignment8() { } function binaryExponentiation() { return __awaiter(this, void 0, void 0, function () { - var _a, _b, _c, _d, _e, _f; - return __generator(this, function (_g) { - switch (_g.label) { + var _a, _b, _c, _d, _e; + return __generator(this, function (_f) { + switch (_f.label) { case 0: _b = (_a = Math).pow; return [4 /*yield*/, x]; case 1: - _b.apply(_a, [(_g.sent()), y]); - _e = (_d = Math).pow; - _f = [x]; + _b.apply(_a, [(_f.sent()), y]); + _d = (_c = Math).pow; + _e = [x]; return [4 /*yield*/, y]; case 2: - _e.apply(_d, _f.concat([_g.sent()])); + _d.apply(_c, _e.concat([_f.sent()])); return [2 /*return*/]; } }); diff --git a/tests/baselines/reference/es5-asyncFunctionCallExpressions.js b/tests/baselines/reference/es5-asyncFunctionCallExpressions.js index 93c4dcfd3cb..452a5e1cc90 100644 --- a/tests/baselines/reference/es5-asyncFunctionCallExpressions.js +++ b/tests/baselines/reference/es5-asyncFunctionCallExpressions.js @@ -113,14 +113,14 @@ function callExpression1() { } function callExpression2() { return __awaiter(this, void 0, void 0, function () { - var _a, _b; - return __generator(this, function (_c) { - switch (_c.label) { + var _a; + return __generator(this, function (_b) { + switch (_b.label) { case 0: _a = x; return [4 /*yield*/, y]; case 1: - _a.apply(void 0, [_c.sent(), z]); + _a.apply(void 0, [_b.sent(), z]); return [2 /*return*/]; } }); @@ -184,16 +184,16 @@ function callExpression6() { } function callExpression7() { return __awaiter(this, void 0, void 0, function () { - var _a, _b, _c, _d, _e, _f, _g; - return __generator(this, function (_h) { - switch (_h.label) { + var _a, _b, _c, _d, _e; + return __generator(this, function (_f) { + switch (_f.label) { case 0: _b = (_a = x).apply; _c = [void 0]; _e = (_d = y).concat; return [4 /*yield*/, z]; case 1: - _b.apply(_a, _c.concat([_e.apply(_d, [[_h.sent()]])])); + _b.apply(_a, _c.concat([_e.apply(_d, [[_f.sent()]])])); return [2 /*return*/]; } }); @@ -201,15 +201,15 @@ function callExpression7() { } function callExpression8() { return __awaiter(this, void 0, void 0, function () { - var _a, _b, _c, _d; - return __generator(this, function (_e) { - switch (_e.label) { + var _a, _b, _c; + return __generator(this, function (_d) { + switch (_d.label) { case 0: _b = (_a = x).apply; _c = [void 0]; return [4 /*yield*/, y]; case 1: - _b.apply(_a, _c.concat([[_e.sent()].concat(z)])); + _b.apply(_a, _c.concat([[_d.sent()].concat(z)])); return [2 /*return*/]; } }); @@ -217,16 +217,16 @@ function callExpression8() { } function callExpression9() { return __awaiter(this, void 0, void 0, function () { - var _a, _b, _c, _d, _e, _f; - return __generator(this, function (_g) { - switch (_g.label) { + var _a, _b, _c, _d, _e; + return __generator(this, function (_f) { + switch (_f.label) { case 0: _b = (_a = x).apply; _c = [void 0]; _e = (_d = [y]).concat; return [4 /*yield*/, z]; case 1: - _b.apply(_a, _c.concat([_e.apply(_d, [(_g.sent())])])); + _b.apply(_a, _c.concat([_e.apply(_d, [(_f.sent())])])); return [2 /*return*/]; } }); @@ -270,14 +270,14 @@ function callExpression12() { } function callExpression13() { return __awaiter(this, void 0, void 0, function () { - var _a, _b, _c; - return __generator(this, function (_d) { - switch (_d.label) { + var _a, _b; + return __generator(this, function (_c) { + switch (_c.label) { case 0: _b = (_a = x).a; return [4 /*yield*/, y]; case 1: - _b.apply(_a, [_d.sent(), z]); + _b.apply(_a, [_c.sent(), z]); return [2 /*return*/]; } }); @@ -352,14 +352,14 @@ function callExpression18() { } function callExpression19() { return __awaiter(this, void 0, void 0, function () { - var _a, _b, _c; - return __generator(this, function (_d) { - switch (_d.label) { + var _a, _b; + return __generator(this, function (_c) { + switch (_c.label) { case 0: _b = (_a = x)[a]; return [4 /*yield*/, y]; case 1: - _b.apply(_a, [_d.sent(), z]); + _b.apply(_a, [_c.sent(), z]); return [2 /*return*/]; } }); diff --git a/tests/baselines/reference/es5-asyncFunctionNewExpressions.js b/tests/baselines/reference/es5-asyncFunctionNewExpressions.js index 0fb1140f129..ba1331afd20 100644 --- a/tests/baselines/reference/es5-asyncFunctionNewExpressions.js +++ b/tests/baselines/reference/es5-asyncFunctionNewExpressions.js @@ -112,14 +112,14 @@ function newExpression1() { } function newExpression2() { return __awaiter(this, void 0, void 0, function () { - var _a, _b; - return __generator(this, function (_c) { - switch (_c.label) { + var _a; + return __generator(this, function (_b) { + switch (_b.label) { case 0: _a = x.bind; return [4 /*yield*/, y]; case 1: - new (_a.apply(x, [void 0, _c.sent(), z]))(); + new (_a.apply(x, [void 0, _b.sent(), z]))(); return [2 /*return*/]; } }); @@ -168,16 +168,16 @@ function newExpression5() { } function newExpression6() { return __awaiter(this, void 0, void 0, function () { - var _a, _b, _c, _d, _e, _f; - return __generator(this, function (_g) { - switch (_g.label) { + var _a, _b, _c, _d, _e; + return __generator(this, function (_f) { + switch (_f.label) { case 0: _b = (_a = x.bind).apply; _c = [x]; _e = (_d = [void 0]).concat; return [4 /*yield*/, y]; case 1: - new (_b.apply(_a, _c.concat([_e.apply(_d, [(_g.sent()), [z]])])))(); + new (_b.apply(_a, _c.concat([_e.apply(_d, [(_f.sent()), [z]])])))(); return [2 /*return*/]; } }); @@ -185,9 +185,9 @@ function newExpression6() { } function newExpression7() { return __awaiter(this, void 0, void 0, function () { - var _a, _b, _c, _d, _e, _f, _g; - return __generator(this, function (_h) { - switch (_h.label) { + var _a, _b, _c, _d, _e, _f; + return __generator(this, function (_g) { + switch (_g.label) { case 0: _b = (_a = x.bind).apply; _c = [x]; @@ -195,7 +195,7 @@ function newExpression7() { _f = [y]; return [4 /*yield*/, z]; case 1: - new (_b.apply(_a, _c.concat([_e.apply(_d, _f.concat([[_h.sent()]]))])))(); + new (_b.apply(_a, _c.concat([_e.apply(_d, _f.concat([[_g.sent()]]))])))(); return [2 /*return*/]; } }); @@ -220,16 +220,16 @@ function newExpression8() { } function newExpression9() { return __awaiter(this, void 0, void 0, function () { - var _a, _b, _c, _d, _e, _f; - return __generator(this, function (_g) { - switch (_g.label) { + var _a, _b, _c, _d, _e; + return __generator(this, function (_f) { + switch (_f.label) { case 0: _b = (_a = x.bind).apply; _c = [x]; _e = (_d = [void 0, y]).concat; return [4 /*yield*/, z]; case 1: - new (_b.apply(_a, _c.concat([_e.apply(_d, [(_g.sent())])])))(); + new (_b.apply(_a, _c.concat([_e.apply(_d, [(_f.sent())])])))(); return [2 /*return*/]; } }); @@ -273,14 +273,14 @@ function newExpression12() { } function newExpression13() { return __awaiter(this, void 0, void 0, function () { - var _a, _b, _c; - return __generator(this, function (_d) { - switch (_d.label) { + var _a, _b; + return __generator(this, function (_c) { + switch (_c.label) { case 0: _b = (_a = x.a).bind; return [4 /*yield*/, y]; case 1: - new (_b.apply(_a, [void 0, _d.sent(), z]))(); + new (_b.apply(_a, [void 0, _c.sent(), z]))(); return [2 /*return*/]; } }); @@ -355,14 +355,14 @@ function newExpression18() { } function newExpression19() { return __awaiter(this, void 0, void 0, function () { - var _a, _b, _c; - return __generator(this, function (_d) { - switch (_d.label) { + var _a, _b; + return __generator(this, function (_c) { + switch (_c.label) { case 0: _b = (_a = x[a]).bind; return [4 /*yield*/, y]; case 1: - new (_b.apply(_a, [void 0, _d.sent(), z]))(); + new (_b.apply(_a, [void 0, _c.sent(), z]))(); return [2 /*return*/]; } }); diff --git a/tests/baselines/reference/es5-importHelpersAsyncFunctions.js b/tests/baselines/reference/es5-importHelpersAsyncFunctions.js index f62c861b7c9..9e5b63b23e9 100644 --- a/tests/baselines/reference/es5-importHelpersAsyncFunctions.js +++ b/tests/baselines/reference/es5-importHelpersAsyncFunctions.js @@ -39,8 +39,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; 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; - return { next: verb(0), "throw": verb(1), "return": verb(2) }; + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "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."); diff --git a/tests/baselines/reference/es6ImportDefaultBindingMergeErrors.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingMergeErrors.errors.txt index 8b67ddfeac3..87311d3557c 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingMergeErrors.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingMergeErrors.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/es6ImportDefaultBindingMergeErrors_1.ts(5,8): error TS2440: Import declaration conflicts with local declaration of 'defaultBinding2' +tests/cases/compiler/es6ImportDefaultBindingMergeErrors_1.ts(5,8): error TS2440: Import declaration conflicts with local declaration of 'defaultBinding2'. tests/cases/compiler/es6ImportDefaultBindingMergeErrors_1.ts(7,8): error TS2300: Duplicate identifier 'defaultBinding3'. tests/cases/compiler/es6ImportDefaultBindingMergeErrors_1.ts(8,8): error TS2300: Duplicate identifier 'defaultBinding3'. @@ -15,7 +15,7 @@ tests/cases/compiler/es6ImportDefaultBindingMergeErrors_1.ts(8,8): error TS2300: var x = defaultBinding; import defaultBinding2 from "./es6ImportDefaultBindingMergeErrors_0"; // Should be error ~~~~~~~~~~~~~~~ -!!! error TS2440: Import declaration conflicts with local declaration of 'defaultBinding2' +!!! error TS2440: Import declaration conflicts with local declaration of 'defaultBinding2'. var defaultBinding2 = "hello world"; import defaultBinding3 from "./es6ImportDefaultBindingMergeErrors_0"; // Should be error ~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/es6ImportNameSpaceImportMergeErrors.errors.txt b/tests/baselines/reference/es6ImportNameSpaceImportMergeErrors.errors.txt index b8b22ce3ed1..de9ba696532 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImportMergeErrors.errors.txt +++ b/tests/baselines/reference/es6ImportNameSpaceImportMergeErrors.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/es6ImportNameSpaceImportMergeErrors_1.ts(4,13): error TS2300: Duplicate identifier 'nameSpaceBinding1'. tests/cases/compiler/es6ImportNameSpaceImportMergeErrors_1.ts(5,13): error TS2300: Duplicate identifier 'nameSpaceBinding1'. -tests/cases/compiler/es6ImportNameSpaceImportMergeErrors_1.ts(7,8): error TS2440: Import declaration conflicts with local declaration of 'nameSpaceBinding3' +tests/cases/compiler/es6ImportNameSpaceImportMergeErrors_1.ts(7,8): error TS2440: Import declaration conflicts with local declaration of 'nameSpaceBinding3'. ==== tests/cases/compiler/es6ImportNameSpaceImportMergeErrors_0.ts (0 errors) ==== @@ -20,6 +20,6 @@ tests/cases/compiler/es6ImportNameSpaceImportMergeErrors_1.ts(7,8): error TS2440 import * as nameSpaceBinding3 from "./es6ImportNameSpaceImportMergeErrors_0"; // should be error ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2440: Import declaration conflicts with local declaration of 'nameSpaceBinding3' +!!! error TS2440: Import declaration conflicts with local declaration of 'nameSpaceBinding3'. var nameSpaceBinding3 = 10; \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportNamedImportMergeErrors.errors.txt b/tests/baselines/reference/es6ImportNamedImportMergeErrors.errors.txt index 4fca12ee8e1..0646e4f2fd6 100644 --- a/tests/baselines/reference/es6ImportNamedImportMergeErrors.errors.txt +++ b/tests/baselines/reference/es6ImportNamedImportMergeErrors.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/es6ImportNamedImportMergeErrors_1.ts(5,10): error TS2440: Import declaration conflicts with local declaration of 'x' -tests/cases/compiler/es6ImportNamedImportMergeErrors_1.ts(7,10): error TS2440: Import declaration conflicts with local declaration of 'x44' +tests/cases/compiler/es6ImportNamedImportMergeErrors_1.ts(5,10): error TS2440: Import declaration conflicts with local declaration of 'x'. +tests/cases/compiler/es6ImportNamedImportMergeErrors_1.ts(7,10): error TS2440: Import declaration conflicts with local declaration of 'x44'. tests/cases/compiler/es6ImportNamedImportMergeErrors_1.ts(9,10): error TS2300: Duplicate identifier 'z'. tests/cases/compiler/es6ImportNamedImportMergeErrors_1.ts(10,16): error TS2300: Duplicate identifier 'z'. @@ -18,11 +18,11 @@ tests/cases/compiler/es6ImportNamedImportMergeErrors_1.ts(10,16): error TS2300: interface x1 { } // shouldnt be error import { x } from "./es6ImportNamedImportMergeErrors_0"; // should be error ~ -!!! error TS2440: Import declaration conflicts with local declaration of 'x' +!!! error TS2440: Import declaration conflicts with local declaration of 'x'. var x = 10; import { x as x44 } from "./es6ImportNamedImportMergeErrors_0"; // should be error ~~~~~~~~ -!!! error TS2440: Import declaration conflicts with local declaration of 'x44' +!!! error TS2440: Import declaration conflicts with local declaration of 'x44'. var x44 = 10; import { z } from "./es6ImportNamedImportMergeErrors_0"; // should be error ~ diff --git a/tests/baselines/reference/evalAfter0.errors.txt b/tests/baselines/reference/evalAfter0.errors.txt new file mode 100644 index 00000000000..448772eda08 --- /dev/null +++ b/tests/baselines/reference/evalAfter0.errors.txt @@ -0,0 +1,10 @@ +tests/cases/compiler/evalAfter0.ts(4,2): error TS2695: Left side of comma operator is unused and has no side effects. + + +==== tests/cases/compiler/evalAfter0.ts (1 errors) ==== + (0,eval)("10"); // fine: special case for eval + + declare var eva; + (0,eva)("10"); // error: no side effect left of comma (suspect of missing method name or something) + ~ +!!! error TS2695: Left side of comma operator is unused and has no side effects. \ No newline at end of file diff --git a/tests/baselines/reference/evalAfter0.js b/tests/baselines/reference/evalAfter0.js new file mode 100644 index 00000000000..aeaa8f6476c --- /dev/null +++ b/tests/baselines/reference/evalAfter0.js @@ -0,0 +1,9 @@ +//// [evalAfter0.ts] +(0,eval)("10"); // fine: special case for eval + +declare var eva; +(0,eva)("10"); // error: no side effect left of comma (suspect of missing method name or something) + +//// [evalAfter0.js] +(0, eval)("10"); // fine: special case for eval +(0, eva)("10"); // error: no side effect left of comma (suspect of missing method name or something) diff --git a/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt b/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt index 1075c505794..057ceb0c71d 100644 --- a/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt +++ b/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt @@ -1,27 +1,27 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(5,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(5,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(5,8): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(5,8): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(6,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(6,8): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(6,8): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(7,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(7,8): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(7,8): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(8,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(8,8): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(8,8): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(11,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(11,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(11,13): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(11,13): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(12,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(12,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(12,13): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(12,13): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(13,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(13,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(13,13): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(13,13): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(14,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(14,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(14,13): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(14,13): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(16,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(16,1): error TS17006: An unary expression with the 'typeof' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(17,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -110,28 +110,28 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxE ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete ++temp ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete temp-- ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete temp++ ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. 1 ** delete --temp ** 3; @@ -140,28 +140,28 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxE ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. 1 ** delete ++temp ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. 1 ** delete temp-- ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. 1 ** delete temp++ ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. typeof --temp ** 3; ~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt b/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt index b643a71c5c8..77f20df2597 100644 --- a/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt +++ b/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt @@ -19,21 +19,21 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInv tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(25,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(26,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(28,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(28,9): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(28,9): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(29,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(29,9): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(29,9): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(30,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(30,9): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(30,9): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(31,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(31,9): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(31,9): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(33,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(33,14): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(33,14): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(34,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(34,14): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(34,14): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(35,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(35,14): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(35,14): error TS2703: The operand of a delete operator must be a property reference. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(36,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(36,14): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(36,14): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts (36 errors) ==== @@ -108,40 +108,40 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInv ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. (delete ++temp) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. (delete temp--) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. (delete temp++) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. 1 ** (delete --temp) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. 1 ** (delete ++temp) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. 1 ** (delete temp--) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. 1 ** (delete temp++) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference \ No newline at end of file +!!! error TS2703: The operand of a delete operator must be a property reference. \ No newline at end of file diff --git a/tests/baselines/reference/exportDefaultInJsFile01.errors.txt b/tests/baselines/reference/exportDefaultInJsFile01.errors.txt index 0565c8bd61e..78b2ee664b9 100644 --- a/tests/baselines/reference/exportDefaultInJsFile01.errors.txt +++ b/tests/baselines/reference/exportDefaultInJsFile01.errors.txt @@ -1,9 +1,9 @@ error TS5055: Cannot write file 'tests/cases/conformance/salsa/myFile01.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS5055: Cannot write file 'tests/cases/conformance/salsa/myFile01.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/conformance/salsa/myFile01.js (0 errors) ==== export default "hello"; \ No newline at end of file diff --git a/tests/baselines/reference/exportDefaultInJsFile02.errors.txt b/tests/baselines/reference/exportDefaultInJsFile02.errors.txt index a74fbacfcfd..f53233a1eff 100644 --- a/tests/baselines/reference/exportDefaultInJsFile02.errors.txt +++ b/tests/baselines/reference/exportDefaultInJsFile02.errors.txt @@ -1,9 +1,9 @@ error TS5055: Cannot write file 'tests/cases/conformance/salsa/myFile02.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS5055: Cannot write file 'tests/cases/conformance/salsa/myFile02.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/conformance/salsa/myFile02.js (0 errors) ==== export default "hello"; \ No newline at end of file diff --git a/tests/baselines/reference/for-of2.errors.txt b/tests/baselines/reference/for-of2.errors.txt index 1975f8be0af..3bf3b679898 100644 --- a/tests/baselines/reference/for-of2.errors.txt +++ b/tests/baselines/reference/for-of2.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/es6/for-ofStatements/for-of2.ts(1,7): error TS1155: 'const' declarations must be initialized +tests/cases/conformance/es6/for-ofStatements/for-of2.ts(1,7): error TS1155: 'const' declarations must be initialized. tests/cases/conformance/es6/for-ofStatements/for-of2.ts(2,6): error TS2540: Cannot assign to 'v' because it is a constant or a read-only property. ==== tests/cases/conformance/es6/for-ofStatements/for-of2.ts (2 errors) ==== const v; ~ -!!! error TS1155: 'const' declarations must be initialized +!!! error TS1155: 'const' declarations must be initialized. for (v of []) { } ~ !!! error TS2540: Cannot assign to 'v' because it is a constant or a read-only property. \ No newline at end of file diff --git a/tests/baselines/reference/functionAndImportNameConflict.errors.txt b/tests/baselines/reference/functionAndImportNameConflict.errors.txt index 4ca496cfb65..0711165bbce 100644 --- a/tests/baselines/reference/functionAndImportNameConflict.errors.txt +++ b/tests/baselines/reference/functionAndImportNameConflict.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/f2.ts(1,9): error TS2440: Import declaration conflicts with local declaration of 'f' +tests/cases/compiler/f2.ts(1,9): error TS2440: Import declaration conflicts with local declaration of 'f'. ==== tests/cases/compiler/f1.ts (0 errors) ==== @@ -8,6 +8,6 @@ tests/cases/compiler/f2.ts(1,9): error TS2440: Import declaration conflicts with ==== tests/cases/compiler/f2.ts (1 errors) ==== import {f} from './f1'; ~ -!!! error TS2440: Import declaration conflicts with local declaration of 'f' +!!! error TS2440: Import declaration conflicts with local declaration of 'f'. export function f() { } \ No newline at end of file diff --git a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt index 7f3d8d90802..06cdca868ad 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt +++ b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt @@ -2,21 +2,21 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(6,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(23,14): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'. - Type 'Function' provides no match for the signature '(x: string): string' + Type 'Function' provides no match for the signature '(x: string): string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(24,15): error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'. Types of parameters 'x' and 'x' are incompatible. Type 'string' is not assignable to type 'string[]'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(25,15): error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'. - Type 'typeof C' provides no match for the signature '(x: string): string' + Type 'typeof C' provides no match for the signature '(x: string): string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(26,15): error TS2345: Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'. - Type 'new (x: string) => string' provides no match for the signature '(x: string): string' + Type 'new (x: string) => string' provides no match for the signature '(x: string): string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(28,16): error TS2345: Argument of type '(x: U, y: V) => U' is not assignable to parameter of type '(x: string) => string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(29,16): error TS2345: Argument of type 'typeof C2' is not assignable to parameter of type '(x: string) => string'. - Type 'typeof C2' provides no match for the signature '(x: string): string' + Type 'typeof C2' provides no match for the signature '(x: string): string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(30,16): error TS2345: Argument of type 'new (x: T) => T' is not assignable to parameter of type '(x: string) => string'. - Type 'new (x: T) => T' provides no match for the signature '(x: string): string' + Type 'new (x: T) => T' provides no match for the signature '(x: string): string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(34,16): error TS2345: Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'. - Type 'F2' provides no match for the signature '(x: string): string' + Type 'F2' provides no match for the signature '(x: string): string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(37,10): error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'. Type '() => void' is not assignable to type '(x: string) => string'. Type 'void' is not assignable to type 'string'. @@ -58,7 +58,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain var r = foo2(new Function()); ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'. -!!! error TS2345: Type 'Function' provides no match for the signature '(x: string): string' +!!! error TS2345: Type 'Function' provides no match for the signature '(x: string): string'. var r2 = foo2((x: string[]) => x); ~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'. @@ -67,11 +67,11 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain var r6 = foo2(C); ~ !!! error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'. -!!! error TS2345: Type 'typeof C' provides no match for the signature '(x: string): string' +!!! error TS2345: Type 'typeof C' provides no match for the signature '(x: string): string'. var r7 = foo2(b); ~ !!! error TS2345: Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'. -!!! error TS2345: Type 'new (x: string) => string' provides no match for the signature '(x: string): string' +!!! error TS2345: Type 'new (x: string) => string' provides no match for the signature '(x: string): string'. var r8 = foo2((x: U) => x); // no error expected var r11 = foo2((x: U, y: V) => x); ~~~~~~~~~~~~~~~~~~~~~~~ @@ -79,18 +79,18 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain var r13 = foo2(C2); ~~ !!! error TS2345: Argument of type 'typeof C2' is not assignable to parameter of type '(x: string) => string'. -!!! error TS2345: Type 'typeof C2' provides no match for the signature '(x: string): string' +!!! error TS2345: Type 'typeof C2' provides no match for the signature '(x: string): string'. var r14 = foo2(b2); ~~ !!! error TS2345: Argument of type 'new (x: T) => T' is not assignable to parameter of type '(x: string) => string'. -!!! error TS2345: Type 'new (x: T) => T' provides no match for the signature '(x: string): string' +!!! error TS2345: Type 'new (x: T) => T' provides no match for the signature '(x: string): string'. interface F2 extends Function { foo: string; } var f2: F2; var r16 = foo2(f2); ~~ !!! error TS2345: Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'. -!!! error TS2345: Type 'F2' provides no match for the signature '(x: string): string' +!!! error TS2345: Type 'F2' provides no match for the signature '(x: string): string'. function fff(x: T, y: U) { foo2(x); diff --git a/tests/baselines/reference/functionsInClassExpressions.symbols b/tests/baselines/reference/functionsInClassExpressions.symbols index a1da3a3175c..4aa62da8e33 100644 --- a/tests/baselines/reference/functionsInClassExpressions.symbols +++ b/tests/baselines/reference/functionsInClassExpressions.symbols @@ -4,24 +4,24 @@ let Foo = class { constructor() { this.bar++; ->this.bar : Symbol((Anonymous class).bar, Decl(functionsInClassExpressions.ts, 3, 5)) ->this : Symbol((Anonymous class), Decl(functionsInClassExpressions.ts, 0, 9)) ->bar : Symbol((Anonymous class).bar, Decl(functionsInClassExpressions.ts, 3, 5)) +>this.bar : Symbol(Foo.bar, Decl(functionsInClassExpressions.ts, 3, 5)) +>this : Symbol(Foo, Decl(functionsInClassExpressions.ts, 0, 9)) +>bar : Symbol(Foo.bar, Decl(functionsInClassExpressions.ts, 3, 5)) } bar = 0; ->bar : Symbol((Anonymous class).bar, Decl(functionsInClassExpressions.ts, 3, 5)) +>bar : Symbol(Foo.bar, Decl(functionsInClassExpressions.ts, 3, 5)) inc = () => { ->inc : Symbol((Anonymous class).inc, Decl(functionsInClassExpressions.ts, 4, 12)) +>inc : Symbol(Foo.inc, Decl(functionsInClassExpressions.ts, 4, 12)) this.bar++; ->this.bar : Symbol((Anonymous class).bar, Decl(functionsInClassExpressions.ts, 3, 5)) ->this : Symbol((Anonymous class), Decl(functionsInClassExpressions.ts, 0, 9)) ->bar : Symbol((Anonymous class).bar, Decl(functionsInClassExpressions.ts, 3, 5)) +>this.bar : Symbol(Foo.bar, Decl(functionsInClassExpressions.ts, 3, 5)) +>this : Symbol(Foo, Decl(functionsInClassExpressions.ts, 0, 9)) +>bar : Symbol(Foo.bar, Decl(functionsInClassExpressions.ts, 3, 5)) } m() { return this.bar; } ->m : Symbol((Anonymous class).m, Decl(functionsInClassExpressions.ts, 7, 5)) ->this.bar : Symbol((Anonymous class).bar, Decl(functionsInClassExpressions.ts, 3, 5)) ->this : Symbol((Anonymous class), Decl(functionsInClassExpressions.ts, 0, 9)) ->bar : Symbol((Anonymous class).bar, Decl(functionsInClassExpressions.ts, 3, 5)) +>m : Symbol(Foo.m, Decl(functionsInClassExpressions.ts, 7, 5)) +>this.bar : Symbol(Foo.bar, Decl(functionsInClassExpressions.ts, 3, 5)) +>this : Symbol(Foo, Decl(functionsInClassExpressions.ts, 0, 9)) +>bar : Symbol(Foo.bar, Decl(functionsInClassExpressions.ts, 3, 5)) } diff --git a/tests/baselines/reference/functionsInClassExpressions.types b/tests/baselines/reference/functionsInClassExpressions.types index b00f3df3490..7352f6e6b12 100644 --- a/tests/baselines/reference/functionsInClassExpressions.types +++ b/tests/baselines/reference/functionsInClassExpressions.types @@ -1,7 +1,7 @@ === tests/cases/compiler/functionsInClassExpressions.ts === let Foo = class { ->Foo : typeof (Anonymous class) ->class { constructor() { this.bar++; } bar = 0; inc = () => { this.bar++; } m() { return this.bar; }} : typeof (Anonymous class) +>Foo : typeof Foo +>class { constructor() { this.bar++; } bar = 0; inc = () => { this.bar++; } m() { return this.bar; }} : typeof Foo constructor() { this.bar++; diff --git a/tests/baselines/reference/funduleSplitAcrossFiles.errors.txt b/tests/baselines/reference/funduleSplitAcrossFiles.errors.txt index 02aa57937ba..18429658f28 100644 --- a/tests/baselines/reference/funduleSplitAcrossFiles.errors.txt +++ b/tests/baselines/reference/funduleSplitAcrossFiles.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/funduleSplitAcrossFiles_module.ts(1,8): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged +tests/cases/compiler/funduleSplitAcrossFiles_module.ts(1,8): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. ==== tests/cases/compiler/funduleSplitAcrossFiles_function.ts (0 errors) ==== @@ -7,7 +7,7 @@ tests/cases/compiler/funduleSplitAcrossFiles_module.ts(1,8): error TS2433: A nam ==== tests/cases/compiler/funduleSplitAcrossFiles_module.ts (1 errors) ==== module D { ~ -!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged +!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. export var y = "hi"; } D.y; \ No newline at end of file diff --git a/tests/baselines/reference/generatorTypeCheck31.errors.txt b/tests/baselines/reference/generatorTypeCheck31.errors.txt index 3f54edacb2a..437b7470069 100644 --- a/tests/baselines/reference/generatorTypeCheck31.errors.txt +++ b/tests/baselines/reference/generatorTypeCheck31.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck31.ts(2,11): error TS2322: Type 'IterableIterator<(x: any) => any>' is not assignable to type '() => Iterable<(x: string) => number>'. - Type 'IterableIterator<(x: any) => any>' provides no match for the signature '(): Iterable<(x: string) => number>' + Type 'IterableIterator<(x: any) => any>' provides no match for the signature '(): Iterable<(x: string) => number>'. ==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck31.ts (1 errors) ==== @@ -11,5 +11,5 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck31.ts(2,11): erro } () ~~~~~~~~ !!! error TS2322: Type 'IterableIterator<(x: any) => any>' is not assignable to type '() => Iterable<(x: string) => number>'. -!!! error TS2322: Type 'IterableIterator<(x: any) => any>' provides no match for the signature '(): Iterable<(x: string) => number>' +!!! error TS2322: Type 'IterableIterator<(x: any) => any>' provides no match for the signature '(): Iterable<(x: string) => number>'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericSpecializations2.errors.txt b/tests/baselines/reference/genericSpecializations2.errors.txt index 49729ca1d8c..9d58731b6fb 100644 --- a/tests/baselines/reference/genericSpecializations2.errors.txt +++ b/tests/baselines/reference/genericSpecializations2.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/genericSpecializations2.ts(8,9): error TS2368: Type parameter name cannot be 'string' -tests/cases/compiler/genericSpecializations2.ts(12,9): error TS2368: Type parameter name cannot be 'string' +tests/cases/compiler/genericSpecializations2.ts(8,9): error TS2368: Type parameter name cannot be 'string'. +tests/cases/compiler/genericSpecializations2.ts(12,9): error TS2368: Type parameter name cannot be 'string'. ==== tests/cases/compiler/genericSpecializations2.ts (2 errors) ==== @@ -12,13 +12,13 @@ tests/cases/compiler/genericSpecializations2.ts(12,9): error TS2368: Type parame class IntFooBad implements IFoo { foo(x: string): string { return null; } ~~~~~~ -!!! error TS2368: Type parameter name cannot be 'string' +!!! error TS2368: Type parameter name cannot be 'string'. } class StringFoo2 implements IFoo { foo(x: string): string { return null; } ~~~~~~ -!!! error TS2368: Type parameter name cannot be 'string' +!!! error TS2368: Type parameter name cannot be 'string'. } class StringFoo3 implements IFoo { diff --git a/tests/baselines/reference/implementsInClassExpression.symbols b/tests/baselines/reference/implementsInClassExpression.symbols index 48a44d91e9c..bf3b3ef9337 100644 --- a/tests/baselines/reference/implementsInClassExpression.symbols +++ b/tests/baselines/reference/implementsInClassExpression.symbols @@ -11,5 +11,5 @@ let cls = class implements Foo { >Foo : Symbol(Foo, Decl(implementsInClassExpression.ts, 0, 0)) doThing() { } ->doThing : Symbol((Anonymous class).doThing, Decl(implementsInClassExpression.ts, 4, 32)) +>doThing : Symbol(cls.doThing, Decl(implementsInClassExpression.ts, 4, 32)) } diff --git a/tests/baselines/reference/implementsInClassExpression.types b/tests/baselines/reference/implementsInClassExpression.types index d3647c30ff1..0734f8b8b78 100644 --- a/tests/baselines/reference/implementsInClassExpression.types +++ b/tests/baselines/reference/implementsInClassExpression.types @@ -7,8 +7,8 @@ interface Foo { } let cls = class implements Foo { ->cls : typeof (Anonymous class) ->class implements Foo { doThing() { }} : typeof (Anonymous class) +>cls : typeof cls +>class implements Foo { doThing() { }} : typeof cls >Foo : Foo doThing() { } diff --git a/tests/baselines/reference/importAndVariableDeclarationConflict1.errors.txt b/tests/baselines/reference/importAndVariableDeclarationConflict1.errors.txt index cae8612481a..145540914a7 100644 --- a/tests/baselines/reference/importAndVariableDeclarationConflict1.errors.txt +++ b/tests/baselines/reference/importAndVariableDeclarationConflict1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/importAndVariableDeclarationConflict1.ts(5,1): error TS2440: Import declaration conflicts with local declaration of 'x' +tests/cases/compiler/importAndVariableDeclarationConflict1.ts(5,1): error TS2440: Import declaration conflicts with local declaration of 'x'. ==== tests/cases/compiler/importAndVariableDeclarationConflict1.ts (1 errors) ==== @@ -8,6 +8,6 @@ tests/cases/compiler/importAndVariableDeclarationConflict1.ts(5,1): error TS2440 import x = m.m; ~~~~~~~~~~~~~~~ -!!! error TS2440: Import declaration conflicts with local declaration of 'x' +!!! error TS2440: Import declaration conflicts with local declaration of 'x'. var x = ''; \ No newline at end of file diff --git a/tests/baselines/reference/importAndVariableDeclarationConflict4.errors.txt b/tests/baselines/reference/importAndVariableDeclarationConflict4.errors.txt index 4905d4d2a73..8dbbf76a1dc 100644 --- a/tests/baselines/reference/importAndVariableDeclarationConflict4.errors.txt +++ b/tests/baselines/reference/importAndVariableDeclarationConflict4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/importAndVariableDeclarationConflict4.ts(6,1): error TS2440: Import declaration conflicts with local declaration of 'x' +tests/cases/compiler/importAndVariableDeclarationConflict4.ts(6,1): error TS2440: Import declaration conflicts with local declaration of 'x'. ==== tests/cases/compiler/importAndVariableDeclarationConflict4.ts (1 errors) ==== @@ -9,5 +9,5 @@ tests/cases/compiler/importAndVariableDeclarationConflict4.ts(6,1): error TS2440 var x = ''; import x = m.m; ~~~~~~~~~~~~~~~ -!!! error TS2440: Import declaration conflicts with local declaration of 'x' +!!! error TS2440: Import declaration conflicts with local declaration of 'x'. \ No newline at end of file diff --git a/tests/baselines/reference/inOperator.errors.txt b/tests/baselines/reference/inOperator.errors.txt index 7c9c874ea19..3ab9f03595e 100644 --- a/tests/baselines/reference/inOperator.errors.txt +++ b/tests/baselines/reference/inOperator.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/inOperator.ts(7,15): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +tests/cases/compiler/inOperator.ts(7,15): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. ==== tests/cases/compiler/inOperator.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/compiler/inOperator.ts(7,15): error TS2361: The right-hand side of a var b = '' in 0; ~ -!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. var c: any; var y: number; diff --git a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt index 7615008d89c..ff411f60c47 100644 --- a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt @@ -5,18 +5,18 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(30,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(31,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(32,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(33,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(34,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(35,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(36,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(37,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(30,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(31,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(32,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(33,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(34,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(35,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(36,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(37,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(38,16): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(39,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. ==== tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts (19 errors) ==== @@ -65,28 +65,28 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv var rb1 = x in b1; ~~ -!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. var rb2 = x in b2; ~~ -!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. var rb3 = x in b3; ~~ -!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. var rb4 = x in b4; ~~ -!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. var rb5 = x in b5; ~~ -!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. var rb6 = x in 0; ~ -!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. var rb7 = x in false; ~~~~~ -!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. var rb8 = x in ''; ~~ -!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. var rb9 = x in null; ~~~~ !!! error TS2531: Object is possibly 'null'. @@ -100,4 +100,4 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv ~~ !!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. ~~ -!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter \ No newline at end of file +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. \ No newline at end of file diff --git a/tests/baselines/reference/intTypeCheck.errors.txt b/tests/baselines/reference/intTypeCheck.errors.txt index f8b4fef7310..e5fbfbdbee8 100644 --- a/tests/baselines/reference/intTypeCheck.errors.txt +++ b/tests/baselines/reference/intTypeCheck.errors.txt @@ -14,26 +14,26 @@ tests/cases/compiler/intTypeCheck.ts(106,20): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(106,21): error TS2693: 'i1' only refers to a type, but is being used as a value here. tests/cases/compiler/intTypeCheck.ts(107,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(112,5): error TS2322: Type '{}' is not assignable to type 'i2'. - Type '{}' provides no match for the signature '(): any' + Type '{}' provides no match for the signature '(): any'. tests/cases/compiler/intTypeCheck.ts(113,5): error TS2322: Type 'Object' is not assignable to type 'i2'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Type 'Object' provides no match for the signature '(): any' + Type 'Object' provides no match for the signature '(): any'. tests/cases/compiler/intTypeCheck.ts(114,17): error TS2350: Only a void function can be called with the 'new' keyword. tests/cases/compiler/intTypeCheck.ts(115,5): error TS2322: Type 'Base' is not assignable to type 'i2'. - Type 'Base' provides no match for the signature '(): any' + Type 'Base' provides no match for the signature '(): any'. tests/cases/compiler/intTypeCheck.ts(120,5): error TS2322: Type 'boolean' is not assignable to type 'i2'. tests/cases/compiler/intTypeCheck.ts(120,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(120,22): error TS2693: 'i2' only refers to a type, but is being used as a value here. tests/cases/compiler/intTypeCheck.ts(121,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(126,5): error TS2322: Type '{}' is not assignable to type 'i3'. - Type '{}' provides no match for the signature 'new (): any' + Type '{}' provides no match for the signature 'new (): any'. tests/cases/compiler/intTypeCheck.ts(127,5): error TS2322: Type 'Object' is not assignable to type 'i3'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Type 'Object' provides no match for the signature 'new (): any' + Type 'Object' provides no match for the signature 'new (): any'. tests/cases/compiler/intTypeCheck.ts(129,5): error TS2322: Type 'Base' is not assignable to type 'i3'. - Type 'Base' provides no match for the signature 'new (): any' + Type 'Base' provides no match for the signature 'new (): any'. tests/cases/compiler/intTypeCheck.ts(131,5): error TS2322: Type '() => void' is not assignable to type 'i3'. - Type '() => void' provides no match for the signature 'new (): any' + Type '() => void' provides no match for the signature 'new (): any'. tests/cases/compiler/intTypeCheck.ts(134,5): error TS2322: Type 'boolean' is not assignable to type 'i3'. tests/cases/compiler/intTypeCheck.ts(134,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(134,22): error TS2693: 'i3' only refers to a type, but is being used as a value here. @@ -58,13 +58,13 @@ tests/cases/compiler/intTypeCheck.ts(162,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(162,22): error TS2693: 'i5' only refers to a type, but is being used as a value here. tests/cases/compiler/intTypeCheck.ts(163,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(168,5): error TS2322: Type '{}' is not assignable to type 'i6'. - Type '{}' provides no match for the signature '(): any' + Type '{}' provides no match for the signature '(): any'. tests/cases/compiler/intTypeCheck.ts(169,5): error TS2322: Type 'Object' is not assignable to type 'i6'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Type 'Object' provides no match for the signature '(): any' + Type 'Object' provides no match for the signature '(): any'. tests/cases/compiler/intTypeCheck.ts(170,17): error TS2350: Only a void function can be called with the 'new' keyword. tests/cases/compiler/intTypeCheck.ts(171,5): error TS2322: Type 'Base' is not assignable to type 'i6'. - Type 'Base' provides no match for the signature '(): any' + Type 'Base' provides no match for the signature '(): any'. tests/cases/compiler/intTypeCheck.ts(173,5): error TS2322: Type '() => void' is not assignable to type 'i6'. Type 'void' is not assignable to type 'number'. tests/cases/compiler/intTypeCheck.ts(176,5): error TS2322: Type 'boolean' is not assignable to type 'i6'. @@ -72,14 +72,14 @@ tests/cases/compiler/intTypeCheck.ts(176,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(176,22): error TS2693: 'i6' only refers to a type, but is being used as a value here. tests/cases/compiler/intTypeCheck.ts(177,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(182,5): error TS2322: Type '{}' is not assignable to type 'i7'. - Type '{}' provides no match for the signature 'new (): any' + Type '{}' provides no match for the signature 'new (): any'. tests/cases/compiler/intTypeCheck.ts(183,5): error TS2322: Type 'Object' is not assignable to type 'i7'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Type 'Object' provides no match for the signature 'new (): any' + Type 'Object' provides no match for the signature 'new (): any'. tests/cases/compiler/intTypeCheck.ts(185,17): error TS2352: Type 'Base' cannot be converted to type 'i7'. - Type 'Base' provides no match for the signature 'new (): any' + Type 'Base' provides no match for the signature 'new (): any'. tests/cases/compiler/intTypeCheck.ts(187,5): error TS2322: Type '() => void' is not assignable to type 'i7'. - Type '() => void' provides no match for the signature 'new (): any' + Type '() => void' provides no match for the signature 'new (): any'. tests/cases/compiler/intTypeCheck.ts(190,5): error TS2322: Type 'boolean' is not assignable to type 'i7'. tests/cases/compiler/intTypeCheck.ts(190,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(190,22): error TS2693: 'i7' only refers to a type, but is being used as a value here. @@ -232,19 +232,19 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj12: i2 = {}; ~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'i2'. -!!! error TS2322: Type '{}' provides no match for the signature '(): any' +!!! error TS2322: Type '{}' provides no match for the signature '(): any'. var obj13: i2 = new Object(); ~~~~~ !!! error TS2322: Type 'Object' is not assignable to type 'i2'. !!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Type 'Object' provides no match for the signature '(): any' +!!! error TS2322: Type 'Object' provides no match for the signature '(): any'. var obj14: i2 = new obj11; ~~~~~~~~~ !!! error TS2350: Only a void function can be called with the 'new' keyword. var obj15: i2 = new Base; ~~~~~ !!! error TS2322: Type 'Base' is not assignable to type 'i2'. -!!! error TS2322: Type 'Base' provides no match for the signature '(): any' +!!! error TS2322: Type 'Base' provides no match for the signature '(): any'. var obj16: i2 = null; var obj17: i2 = function ():any { return 0; }; //var obj18: i2 = function foo() { }; @@ -266,22 +266,22 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj23: i3 = {}; ~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'i3'. -!!! error TS2322: Type '{}' provides no match for the signature 'new (): any' +!!! error TS2322: Type '{}' provides no match for the signature 'new (): any'. var obj24: i3 = new Object(); ~~~~~ !!! error TS2322: Type 'Object' is not assignable to type 'i3'. !!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' +!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'. var obj25: i3 = new obj22; var obj26: i3 = new Base; ~~~~~ !!! error TS2322: Type 'Base' is not assignable to type 'i3'. -!!! error TS2322: Type 'Base' provides no match for the signature 'new (): any' +!!! error TS2322: Type 'Base' provides no match for the signature 'new (): any'. var obj27: i3 = null; var obj28: i3 = function () { }; ~~~~~ !!! error TS2322: Type '() => void' is not assignable to type 'i3'. -!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any' +!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any'. //var obj29: i3 = function foo() { }; var obj30: i3 = anyVar; var obj31: i3 = new anyVar; @@ -362,19 +362,19 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj56: i6 = {}; ~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'i6'. -!!! error TS2322: Type '{}' provides no match for the signature '(): any' +!!! error TS2322: Type '{}' provides no match for the signature '(): any'. var obj57: i6 = new Object(); ~~~~~ !!! error TS2322: Type 'Object' is not assignable to type 'i6'. !!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Type 'Object' provides no match for the signature '(): any' +!!! error TS2322: Type 'Object' provides no match for the signature '(): any'. var obj58: i6 = new obj55; ~~~~~~~~~ !!! error TS2350: Only a void function can be called with the 'new' keyword. var obj59: i6 = new Base; ~~~~~ !!! error TS2322: Type 'Base' is not assignable to type 'i6'. -!!! error TS2322: Type 'Base' provides no match for the signature '(): any' +!!! error TS2322: Type 'Base' provides no match for the signature '(): any'. var obj60: i6 = null; var obj61: i6 = function () { }; ~~~~~ @@ -399,22 +399,22 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj67: i7 = {}; ~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'i7'. -!!! error TS2322: Type '{}' provides no match for the signature 'new (): any' +!!! error TS2322: Type '{}' provides no match for the signature 'new (): any'. var obj68: i7 = new Object(); ~~~~~ !!! error TS2322: Type 'Object' is not assignable to type 'i7'. !!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' +!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'. var obj69: i7 = new obj66; var obj70: i7 = new Base; ~~~~~~~~~~~~ !!! error TS2352: Type 'Base' cannot be converted to type 'i7'. -!!! error TS2352: Type 'Base' provides no match for the signature 'new (): any' +!!! error TS2352: Type 'Base' provides no match for the signature 'new (): any'. var obj71: i7 = null; var obj72: i7 = function () { }; ~~~~~ !!! error TS2322: Type '() => void' is not assignable to type 'i7'. -!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any' +!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any'. //var obj73: i7 = function foo() { }; var obj74: i7 = anyVar; var obj75: i7 = new anyVar; diff --git a/tests/baselines/reference/interfaceImplementation1.errors.txt b/tests/baselines/reference/interfaceImplementation1.errors.txt index e5e1a212a06..9f061b6c5c0 100644 --- a/tests/baselines/reference/interfaceImplementation1.errors.txt +++ b/tests/baselines/reference/interfaceImplementation1.errors.txt @@ -3,7 +3,7 @@ tests/cases/compiler/interfaceImplementation1.ts(12,7): error TS2420: Class 'C1' tests/cases/compiler/interfaceImplementation1.ts(12,7): error TS2420: Class 'C1' incorrectly implements interface 'I2'. Property 'iFn' is private in type 'C1' but not in type 'I2'. tests/cases/compiler/interfaceImplementation1.ts(34,5): error TS2322: Type '() => C2' is not assignable to type 'I4'. - Type '() => C2' provides no match for the signature 'new (): I3' + Type '() => C2' provides no match for the signature 'new (): I3'. ==== tests/cases/compiler/interfaceImplementation1.ts (3 errors) ==== @@ -49,7 +49,7 @@ tests/cases/compiler/interfaceImplementation1.ts(34,5): error TS2322: Type '() = var a:I4 = function(){ ~ !!! error TS2322: Type '() => C2' is not assignable to type 'I4'. -!!! error TS2322: Type '() => C2' provides no match for the signature 'new (): I3' +!!! error TS2322: Type '() => C2' provides no match for the signature 'new (): I3'. return new C2(); } new a(); diff --git a/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt b/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt index 902e4b448b5..1925079095a 100644 --- a/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt +++ b/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(1,11): error TS2427: Interface name cannot be 'any' -tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(2,11): error TS2427: Interface name cannot be 'number' -tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(3,11): error TS2427: Interface name cannot be 'string' -tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(4,11): error TS2427: Interface name cannot be 'boolean' +tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(1,11): error TS2427: Interface name cannot be 'any'. +tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(2,11): error TS2427: Interface name cannot be 'number'. +tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(3,11): error TS2427: Interface name cannot be 'string'. +tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(4,11): error TS2427: Interface name cannot be 'boolean'. tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(5,1): error TS2304: Cannot find name 'interface'. tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(5,11): error TS1005: ';' expected. @@ -9,16 +9,16 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefine ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts (6 errors) ==== interface any { } ~~~ -!!! error TS2427: Interface name cannot be 'any' +!!! error TS2427: Interface name cannot be 'any'. interface number { } ~~~~~~ -!!! error TS2427: Interface name cannot be 'number' +!!! error TS2427: Interface name cannot be 'number'. interface string { } ~~~~~~ -!!! error TS2427: Interface name cannot be 'string' +!!! error TS2427: Interface name cannot be 'string'. interface boolean { } ~~~~~~~ -!!! error TS2427: Interface name cannot be 'boolean' +!!! error TS2427: Interface name cannot be 'boolean'. interface void {} ~~~~~~~~~ !!! error TS2304: Cannot find name 'interface'. diff --git a/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt b/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt index 1292efd8a08..8aac049b344 100644 --- a/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt +++ b/tests/baselines/reference/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.ts(11,16): error TS2437: Module 'A' is hidden by a local declaration with the same name +tests/cases/compiler/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.ts(11,16): error TS2437: Module 'A' is hidden by a local declaration with the same name. ==== tests/cases/compiler/internalImportInstantiatedModuleMergedWithClassNotReferencingInstance.ts (1 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/internalImportInstantiatedModuleMergedWithClassNotReferenci var A = 1; import Y = A; ~ -!!! error TS2437: Module 'A' is hidden by a local declaration with the same name +!!! error TS2437: Module 'A' is hidden by a local declaration with the same name. } \ No newline at end of file diff --git a/tests/baselines/reference/internalImportInstantiatedModuleNotReferencingInstance.errors.txt b/tests/baselines/reference/internalImportInstantiatedModuleNotReferencingInstance.errors.txt index 5146966c3a4..fa7038fd49f 100644 --- a/tests/baselines/reference/internalImportInstantiatedModuleNotReferencingInstance.errors.txt +++ b/tests/baselines/reference/internalImportInstantiatedModuleNotReferencingInstance.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/internalImportInstantiatedModuleNotReferencingInstance.ts(8,16): error TS2437: Module 'A' is hidden by a local declaration with the same name +tests/cases/compiler/internalImportInstantiatedModuleNotReferencingInstance.ts(8,16): error TS2437: Module 'A' is hidden by a local declaration with the same name. ==== tests/cases/compiler/internalImportInstantiatedModuleNotReferencingInstance.ts (1 errors) ==== @@ -11,6 +11,6 @@ tests/cases/compiler/internalImportInstantiatedModuleNotReferencingInstance.ts(8 var A = 1; import Y = A; ~ -!!! error TS2437: Module 'A' is hidden by a local declaration with the same name +!!! error TS2437: Module 'A' is hidden by a local declaration with the same name. } \ No newline at end of file diff --git a/tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt b/tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt index 9f5cba24873..c744b629cae 100644 --- a/tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt +++ b/tests/baselines/reference/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstance.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstance.ts(10,16): error TS2437: Module 'A' is hidden by a local declaration with the same name +tests/cases/compiler/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstance.ts(10,16): error TS2437: Module 'A' is hidden by a local declaration with the same name. ==== tests/cases/compiler/internalImportUnInstantiatedModuleMergedWithClassNotReferencingInstance.ts (1 errors) ==== @@ -13,6 +13,6 @@ tests/cases/compiler/internalImportUnInstantiatedModuleMergedWithClassNotReferen var A = 1; import Y = A; ~ -!!! error TS2437: Module 'A' is hidden by a local declaration with the same name +!!! error TS2437: Module 'A' is hidden by a local declaration with the same name. } \ No newline at end of file diff --git a/tests/baselines/reference/invalidNestedModules.errors.txt b/tests/baselines/reference/invalidNestedModules.errors.txt index 1f9551a0f0b..93daeb6dd60 100644 --- a/tests/baselines/reference/invalidNestedModules.errors.txt +++ b/tests/baselines/reference/invalidNestedModules.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts(1,12): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts(1,12): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts(17,18): error TS2300: Duplicate identifier 'Point'. tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts(24,20): error TS2300: Duplicate identifier 'Point'. @@ -6,7 +6,7 @@ tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules. ==== tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts (3 errors) ==== module A.B.C { ~ -!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. export class Point { x: number; y: number; diff --git a/tests/baselines/reference/jsDocTypes.js b/tests/baselines/reference/jsDocTypes.js new file mode 100644 index 00000000000..a6df2f361c6 --- /dev/null +++ b/tests/baselines/reference/jsDocTypes.js @@ -0,0 +1,137 @@ +//// [tests/cases/conformance/salsa/jsDocTypes.ts] //// + +//// [a.js] + +/** @type {String} */ +var S; + +/** @type {string} */ +var s; + +/** @type {Number} */ +var N; + +/** @type {number} */ +var n; + +/** @type {Boolean} */ +var B; + +/** @type {boolean} */ +var b; + +/** @type {Void} */ +var V; + +/** @type {void} */ +var v; + +/** @type {Undefined} */ +var U; + +/** @type {undefined} */ +var u; + +/** @type {Null} */ +var Nl; + +/** @type {null} */ +var nl; + +/** @type {Array} */ +var A; + +/** @type {array} */ +var a; + +/** @type {Promise} */ +var P; + +/** @type {promise} */ +var p; + +/** @type {?number} */ +var nullable; + +/** @type {Object} */ +var Obj; + + + +//// [b.ts] +var S: string; +var s: string; +var N: number; +var n: number +var B: boolean; +var b: boolean; +var V :void; +var v: void; +var U: undefined; +var u: undefined; +var Nl: null; +var nl: null; +var A: any[]; +var a: any[]; +var P: Promise; +var p: Promise; +var nullable: number | null; +var Obj: any; + + +//// [a.js] +/** @type {String} */ +var S; +/** @type {string} */ +var s; +/** @type {Number} */ +var N; +/** @type {number} */ +var n; +/** @type {Boolean} */ +var B; +/** @type {boolean} */ +var b; +/** @type {Void} */ +var V; +/** @type {void} */ +var v; +/** @type {Undefined} */ +var U; +/** @type {undefined} */ +var u; +/** @type {Null} */ +var Nl; +/** @type {null} */ +var nl; +/** @type {Array} */ +var A; +/** @type {array} */ +var a; +/** @type {Promise} */ +var P; +/** @type {promise} */ +var p; +/** @type {?number} */ +var nullable; +/** @type {Object} */ +var Obj; +//// [b.js] +var S; +var s; +var N; +var n; +var B; +var b; +var V; +var v; +var U; +var u; +var Nl; +var nl; +var A; +var a; +var P; +var p; +var nullable; +var Obj; diff --git a/tests/baselines/reference/jsDocTypes.symbols b/tests/baselines/reference/jsDocTypes.symbols new file mode 100644 index 00000000000..9bde032cb44 --- /dev/null +++ b/tests/baselines/reference/jsDocTypes.symbols @@ -0,0 +1,133 @@ +=== tests/cases/conformance/salsa/a.js === + +/** @type {String} */ +var S; +>S : Symbol(S, Decl(a.js, 2, 3), Decl(b.ts, 0, 3)) + +/** @type {string} */ +var s; +>s : Symbol(s, Decl(a.js, 5, 3), Decl(b.ts, 1, 3)) + +/** @type {Number} */ +var N; +>N : Symbol(N, Decl(a.js, 8, 3), Decl(b.ts, 2, 3)) + +/** @type {number} */ +var n; +>n : Symbol(n, Decl(a.js, 11, 3), Decl(b.ts, 3, 3)) + +/** @type {Boolean} */ +var B; +>B : Symbol(B, Decl(a.js, 14, 3), Decl(b.ts, 4, 3)) + +/** @type {boolean} */ +var b; +>b : Symbol(b, Decl(a.js, 17, 3), Decl(b.ts, 5, 3)) + +/** @type {Void} */ +var V; +>V : Symbol(V, Decl(a.js, 20, 3), Decl(b.ts, 6, 3)) + +/** @type {void} */ +var v; +>v : Symbol(v, Decl(a.js, 23, 3), Decl(b.ts, 7, 3)) + +/** @type {Undefined} */ +var U; +>U : Symbol(U, Decl(a.js, 26, 3), Decl(b.ts, 8, 3)) + +/** @type {undefined} */ +var u; +>u : Symbol(u, Decl(a.js, 29, 3), Decl(b.ts, 9, 3)) + +/** @type {Null} */ +var Nl; +>Nl : Symbol(Nl, Decl(a.js, 32, 3), Decl(b.ts, 10, 3)) + +/** @type {null} */ +var nl; +>nl : Symbol(nl, Decl(a.js, 35, 3), Decl(b.ts, 11, 3)) + +/** @type {Array} */ +var A; +>A : Symbol(A, Decl(a.js, 38, 3), Decl(b.ts, 12, 3)) + +/** @type {array} */ +var a; +>a : Symbol(a, Decl(a.js, 41, 3), Decl(b.ts, 13, 3)) + +/** @type {Promise} */ +var P; +>P : Symbol(P, Decl(a.js, 44, 3), Decl(b.ts, 14, 3)) + +/** @type {promise} */ +var p; +>p : Symbol(p, Decl(a.js, 47, 3), Decl(b.ts, 15, 3)) + +/** @type {?number} */ +var nullable; +>nullable : Symbol(nullable, Decl(a.js, 50, 3), Decl(b.ts, 16, 3)) + +/** @type {Object} */ +var Obj; +>Obj : Symbol(Obj, Decl(a.js, 53, 3), Decl(b.ts, 17, 3)) + + + +=== tests/cases/conformance/salsa/b.ts === +var S: string; +>S : Symbol(S, Decl(a.js, 2, 3), Decl(b.ts, 0, 3)) + +var s: string; +>s : Symbol(s, Decl(a.js, 5, 3), Decl(b.ts, 1, 3)) + +var N: number; +>N : Symbol(N, Decl(a.js, 8, 3), Decl(b.ts, 2, 3)) + +var n: number +>n : Symbol(n, Decl(a.js, 11, 3), Decl(b.ts, 3, 3)) + +var B: boolean; +>B : Symbol(B, Decl(a.js, 14, 3), Decl(b.ts, 4, 3)) + +var b: boolean; +>b : Symbol(b, Decl(a.js, 17, 3), Decl(b.ts, 5, 3)) + +var V :void; +>V : Symbol(V, Decl(a.js, 20, 3), Decl(b.ts, 6, 3)) + +var v: void; +>v : Symbol(v, Decl(a.js, 23, 3), Decl(b.ts, 7, 3)) + +var U: undefined; +>U : Symbol(U, Decl(a.js, 26, 3), Decl(b.ts, 8, 3)) + +var u: undefined; +>u : Symbol(u, Decl(a.js, 29, 3), Decl(b.ts, 9, 3)) + +var Nl: null; +>Nl : Symbol(Nl, Decl(a.js, 32, 3), Decl(b.ts, 10, 3)) + +var nl: null; +>nl : Symbol(nl, Decl(a.js, 35, 3), Decl(b.ts, 11, 3)) + +var A: any[]; +>A : Symbol(A, Decl(a.js, 38, 3), Decl(b.ts, 12, 3)) + +var a: any[]; +>a : Symbol(a, Decl(a.js, 41, 3), Decl(b.ts, 13, 3)) + +var P: Promise; +>P : Symbol(P, Decl(a.js, 44, 3), Decl(b.ts, 14, 3)) +>Promise : Symbol(Promise, Decl(lib.d.ts, --, --)) + +var p: Promise; +>p : Symbol(p, Decl(a.js, 47, 3), Decl(b.ts, 15, 3)) +>Promise : Symbol(Promise, Decl(lib.d.ts, --, --)) + +var nullable: number | null; +>nullable : Symbol(nullable, Decl(a.js, 50, 3), Decl(b.ts, 16, 3)) + +var Obj: any; +>Obj : Symbol(Obj, Decl(a.js, 53, 3), Decl(b.ts, 17, 3)) + diff --git a/tests/baselines/reference/jsDocTypes.types b/tests/baselines/reference/jsDocTypes.types new file mode 100644 index 00000000000..c0214edf627 --- /dev/null +++ b/tests/baselines/reference/jsDocTypes.types @@ -0,0 +1,136 @@ +=== tests/cases/conformance/salsa/a.js === + +/** @type {String} */ +var S; +>S : string + +/** @type {string} */ +var s; +>s : string + +/** @type {Number} */ +var N; +>N : number + +/** @type {number} */ +var n; +>n : number + +/** @type {Boolean} */ +var B; +>B : boolean + +/** @type {boolean} */ +var b; +>b : boolean + +/** @type {Void} */ +var V; +>V : void + +/** @type {void} */ +var v; +>v : void + +/** @type {Undefined} */ +var U; +>U : undefined + +/** @type {undefined} */ +var u; +>u : undefined + +/** @type {Null} */ +var Nl; +>Nl : null + +/** @type {null} */ +var nl; +>nl : null + +/** @type {Array} */ +var A; +>A : any[] + +/** @type {array} */ +var a; +>a : any[] + +/** @type {Promise} */ +var P; +>P : Promise + +/** @type {promise} */ +var p; +>p : Promise + +/** @type {?number} */ +var nullable; +>nullable : number | null + +/** @type {Object} */ +var Obj; +>Obj : any + + + +=== tests/cases/conformance/salsa/b.ts === +var S: string; +>S : string + +var s: string; +>s : string + +var N: number; +>N : number + +var n: number +>n : number + +var B: boolean; +>B : boolean + +var b: boolean; +>b : boolean + +var V :void; +>V : void + +var v: void; +>v : void + +var U: undefined; +>U : undefined + +var u: undefined; +>u : undefined + +var Nl: null; +>Nl : null +>null : null + +var nl: null; +>nl : null +>null : null + +var A: any[]; +>A : any[] + +var a: any[]; +>a : any[] + +var P: Promise; +>P : Promise +>Promise : Promise + +var p: Promise; +>p : Promise +>Promise : Promise + +var nullable: number | null; +>nullable : number | null +>null : null + +var Obj: any; +>Obj : any + diff --git a/tests/baselines/reference/jsFileCompilationAbstractModifier.errors.txt b/tests/baselines/reference/jsFileCompilationAbstractModifier.errors.txt index c7d2ad270be..48bf64ac109 100644 --- a/tests/baselines/reference/jsFileCompilationAbstractModifier.errors.txt +++ b/tests/baselines/reference/jsFileCompilationAbstractModifier.errors.txt @@ -1,11 +1,11 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,1): error TS8009: 'abstract' can only be used in a .ts file. tests/cases/compiler/a.js(2,5): error TS8009: 'abstract' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (2 errors) ==== abstract class c { ~~~~~~~~ diff --git a/tests/baselines/reference/jsFileCompilationAmbientVarDeclarationSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationAmbientVarDeclarationSyntax.errors.txt index 039834ff702..75451b15389 100644 --- a/tests/baselines/reference/jsFileCompilationAmbientVarDeclarationSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationAmbientVarDeclarationSyntax.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,1): error TS8009: 'declare' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== declare var v; ~~~~~~~ diff --git a/tests/baselines/reference/jsFileCompilationBindStrictModeErrors.errors.txt b/tests/baselines/reference/jsFileCompilationBindStrictModeErrors.errors.txt index 3cc2f5f085f..d681cec3775 100644 --- a/tests/baselines/reference/jsFileCompilationBindStrictModeErrors.errors.txt +++ b/tests/baselines/reference/jsFileCompilationBindStrictModeErrors.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/a.js(5,5): error TS1117: An object literal cannot have multiple properties with the same name in strict mode. -tests/cases/compiler/a.js(7,5): error TS1212: Identifier expected. 'let' is a reserved word in strict mode +tests/cases/compiler/a.js(7,5): error TS1212: Identifier expected. 'let' is a reserved word in strict mode. tests/cases/compiler/a.js(8,8): error TS1102: 'delete' cannot be called on an identifier in strict mode. tests/cases/compiler/a.js(10,10): error TS1100: Invalid use of 'eval' in strict mode. tests/cases/compiler/a.js(12,10): error TS1100: Invalid use of 'arguments' in strict mode. @@ -23,7 +23,7 @@ tests/cases/compiler/d.js(2,11): error TS1005: ',' expected. }; var let = 10; // error ~~~ -!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode. delete a; // error ~ !!! error TS1102: 'delete' cannot be called on an identifier in strict mode. diff --git a/tests/baselines/reference/jsFileCompilationEmitBlockedCorrectly.errors.txt b/tests/baselines/reference/jsFileCompilationEmitBlockedCorrectly.errors.txt index 75bcf88b10a..234c9156cc1 100644 --- a/tests/baselines/reference/jsFileCompilationEmitBlockedCorrectly.errors.txt +++ b/tests/baselines/reference/jsFileCompilationEmitBlockedCorrectly.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. error TS5056: Cannot write file 'tests/cases/compiler/a.js' because it would be overwritten by multiple input files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS5056: Cannot write file 'tests/cases/compiler/a.js' because it would be overwritten by multiple input files. ==== tests/cases/compiler/a.ts (0 errors) ==== class c { diff --git a/tests/baselines/reference/jsFileCompilationEnumSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationEnumSyntax.errors.txt index c6da8931d5e..85d3b5ef798 100644 --- a/tests/baselines/reference/jsFileCompilationEnumSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationEnumSyntax.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,6): error TS8015: 'enum declarations' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== enum E { } ~ diff --git a/tests/baselines/reference/jsFileCompilationErrorOnDeclarationsWithJsFileReferenceWithNoOut.errors.txt b/tests/baselines/reference/jsFileCompilationErrorOnDeclarationsWithJsFileReferenceWithNoOut.errors.txt index 54e91c5d196..c9937ecd359 100644 --- a/tests/baselines/reference/jsFileCompilationErrorOnDeclarationsWithJsFileReferenceWithNoOut.errors.txt +++ b/tests/baselines/reference/jsFileCompilationErrorOnDeclarationsWithJsFileReferenceWithNoOut.errors.txt @@ -1,11 +1,11 @@ error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. error TS5055: Cannot write file 'tests/cases/compiler/c.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. !!! error TS5055: Cannot write file 'tests/cases/compiler/c.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.ts (0 errors) ==== class c { } diff --git a/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt index babbeea8004..e3df8cf5d94 100644 --- a/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,1): error TS8003: 'export=' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== export = b; ~~~~~~~~~~~ diff --git a/tests/baselines/reference/jsFileCompilationHeritageClauseSyntaxOfClass.errors.txt b/tests/baselines/reference/jsFileCompilationHeritageClauseSyntaxOfClass.errors.txt index 3b30663308f..95e967401a8 100644 --- a/tests/baselines/reference/jsFileCompilationHeritageClauseSyntaxOfClass.errors.txt +++ b/tests/baselines/reference/jsFileCompilationHeritageClauseSyntaxOfClass.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,9): error TS8005: 'implements clauses' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== class C implements D { } ~~~~~~~~~~~~ diff --git a/tests/baselines/reference/jsFileCompilationImportEqualsSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationImportEqualsSyntax.errors.txt index a064f53e92f..d6d0ce64d44 100644 --- a/tests/baselines/reference/jsFileCompilationImportEqualsSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationImportEqualsSyntax.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,1): error TS8002: 'import ... =' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== import a = b; ~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/jsFileCompilationInterfaceSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationInterfaceSyntax.errors.txt index 9e53438c732..be051cafc86 100644 --- a/tests/baselines/reference/jsFileCompilationInterfaceSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationInterfaceSyntax.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,11): error TS8006: 'interface declarations' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== interface I { } ~ diff --git a/tests/baselines/reference/jsFileCompilationModuleSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationModuleSyntax.errors.txt index 6952c0055c0..cd0bd8ef91a 100644 --- a/tests/baselines/reference/jsFileCompilationModuleSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationModuleSyntax.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,8): error TS8007: 'module declarations' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== module M { } ~ diff --git a/tests/baselines/reference/jsFileCompilationNoErrorWithoutDeclarationsWithJsFileReferenceWithNoOut.errors.txt b/tests/baselines/reference/jsFileCompilationNoErrorWithoutDeclarationsWithJsFileReferenceWithNoOut.errors.txt index 888310414f2..fef38ae7549 100644 --- a/tests/baselines/reference/jsFileCompilationNoErrorWithoutDeclarationsWithJsFileReferenceWithNoOut.errors.txt +++ b/tests/baselines/reference/jsFileCompilationNoErrorWithoutDeclarationsWithJsFileReferenceWithNoOut.errors.txt @@ -1,9 +1,9 @@ error TS5055: Cannot write file 'tests/cases/compiler/c.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS5055: Cannot write file 'tests/cases/compiler/c.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.ts (0 errors) ==== class c { } diff --git a/tests/baselines/reference/jsFileCompilationOptionalParameter.errors.txt b/tests/baselines/reference/jsFileCompilationOptionalParameter.errors.txt index 15bfe2281d9..a340f3d6d1b 100644 --- a/tests/baselines/reference/jsFileCompilationOptionalParameter.errors.txt +++ b/tests/baselines/reference/jsFileCompilationOptionalParameter.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,13): error TS8009: '?' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== function F(p?) { } ~ diff --git a/tests/baselines/reference/jsFileCompilationPublicMethodSyntaxOfClass.errors.txt b/tests/baselines/reference/jsFileCompilationPublicMethodSyntaxOfClass.errors.txt index af95c136205..2f2cccf83d8 100644 --- a/tests/baselines/reference/jsFileCompilationPublicMethodSyntaxOfClass.errors.txt +++ b/tests/baselines/reference/jsFileCompilationPublicMethodSyntaxOfClass.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(2,5): error TS8009: 'public' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== class C { public foo() { diff --git a/tests/baselines/reference/jsFileCompilationPublicParameterModifier.errors.txt b/tests/baselines/reference/jsFileCompilationPublicParameterModifier.errors.txt index 9314e1da807..6f266b7df31 100644 --- a/tests/baselines/reference/jsFileCompilationPublicParameterModifier.errors.txt +++ b/tests/baselines/reference/jsFileCompilationPublicParameterModifier.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,23): error TS8012: 'parameter modifiers' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== class C { constructor(public x) { }} ~~~~~~ diff --git a/tests/baselines/reference/jsFileCompilationRestParamJsDocFunction.types b/tests/baselines/reference/jsFileCompilationRestParamJsDocFunction.types index c420454b8cf..f40e9164c38 100644 --- a/tests/baselines/reference/jsFileCompilationRestParamJsDocFunction.types +++ b/tests/baselines/reference/jsFileCompilationRestParamJsDocFunction.types @@ -11,8 +11,8 @@ * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { ->apply : (func: Function, thisArg: any, ...args: any[]) => any ->func : Function +>apply : (func: {}, thisArg: any, ...args: any[]) => any +>func : {} >thisArg : any >args : any[] @@ -29,7 +29,7 @@ function apply(func, thisArg, args) { >0 : 0 >func.call(thisArg) : any >func.call : (this: Function, thisArg: any, ...argArray: any[]) => any ->func : Function +>func : {} >call : (this: Function, thisArg: any, ...argArray: any[]) => any >thisArg : any @@ -37,7 +37,7 @@ function apply(func, thisArg, args) { >1 : 1 >func.call(thisArg, args[0]) : any >func.call : (this: Function, thisArg: any, ...argArray: any[]) => any ->func : Function +>func : {} >call : (this: Function, thisArg: any, ...argArray: any[]) => any >thisArg : any >args[0] : any @@ -48,7 +48,7 @@ function apply(func, thisArg, args) { >2 : 2 >func.call(thisArg, args[0], args[1]) : any >func.call : (this: Function, thisArg: any, ...argArray: any[]) => any ->func : Function +>func : {} >call : (this: Function, thisArg: any, ...argArray: any[]) => any >thisArg : any >args[0] : any @@ -62,7 +62,7 @@ function apply(func, thisArg, args) { >3 : 3 >func.call(thisArg, args[0], args[1], args[2]) : any >func.call : (this: Function, thisArg: any, ...argArray: any[]) => any ->func : Function +>func : {} >call : (this: Function, thisArg: any, ...argArray: any[]) => any >thisArg : any >args[0] : any @@ -78,12 +78,12 @@ function apply(func, thisArg, args) { return func.apply(thisArg, args); >func.apply(thisArg, args) : any >func.apply : (this: Function, thisArg: any, argArray?: any) => any ->func : Function +>func : {} >apply : (this: Function, thisArg: any, argArray?: any) => any >thisArg : any >args : any[] } export default apply; ->apply : (func: Function, thisArg: any, ...args: any[]) => any +>apply : (func: {}, thisArg: any, ...args: any[]) => any diff --git a/tests/baselines/reference/jsFileCompilationReturnTypeSyntaxOfFunction.errors.txt b/tests/baselines/reference/jsFileCompilationReturnTypeSyntaxOfFunction.errors.txt index acae950d081..f43d221d6a9 100644 --- a/tests/baselines/reference/jsFileCompilationReturnTypeSyntaxOfFunction.errors.txt +++ b/tests/baselines/reference/jsFileCompilationReturnTypeSyntaxOfFunction.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,15): error TS8010: 'types' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== function F(): number { } ~~~~~~ diff --git a/tests/baselines/reference/jsFileCompilationSyntaxError.errors.txt b/tests/baselines/reference/jsFileCompilationSyntaxError.errors.txt index eb4c114d3d0..357f49f97bc 100644 --- a/tests/baselines/reference/jsFileCompilationSyntaxError.errors.txt +++ b/tests/baselines/reference/jsFileCompilationSyntaxError.errors.txt @@ -1,9 +1,9 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (0 errors) ==== /** * @type {number} diff --git a/tests/baselines/reference/jsFileCompilationTypeAliasSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationTypeAliasSyntax.errors.txt index 74978eddf8c..dd7c1d858e6 100644 --- a/tests/baselines/reference/jsFileCompilationTypeAliasSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeAliasSyntax.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,6): error TS8008: 'type aliases' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== type a = b; ~ diff --git a/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.errors.txt b/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.errors.txt index f53ec55d2b1..8d8a1a1a83e 100644 --- a/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,5): error TS8011: 'type arguments' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== Foo(); ~~~~~~ diff --git a/tests/baselines/reference/jsFileCompilationTypeAssertions.errors.txt b/tests/baselines/reference/jsFileCompilationTypeAssertions.errors.txt index be1e6d32436..3ec792c79fe 100644 --- a/tests/baselines/reference/jsFileCompilationTypeAssertions.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeAssertions.errors.txt @@ -1,11 +1,11 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,10): error TS17008: JSX element 'string' has no corresponding closing tag. tests/cases/compiler/a.js(1,27): error TS1005: 'undefined; ~~~~~~ diff --git a/tests/baselines/reference/jsFileCompilationTypeOfParameter.errors.txt b/tests/baselines/reference/jsFileCompilationTypeOfParameter.errors.txt index 811c0793ffe..754d83cff0c 100644 --- a/tests/baselines/reference/jsFileCompilationTypeOfParameter.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeOfParameter.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,15): error TS8010: 'types' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== function F(a: number) { } ~~~~~~ diff --git a/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfClass.errors.txt b/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfClass.errors.txt index 0fe902aa661..7f27e1e8211 100644 --- a/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfClass.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfClass.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,9): error TS8004: 'type parameter declarations' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== class C { } ~ diff --git a/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfFunction.errors.txt b/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfFunction.errors.txt index bfc4c7be26a..12b53c41b97 100644 --- a/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfFunction.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeParameterSyntaxOfFunction.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,12): error TS8004: 'type parameter declarations' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== function F() { } ~ diff --git a/tests/baselines/reference/jsFileCompilationTypeSyntaxOfVar.errors.txt b/tests/baselines/reference/jsFileCompilationTypeSyntaxOfVar.errors.txt index 65333751780..9c7dd647ca7 100644 --- a/tests/baselines/reference/jsFileCompilationTypeSyntaxOfVar.errors.txt +++ b/tests/baselines/reference/jsFileCompilationTypeSyntaxOfVar.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. tests/cases/compiler/a.js(1,8): error TS8010: 'types' can only be used in a .ts file. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.js (1 errors) ==== var v: () => number; ~~~~~~~~~~~~ diff --git a/tests/baselines/reference/jsFileCompilationWithDeclarationEmitPathSameAsInput.errors.txt b/tests/baselines/reference/jsFileCompilationWithDeclarationEmitPathSameAsInput.errors.txt index 4170e818fd7..b44d0752512 100644 --- a/tests/baselines/reference/jsFileCompilationWithDeclarationEmitPathSameAsInput.errors.txt +++ b/tests/baselines/reference/jsFileCompilationWithDeclarationEmitPathSameAsInput.errors.txt @@ -1,9 +1,9 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.d.ts' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.d.ts' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.ts (0 errors) ==== class c { } diff --git a/tests/baselines/reference/jsFileCompilationWithJsEmitPathSameAsInput.errors.txt b/tests/baselines/reference/jsFileCompilationWithJsEmitPathSameAsInput.errors.txt index 8004efd02ef..b00b55304e1 100644 --- a/tests/baselines/reference/jsFileCompilationWithJsEmitPathSameAsInput.errors.txt +++ b/tests/baselines/reference/jsFileCompilationWithJsEmitPathSameAsInput.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. error TS5056: Cannot write file 'tests/cases/compiler/a.js' because it would be overwritten by multiple input files. !!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS5056: Cannot write file 'tests/cases/compiler/a.js' because it would be overwritten by multiple input files. ==== tests/cases/compiler/a.ts (0 errors) ==== class c { diff --git a/tests/baselines/reference/jsFileCompilationWithMapFileAsJs.errors.txt b/tests/baselines/reference/jsFileCompilationWithMapFileAsJs.errors.txt index 069c562f29b..84dfd78e6a3 100644 --- a/tests/baselines/reference/jsFileCompilationWithMapFileAsJs.errors.txt +++ b/tests/baselines/reference/jsFileCompilationWithMapFileAsJs.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. error TS6054: File 'tests/cases/compiler/b.js.map' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. !!! error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS6054: File 'tests/cases/compiler/b.js.map' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. ==== tests/cases/compiler/a.ts (0 errors) ==== diff --git a/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithInlineSourceMap.errors.txt b/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithInlineSourceMap.errors.txt index 069c562f29b..84dfd78e6a3 100644 --- a/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithInlineSourceMap.errors.txt +++ b/tests/baselines/reference/jsFileCompilationWithMapFileAsJsWithInlineSourceMap.errors.txt @@ -1,10 +1,10 @@ error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. error TS6054: File 'tests/cases/compiler/b.js.map' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. !!! error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS6054: File 'tests/cases/compiler/b.js.map' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'. ==== tests/cases/compiler/a.ts (0 errors) ==== diff --git a/tests/baselines/reference/jsFileCompilationWithOutDeclarationFileNameSameAsInputJsFile.errors.txt b/tests/baselines/reference/jsFileCompilationWithOutDeclarationFileNameSameAsInputJsFile.errors.txt index 0a4f0cdf1a4..e10ec91b4c5 100644 --- a/tests/baselines/reference/jsFileCompilationWithOutDeclarationFileNameSameAsInputJsFile.errors.txt +++ b/tests/baselines/reference/jsFileCompilationWithOutDeclarationFileNameSameAsInputJsFile.errors.txt @@ -1,9 +1,9 @@ error TS5055: Cannot write file 'tests/cases/compiler/b.d.ts' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS5055: Cannot write file 'tests/cases/compiler/b.d.ts' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.ts (0 errors) ==== class c { } diff --git a/tests/baselines/reference/jsFileCompilationWithOutFileNameSameAsInputJsFile.errors.txt b/tests/baselines/reference/jsFileCompilationWithOutFileNameSameAsInputJsFile.errors.txt index 3f72a8113ef..06df925215b 100644 --- a/tests/baselines/reference/jsFileCompilationWithOutFileNameSameAsInputJsFile.errors.txt +++ b/tests/baselines/reference/jsFileCompilationWithOutFileNameSameAsInputJsFile.errors.txt @@ -1,9 +1,9 @@ error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.ts (0 errors) ==== class c { } diff --git a/tests/baselines/reference/jsFileCompilationWithoutOut.errors.txt b/tests/baselines/reference/jsFileCompilationWithoutOut.errors.txt index 3f72a8113ef..06df925215b 100644 --- a/tests/baselines/reference/jsFileCompilationWithoutOut.errors.txt +++ b/tests/baselines/reference/jsFileCompilationWithoutOut.errors.txt @@ -1,9 +1,9 @@ error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS5055: Cannot write file 'tests/cases/compiler/b.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== tests/cases/compiler/a.ts (0 errors) ==== class c { } diff --git a/tests/baselines/reference/jsxEsprimaFbTestSuite.errors.txt b/tests/baselines/reference/jsxEsprimaFbTestSuite.errors.txt index 23b14a25cd2..77f83ccbd36 100644 --- a/tests/baselines/reference/jsxEsprimaFbTestSuite.errors.txt +++ b/tests/baselines/reference/jsxEsprimaFbTestSuite.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(39,29): error TS1005: '{' tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(39,57): error TS1109: Expression expected. tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(39,58): error TS1109: Expression expected. tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(41,1): error TS1003: Identifier expected. -tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(41,12): error TS2657: JSX expressions must have one parent element +tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(41,12): error TS2657: JSX expressions must have one parent element. ==== tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx (8 errors) ==== @@ -65,7 +65,7 @@ tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(41,12): error TS2657: JSX ~ !!! error TS1003: Identifier expected. ~ -!!! error TS2657: JSX expressions must have one parent element +!!! error TS2657: JSX expressions must have one parent element. ; diff --git a/tests/baselines/reference/jsxInvalidEsprimaTestSuite.errors.txt b/tests/baselines/reference/jsxInvalidEsprimaTestSuite.errors.txt index 4b415154c6b..8af8f5033ba 100644 --- a/tests/baselines/reference/jsxInvalidEsprimaTestSuite.errors.txt +++ b/tests/baselines/reference/jsxInvalidEsprimaTestSuite.errors.txt @@ -17,7 +17,7 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(8,4): error TS17002: tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(9,13): error TS1002: Unterminated string literal. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(10,1): error TS1003: Identifier expected. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(10,6): error TS17002: Expected corresponding JSX closing tag for 'a'. -tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(10,10): error TS2657: JSX expressions must have one parent element +tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(10,10): error TS2657: JSX expressions must have one parent element. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(11,3): error TS1003: Identifier expected. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(11,5): error TS1003: Identifier expected. tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(11,11): error TS1005: '>' expected. @@ -120,7 +120,7 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS1005: ~~~~ !!! error TS17002: Expected corresponding JSX closing tag for 'a'. ~ -!!! error TS2657: JSX expressions must have one parent element +!!! error TS2657: JSX expressions must have one parent element. ; ~ !!! error TS1003: Identifier expected. diff --git a/tests/baselines/reference/letAsIdentifierInStrictMode.errors.txt b/tests/baselines/reference/letAsIdentifierInStrictMode.errors.txt index 42f71669c66..e5812e46bf9 100644 --- a/tests/baselines/reference/letAsIdentifierInStrictMode.errors.txt +++ b/tests/baselines/reference/letAsIdentifierInStrictMode.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/letAsIdentifierInStrictMode.ts(2,5): error TS1212: Identifier expected. 'let' is a reserved word in strict mode +tests/cases/compiler/letAsIdentifierInStrictMode.ts(2,5): error TS1212: Identifier expected. 'let' is a reserved word in strict mode. tests/cases/compiler/letAsIdentifierInStrictMode.ts(3,5): error TS2300: Duplicate identifier 'a'. -tests/cases/compiler/letAsIdentifierInStrictMode.ts(4,1): error TS1212: Identifier expected. 'let' is a reserved word in strict mode +tests/cases/compiler/letAsIdentifierInStrictMode.ts(4,1): error TS1212: Identifier expected. 'let' is a reserved word in strict mode. tests/cases/compiler/letAsIdentifierInStrictMode.ts(6,1): error TS2300: Duplicate identifier 'a'. @@ -8,13 +8,13 @@ tests/cases/compiler/letAsIdentifierInStrictMode.ts(6,1): error TS2300: Duplicat "use strict"; var let = 10; ~~~ -!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode. var a = 10; ~ !!! error TS2300: Duplicate identifier 'a'. let = 30; ~~~ -!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode. let a; ~ diff --git a/tests/baselines/reference/library-reference-1.trace.json b/tests/baselines/reference/library-reference-1.trace.json index d13ac9da455..b09781aa3f4 100644 --- a/tests/baselines/reference/library-reference-1.trace.json +++ b/tests/baselines/reference/library-reference-1.trace.json @@ -1,14 +1,14 @@ [ "======== Resolving type reference directive 'jquery', containing file '/src/consumer.ts', root directory 'types'. ========", - "Resolving with primary search path 'types'", + "Resolving with primary search path 'types'.", "File 'types/jquery/package.json' does not exist.", "File 'types/jquery/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for 'types/jquery/index.d.ts', result '/src/types/jquery/index.d.ts'", + "Resolving real path for 'types/jquery/index.d.ts', result '/src/types/jquery/index.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/src/types/jquery/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'jquery', containing file '/src/__inferred type names__.ts', root directory 'types'. ========", - "Resolving with primary search path 'types'", + "Resolving with primary search path 'types'.", "File 'types/jquery/package.json' does not exist.", "File 'types/jquery/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for 'types/jquery/index.d.ts', result '/src/types/jquery/index.d.ts'", + "Resolving real path for 'types/jquery/index.d.ts', result '/src/types/jquery/index.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/src/types/jquery/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-10.trace.json b/tests/baselines/reference/library-reference-10.trace.json index 760f0c5ec82..ada939d8129 100644 --- a/tests/baselines/reference/library-reference-10.trace.json +++ b/tests/baselines/reference/library-reference-10.trace.json @@ -1,16 +1,16 @@ [ "======== Resolving type reference directive 'jquery', containing file '/foo/consumer.ts', root directory './types'. ========", - "Resolving with primary search path './types'", + "Resolving with primary search path './types'.", "Found 'package.json' at './types/jquery/package.json'.", "'package.json' has 'typings' field 'jquery.d.ts' that references 'types/jquery/jquery.d.ts'.", "File 'types/jquery/jquery.d.ts' exist - use it as a name resolution result.", - "Resolving real path for 'types/jquery/jquery.d.ts', result '/foo/types/jquery/jquery.d.ts'", + "Resolving real path for 'types/jquery/jquery.d.ts', result '/foo/types/jquery/jquery.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/foo/types/jquery/jquery.d.ts', primary: true. ========", "======== Resolving type reference directive 'jquery', containing file '/foo/__inferred type names__.ts', root directory './types'. ========", - "Resolving with primary search path './types'", + "Resolving with primary search path './types'.", "Found 'package.json' at './types/jquery/package.json'.", "'package.json' has 'typings' field 'jquery.d.ts' that references 'types/jquery/jquery.d.ts'.", "File 'types/jquery/jquery.d.ts' exist - use it as a name resolution result.", - "Resolving real path for 'types/jquery/jquery.d.ts', result '/foo/types/jquery/jquery.d.ts'", + "Resolving real path for 'types/jquery/jquery.d.ts', result '/foo/types/jquery/jquery.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/foo/types/jquery/jquery.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-11.trace.json b/tests/baselines/reference/library-reference-11.trace.json index 0393f04cc80..053dc497065 100644 --- a/tests/baselines/reference/library-reference-11.trace.json +++ b/tests/baselines/reference/library-reference-11.trace.json @@ -1,12 +1,12 @@ [ "======== Resolving type reference directive 'jquery', containing file '/a/b/consumer.ts', root directory not set. ========", "Root directory cannot be determined, skipping primary search paths.", - "Looking up in 'node_modules' folder, initial location '/a/b'", + "Looking up in 'node_modules' folder, initial location '/a/b'.", "Directory '/a/b/node_modules' does not exist, skipping all lookups in it.", "File '/a/node_modules/jquery.d.ts' does not exist.", "Found 'package.json' at '/a/node_modules/jquery/package.json'.", "'package.json' has 'typings' field 'jquery.d.ts' that references '/a/node_modules/jquery/jquery.d.ts'.", "File '/a/node_modules/jquery/jquery.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/a/node_modules/jquery/jquery.d.ts', result '/a/node_modules/jquery/jquery.d.ts'", + "Resolving real path for '/a/node_modules/jquery/jquery.d.ts', result '/a/node_modules/jquery/jquery.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/a/node_modules/jquery/jquery.d.ts', primary: false. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-12.trace.json b/tests/baselines/reference/library-reference-12.trace.json index 75b53d589ee..d990709cac8 100644 --- a/tests/baselines/reference/library-reference-12.trace.json +++ b/tests/baselines/reference/library-reference-12.trace.json @@ -1,13 +1,13 @@ [ "======== Resolving type reference directive 'jquery', containing file '/a/b/consumer.ts', root directory not set. ========", "Root directory cannot be determined, skipping primary search paths.", - "Looking up in 'node_modules' folder, initial location '/a/b'", + "Looking up in 'node_modules' folder, initial location '/a/b'.", "Directory '/a/b/node_modules' does not exist, skipping all lookups in it.", "File '/a/node_modules/jquery.d.ts' does not exist.", "Found 'package.json' at '/a/node_modules/jquery/package.json'.", "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'dist/jquery.d.ts' that references '/a/node_modules/jquery/dist/jquery.d.ts'.", "File '/a/node_modules/jquery/dist/jquery.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/a/node_modules/jquery/dist/jquery.d.ts', result '/a/node_modules/jquery/dist/jquery.d.ts'", + "Resolving real path for '/a/node_modules/jquery/dist/jquery.d.ts', result '/a/node_modules/jquery/dist/jquery.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/a/node_modules/jquery/dist/jquery.d.ts', primary: false. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-13.trace.json b/tests/baselines/reference/library-reference-13.trace.json index 338cefbc47e..70ebb875899 100644 --- a/tests/baselines/reference/library-reference-13.trace.json +++ b/tests/baselines/reference/library-reference-13.trace.json @@ -1,8 +1,8 @@ [ "======== Resolving type reference directive 'jquery', containing file '/a/__inferred type names__.ts', root directory '/a/types'. ========", - "Resolving with primary search path '/a/types'", + "Resolving with primary search path '/a/types'.", "File '/a/types/jquery/package.json' does not exist.", "File '/a/types/jquery/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/a/types/jquery/index.d.ts', result '/a/types/jquery/index.d.ts'", + "Resolving real path for '/a/types/jquery/index.d.ts', result '/a/types/jquery/index.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/a/types/jquery/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-14.trace.json b/tests/baselines/reference/library-reference-14.trace.json index 338cefbc47e..70ebb875899 100644 --- a/tests/baselines/reference/library-reference-14.trace.json +++ b/tests/baselines/reference/library-reference-14.trace.json @@ -1,8 +1,8 @@ [ "======== Resolving type reference directive 'jquery', containing file '/a/__inferred type names__.ts', root directory '/a/types'. ========", - "Resolving with primary search path '/a/types'", + "Resolving with primary search path '/a/types'.", "File '/a/types/jquery/package.json' does not exist.", "File '/a/types/jquery/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/a/types/jquery/index.d.ts', result '/a/types/jquery/index.d.ts'", + "Resolving real path for '/a/types/jquery/index.d.ts', result '/a/types/jquery/index.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/a/types/jquery/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-15.trace.json b/tests/baselines/reference/library-reference-15.trace.json index 6d8b5cf1408..0f76cf52984 100644 --- a/tests/baselines/reference/library-reference-15.trace.json +++ b/tests/baselines/reference/library-reference-15.trace.json @@ -1,8 +1,8 @@ [ "======== Resolving type reference directive 'jquery', containing file '/a/__inferred type names__.ts', root directory 'types'. ========", - "Resolving with primary search path 'types'", + "Resolving with primary search path 'types'.", "File 'types/jquery/package.json' does not exist.", "File 'types/jquery/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for 'types/jquery/index.d.ts', result '/a/types/jquery/index.d.ts'", + "Resolving real path for 'types/jquery/index.d.ts', result '/a/types/jquery/index.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/a/types/jquery/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-2.trace.json b/tests/baselines/reference/library-reference-2.trace.json index ef0936a35a2..e708d11c464 100644 --- a/tests/baselines/reference/library-reference-2.trace.json +++ b/tests/baselines/reference/library-reference-2.trace.json @@ -1,18 +1,18 @@ [ "======== Resolving type reference directive 'jquery', containing file '/consumer.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "Found 'package.json' at '/types/jquery/package.json'.", "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.", "File '/types/jquery/jquery.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/jquery/jquery.d.ts', result '/types/jquery/jquery.d.ts'", + "Resolving real path for '/types/jquery/jquery.d.ts', result '/types/jquery/jquery.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/types/jquery/jquery.d.ts', primary: true. ========", "======== Resolving type reference directive 'jquery', containing file 'test/__inferred type names__.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "Found 'package.json' at '/types/jquery/package.json'.", "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.", "File '/types/jquery/jquery.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/jquery/jquery.d.ts', result '/types/jquery/jquery.d.ts'", + "Resolving real path for '/types/jquery/jquery.d.ts', result '/types/jquery/jquery.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/types/jquery/jquery.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-3.trace.json b/tests/baselines/reference/library-reference-3.trace.json index d672eb50de8..22747738c10 100644 --- a/tests/baselines/reference/library-reference-3.trace.json +++ b/tests/baselines/reference/library-reference-3.trace.json @@ -1,10 +1,10 @@ [ "======== Resolving type reference directive 'jquery', containing file '/src/consumer.ts', root directory not set. ========", "Root directory cannot be determined, skipping primary search paths.", - "Looking up in 'node_modules' folder, initial location '/src'", + "Looking up in 'node_modules' folder, initial location '/src'.", "File '/src/node_modules/jquery.d.ts' does not exist.", "File '/src/node_modules/jquery/package.json' does not exist.", "File '/src/node_modules/jquery/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/src/node_modules/jquery/index.d.ts', result '/src/node_modules/jquery/index.d.ts'", + "Resolving real path for '/src/node_modules/jquery/index.d.ts', result '/src/node_modules/jquery/index.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/src/node_modules/jquery/index.d.ts', primary: false. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-4.trace.json b/tests/baselines/reference/library-reference-4.trace.json index b6b9e5e0af2..03fdfa0e863 100644 --- a/tests/baselines/reference/library-reference-4.trace.json +++ b/tests/baselines/reference/library-reference-4.trace.json @@ -1,36 +1,36 @@ [ "======== Resolving type reference directive 'foo', containing file '/src/root.ts', root directory '/src'. ========", - "Resolving with primary search path '/src'", - "Looking up in 'node_modules' folder, initial location '/src'", + "Resolving with primary search path '/src'.", + "Looking up in 'node_modules' folder, initial location '/src'.", "Directory '/src/node_modules' does not exist, skipping all lookups in it.", "File '/node_modules/foo.d.ts' does not exist.", "File '/node_modules/foo/package.json' does not exist.", "File '/node_modules/foo/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/foo/index.d.ts', result '/node_modules/foo/index.d.ts'", + "Resolving real path for '/node_modules/foo/index.d.ts', result '/node_modules/foo/index.d.ts'.", "======== Type reference directive 'foo' was successfully resolved to '/node_modules/foo/index.d.ts', primary: false. ========", "======== Resolving type reference directive 'bar', containing file '/src/root.ts', root directory '/src'. ========", - "Resolving with primary search path '/src'", - "Looking up in 'node_modules' folder, initial location '/src'", + "Resolving with primary search path '/src'.", + "Looking up in 'node_modules' folder, initial location '/src'.", "Directory '/src/node_modules' does not exist, skipping all lookups in it.", "File '/node_modules/bar.d.ts' does not exist.", "File '/node_modules/bar/package.json' does not exist.", "File '/node_modules/bar/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/bar/index.d.ts', result '/node_modules/bar/index.d.ts'", + "Resolving real path for '/node_modules/bar/index.d.ts', result '/node_modules/bar/index.d.ts'.", "======== Type reference directive 'bar' was successfully resolved to '/node_modules/bar/index.d.ts', primary: false. ========", "======== Resolving type reference directive 'alpha', containing file '/node_modules/foo/index.d.ts', root directory '/src'. ========", - "Resolving with primary search path '/src'", - "Looking up in 'node_modules' folder, initial location '/node_modules/foo'", + "Resolving with primary search path '/src'.", + "Looking up in 'node_modules' folder, initial location '/node_modules/foo'.", "File '/node_modules/foo/node_modules/alpha.d.ts' does not exist.", "File '/node_modules/foo/node_modules/alpha/package.json' does not exist.", "File '/node_modules/foo/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/foo/node_modules/alpha/index.d.ts', result '/node_modules/foo/node_modules/alpha/index.d.ts'", + "Resolving real path for '/node_modules/foo/node_modules/alpha/index.d.ts', result '/node_modules/foo/node_modules/alpha/index.d.ts'.", "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/foo/node_modules/alpha/index.d.ts', primary: false. ========", "======== Resolving type reference directive 'alpha', containing file '/node_modules/bar/index.d.ts', root directory '/src'. ========", - "Resolving with primary search path '/src'", - "Looking up in 'node_modules' folder, initial location '/node_modules/bar'", + "Resolving with primary search path '/src'.", + "Looking up in 'node_modules' folder, initial location '/node_modules/bar'.", "File '/node_modules/bar/node_modules/alpha.d.ts' does not exist.", "File '/node_modules/bar/node_modules/alpha/package.json' does not exist.", "File '/node_modules/bar/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/bar/node_modules/alpha/index.d.ts', result '/node_modules/bar/node_modules/alpha/index.d.ts'", + "Resolving real path for '/node_modules/bar/node_modules/alpha/index.d.ts', result '/node_modules/bar/node_modules/alpha/index.d.ts'.", "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/bar/node_modules/alpha/index.d.ts', primary: false. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-5.trace.json b/tests/baselines/reference/library-reference-5.trace.json index 818fceb42cf..cb14078670a 100644 --- a/tests/baselines/reference/library-reference-5.trace.json +++ b/tests/baselines/reference/library-reference-5.trace.json @@ -1,40 +1,40 @@ [ "======== Resolving type reference directive 'foo', containing file '/src/root.ts', root directory 'types'. ========", - "Resolving with primary search path 'types'", + "Resolving with primary search path 'types'.", "Directory 'types' does not exist, skipping all lookups in it.", - "Looking up in 'node_modules' folder, initial location '/src'", + "Looking up in 'node_modules' folder, initial location '/src'.", "Directory '/src/node_modules' does not exist, skipping all lookups in it.", "File '/node_modules/foo.d.ts' does not exist.", "File '/node_modules/foo/package.json' does not exist.", "File '/node_modules/foo/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/foo/index.d.ts', result '/node_modules/foo/index.d.ts'", + "Resolving real path for '/node_modules/foo/index.d.ts', result '/node_modules/foo/index.d.ts'.", "======== Type reference directive 'foo' was successfully resolved to '/node_modules/foo/index.d.ts', primary: false. ========", "======== Resolving type reference directive 'bar', containing file '/src/root.ts', root directory 'types'. ========", - "Resolving with primary search path 'types'", + "Resolving with primary search path 'types'.", "Directory 'types' does not exist, skipping all lookups in it.", - "Looking up in 'node_modules' folder, initial location '/src'", + "Looking up in 'node_modules' folder, initial location '/src'.", "Directory '/src/node_modules' does not exist, skipping all lookups in it.", "File '/node_modules/bar.d.ts' does not exist.", "File '/node_modules/bar/package.json' does not exist.", "File '/node_modules/bar/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/bar/index.d.ts', result '/node_modules/bar/index.d.ts'", + "Resolving real path for '/node_modules/bar/index.d.ts', result '/node_modules/bar/index.d.ts'.", "======== Type reference directive 'bar' was successfully resolved to '/node_modules/bar/index.d.ts', primary: false. ========", "======== Resolving type reference directive 'alpha', containing file '/node_modules/foo/index.d.ts', root directory 'types'. ========", - "Resolving with primary search path 'types'", + "Resolving with primary search path 'types'.", "Directory 'types' does not exist, skipping all lookups in it.", - "Looking up in 'node_modules' folder, initial location '/node_modules/foo'", + "Looking up in 'node_modules' folder, initial location '/node_modules/foo'.", "File '/node_modules/foo/node_modules/alpha.d.ts' does not exist.", "File '/node_modules/foo/node_modules/alpha/package.json' does not exist.", "File '/node_modules/foo/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/foo/node_modules/alpha/index.d.ts', result '/node_modules/foo/node_modules/alpha/index.d.ts'", + "Resolving real path for '/node_modules/foo/node_modules/alpha/index.d.ts', result '/node_modules/foo/node_modules/alpha/index.d.ts'.", "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/foo/node_modules/alpha/index.d.ts', primary: false. ========", "======== Resolving type reference directive 'alpha', containing file '/node_modules/bar/index.d.ts', root directory 'types'. ========", - "Resolving with primary search path 'types'", + "Resolving with primary search path 'types'.", "Directory 'types' does not exist, skipping all lookups in it.", - "Looking up in 'node_modules' folder, initial location '/node_modules/bar'", + "Looking up in 'node_modules' folder, initial location '/node_modules/bar'.", "File '/node_modules/bar/node_modules/alpha.d.ts' does not exist.", "File '/node_modules/bar/node_modules/alpha/package.json' does not exist.", "File '/node_modules/bar/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/bar/node_modules/alpha/index.d.ts', result '/node_modules/bar/node_modules/alpha/index.d.ts'", + "Resolving real path for '/node_modules/bar/node_modules/alpha/index.d.ts', result '/node_modules/bar/node_modules/alpha/index.d.ts'.", "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/bar/node_modules/alpha/index.d.ts', primary: false. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-6.trace.json b/tests/baselines/reference/library-reference-6.trace.json index 6ca81a6c418..3c682db6af7 100644 --- a/tests/baselines/reference/library-reference-6.trace.json +++ b/tests/baselines/reference/library-reference-6.trace.json @@ -1,14 +1,14 @@ [ "======== Resolving type reference directive 'alpha', containing file '/src/foo.ts', root directory '/node_modules/@types'. ========", - "Resolving with primary search path '/node_modules/@types'", + "Resolving with primary search path '/node_modules/@types'.", "File '/node_modules/@types/alpha/package.json' does not exist.", "File '/node_modules/@types/alpha/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/alpha/index.d.ts', result '/node_modules/@types/alpha/index.d.ts'", + "Resolving real path for '/node_modules/@types/alpha/index.d.ts', result '/node_modules/@types/alpha/index.d.ts'.", "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/@types/alpha/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'alpha', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========", - "Resolving with primary search path '/node_modules/@types'", + "Resolving with primary search path '/node_modules/@types'.", "File '/node_modules/@types/alpha/package.json' does not exist.", "File '/node_modules/@types/alpha/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/alpha/index.d.ts', result '/node_modules/@types/alpha/index.d.ts'", + "Resolving real path for '/node_modules/@types/alpha/index.d.ts', result '/node_modules/@types/alpha/index.d.ts'.", "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/@types/alpha/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-7.trace.json b/tests/baselines/reference/library-reference-7.trace.json index d672eb50de8..22747738c10 100644 --- a/tests/baselines/reference/library-reference-7.trace.json +++ b/tests/baselines/reference/library-reference-7.trace.json @@ -1,10 +1,10 @@ [ "======== Resolving type reference directive 'jquery', containing file '/src/consumer.ts', root directory not set. ========", "Root directory cannot be determined, skipping primary search paths.", - "Looking up in 'node_modules' folder, initial location '/src'", + "Looking up in 'node_modules' folder, initial location '/src'.", "File '/src/node_modules/jquery.d.ts' does not exist.", "File '/src/node_modules/jquery/package.json' does not exist.", "File '/src/node_modules/jquery/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/src/node_modules/jquery/index.d.ts', result '/src/node_modules/jquery/index.d.ts'", + "Resolving real path for '/src/node_modules/jquery/index.d.ts', result '/src/node_modules/jquery/index.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/src/node_modules/jquery/index.d.ts', primary: false. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-8.trace.json b/tests/baselines/reference/library-reference-8.trace.json index 905c3c2bb36..794df2daa7a 100644 --- a/tests/baselines/reference/library-reference-8.trace.json +++ b/tests/baselines/reference/library-reference-8.trace.json @@ -1,38 +1,38 @@ [ "======== Resolving type reference directive 'alpha', containing file '/test/foo.ts', root directory '/test/types'. ========", - "Resolving with primary search path '/test/types'", + "Resolving with primary search path '/test/types'.", "File '/test/types/alpha/package.json' does not exist.", "File '/test/types/alpha/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/test/types/alpha/index.d.ts', result '/test/types/alpha/index.d.ts'", + "Resolving real path for '/test/types/alpha/index.d.ts', result '/test/types/alpha/index.d.ts'.", "======== Type reference directive 'alpha' was successfully resolved to '/test/types/alpha/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'beta', containing file '/test/foo.ts', root directory '/test/types'. ========", - "Resolving with primary search path '/test/types'", + "Resolving with primary search path '/test/types'.", "File '/test/types/beta/package.json' does not exist.", "File '/test/types/beta/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/test/types/beta/index.d.ts', result '/test/types/beta/index.d.ts'", + "Resolving real path for '/test/types/beta/index.d.ts', result '/test/types/beta/index.d.ts'.", "======== Type reference directive 'beta' was successfully resolved to '/test/types/beta/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'beta', containing file '/test/types/alpha/index.d.ts', root directory '/test/types'. ========", - "Resolving with primary search path '/test/types'", + "Resolving with primary search path '/test/types'.", "File '/test/types/beta/package.json' does not exist.", "File '/test/types/beta/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/test/types/beta/index.d.ts', result '/test/types/beta/index.d.ts'", + "Resolving real path for '/test/types/beta/index.d.ts', result '/test/types/beta/index.d.ts'.", "======== Type reference directive 'beta' was successfully resolved to '/test/types/beta/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'alpha', containing file '/test/types/beta/index.d.ts', root directory '/test/types'. ========", - "Resolving with primary search path '/test/types'", + "Resolving with primary search path '/test/types'.", "File '/test/types/alpha/package.json' does not exist.", "File '/test/types/alpha/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/test/types/alpha/index.d.ts', result '/test/types/alpha/index.d.ts'", + "Resolving real path for '/test/types/alpha/index.d.ts', result '/test/types/alpha/index.d.ts'.", "======== Type reference directive 'alpha' was successfully resolved to '/test/types/alpha/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'alpha', containing file '/test/__inferred type names__.ts', root directory '/test/types'. ========", - "Resolving with primary search path '/test/types'", + "Resolving with primary search path '/test/types'.", "File '/test/types/alpha/package.json' does not exist.", "File '/test/types/alpha/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/test/types/alpha/index.d.ts', result '/test/types/alpha/index.d.ts'", + "Resolving real path for '/test/types/alpha/index.d.ts', result '/test/types/alpha/index.d.ts'.", "======== Type reference directive 'alpha' was successfully resolved to '/test/types/alpha/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'beta', containing file '/test/__inferred type names__.ts', root directory '/test/types'. ========", - "Resolving with primary search path '/test/types'", + "Resolving with primary search path '/test/types'.", "File '/test/types/beta/package.json' does not exist.", "File '/test/types/beta/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/test/types/beta/index.d.ts', result '/test/types/beta/index.d.ts'", + "Resolving real path for '/test/types/beta/index.d.ts', result '/test/types/beta/index.d.ts'.", "======== Type reference directive 'beta' was successfully resolved to '/test/types/beta/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.trace.json b/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.trace.json index eeff8b42ce6..46f03d1e8c4 100644 --- a/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.trace.json +++ b/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.trace.json @@ -15,6 +15,6 @@ "File '/node_modules/shortid.jsx' does not exist.", "File '/node_modules/shortid/package.json' does not exist.", "File '/node_modules/shortid/index.js' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/shortid/index.js', result '/node_modules/shortid/index.js'", + "Resolving real path for '/node_modules/shortid/index.js', result '/node_modules/shortid/index.js'.", "======== Module name 'shortid' was successfully resolved to '/node_modules/shortid/index.js'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/misspelledNewMetaProperty.errors.txt b/tests/baselines/reference/misspelledNewMetaProperty.errors.txt new file mode 100644 index 00000000000..429a40a5b80 --- /dev/null +++ b/tests/baselines/reference/misspelledNewMetaProperty.errors.txt @@ -0,0 +1,7 @@ +tests/cases/compiler/misspelledNewMetaProperty.ts(1,20): error TS17012: 'targ' is not a valid meta-property for keyword 'new'. Did you mean 'target'? + + +==== tests/cases/compiler/misspelledNewMetaProperty.ts (1 errors) ==== + function foo(){new.targ} + ~~~~ +!!! error TS17012: 'targ' is not a valid meta-property for keyword 'new'. Did you mean 'target'? \ No newline at end of file diff --git a/tests/baselines/reference/misspelledNewMetaProperty.js b/tests/baselines/reference/misspelledNewMetaProperty.js new file mode 100644 index 00000000000..964cf91d52c --- /dev/null +++ b/tests/baselines/reference/misspelledNewMetaProperty.js @@ -0,0 +1,5 @@ +//// [misspelledNewMetaProperty.ts] +function foo(){new.targ} + +//// [misspelledNewMetaProperty.js] +function foo() { new.targ; } diff --git a/tests/baselines/reference/moduleResolutionWithExtensions.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions.trace.json index 50e3cccad9c..104853f8aa3 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions.trace.json @@ -10,7 +10,7 @@ "File '/src/a.js.ts' does not exist.", "File '/src/a.js.tsx' does not exist.", "File '/src/a.js.d.ts' does not exist.", - "File name '/src/a.js' has a '.js' extension - stripping it", + "File name '/src/a.js' has a '.js' extension - stripping it.", "File '/src/a.ts' exist - use it as a name resolution result.", "======== Module name './a.js' was successfully resolved to '/src/a.ts'. ========", "======== Resolving module './jquery.js' from '/src/jquery_user_1.ts'. ========", @@ -19,7 +19,7 @@ "File '/src/jquery.js.ts' does not exist.", "File '/src/jquery.js.tsx' does not exist.", "File '/src/jquery.js.d.ts' does not exist.", - "File name '/src/jquery.js' has a '.js' extension - stripping it", + "File name '/src/jquery.js' has a '.js' extension - stripping it.", "File '/src/jquery.ts' does not exist.", "File '/src/jquery.tsx' does not exist.", "File '/src/jquery.d.ts' exist - use it as a name resolution result.", diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json index e550bb41eab..3632a5c2242 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json @@ -14,7 +14,7 @@ "File '/node_modules/foo/foo.js.ts' does not exist.", "File '/node_modules/foo/foo.js.tsx' does not exist.", "File '/node_modules/foo/foo.js.d.ts' does not exist.", - "File name '/node_modules/foo/foo.js' has a '.js' extension - stripping it", + "File name '/node_modules/foo/foo.js' has a '.js' extension - stripping it.", "File '/node_modules/foo/foo.ts' does not exist.", "File '/node_modules/foo/foo.tsx' does not exist.", "File '/node_modules/foo/foo.d.ts' does not exist.", diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_withAmbientPresent.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_withAmbientPresent.trace.json index c01ba494886..6cfdb8b567e 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_withAmbientPresent.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_withAmbientPresent.trace.json @@ -15,6 +15,6 @@ "File '/node_modules/js.jsx' does not exist.", "File '/node_modules/js/package.json' does not exist.", "File '/node_modules/js/index.js' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/js/index.js', result '/node_modules/js/index.js'", + "Resolving real path for '/node_modules/js/index.js', result '/node_modules/js/index.js'.", "======== Module name 'js' was successfully resolved to '/node_modules/js/index.js'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithSymlinks.trace.json b/tests/baselines/reference/moduleResolutionWithSymlinks.trace.json index 1b21293fc05..2dd33953680 100644 --- a/tests/baselines/reference/moduleResolutionWithSymlinks.trace.json +++ b/tests/baselines/reference/moduleResolutionWithSymlinks.trace.json @@ -25,6 +25,6 @@ "File '/src/library-b/node_modules/library-a.d.ts' does not exist.", "File '/src/library-b/node_modules/library-a/package.json' does not exist.", "File '/src/library-b/node_modules/library-a/index.ts' exist - use it as a name resolution result.", - "Resolving real path for '/src/library-b/node_modules/library-a/index.ts', result '/src/library-a/index.ts'", + "Resolving real path for '/src/library-b/node_modules/library-a/index.ts', result '/src/library-a/index.ts'.", "======== Module name 'library-a' was successfully resolved to '/src/library-a/index.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithSymlinks_referenceTypes.trace.json b/tests/baselines/reference/moduleResolutionWithSymlinks_referenceTypes.trace.json index 78d169457ee..65d89ed7458 100644 --- a/tests/baselines/reference/moduleResolutionWithSymlinks_referenceTypes.trace.json +++ b/tests/baselines/reference/moduleResolutionWithSymlinks_referenceTypes.trace.json @@ -1,29 +1,29 @@ [ "======== Resolving type reference directive 'library-a', containing file '/app.ts', root directory ''. ========", "Root directory cannot be determined, skipping primary search paths.", - "Looking up in 'node_modules' folder, initial location '/'", + "Looking up in 'node_modules' folder, initial location '/'.", "File '/node_modules/library-a.d.ts' does not exist.", "File '/node_modules/@types/library-a.d.ts' does not exist.", "File '/node_modules/@types/library-a/package.json' does not exist.", "File '/node_modules/@types/library-a/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/library-a/index.d.ts', result '/node_modules/@types/library-a/index.d.ts'", + "Resolving real path for '/node_modules/@types/library-a/index.d.ts', result '/node_modules/@types/library-a/index.d.ts'.", "======== Type reference directive 'library-a' was successfully resolved to '/node_modules/@types/library-a/index.d.ts', primary: false. ========", "======== Resolving type reference directive 'library-b', containing file '/app.ts', root directory ''. ========", "Root directory cannot be determined, skipping primary search paths.", - "Looking up in 'node_modules' folder, initial location '/'", + "Looking up in 'node_modules' folder, initial location '/'.", "File '/node_modules/library-b.d.ts' does not exist.", "File '/node_modules/@types/library-b.d.ts' does not exist.", "File '/node_modules/@types/library-b/package.json' does not exist.", "File '/node_modules/@types/library-b/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/library-b/index.d.ts', result '/node_modules/@types/library-b/index.d.ts'", + "Resolving real path for '/node_modules/@types/library-b/index.d.ts', result '/node_modules/@types/library-b/index.d.ts'.", "======== Type reference directive 'library-b' was successfully resolved to '/node_modules/@types/library-b/index.d.ts', primary: false. ========", "======== Resolving type reference directive 'library-a', containing file '/node_modules/@types/library-b/index.d.ts', root directory ''. ========", "Root directory cannot be determined, skipping primary search paths.", - "Looking up in 'node_modules' folder, initial location '/node_modules/@types/library-b'", + "Looking up in 'node_modules' folder, initial location '/node_modules/@types/library-b'.", "File '/node_modules/@types/library-b/node_modules/library-a.d.ts' does not exist.", "File '/node_modules/@types/library-b/node_modules/@types/library-a.d.ts' does not exist.", "File '/node_modules/@types/library-b/node_modules/@types/library-a/package.json' does not exist.", "File '/node_modules/@types/library-b/node_modules/@types/library-a/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/library-b/node_modules/@types/library-a/index.d.ts', result '/node_modules/@types/library-a/index.d.ts'", + "Resolving real path for '/node_modules/@types/library-b/node_modules/@types/library-a/index.d.ts', result '/node_modules/@types/library-a/index.d.ts'.", "======== Type reference directive 'library-a' was successfully resolved to '/node_modules/@types/library-a/index.d.ts', primary: false. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithSymlinks_withOutDir.trace.json b/tests/baselines/reference/moduleResolutionWithSymlinks_withOutDir.trace.json index 1b21293fc05..2dd33953680 100644 --- a/tests/baselines/reference/moduleResolutionWithSymlinks_withOutDir.trace.json +++ b/tests/baselines/reference/moduleResolutionWithSymlinks_withOutDir.trace.json @@ -25,6 +25,6 @@ "File '/src/library-b/node_modules/library-a.d.ts' does not exist.", "File '/src/library-b/node_modules/library-a/package.json' does not exist.", "File '/src/library-b/node_modules/library-a/index.ts' exist - use it as a name resolution result.", - "Resolving real path for '/src/library-b/node_modules/library-a/index.ts', result '/src/library-a/index.ts'", + "Resolving real path for '/src/library-b/node_modules/library-a/index.ts', result '/src/library-a/index.ts'.", "======== Module name 'library-a' was successfully resolved to '/src/library-a/index.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/multipleDeclarations.symbols b/tests/baselines/reference/multipleDeclarations.symbols index 9e49c2fc00c..4fc8f8a5f28 100644 --- a/tests/baselines/reference/multipleDeclarations.symbols +++ b/tests/baselines/reference/multipleDeclarations.symbols @@ -30,7 +30,7 @@ class X { >this : Symbol(X, Decl(input.js, 5, 1)) this.mistake = 'frankly, complete nonsense'; ->this.mistake : Symbol(X.mistake, Decl(input.js, 12, 5)) +>this.mistake : Symbol(X.mistake, Decl(input.js, 12, 5), Decl(input.js, 16, 16)) >this : Symbol(X, Decl(input.js, 5, 1)) >mistake : Symbol(X.mistake, Decl(input.js, 8, 35)) } @@ -38,7 +38,7 @@ class X { >m : Symbol(X.m, Decl(input.js, 10, 5)) } mistake() { ->mistake : Symbol(X.mistake, Decl(input.js, 12, 5)) +>mistake : Symbol(X.mistake, Decl(input.js, 12, 5), Decl(input.js, 16, 16)) } } let x = new X(); @@ -46,9 +46,11 @@ let x = new X(); >X : Symbol(X, Decl(input.js, 5, 1)) X.prototype.mistake = false; ->X.prototype.mistake : Symbol(X.mistake, Decl(input.js, 12, 5)) +>X.prototype.mistake : Symbol(X.mistake, Decl(input.js, 12, 5), Decl(input.js, 16, 16)) +>X.prototype : Symbol(X.mistake, Decl(input.js, 12, 5), Decl(input.js, 16, 16)) >X : Symbol(X, Decl(input.js, 5, 1)) >prototype : Symbol(X.prototype) +>mistake : Symbol(X.mistake, Decl(input.js, 12, 5), Decl(input.js, 16, 16)) x.m(); >x.m : Symbol(X.m, Decl(input.js, 10, 5)) @@ -56,15 +58,15 @@ x.m(); >m : Symbol(X.m, Decl(input.js, 10, 5)) x.mistake; ->x.mistake : Symbol(X.mistake, Decl(input.js, 12, 5)) +>x.mistake : Symbol(X.mistake, Decl(input.js, 12, 5), Decl(input.js, 16, 16)) >x : Symbol(x, Decl(input.js, 16, 3)) ->mistake : Symbol(X.mistake, Decl(input.js, 12, 5)) +>mistake : Symbol(X.mistake, Decl(input.js, 12, 5), Decl(input.js, 16, 16)) class Y { >Y : Symbol(Y, Decl(input.js, 19, 10)) mistake() { ->mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35)) +>mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35), Decl(input.js, 29, 1)) } m() { >m : Symbol(Y.m, Decl(input.js, 22, 5), Decl(input.js, 25, 19)) @@ -80,15 +82,17 @@ class Y { >this : Symbol(Y, Decl(input.js, 19, 10)) this.mistake = 'even more nonsense'; ->this.mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35)) +>this.mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35), Decl(input.js, 29, 1)) >this : Symbol(Y, Decl(input.js, 19, 10)) ->mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35)) +>mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35), Decl(input.js, 29, 1)) } } Y.prototype.mistake = true; ->Y.prototype.mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35)) +>Y.prototype.mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35), Decl(input.js, 29, 1)) +>Y.prototype : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35), Decl(input.js, 29, 1)) >Y : Symbol(Y, Decl(input.js, 19, 10)) >prototype : Symbol(Y.prototype) +>mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35), Decl(input.js, 29, 1)) let y = new Y(); >y : Symbol(y, Decl(input.js, 31, 3)) @@ -100,7 +104,7 @@ y.m(); >m : Symbol(Y.m, Decl(input.js, 22, 5), Decl(input.js, 25, 19)) y.mistake(); ->y.mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35)) +>y.mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35), Decl(input.js, 29, 1)) >y : Symbol(y, Decl(input.js, 31, 3)) ->mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35)) +>mistake : Symbol(Y.mistake, Decl(input.js, 20, 9), Decl(input.js, 26, 35), Decl(input.js, 29, 1)) diff --git a/tests/baselines/reference/multipleDeclarations.types b/tests/baselines/reference/multipleDeclarations.types index 195bdc2ad0d..b82cdbe05ed 100644 --- a/tests/baselines/reference/multipleDeclarations.types +++ b/tests/baselines/reference/multipleDeclarations.types @@ -43,16 +43,16 @@ class X { this.mistake = 'frankly, complete nonsense'; >this.mistake = 'frankly, complete nonsense' : "frankly, complete nonsense" ->this.mistake : () => void +>this.mistake : any >this : this ->mistake : () => void +>mistake : any >'frankly, complete nonsense' : "frankly, complete nonsense" } m() { >m : () => void } mistake() { ->mistake : () => void +>mistake : any } } let x = new X(); @@ -62,11 +62,11 @@ let x = new X(); X.prototype.mistake = false; >X.prototype.mistake = false : false ->X.prototype.mistake : () => void +>X.prototype.mistake : any >X.prototype : X >X : typeof X >prototype : X ->mistake : () => void +>mistake : any >false : false x.m(); @@ -76,9 +76,9 @@ x.m(); >m : () => void x.mistake; ->x.mistake : () => void +>x.mistake : any >x : X ->mistake : () => void +>mistake : any class Y { >Y : Y diff --git a/tests/baselines/reference/multipleExports.errors.txt b/tests/baselines/reference/multipleExports.errors.txt index 430b8618daf..43e9c4bffa3 100644 --- a/tests/baselines/reference/multipleExports.errors.txt +++ b/tests/baselines/reference/multipleExports.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/multipleExports.ts(10,5): error TS1194: Export declarations are not permitted in a namespace. -tests/cases/compiler/multipleExports.ts(10,13): error TS2484: Export declaration conflicts with exported declaration of 'x' +tests/cases/compiler/multipleExports.ts(10,13): error TS2484: Export declaration conflicts with exported declaration of 'x'. ==== tests/cases/compiler/multipleExports.ts (2 errors) ==== @@ -16,6 +16,6 @@ tests/cases/compiler/multipleExports.ts(10,13): error TS2484: Export declaration ~~~~~~~~~~~ !!! error TS1194: Export declarations are not permitted in a namespace. ~ -!!! error TS2484: Export declaration conflicts with exported declaration of 'x' +!!! error TS2484: Export declaration conflicts with exported declaration of 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/nameCollisions.errors.txt b/tests/baselines/reference/nameCollisions.errors.txt index e3c1b691371..6a7e1114aa2 100644 --- a/tests/baselines/reference/nameCollisions.errors.txt +++ b/tests/baselines/reference/nameCollisions.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/nameCollisions.ts(2,9): error TS2300: Duplicate identifier tests/cases/compiler/nameCollisions.ts(4,12): error TS2300: Duplicate identifier 'x'. tests/cases/compiler/nameCollisions.ts(10,12): error TS2300: Duplicate identifier 'z'. tests/cases/compiler/nameCollisions.ts(13,9): error TS2300: Duplicate identifier 'z'. -tests/cases/compiler/nameCollisions.ts(15,12): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +tests/cases/compiler/nameCollisions.ts(15,12): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. tests/cases/compiler/nameCollisions.ts(24,9): error TS2300: Duplicate identifier 'f'. tests/cases/compiler/nameCollisions.ts(25,14): error TS2300: Duplicate identifier 'f'. tests/cases/compiler/nameCollisions.ts(27,14): error TS2300: Duplicate identifier 'f2'. @@ -38,7 +38,7 @@ tests/cases/compiler/nameCollisions.ts(37,11): error TS2300: Duplicate identifie module y { ~ -!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged +!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. var b; } diff --git a/tests/baselines/reference/objectCreate.types b/tests/baselines/reference/objectCreate.types index 028c98af817..b4e0e72061e 100644 --- a/tests/baselines/reference/objectCreate.types +++ b/tests/baselines/reference/objectCreate.types @@ -7,19 +7,19 @@ declare var union: null | { a: number, b: string }; >b : string var n = Object.create(null); // object ->n : object ->Object.create(null) : object ->Object.create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>n : any +>Object.create(null) : any +>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >null : null var t = Object.create({ a: 1, b: "" }); // {a: number, b: string } ->t : object | { a: number; b: string; } ->Object.create({ a: 1, b: "" }) : object | { a: number; b: string; } ->Object.create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>t : any +>Object.create({ a: 1, b: "" }) : any +>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >{ a: 1, b: "" } : { a: number; b: string; } >a : number >1 : 1 @@ -27,45 +27,45 @@ var t = Object.create({ a: 1, b: "" }); // {a: number, b: string } >"" : "" var u = Object.create(union); // object | {a: number, b: string } ->u : object | { a: number; b: string; } ->Object.create(union) : object | { a: number; b: string; } ->Object.create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>u : any +>Object.create(union) : any +>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >union : { a: number; b: string; } | null var e = Object.create({}); // {} ->e : object | {} ->Object.create({}) : object | {} ->Object.create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>e : any +>Object.create({}) : any +>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >{} : {} var o = Object.create({}); // object ->o : object ->Object.create({}) : object ->Object.create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>o : any +>Object.create({}) : any +>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >{} : object >{} : {} var a = Object.create(null, {}); // any >a : any >Object.create(null, {}) : any ->Object.create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >null : null >{} : {} var a = Object.create({ a: 1, b: "" }, {}); >a : any >Object.create({ a: 1, b: "" }, {}) : any ->Object.create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >{ a: 1, b: "" } : { a: number; b: string; } >a : number >1 : 1 @@ -76,27 +76,27 @@ var a = Object.create({ a: 1, b: "" }, {}); var a = Object.create(union, {}); >a : any >Object.create(union, {}) : any ->Object.create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >union : { a: number; b: string; } | null >{} : {} var a = Object.create({}, {}); >a : any >Object.create({}, {}) : any ->Object.create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >{} : {} >{} : {} var a = Object.create({}, {}); >a : any >Object.create({}, {}) : any ->Object.create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>Object.create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T | null): object | T; (o: object | null, properties: PropertyDescriptorMap): any; } +>create : { (o: object | null): any; (o: object | null, properties: PropertyDescriptorMap): any; } >{} : object >{} : {} >{} : {} diff --git a/tests/baselines/reference/objectCreate2.types b/tests/baselines/reference/objectCreate2.types index 1b33723b0c9..3e19c08bfc0 100644 --- a/tests/baselines/reference/objectCreate2.types +++ b/tests/baselines/reference/objectCreate2.types @@ -9,17 +9,17 @@ declare var union: null | { a: number, b: string }; var n = Object.create(null); // any >n : any >Object.create(null) : any ->Object.create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>Object.create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >null : null var t = Object.create({ a: 1, b: "" }); // {a: number, b: string } ->t : object | { a: number; b: string; } ->Object.create({ a: 1, b: "" }) : object | { a: number; b: string; } ->Object.create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>t : any +>Object.create({ a: 1, b: "" }) : any +>Object.create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >{ a: 1, b: "" } : { a: number; b: string; } >a : number >1 : 1 @@ -27,45 +27,45 @@ var t = Object.create({ a: 1, b: "" }); // {a: number, b: string } >"" : "" var u = Object.create(union); // {a: number, b: string } ->u : object | { a: number; b: string; } ->Object.create(union) : object | { a: number; b: string; } ->Object.create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>u : any +>Object.create(union) : any +>Object.create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >union : { a: number; b: string; } var e = Object.create({}); // {} ->e : object | {} ->Object.create({}) : object | {} ->Object.create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>e : any +>Object.create({}) : any +>Object.create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >{} : {} var o = Object.create({}); // object ->o : object ->Object.create({}) : object ->Object.create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>o : any +>Object.create({}) : any +>Object.create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >{} : object >{} : {} var a = Object.create(null, {}); // any >a : any >Object.create(null, {}) : any ->Object.create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>Object.create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >null : null >{} : {} var a = Object.create({ a: 1, b: "" }, {}); >a : any >Object.create({ a: 1, b: "" }, {}) : any ->Object.create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>Object.create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >{ a: 1, b: "" } : { a: number; b: string; } >a : number >1 : 1 @@ -76,27 +76,27 @@ var a = Object.create({ a: 1, b: "" }, {}); var a = Object.create(union, {}); >a : any >Object.create(union, {}) : any ->Object.create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>Object.create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >union : { a: number; b: string; } >{} : {} var a = Object.create({}, {}); >a : any >Object.create({}, {}) : any ->Object.create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>Object.create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >{} : {} >{} : {} var a = Object.create({}, {}); >a : any >Object.create({}, {}) : any ->Object.create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>Object.create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >Object : ObjectConstructor ->create : { (o: T): object | T; (o: object, properties: PropertyDescriptorMap): any; } +>create : { (o: object): any; (o: object, properties: PropertyDescriptorMap): any; } >{} : object >{} : {} >{} : {} diff --git a/tests/baselines/reference/objectRestNegative.errors.txt b/tests/baselines/reference/objectRestNegative.errors.txt index 56de8aaccb6..ced36a642d6 100644 --- a/tests/baselines/reference/objectRestNegative.errors.txt +++ b/tests/baselines/reference/objectRestNegative.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/rest/objectRestNegative.ts(2,10): error TS2462: A rest element must be last in a destructuring pattern +tests/cases/conformance/types/rest/objectRestNegative.ts(2,10): error TS2462: A rest element must be last in a destructuring pattern. tests/cases/conformance/types/rest/objectRestNegative.ts(6,10): error TS2322: Type '{ a: number; }' is not assignable to type '{ a: string; }'. Types of property 'a' are incompatible. Type 'number' is not assignable to type 'string'. -tests/cases/conformance/types/rest/objectRestNegative.ts(9,31): error TS2462: A rest element must be last in a destructuring pattern +tests/cases/conformance/types/rest/objectRestNegative.ts(9,31): error TS2462: A rest element must be last in a destructuring pattern. tests/cases/conformance/types/rest/objectRestNegative.ts(11,30): error TS7008: Member 'x' implicitly has an 'any' type. tests/cases/conformance/types/rest/objectRestNegative.ts(11,33): error TS7008: Member 'y' implicitly has an 'any' type. tests/cases/conformance/types/rest/objectRestNegative.ts(12,17): error TS2700: Rest types may only be created from object types. @@ -13,7 +13,7 @@ tests/cases/conformance/types/rest/objectRestNegative.ts(17,9): error TS2701: Th let o = { a: 1, b: 'no' }; var { ...mustBeLast, a } = o; ~~~~~~~~~~ -!!! error TS2462: A rest element must be last in a destructuring pattern +!!! error TS2462: A rest element must be last in a destructuring pattern. var b: string; let notAssignable: { a: string }; @@ -26,7 +26,7 @@ tests/cases/conformance/types/rest/objectRestNegative.ts(17,9): error TS2701: Th function stillMustBeLast({ ...mustBeLast, a }: { a: number, b: string }): void { ~~~~~~~~~~ -!!! error TS2462: A rest element must be last in a destructuring pattern +!!! error TS2462: A rest element must be last in a destructuring pattern. } function generic(t: T) { ~~ diff --git a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt index caeca11edf8..bd6a09f500b 100644 --- a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt +++ b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Type 'Object' provides no match for the signature '(): void' + Type 'Object' provides no match for the signature '(): void'. tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts(14,1): error TS2322: Type 'Object' is not assignable to type '() => void'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Type 'Object' provides no match for the signature '(): void' + Type 'Object' provides no match for the signature '(): void'. ==== tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts (2 errors) ==== @@ -18,7 +18,7 @@ tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOf ~ !!! error TS2322: Type 'Object' is not assignable to type 'I'. !!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Type 'Object' provides no match for the signature '(): void' +!!! error TS2322: Type 'Object' provides no match for the signature '(): void'. var a: { (): void @@ -28,4 +28,4 @@ tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOf ~ !!! error TS2322: Type 'Object' is not assignable to type '() => void'. !!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Type 'Object' provides no match for the signature '(): void' \ No newline at end of file +!!! error TS2322: Type 'Object' provides no match for the signature '(): void'. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt index ad0e801e435..24136942ea7 100644 --- a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt +++ b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Type 'Object' provides no match for the signature 'new (): any' + Type 'Object' provides no match for the signature 'new (): any'. tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts(14,1): error TS2322: Type 'Object' is not assignable to type 'new () => any'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Type 'Object' provides no match for the signature 'new (): any' + Type 'Object' provides no match for the signature 'new (): any'. ==== tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts (2 errors) ==== @@ -18,7 +18,7 @@ tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMemb ~ !!! error TS2322: Type 'Object' is not assignable to type 'I'. !!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' +!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'. var a: { new(): any @@ -28,4 +28,4 @@ tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMemb ~ !!! error TS2322: Type 'Object' is not assignable to type 'new () => any'. !!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' \ No newline at end of file +!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'. \ No newline at end of file diff --git a/tests/baselines/reference/objectTypesWithPredefinedTypesAsName.errors.txt b/tests/baselines/reference/objectTypesWithPredefinedTypesAsName.errors.txt index d6f2d2bae19..c7f4d14601e 100644 --- a/tests/baselines/reference/objectTypesWithPredefinedTypesAsName.errors.txt +++ b/tests/baselines/reference/objectTypesWithPredefinedTypesAsName.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts(3,7): error TS2414: Class name cannot be 'any' -tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts(5,7): error TS2414: Class name cannot be 'number' -tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts(7,7): error TS2414: Class name cannot be 'boolean' -tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts(10,7): error TS2414: Class name cannot be 'string' +tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts(3,7): error TS2414: Class name cannot be 'any'. +tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts(5,7): error TS2414: Class name cannot be 'number'. +tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts(7,7): error TS2414: Class name cannot be 'boolean'. +tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts(10,7): error TS2414: Class name cannot be 'string'. ==== tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPredefinedTypesAsName.ts (4 errors) ==== @@ -9,20 +9,20 @@ tests/cases/conformance/types/specifyingTypes/predefinedTypes/objectTypesWithPre class any { } ~~~ -!!! error TS2414: Class name cannot be 'any' +!!! error TS2414: Class name cannot be 'any'. class number { } ~~~~~~ -!!! error TS2414: Class name cannot be 'number' +!!! error TS2414: Class name cannot be 'number'. class boolean { } ~~~~~~~ -!!! error TS2414: Class name cannot be 'boolean' +!!! error TS2414: Class name cannot be 'boolean'. class bool { } // not a predefined type anymore class string { } ~~~~~~ -!!! error TS2414: Class name cannot be 'string' +!!! error TS2414: Class name cannot be 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/packageJsonMain.trace.json b/tests/baselines/reference/packageJsonMain.trace.json index a167e8dfec6..08daccbe479 100644 --- a/tests/baselines/reference/packageJsonMain.trace.json +++ b/tests/baselines/reference/packageJsonMain.trace.json @@ -20,7 +20,7 @@ "File '/node_modules/foo/oof' does not exist.", "Loading module as file / folder, candidate module location '/node_modules/foo/oof', target file type 'JavaScript'.", "File '/node_modules/foo/oof.js' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/foo/oof.js', result '/node_modules/foo/oof.js'", + "Resolving real path for '/node_modules/foo/oof.js', result '/node_modules/foo/oof.js'.", "======== Module name 'foo' was successfully resolved to '/node_modules/foo/oof.js'. ========", "======== Resolving module 'bar' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -41,7 +41,7 @@ "Found 'package.json' at '/node_modules/bar/package.json'.", "'package.json' has 'main' field 'rab.js' that references '/node_modules/bar/rab.js'.", "File '/node_modules/bar/rab.js' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/bar/rab.js', result '/node_modules/bar/rab.js'", + "Resolving real path for '/node_modules/bar/rab.js', result '/node_modules/bar/rab.js'.", "======== Module name 'bar' was successfully resolved to '/node_modules/bar/rab.js'. ========", "======== Resolving module 'baz' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -66,6 +66,6 @@ "File '/node_modules/baz/zab.js' does not exist.", "File '/node_modules/baz/zab.jsx' does not exist.", "File '/node_modules/baz/zab/index.js' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/baz/zab/index.js', result '/node_modules/baz/zab/index.js'", + "Resolving real path for '/node_modules/baz/zab/index.js', result '/node_modules/baz/zab/index.js'.", "======== Module name 'baz' was successfully resolved to '/node_modules/baz/zab/index.js'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/parseTypes.errors.txt b/tests/baselines/reference/parseTypes.errors.txt index cf8b0d79115..184137fe220 100644 --- a/tests/baselines/reference/parseTypes.errors.txt +++ b/tests/baselines/reference/parseTypes.errors.txt @@ -3,7 +3,7 @@ tests/cases/compiler/parseTypes.ts(10,1): error TS2322: Type '(s: string) => voi tests/cases/compiler/parseTypes.ts(11,1): error TS2322: Type '(s: string) => void' is not assignable to type '{ [x: number]: number; }'. Index signature is missing in type '(s: string) => void'. tests/cases/compiler/parseTypes.ts(12,1): error TS2322: Type '(s: string) => void' is not assignable to type 'new () => number'. - Type '(s: string) => void' provides no match for the signature 'new (): number' + Type '(s: string) => void' provides no match for the signature 'new (): number'. ==== tests/cases/compiler/parseTypes.ts (4 errors) ==== @@ -28,5 +28,5 @@ tests/cases/compiler/parseTypes.ts(12,1): error TS2322: Type '(s: string) => voi z=g; ~ !!! error TS2322: Type '(s: string) => void' is not assignable to type 'new () => number'. -!!! error TS2322: Type '(s: string) => void' provides no match for the signature 'new (): number' +!!! error TS2322: Type '(s: string) => void' provides no match for the signature 'new (): number'. \ No newline at end of file diff --git a/tests/baselines/reference/parser.asyncGenerators.classMethods.esnext.errors.txt b/tests/baselines/reference/parser.asyncGenerators.classMethods.esnext.errors.txt new file mode 100644 index 00000000000..febd6d1160e --- /dev/null +++ b/tests/baselines/reference/parser.asyncGenerators.classMethods.esnext.errors.txt @@ -0,0 +1,235 @@ +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorGetAccessorIsError.ts(2,17): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorPropertyIsError.ts(2,15): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorSetAccessorIsError.ts(2,17): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts(2,19): error TS2524: 'await' expressions cannot be used in a parameter initializer. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts(3,14): error TS1109: Expression expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(2,15): error TS1138: Parameter declaration expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(2,15): error TS2693: 'await' only refers to a type, but is being used as a value here. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(2,20): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(4,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,18): error TS1003: Identifier expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,24): error TS1109: Expression expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,26): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(3,18): error TS1003: Identifier expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(3,26): error TS1005: '=>' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,28): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,34): error TS1109: Expression expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,36): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(3,28): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(3,36): error TS1005: '=>' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldAsTypeIsStrictError.ts(4,16): error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInClassComputedPropertyIsError.ts(2,14): error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInClassComputedPropertyIsError.ts(2,14): error TS2693: 'yield' only refers to a type, but is being used as a value here. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts(2,19): error TS1163: A 'yield' expression is only allowed in a generator body. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts(2,19): error TS2523: 'yield' expressions cannot be used in a parameter initializer. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(2,15): error TS1138: Parameter declaration expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(2,15): error TS2693: 'yield' only refers to a type, but is being used as a value here. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(2,20): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(4,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts(3,16): error TS1109: Expression expected. + + +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/methodIsOk.ts (0 errors) ==== + class C1 { + async * f() { + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMethodNameIsOk.ts (0 errors) ==== + class C2 { + async * await() { + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldMethodNameIsOk.ts (0 errors) ==== + class C3 { + async * yield() { + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts (4 errors) ==== + class C4 { + async * f(await) { + ~~~~~ +!!! error TS1138: Parameter declaration expected. + ~~~~~ +!!! error TS2693: 'await' only refers to a type, but is being used as a value here. + ~ +!!! error TS1005: ';' expected. + } + } + ~ +!!! error TS1128: Declaration or statement expected. +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts (4 errors) ==== + class C5 { + async * f(yield) { + ~~~~~ +!!! error TS1138: Parameter declaration expected. + ~~~~~ +!!! error TS2693: 'yield' only refers to a type, but is being used as a value here. + ~ +!!! error TS1005: ';' expected. + } + } + ~ +!!! error TS1128: Declaration or statement expected. +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts (1 errors) ==== + class C6 { + async * f(a = await 1) { + ~~~~~~~ +!!! error TS2524: 'await' expressions cannot be used in a parameter initializer. + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts (2 errors) ==== + class C7 { + async * f(a = yield) { + ~~~~~ +!!! error TS1163: A 'yield' expression is only allowed in a generator body. + ~~~~~ +!!! error TS2523: 'yield' expressions cannot be used in a parameter initializer. + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedAsyncGeneratorIsOk.ts (0 errors) ==== + class C8 { + async * f() { + async function * g() { + } + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts (2 errors) ==== + class C9 { + async * f() { + function yield() { + ~~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: '=>' expected. + } + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts (2 errors) ==== + class C10 { + async * f() { + const x = function yield() { + ~~~~~ +!!! error TS1005: '(' expected. + ~ +!!! error TS1005: '=>' expected. + }; + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts (3 errors) ==== + class C11 { + async * f() { + function await() { + ~~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1109: Expression expected. + ~ +!!! error TS1005: ';' expected. + } + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts (3 errors) ==== + class C12 { + async * f() { + const x = function await() { + ~~~~~ +!!! error TS1005: '(' expected. + ~ +!!! error TS1109: Expression expected. + ~ +!!! error TS1005: ';' expected. + }; + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldIsOk.ts (0 errors) ==== + class C13 { + async * f() { + yield; + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldWithValueIsOk.ts (0 errors) ==== + class C14 { + async * f() { + yield 1; + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts (1 errors) ==== + class C15 { + async * f() { + yield *; + ~ +!!! error TS1109: Expression expected. + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarWithValueIsOk.ts (0 errors) ==== + class C16 { + async * f() { + yield * []; + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitWithValueIsOk.ts (0 errors) ==== + class C17 { + async * f() { + await 1; + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts (1 errors) ==== + class C18 { + async * f() { + await; + ~ +!!! error TS1109: Expression expected. + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitAsTypeIsOk.ts (0 errors) ==== + interface await {} + class C19 { + async * f() { + let x: await; + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldAsTypeIsStrictError.ts (1 errors) ==== + interface yield {} + class C20 { + async * f() { + let x: yield; + ~~~~~ +!!! error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode. + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInClassComputedPropertyIsError.ts (2 errors) ==== + class C21 { + async * [yield]() { + ~~~~~ +!!! error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode. + ~~~~~ +!!! error TS2693: 'yield' only refers to a type, but is being used as a value here. + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInNestedComputedPropertyIsOk.ts (0 errors) ==== + class C22 { + async * f() { + const x = { [yield]: 1 }; + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorGetAccessorIsError.ts (1 errors) ==== + class C23 { + async * get x() { + ~ +!!! error TS1005: '(' expected. + return 1; + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorSetAccessorIsError.ts (1 errors) ==== + class C24 { + async * set x(value: number) { + ~ +!!! error TS1005: '(' expected. + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorPropertyIsError.ts (1 errors) ==== + class C25 { + async * x = 1; + ~ +!!! error TS1005: '(' expected. + } \ No newline at end of file diff --git a/tests/baselines/reference/parser.asyncGenerators.functionDeclarations.esnext.errors.txt b/tests/baselines/reference/parser.asyncGenerators.functionDeclarations.esnext.errors.txt new file mode 100644 index 00000000000..a80c67badd5 --- /dev/null +++ b/tests/baselines/reference/parser.asyncGenerators.functionDeclarations.esnext.errors.txt @@ -0,0 +1,137 @@ +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts(1,25): error TS2524: 'await' expressions cannot be used in a parameter initializer. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts(2,10): error TS1109: Expression expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(1,21): error TS1138: Parameter declaration expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(1,26): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,14): error TS1003: Identifier expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,20): error TS1109: Expression expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,22): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(2,14): error TS1003: Identifier expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(2,22): error TS1005: '=>' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(2,24): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(2,32): error TS1005: '=>' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(2,24): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(2,32): error TS1005: '=>' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts(1,25): error TS2523: 'yield' expressions cannot be used in a parameter initializer. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(1,21): error TS1138: Parameter declaration expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(1,26): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts(2,12): error TS1109: Expression expected. + + +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/functionDeclarationIsOk.ts (0 errors) ==== + async function * f1() { + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitNameIsOk.ts (0 errors) ==== + async function * await() { + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldNameIsOk.ts (0 errors) ==== + async function * yield() { + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts (2 errors) ==== + async function * f4(await) { + ~~~~~ +!!! error TS1138: Parameter declaration expected. + ~ +!!! error TS1005: ';' expected. + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts (2 errors) ==== + async function * f5(yield) { + ~~~~~ +!!! error TS1138: Parameter declaration expected. + ~ +!!! error TS1005: ';' expected. + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts (1 errors) ==== + async function * f6(a = await 1) { + ~~~~~~~ +!!! error TS2524: 'await' expressions cannot be used in a parameter initializer. + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts (1 errors) ==== + async function * f7(a = yield) { + ~~~~~ +!!! error TS2523: 'yield' expressions cannot be used in a parameter initializer. + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedAsyncGeneratorIsOk.ts (0 errors) ==== + async function * f8() { + async function * g() { + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts (2 errors) ==== + async function * f9() { + function yield() { + ~~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: '=>' expected. + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts (2 errors) ==== + async function * f10() { + const x = function yield() { + ~~~~~ +!!! error TS1005: '(' expected. + ~ +!!! error TS1005: '=>' expected. + }; + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts (3 errors) ==== + async function * f11() { + function await() { + ~~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1109: Expression expected. + ~ +!!! error TS1005: ';' expected. + } + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts (2 errors) ==== + async function * f12() { + const x = function yield() { + ~~~~~ +!!! error TS1005: '(' expected. + ~ +!!! error TS1005: '=>' expected. + }; + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldIsOk.ts (0 errors) ==== + async function * f13() { + yield; + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldWithValueIsOk.ts (0 errors) ==== + async function * f14() { + yield 1; + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts (1 errors) ==== + async function * f15() { + yield *; + ~ +!!! error TS1109: Expression expected. + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarWithValueIsOk.ts (0 errors) ==== + async function * f16() { + yield * []; + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitWithValueIsOk.ts (0 errors) ==== + async function * f17() { + await 1; + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts (1 errors) ==== + async function * f18() { + await; + ~ +!!! error TS1109: Expression expected. + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitAsTypeIsOk.ts (0 errors) ==== + interface await {} + async function * f19() { + let x: await; + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldAsTypeIsOk.ts (0 errors) ==== + interface yield {} + async function * f20() { + let x: yield; + } +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInNestedComputedPropertyIsOk.ts (0 errors) ==== + async function * f21() { + const x = { [yield]: 1 }; + } \ No newline at end of file diff --git a/tests/baselines/reference/parser.asyncGenerators.functionExpressions.esnext.errors.txt b/tests/baselines/reference/parser.asyncGenerators.functionExpressions.esnext.errors.txt new file mode 100644 index 00000000000..0eed47d2039 --- /dev/null +++ b/tests/baselines/reference/parser.asyncGenerators.functionExpressions.esnext.errors.txt @@ -0,0 +1,171 @@ +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts(1,34): error TS2524: 'await' expressions cannot be used in a parameter initializer. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts(2,10): error TS1109: Expression expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitNameIsError.ts(1,29): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitNameIsError.ts(1,29): error TS2451: Cannot redeclare block-scoped variable 'await'. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitNameIsError.ts(1,34): error TS1005: '=' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitNameIsError.ts(1,37): error TS1005: '=>' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(1,30): error TS1138: Parameter declaration expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(1,30): error TS2451: Cannot redeclare block-scoped variable 'await'. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(1,35): error TS1005: ',' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,14): error TS1003: Identifier expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,20): error TS1109: Expression expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,22): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(2,14): error TS1003: Identifier expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(2,22): error TS1005: '=>' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(2,24): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(2,30): error TS1109: Expression expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(2,32): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(2,24): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(2,32): error TS1005: '=>' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts(1,34): error TS2523: 'yield' expressions cannot be used in a parameter initializer. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldNameIsError.ts(1,29): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldNameIsError.ts(1,29): error TS2451: Cannot redeclare block-scoped variable 'yield'. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldNameIsError.ts(1,34): error TS1005: '=' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldNameIsError.ts(1,37): error TS1005: '=>' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(1,30): error TS1138: Parameter declaration expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(1,30): error TS2451: Cannot redeclare block-scoped variable 'yield'. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(1,35): error TS1005: ',' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts(2,12): error TS1109: Expression expected. + + +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/functionExpressionIsOk.ts (0 errors) ==== + const f1 = async function * f() { + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitNameIsError.ts (4 errors) ==== + const f2 = async function * await() { + ~~~~~ +!!! error TS1005: '(' expected. + ~~~~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'await'. + ~ +!!! error TS1005: '=' expected. + ~ +!!! error TS1005: '=>' expected. + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldNameIsError.ts (4 errors) ==== + const f3 = async function * yield() { + ~~~~~ +!!! error TS1005: '(' expected. + ~~~~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'yield'. + ~ +!!! error TS1005: '=' expected. + ~ +!!! error TS1005: '=>' expected. + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts (3 errors) ==== + const f4 = async function * (await) { + ~~~~~ +!!! error TS1138: Parameter declaration expected. + ~~~~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'await'. + ~ +!!! error TS1005: ',' expected. + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts (3 errors) ==== + const f5 = async function * (yield) { + ~~~~~ +!!! error TS1138: Parameter declaration expected. + ~~~~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'yield'. + ~ +!!! error TS1005: ',' expected. + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts (1 errors) ==== + const f6 = async function * (a = await 1) { + ~~~~~~~ +!!! error TS2524: 'await' expressions cannot be used in a parameter initializer. + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts (1 errors) ==== + const f7 = async function * (a = yield) { + ~~~~~ +!!! error TS2523: 'yield' expressions cannot be used in a parameter initializer. + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedAsyncGeneratorIsOk.ts (0 errors) ==== + const f8 = async function * () { + async function * g() { + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts (2 errors) ==== + const f9 = async function * () { + function yield() { + ~~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: '=>' expected. + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts (2 errors) ==== + const f10 = async function * () { + const x = function yield() { + ~~~~~ +!!! error TS1005: '(' expected. + ~ +!!! error TS1005: '=>' expected. + }; + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts (3 errors) ==== + const f11 = async function * () { + function await() { + ~~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1109: Expression expected. + ~ +!!! error TS1005: ';' expected. + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts (3 errors) ==== + const f12 = async function * () { + const x = function await() { + ~~~~~ +!!! error TS1005: '(' expected. + ~ +!!! error TS1109: Expression expected. + ~ +!!! error TS1005: ';' expected. + }; + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldIsOk.ts (0 errors) ==== + const f13 = async function * () { + yield; + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldWithValueIsOk.ts (0 errors) ==== + const f14 = async function * () { + yield 1; + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts (1 errors) ==== + const f15 = async function * () { + yield *; + ~ +!!! error TS1109: Expression expected. + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarWithValueIsOk.ts (0 errors) ==== + const f16 = async function * () { + yield * []; + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitWithValueIsOk.ts (0 errors) ==== + const f17 = async function * () { + await 1; + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts (1 errors) ==== + const f18 = async function * () { + await; + ~ +!!! error TS1109: Expression expected. + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitAsTypeIsOk.ts (0 errors) ==== + interface await {} + const f19 = async function * () { + let x: await; + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldAsTypeIsOk.ts (0 errors) ==== + interface yield {} + const f20 = async function * () { + let x: yield; + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInNestedComputedPropertyIsOk.ts (0 errors) ==== + const f21 = async function *() { + const x = { [yield]: 1 }; + }; + \ No newline at end of file diff --git a/tests/baselines/reference/parser.asyncGenerators.objectLiteralMethods.esnext.errors.txt b/tests/baselines/reference/parser.asyncGenerators.objectLiteralMethods.esnext.errors.txt new file mode 100644 index 00000000000..8215f418cdc --- /dev/null +++ b/tests/baselines/reference/parser.asyncGenerators.objectLiteralMethods.esnext.errors.txt @@ -0,0 +1,218 @@ +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorGetAccessorIsError.ts(2,17): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorPropertyIsError.ts(2,14): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorSetAccessorIsError.ts(2,17): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts(2,19): error TS2524: 'await' expressions cannot be used in a parameter initializer. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts(3,14): error TS1109: Expression expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(2,15): error TS1138: Parameter declaration expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(2,20): error TS1005: ':' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(2,22): error TS1136: Property assignment expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(4,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,18): error TS1003: Identifier expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,24): error TS1109: Expression expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,26): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(3,18): error TS1003: Identifier expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(3,26): error TS1005: '=>' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,28): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,34): error TS1109: Expression expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,36): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(3,28): error TS1005: '(' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(3,36): error TS1005: '=>' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts(2,19): error TS2523: 'yield' expressions cannot be used in a parameter initializer. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(2,15): error TS1138: Parameter declaration expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(2,20): error TS1005: ':' expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(2,22): error TS1136: Property assignment expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(4,1): error TS1128: Declaration or statement expected. +tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts(3,16): error TS1109: Expression expected. + + +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/methodIsOk.ts (0 errors) ==== + const o1 = { + async * f() { + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMethodNameIsOk.ts (0 errors) ==== + const o2 = { + async * await() { + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldMethodNameIsOk.ts (0 errors) ==== + const o3 = { + async * yield() { + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts (4 errors) ==== + const o4 = { + async * f(await) { + ~~~~~ +!!! error TS1138: Parameter declaration expected. + ~ +!!! error TS1005: ':' expected. + ~ +!!! error TS1136: Property assignment expected. + } + }; + ~ +!!! error TS1128: Declaration or statement expected. +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts (4 errors) ==== + const o5 = { + async * f(yield) { + ~~~~~ +!!! error TS1138: Parameter declaration expected. + ~ +!!! error TS1005: ':' expected. + ~ +!!! error TS1136: Property assignment expected. + } + }; + ~ +!!! error TS1128: Declaration or statement expected. +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts (1 errors) ==== + const o6 = { + async * f(a = await 1) { + ~~~~~~~ +!!! error TS2524: 'await' expressions cannot be used in a parameter initializer. + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts (1 errors) ==== + const o7 = { + async * f(a = yield) { + ~~~~~ +!!! error TS2523: 'yield' expressions cannot be used in a parameter initializer. + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedAsyncGeneratorIsOk.ts (0 errors) ==== + const o8 = { + async * f() { + async function * g() { + } + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts (2 errors) ==== + const o9 = { + async * f() { + function yield() { + ~~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: '=>' expected. + } + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts (2 errors) ==== + const o10 = { + async * f() { + const x = function yield() { + ~~~~~ +!!! error TS1005: '(' expected. + ~ +!!! error TS1005: '=>' expected. + }; + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts (3 errors) ==== + const o11 = { + async * f() { + function await() { + ~~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1109: Expression expected. + ~ +!!! error TS1005: ';' expected. + } + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts (3 errors) ==== + const o12 = { + async * f() { + const x = function await() { + ~~~~~ +!!! error TS1005: '(' expected. + ~ +!!! error TS1109: Expression expected. + ~ +!!! error TS1005: ';' expected. + }; + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldIsOk.ts (0 errors) ==== + const o13 = { + async * f() { + yield; + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldWithValueIsOk.ts (0 errors) ==== + const o14 = { + async * f() { + yield 1; + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts (1 errors) ==== + const o15 = { + async * f() { + yield *; + ~ +!!! error TS1109: Expression expected. + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarWithValueIsOk.ts (0 errors) ==== + const o16 = { + async * f() { + yield * []; + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitWithValueIsOk.ts (0 errors) ==== + const o17 = { + async * f() { + await 1; + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts (1 errors) ==== + const o18 = { + async * f() { + await; + ~ +!!! error TS1109: Expression expected. + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitAsTypeIsOk.ts (0 errors) ==== + interface await {} + const o19 = { + async * f() { + let x: await; + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldAsTypeIsOk.ts (0 errors) ==== + interface yield {} + const o20 = { + async * f() { + let x: yield; + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInNestedComputedPropertyIsOk.ts (0 errors) ==== + const o21 = { + async * f() { + const x = { [yield]: 1 }; + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorGetAccessorIsError.ts (1 errors) ==== + const o22 = { + async * get x() { + ~ +!!! error TS1005: '(' expected. + return 1; + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorSetAccessorIsError.ts (1 errors) ==== + const o23 = { + async * set x(value: number) { + ~ +!!! error TS1005: '(' expected. + } + }; +==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorPropertyIsError.ts (1 errors) ==== + const o24 = { + async * x: 1; + ~ +!!! error TS1005: '(' expected. + }; \ No newline at end of file diff --git a/tests/baselines/reference/parser.forAwait.esnext.errors.txt b/tests/baselines/reference/parser.forAwait.esnext.errors.txt new file mode 100644 index 00000000000..44dfd947b56 --- /dev/null +++ b/tests/baselines/reference/parser.forAwait.esnext.errors.txt @@ -0,0 +1,104 @@ +tests/cases/conformance/parser/ecmascriptnext/forAwait/forAwaitInWithDeclIsError.ts(1,20): error TS1005: 'of' expected. +tests/cases/conformance/parser/ecmascriptnext/forAwait/forAwaitInWithDeclIsError.ts(1,23): error TS2304: Cannot find name 'y'. +tests/cases/conformance/parser/ecmascriptnext/forAwait/forAwaitInWithExprIsError.ts(1,12): error TS2304: Cannot find name 'x'. +tests/cases/conformance/parser/ecmascriptnext/forAwait/forAwaitInWithExprIsError.ts(1,14): error TS1005: 'of' expected. +tests/cases/conformance/parser/ecmascriptnext/forAwait/forAwaitInWithExprIsError.ts(1,17): error TS2304: Cannot find name 'y'. +tests/cases/conformance/parser/ecmascriptnext/forAwait/inFunctionDeclWithDeclIsError.ts(3,9): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator. +tests/cases/conformance/parser/ecmascriptnext/forAwait/inFunctionDeclWithExprIsError.ts(3,9): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator. +tests/cases/conformance/parser/ecmascriptnext/forAwait/inGeneratorWithDeclIsError.ts(3,9): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator. +tests/cases/conformance/parser/ecmascriptnext/forAwait/inGeneratorWithExprIsError.ts(3,9): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator. +tests/cases/conformance/parser/ecmascriptnext/forAwait/topLevelWithDeclIsError.ts(1,5): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator. +tests/cases/conformance/parser/ecmascriptnext/forAwait/topLevelWithDeclIsError.ts(1,23): error TS2304: Cannot find name 'y'. +tests/cases/conformance/parser/ecmascriptnext/forAwait/topLevelWithExprIsError.ts(1,5): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator. +tests/cases/conformance/parser/ecmascriptnext/forAwait/topLevelWithExprIsError.ts(1,12): error TS2304: Cannot find name 'x'. +tests/cases/conformance/parser/ecmascriptnext/forAwait/topLevelWithExprIsError.ts(1,17): error TS2304: Cannot find name 'y'. + + +==== tests/cases/conformance/parser/ecmascriptnext/forAwait/topLevelWithDeclIsError.ts (2 errors) ==== + for await (const x of y) { + ~~~~~ +!!! error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator. + ~ +!!! error TS2304: Cannot find name 'y'. + } +==== tests/cases/conformance/parser/ecmascriptnext/forAwait/topLevelWithExprIsError.ts (3 errors) ==== + for await (x of y) { + ~~~~~ +!!! error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator. + ~ +!!! error TS2304: Cannot find name 'x'. + ~ +!!! error TS2304: Cannot find name 'y'. + } +==== tests/cases/conformance/parser/ecmascriptnext/forAwait/forAwaitInWithDeclIsError.ts (2 errors) ==== + for await (const x in y) { + ~~ +!!! error TS1005: 'of' expected. + ~ +!!! error TS2304: Cannot find name 'y'. + } +==== tests/cases/conformance/parser/ecmascriptnext/forAwait/forAwaitInWithExprIsError.ts (3 errors) ==== + for await (x in y) { + ~ +!!! error TS2304: Cannot find name 'x'. + ~~ +!!! error TS1005: 'of' expected. + ~ +!!! error TS2304: Cannot find name 'y'. + } +==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inFunctionDeclWithDeclIsError.ts (1 errors) ==== + function f5() { + let y: any; + for await (const x of y) { + ~~~~~ +!!! error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator. + } + } +==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inFunctionDeclWithExprIsError.ts (1 errors) ==== + function f6() { + let x: any, y: any; + for await (x of y) { + ~~~~~ +!!! error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator. + } + } +==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inAsyncFunctionWithDeclIsOk.ts (0 errors) ==== + async function f7() { + let y: any; + for await (const x of y) { + } + } +==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inAsyncFunctionWithExprIsOk.ts (0 errors) ==== + async function f8() { + let x: any, y: any; + for await (x of y) { + } + } +==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inAsyncGeneratorWithDeclIsOk.ts (0 errors) ==== + async function* f9() { + let y: any; + for await (const x of y) { + } + } +==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inAsyncGeneratorWithExpressionIsOk.ts (0 errors) ==== + async function* f10() { + let x: any, y: any; + for await (x of y) { + } + } +==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inGeneratorWithDeclIsError.ts (1 errors) ==== + function* f11() { + let y: any; + for await (const x of y) { + ~~~~~ +!!! error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator. + } + } +==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inGeneratorWithExprIsError.ts (1 errors) ==== + function* f12() { + let x: any, y: any; + for await (x of y) { + ~~~~~ +!!! error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/parser10.1.1-8gs.errors.txt b/tests/baselines/reference/parser10.1.1-8gs.errors.txt index 3426ccab8da..75ab54029a6 100644 --- a/tests/baselines/reference/parser10.1.1-8gs.errors.txt +++ b/tests/baselines/reference/parser10.1.1-8gs.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts(17,7): error TS2304: Cannot find name 'NotEarlyError'. -tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts(18,5): error TS1212: Identifier expected. 'public' is a reserved word in strict mode +tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts(18,5): error TS1212: Identifier expected. 'public' is a reserved word in strict mode. ==== tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts (2 errors) ==== @@ -24,5 +24,5 @@ tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts(18,5): error TS12 !!! error TS2304: Cannot find name 'NotEarlyError'. var public = 1; ~~~~~~ -!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode. \ No newline at end of file diff --git a/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt b/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt index a2bbb98fbf4..6797a574021 100644 --- a/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt +++ b/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAutomaticSemicolonInsertion1.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Type 'Object' provides no match for the signature '(): void' + Type 'Object' provides no match for the signature '(): void'. tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAutomaticSemicolonInsertion1.ts(14,1): error TS2322: Type 'Object' is not assignable to type '() => void'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Type 'Object' provides no match for the signature '(): void' + Type 'Object' provides no match for the signature '(): void'. ==== tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAutomaticSemicolonInsertion1.ts (2 errors) ==== @@ -18,7 +18,7 @@ tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAut ~ !!! error TS2322: Type 'Object' is not assignable to type 'I'. !!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Type 'Object' provides no match for the signature '(): void' +!!! error TS2322: Type 'Object' provides no match for the signature '(): void'. var a: { (): void @@ -28,5 +28,5 @@ tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAut ~ !!! error TS2322: Type 'Object' is not assignable to type '() => void'. !!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Type 'Object' provides no match for the signature '(): void' +!!! error TS2322: Type 'Object' provides no match for the signature '(): void'. \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration24.errors.txt b/tests/baselines/reference/parserClassDeclaration24.errors.txt index 5b3b0640684..02a2b835d2b 100644 --- a/tests/baselines/reference/parserClassDeclaration24.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration24.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration24.ts(1,7): error TS2414: Class name cannot be 'any' +tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration24.ts(1,7): error TS2414: Class name cannot be 'any'. ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration24.ts (1 errors) ==== class any { ~~~ -!!! error TS2414: Class name cannot be 'any' +!!! error TS2414: Class name cannot be 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserInterfaceDeclaration8.errors.txt b/tests/baselines/reference/parserInterfaceDeclaration8.errors.txt index 2c50b97d163..90af9c235e6 100644 --- a/tests/baselines/reference/parserInterfaceDeclaration8.errors.txt +++ b/tests/baselines/reference/parserInterfaceDeclaration8.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration8.ts(1,11): error TS2427: Interface name cannot be 'string' +tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration8.ts(1,11): error TS2427: Interface name cannot be 'string'. ==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration8.ts (1 errors) ==== interface string { ~~~~~~ -!!! error TS2427: Interface name cannot be 'string' +!!! error TS2427: Interface name cannot be 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserStrictMode15.errors.txt b/tests/baselines/reference/parserStrictMode15.errors.txt index 831d214c9fb..e3d38176130 100644 --- a/tests/baselines/reference/parserStrictMode15.errors.txt +++ b/tests/baselines/reference/parserStrictMode15.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts(2,8): error TS1102: 'delete' cannot be called on an identifier in strict mode. tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts(2,8): error TS2304: Cannot find name 'a'. -tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts(2,8): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts(2,8): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts (3 errors) ==== @@ -11,4 +11,4 @@ tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts(2,8) ~ !!! error TS2304: Cannot find name 'a'. ~ -!!! error TS2703: The operand of a delete operator must be a property reference \ No newline at end of file +!!! error TS2703: The operand of a delete operator must be a property reference. \ No newline at end of file diff --git a/tests/baselines/reference/parserStrictMode16.errors.txt b/tests/baselines/reference/parserStrictMode16.errors.txt index fe99c337232..4761f0a94b4 100644 --- a/tests/baselines/reference/parserStrictMode16.errors.txt +++ b/tests/baselines/reference/parserStrictMode16.errors.txt @@ -1,20 +1,20 @@ -tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(2,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(3,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(4,8): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(5,8): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(2,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(3,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(4,8): error TS2703: The operand of a delete operator must be a property reference. +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(5,8): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts (4 errors) ==== "use strict"; delete this; ~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete 1; ~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete null; ~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference +!!! error TS2703: The operand of a delete operator must be a property reference. delete "a"; ~~~ -!!! error TS2703: The operand of a delete operator must be a property reference \ No newline at end of file +!!! error TS2703: The operand of a delete operator must be a property reference. \ No newline at end of file diff --git a/tests/baselines/reference/parserStrictMode2.errors.txt b/tests/baselines/reference/parserStrictMode2.errors.txt index 464e8eface8..c112d562ad9 100644 --- a/tests/baselines/reference/parserStrictMode2.errors.txt +++ b/tests/baselines/reference/parserStrictMode2.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode2.ts(2,1): error TS2304: Cannot find name 'foo1'. tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode2.ts(3,1): error TS2304: Cannot find name 'foo1'. tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode2.ts(4,1): error TS2304: Cannot find name 'foo1'. -tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode2.ts(5,1): error TS1212: Identifier expected. 'static' is a reserved word in strict mode +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode2.ts(5,1): error TS1212: Identifier expected. 'static' is a reserved word in strict mode. tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode2.ts(5,1): error TS2304: Cannot find name 'static'. @@ -18,6 +18,6 @@ tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode2.ts(5,1): !!! error TS2304: Cannot find name 'foo1'. static(); ~~~~~~ -!!! error TS1212: Identifier expected. 'static' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'static' is a reserved word in strict mode. ~~~~~~ !!! error TS2304: Cannot find name 'static'. \ No newline at end of file diff --git a/tests/baselines/reference/parser_duplicateLabel1.errors.txt b/tests/baselines/reference/parser_duplicateLabel1.errors.txt index c98ede21ecf..95c0ad9a290 100644 --- a/tests/baselines/reference/parser_duplicateLabel1.errors.txt +++ b/tests/baselines/reference/parser_duplicateLabel1.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts(1,1): error TS7028: Unused label. -tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts(2,1): error TS1114: Duplicate label 'target' +tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts(2,1): error TS1114: Duplicate label 'target'. tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel1.ts(2,1): error TS7028: Unused label. @@ -9,7 +9,7 @@ tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_d !!! error TS7028: Unused label. target: ~~~~~~ -!!! error TS1114: Duplicate label 'target' +!!! error TS1114: Duplicate label 'target'. ~~~~~~ !!! error TS7028: Unused label. while (true) { diff --git a/tests/baselines/reference/parser_duplicateLabel2.errors.txt b/tests/baselines/reference/parser_duplicateLabel2.errors.txt index cbad8b73a21..6d42b8c34fe 100644 --- a/tests/baselines/reference/parser_duplicateLabel2.errors.txt +++ b/tests/baselines/reference/parser_duplicateLabel2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts(1,1): error TS7028: Unused label. -tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts(3,3): error TS1114: Duplicate label 'target' +tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts(3,3): error TS1114: Duplicate label 'target'. tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_duplicateLabel2.ts(3,3): error TS7028: Unused label. @@ -10,7 +10,7 @@ tests/cases/conformance/parser/ecmascript5/Statements/LabeledStatements/parser_d while (true) { target: ~~~~~~ -!!! error TS1114: Duplicate label 'target' +!!! error TS1114: Duplicate label 'target'. ~~~~~~ !!! error TS7028: Unused label. while (true) { diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.errors.txt b/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.errors.txt index ad954bd142b..3b0a387f644 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.errors.txt +++ b/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.errors.txt @@ -1,8 +1,8 @@ -error TS5061: Pattern '*1*' can have at most one '*' character -error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character +error TS5061: Pattern '*1*' can have at most one '*' character. +error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character. -!!! error TS5061: Pattern '*1*' can have at most one '*' character -!!! error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character +!!! error TS5061: Pattern '*1*' can have at most one '*' character. +!!! error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character. ==== tests/cases/compiler/root/src/folder1/file1.ts (0 errors) ==== export var x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution2_node.errors.txt b/tests/baselines/reference/pathMappingBasedModuleResolution2_node.errors.txt index ad954bd142b..3b0a387f644 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution2_node.errors.txt +++ b/tests/baselines/reference/pathMappingBasedModuleResolution2_node.errors.txt @@ -1,8 +1,8 @@ -error TS5061: Pattern '*1*' can have at most one '*' character -error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character +error TS5061: Pattern '*1*' can have at most one '*' character. +error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character. -!!! error TS5061: Pattern '*1*' can have at most one '*' character -!!! error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character +!!! error TS5061: Pattern '*1*' can have at most one '*' character. +!!! error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character. ==== tests/cases/compiler/root/src/folder1/file1.ts (0 errors) ==== export var x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.trace.json index 90b8620e36c..cd76270105b 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module 'folder2/file2' from 'c:/root/folder1/file1.ts'. ========", "Explicitly specified module resolution kind: 'Classic'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'.", "Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.", "File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.", "======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========", @@ -11,7 +11,7 @@ "======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========", "======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'Classic'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'.", "Resolving module name 'file4' relative to base url 'c:/root' - 'c:/root/file4'.", "File 'c:/root/file4.ts' does not exist.", "File 'c:/root/file4.tsx' does not exist.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json index c61871b34c0..6ac06e1dda1 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module 'folder2/file2' from 'c:/root/folder1/file1.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'.", "Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.", "Loading module as file / folder, candidate module location 'c:/root/folder2/file2', target file type 'TypeScript'.", "File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.", @@ -13,7 +13,7 @@ "======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========", "======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'.", "Resolving module name 'file4' relative to base url 'c:/root' - 'c:/root/file4'.", "Loading module as file / folder, candidate module location 'c:/root/file4', target file type 'TypeScript'.", "File 'c:/root/file4.ts' does not exist.", @@ -30,6 +30,6 @@ "File 'c:/node_modules/file4/index.ts' does not exist.", "File 'c:/node_modules/file4/index.tsx' does not exist.", "File 'c:/node_modules/file4/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for 'c:/node_modules/file4/index.d.ts', result 'c:/node_modules/file4/index.d.ts'", + "Resolving real path for 'c:/node_modules/file4/index.d.ts', result 'c:/node_modules/file4/index.d.ts'.", "======== Module name 'file4' was successfully resolved to 'c:/node_modules/file4/index.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.trace.json index 90b8620e36c..cd76270105b 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module 'folder2/file2' from 'c:/root/folder1/file1.ts'. ========", "Explicitly specified module resolution kind: 'Classic'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'.", "Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.", "File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.", "======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========", @@ -11,7 +11,7 @@ "======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========", "======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'Classic'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'.", "Resolving module name 'file4' relative to base url 'c:/root' - 'c:/root/file4'.", "File 'c:/root/file4.ts' does not exist.", "File 'c:/root/file4.tsx' does not exist.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json index c61871b34c0..6ac06e1dda1 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module 'folder2/file2' from 'c:/root/folder1/file1.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'.", "Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.", "Loading module as file / folder, candidate module location 'c:/root/folder2/file2', target file type 'TypeScript'.", "File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.", @@ -13,7 +13,7 @@ "======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========", "======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'.", "Resolving module name 'file4' relative to base url 'c:/root' - 'c:/root/file4'.", "Loading module as file / folder, candidate module location 'c:/root/file4', target file type 'TypeScript'.", "File 'c:/root/file4.ts' does not exist.", @@ -30,6 +30,6 @@ "File 'c:/node_modules/file4/index.ts' does not exist.", "File 'c:/node_modules/file4/index.tsx' does not exist.", "File 'c:/node_modules/file4/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for 'c:/node_modules/file4/index.d.ts', result 'c:/node_modules/file4/index.d.ts'", + "Resolving real path for 'c:/node_modules/file4/index.d.ts', result 'c:/node_modules/file4/index.d.ts'.", "======== Module name 'file4' was successfully resolved to 'c:/node_modules/file4/index.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.trace.json index 9108b25e88c..4fa08fc9cc1 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module 'folder2/file1' from 'c:/root/folder1/file1.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file1'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file1'.", "'paths' option is specified, looking for a pattern to match module name 'folder2/file1'.", "Module name 'folder2/file1', matched pattern '*'.", "Trying substitution '*', candidate module location: 'folder2/file1'.", @@ -9,7 +9,7 @@ "======== Module name 'folder2/file1' was successfully resolved to 'c:/root/folder2/file1.ts'. ========", "======== Resolving module 'folder3/file2' from 'c:/root/folder1/file1.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder3/file2'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder3/file2'.", "'paths' option is specified, looking for a pattern to match module name 'folder3/file2'.", "Module name 'folder3/file2', matched pattern '*'.", "Trying substitution '*', candidate module location: 'folder3/file2'.", @@ -18,7 +18,7 @@ "======== Module name 'folder3/file2' was successfully resolved to 'c:/root/generated/folder3/file2.ts'. ========", "======== Resolving module 'components/file3' from 'c:/root/folder1/file1.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'components/file3'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'components/file3'.", "'paths' option is specified, looking for a pattern to match module name 'components/file3'.", "Module name 'components/file3', matched pattern 'components/*'.", "Trying substitution 'shared/components/*', candidate module location: 'shared/components/file3'.", @@ -26,7 +26,7 @@ "======== Module name 'components/file3' was successfully resolved to 'c:/root/shared/components/file3.ts'. ========", "======== Resolving module 'file4' from 'c:/root/folder1/file1.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'.", "'paths' option is specified, looking for a pattern to match module name 'file4'.", "Module name 'file4', matched pattern '*'.", "Trying substitution '*', candidate module location: 'file4'.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json index d70942a4b47..3b6710408fc 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module 'folder2/file1' from 'c:/root/folder1/file1.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file1'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file1'.", "'paths' option is specified, looking for a pattern to match module name 'folder2/file1'.", "Module name 'folder2/file1', matched pattern '*'.", "Trying substitution '*', candidate module location: 'folder2/file1'.", @@ -10,7 +10,7 @@ "======== Module name 'folder2/file1' was successfully resolved to 'c:/root/folder2/file1.ts'. ========", "======== Resolving module 'folder3/file2' from 'c:/root/folder1/file1.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder3/file2'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder3/file2'.", "'paths' option is specified, looking for a pattern to match module name 'folder3/file2'.", "Module name 'folder3/file2', matched pattern '*'.", "Trying substitution '*', candidate module location: 'folder3/file2'.", @@ -21,7 +21,7 @@ "======== Module name 'folder3/file2' was successfully resolved to 'c:/root/generated/folder3/file2.ts'. ========", "======== Resolving module 'components/file3' from 'c:/root/folder1/file1.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'components/file3'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'components/file3'.", "'paths' option is specified, looking for a pattern to match module name 'components/file3'.", "Module name 'components/file3', matched pattern 'components/*'.", "Trying substitution 'shared/components/*', candidate module location: 'shared/components/file3'.", @@ -36,7 +36,7 @@ "======== Module name 'components/file3' was successfully resolved to 'c:/root/shared/components/file3/index.d.ts'. ========", "======== Resolving module 'file4' from 'c:/root/folder1/file1.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'", + "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'.", "'paths' option is specified, looking for a pattern to match module name 'file4'.", "Module name 'file4', matched pattern '*'.", "Trying substitution '*', candidate module location: 'file4'.", @@ -55,6 +55,6 @@ "Directory 'c:/root/folder1/node_modules' does not exist, skipping all lookups in it.", "Directory 'c:/root/node_modules' does not exist, skipping all lookups in it.", "File 'c:/node_modules/file4.ts' exist - use it as a name resolution result.", - "Resolving real path for 'c:/node_modules/file4.ts', result 'c:/node_modules/file4.ts'", + "Resolving real path for 'c:/node_modules/file4.ts', result 'c:/node_modules/file4.ts'.", "======== Module name 'file4' was successfully resolved to 'c:/node_modules/file4.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.trace.json index ec865b7ac66..93bc0e4db89 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.trace.json @@ -1,27 +1,27 @@ [ "======== Resolving module './project/file3' from 'c:/root/src/file1.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", - "'rootDirs' option is set, using it to resolve relative module name './project/file3'", + "'rootDirs' option is set, using it to resolve relative module name './project/file3'.", "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/src/project/file3' - 'true'.", "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/src/project/file3' - 'false'.", - "Longest matching prefix for 'c:/root/src/project/file3' is 'c:/root/src/'", - "Loading 'project/file3' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file3'", - "Trying other entries in 'rootDirs'", - "Loading 'project/file3' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file3'", + "Longest matching prefix for 'c:/root/src/project/file3' is 'c:/root/src/'.", + "Loading 'project/file3' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file3'.", + "Trying other entries in 'rootDirs'.", + "Loading 'project/file3' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file3'.", "File 'c:/root/generated/src/project/file3.ts' exist - use it as a name resolution result.", "======== Module name './project/file3' was successfully resolved to 'c:/root/generated/src/project/file3.ts'. ========", "======== Resolving module '../file2' from 'c:/root/generated/src/project/file3.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", - "'rootDirs' option is set, using it to resolve relative module name '../file2'", + "'rootDirs' option is set, using it to resolve relative module name '../file2'.", "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/generated/src/file2' - 'false'.", "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/generated/src/file2' - 'true'.", - "Longest matching prefix for 'c:/root/generated/src/file2' is 'c:/root/generated/src/'", - "Loading 'file2' from the root dir 'c:/root/generated/src/', candidate location 'c:/root/generated/src/file2'", + "Longest matching prefix for 'c:/root/generated/src/file2' is 'c:/root/generated/src/'.", + "Loading 'file2' from the root dir 'c:/root/generated/src/', candidate location 'c:/root/generated/src/file2'.", "File 'c:/root/generated/src/file2.ts' does not exist.", "File 'c:/root/generated/src/file2.tsx' does not exist.", "File 'c:/root/generated/src/file2.d.ts' does not exist.", - "Trying other entries in 'rootDirs'", - "Loading 'file2' from the root dir 'c:/root/src', candidate location 'c:/root/src/file2'", + "Trying other entries in 'rootDirs'.", + "Loading 'file2' from the root dir 'c:/root/src', candidate location 'c:/root/src/file2'.", "File 'c:/root/src/file2.ts' does not exist.", "File 'c:/root/src/file2.tsx' does not exist.", "File 'c:/root/src/file2.d.ts' exist - use it as a name resolution result.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution6_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution6_node.trace.json index d623e166ef0..50f9bd862c1 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution6_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution6_node.trace.json @@ -1,32 +1,32 @@ [ "======== Resolving module './project/file3' from 'c:/root/src/file1.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "'rootDirs' option is set, using it to resolve relative module name './project/file3'", + "'rootDirs' option is set, using it to resolve relative module name './project/file3'.", "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/src/project/file3' - 'true'.", "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/src/project/file3' - 'false'.", - "Longest matching prefix for 'c:/root/src/project/file3' is 'c:/root/src/'", - "Loading 'project/file3' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file3'", + "Longest matching prefix for 'c:/root/src/project/file3' is 'c:/root/src/'.", + "Loading 'project/file3' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file3'.", "Loading module as file / folder, candidate module location 'c:/root/src/project/file3', target file type 'TypeScript'.", "Directory 'c:/root/src/project' does not exist, skipping all lookups in it.", - "Trying other entries in 'rootDirs'", - "Loading 'project/file3' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file3'", + "Trying other entries in 'rootDirs'.", + "Loading 'project/file3' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file3'.", "Loading module as file / folder, candidate module location 'c:/root/generated/src/project/file3', target file type 'TypeScript'.", "File 'c:/root/generated/src/project/file3.ts' exist - use it as a name resolution result.", "======== Module name './project/file3' was successfully resolved to 'c:/root/generated/src/project/file3.ts'. ========", "======== Resolving module '../file2' from 'c:/root/generated/src/project/file3.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "'rootDirs' option is set, using it to resolve relative module name '../file2'", + "'rootDirs' option is set, using it to resolve relative module name '../file2'.", "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/generated/src/file2' - 'false'.", "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/generated/src/file2' - 'true'.", - "Longest matching prefix for 'c:/root/generated/src/file2' is 'c:/root/generated/src/'", - "Loading 'file2' from the root dir 'c:/root/generated/src/', candidate location 'c:/root/generated/src/file2'", + "Longest matching prefix for 'c:/root/generated/src/file2' is 'c:/root/generated/src/'.", + "Loading 'file2' from the root dir 'c:/root/generated/src/', candidate location 'c:/root/generated/src/file2'.", "Loading module as file / folder, candidate module location 'c:/root/generated/src/file2', target file type 'TypeScript'.", "File 'c:/root/generated/src/file2.ts' does not exist.", "File 'c:/root/generated/src/file2.tsx' does not exist.", "File 'c:/root/generated/src/file2.d.ts' does not exist.", "Directory 'c:/root/generated/src/file2' does not exist, skipping all lookups in it.", - "Trying other entries in 'rootDirs'", - "Loading 'file2' from the root dir 'c:/root/src', candidate location 'c:/root/src/file2'", + "Trying other entries in 'rootDirs'.", + "Loading 'file2' from the root dir 'c:/root/src', candidate location 'c:/root/src/file2'.", "Loading module as file / folder, candidate module location 'c:/root/src/file2', target file type 'TypeScript'.", "File 'c:/root/src/file2.ts' does not exist.", "File 'c:/root/src/file2.tsx' does not exist.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.trace.json index 61056ea8502..78a273ae059 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.trace.json @@ -1,18 +1,18 @@ [ "======== Resolving module './project/file2' from 'c:/root/src/file1.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", - "'rootDirs' option is set, using it to resolve relative module name './project/file2'", + "'rootDirs' option is set, using it to resolve relative module name './project/file2'.", "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/src/project/file2' - 'true'.", "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/src/project/file2' - 'false'.", - "Longest matching prefix for 'c:/root/src/project/file2' is 'c:/root/src/'", - "Loading 'project/file2' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file2'", - "Trying other entries in 'rootDirs'", - "Loading 'project/file2' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file2'", + "Longest matching prefix for 'c:/root/src/project/file2' is 'c:/root/src/'.", + "Loading 'project/file2' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file2'.", + "Trying other entries in 'rootDirs'.", + "Loading 'project/file2' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file2'.", "File 'c:/root/generated/src/project/file2.ts' exist - use it as a name resolution result.", "======== Module name './project/file2' was successfully resolved to 'c:/root/generated/src/project/file2.ts'. ========", "======== Resolving module 'module3' from 'c:/root/src/file1.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", - "'baseUrl' option is set to 'c:/root/', using this value to resolve non-relative module name 'module3'", + "'baseUrl' option is set to 'c:/root/', using this value to resolve non-relative module name 'module3'.", "'paths' option is specified, looking for a pattern to match module name 'module3'.", "Module name 'module3', matched pattern '*'.", "Trying substitution '*', candidate module location: 'module3'.", @@ -35,7 +35,7 @@ "======== Module name 'module3' was successfully resolved to 'c:/module3.d.ts'. ========", "======== Resolving module 'module1' from 'c:/root/generated/src/project/file2.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", - "'baseUrl' option is set to 'c:/root/', using this value to resolve non-relative module name 'module1'", + "'baseUrl' option is set to 'c:/root/', using this value to resolve non-relative module name 'module1'.", "'paths' option is specified, looking for a pattern to match module name 'module1'.", "Module name 'module1', matched pattern '*'.", "Trying substitution '*', candidate module location: 'module1'.", @@ -49,7 +49,7 @@ "======== Module name 'module1' was successfully resolved to 'c:/shared/module1.d.ts'. ========", "======== Resolving module 'templates/module2' from 'c:/root/generated/src/project/file2.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", - "'baseUrl' option is set to 'c:/root/', using this value to resolve non-relative module name 'templates/module2'", + "'baseUrl' option is set to 'c:/root/', using this value to resolve non-relative module name 'templates/module2'.", "'paths' option is specified, looking for a pattern to match module name 'templates/module2'.", "Module name 'templates/module2', matched pattern 'templates/*'.", "Trying substitution 'generated/src/templates/*', candidate module location: 'generated/src/templates/module2'.", @@ -57,16 +57,16 @@ "======== Module name 'templates/module2' was successfully resolved to 'c:/root/generated/src/templates/module2.ts'. ========", "======== Resolving module '../file3' from 'c:/root/generated/src/project/file2.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", - "'rootDirs' option is set, using it to resolve relative module name '../file3'", + "'rootDirs' option is set, using it to resolve relative module name '../file3'.", "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/generated/src/file3' - 'false'.", "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/generated/src/file3' - 'true'.", - "Longest matching prefix for 'c:/root/generated/src/file3' is 'c:/root/generated/src/'", - "Loading 'file3' from the root dir 'c:/root/generated/src/', candidate location 'c:/root/generated/src/file3'", + "Longest matching prefix for 'c:/root/generated/src/file3' is 'c:/root/generated/src/'.", + "Loading 'file3' from the root dir 'c:/root/generated/src/', candidate location 'c:/root/generated/src/file3'.", "File 'c:/root/generated/src/file3.ts' does not exist.", "File 'c:/root/generated/src/file3.tsx' does not exist.", "File 'c:/root/generated/src/file3.d.ts' does not exist.", - "Trying other entries in 'rootDirs'", - "Loading 'file3' from the root dir 'c:/root/src', candidate location 'c:/root/src/file3'", + "Trying other entries in 'rootDirs'.", + "Loading 'file3' from the root dir 'c:/root/src', candidate location 'c:/root/src/file3'.", "File 'c:/root/src/file3.ts' does not exist.", "File 'c:/root/src/file3.tsx' does not exist.", "File 'c:/root/src/file3.d.ts' exist - use it as a name resolution result.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json index 4cc7dbae1c1..50e4a6fabeb 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json @@ -1,21 +1,21 @@ [ "======== Resolving module './project/file2' from 'c:/root/src/file1.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "'rootDirs' option is set, using it to resolve relative module name './project/file2'", + "'rootDirs' option is set, using it to resolve relative module name './project/file2'.", "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/src/project/file2' - 'true'.", "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/src/project/file2' - 'false'.", - "Longest matching prefix for 'c:/root/src/project/file2' is 'c:/root/src/'", - "Loading 'project/file2' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file2'", + "Longest matching prefix for 'c:/root/src/project/file2' is 'c:/root/src/'.", + "Loading 'project/file2' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file2'.", "Loading module as file / folder, candidate module location 'c:/root/src/project/file2', target file type 'TypeScript'.", "Directory 'c:/root/src/project' does not exist, skipping all lookups in it.", - "Trying other entries in 'rootDirs'", - "Loading 'project/file2' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file2'", + "Trying other entries in 'rootDirs'.", + "Loading 'project/file2' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file2'.", "Loading module as file / folder, candidate module location 'c:/root/generated/src/project/file2', target file type 'TypeScript'.", "File 'c:/root/generated/src/project/file2.ts' exist - use it as a name resolution result.", "======== Module name './project/file2' was successfully resolved to 'c:/root/generated/src/project/file2.ts'. ========", "======== Resolving module 'module3' from 'c:/root/src/file1.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "'baseUrl' option is set to 'c:/root/', using this value to resolve non-relative module name 'module3'", + "'baseUrl' option is set to 'c:/root/', using this value to resolve non-relative module name 'module3'.", "'paths' option is specified, looking for a pattern to match module name 'module3'.", "Module name 'module3', matched pattern '*'.", "Trying substitution '*', candidate module location: 'module3'.", @@ -36,11 +36,11 @@ "File 'c:/node_modules/module3.ts' does not exist.", "File 'c:/node_modules/module3.tsx' does not exist.", "File 'c:/node_modules/module3.d.ts' exist - use it as a name resolution result.", - "Resolving real path for 'c:/node_modules/module3.d.ts', result 'c:/node_modules/module3.d.ts'", + "Resolving real path for 'c:/node_modules/module3.d.ts', result 'c:/node_modules/module3.d.ts'.", "======== Module name 'module3' was successfully resolved to 'c:/node_modules/module3.d.ts'. ========", "======== Resolving module 'module1' from 'c:/root/generated/src/project/file2.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "'baseUrl' option is set to 'c:/root/', using this value to resolve non-relative module name 'module1'", + "'baseUrl' option is set to 'c:/root/', using this value to resolve non-relative module name 'module1'.", "'paths' option is specified, looking for a pattern to match module name 'module1'.", "Module name 'module1', matched pattern '*'.", "Trying substitution '*', candidate module location: 'module1'.", @@ -61,7 +61,7 @@ "======== Module name 'module1' was successfully resolved to 'c:/shared/module1/index.d.ts'. ========", "======== Resolving module 'templates/module2' from 'c:/root/generated/src/project/file2.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "'baseUrl' option is set to 'c:/root/', using this value to resolve non-relative module name 'templates/module2'", + "'baseUrl' option is set to 'c:/root/', using this value to resolve non-relative module name 'templates/module2'.", "'paths' option is specified, looking for a pattern to match module name 'templates/module2'.", "Module name 'templates/module2', matched pattern 'templates/*'.", "Trying substitution 'generated/src/templates/*', candidate module location: 'generated/src/templates/module2'.", @@ -70,18 +70,18 @@ "======== Module name 'templates/module2' was successfully resolved to 'c:/root/generated/src/templates/module2.ts'. ========", "======== Resolving module '../file3' from 'c:/root/generated/src/project/file2.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "'rootDirs' option is set, using it to resolve relative module name '../file3'", + "'rootDirs' option is set, using it to resolve relative module name '../file3'.", "Checking if 'c:/root/src/' is the longest matching prefix for 'c:/root/generated/src/file3' - 'false'.", "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/generated/src/file3' - 'true'.", - "Longest matching prefix for 'c:/root/generated/src/file3' is 'c:/root/generated/src/'", - "Loading 'file3' from the root dir 'c:/root/generated/src/', candidate location 'c:/root/generated/src/file3'", + "Longest matching prefix for 'c:/root/generated/src/file3' is 'c:/root/generated/src/'.", + "Loading 'file3' from the root dir 'c:/root/generated/src/', candidate location 'c:/root/generated/src/file3'.", "Loading module as file / folder, candidate module location 'c:/root/generated/src/file3', target file type 'TypeScript'.", "File 'c:/root/generated/src/file3.ts' does not exist.", "File 'c:/root/generated/src/file3.tsx' does not exist.", "File 'c:/root/generated/src/file3.d.ts' does not exist.", "Directory 'c:/root/generated/src/file3' does not exist, skipping all lookups in it.", - "Trying other entries in 'rootDirs'", - "Loading 'file3' from the root dir 'c:/root/src', candidate location 'c:/root/src/file3'", + "Trying other entries in 'rootDirs'.", + "Loading 'file3' from the root dir 'c:/root/src', candidate location 'c:/root/src/file3'.", "Loading module as file / folder, candidate module location 'c:/root/src/file3', target file type 'TypeScript'.", "File 'c:/root/src/file3.ts' does not exist.", "File 'c:/root/src/file3.tsx' does not exist.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension.trace.json index a761414eb42..39a12996d42 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module 'foo' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "'baseUrl' option is set to '/', using this value to resolve non-relative module name 'foo'", + "'baseUrl' option is set to '/', using this value to resolve non-relative module name 'foo'.", "'paths' option is specified, looking for a pattern to match module name 'foo'.", "Module name 'foo', matched pattern 'foo'.", "Trying substitution 'foo/foo.ts', candidate module location: 'foo/foo.ts'.", @@ -9,7 +9,7 @@ "======== Module name 'foo' was successfully resolved to '/foo/foo.ts'. ========", "======== Resolving module 'bar' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "'baseUrl' option is set to '/', using this value to resolve non-relative module name 'bar'", + "'baseUrl' option is set to '/', using this value to resolve non-relative module name 'bar'.", "'paths' option is specified, looking for a pattern to match module name 'bar'.", "Module name 'bar', matched pattern 'bar'.", "Trying substitution 'bar/bar.js', candidate module location: 'bar/bar.js'.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_failedLookup.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_failedLookup.trace.json index 197b7f5c249..7561a47b1e7 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_failedLookup.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_failedLookup.trace.json @@ -1,14 +1,14 @@ [ "======== Resolving module 'foo' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "'baseUrl' option is set to '/', using this value to resolve non-relative module name 'foo'", + "'baseUrl' option is set to '/', using this value to resolve non-relative module name 'foo'.", "'paths' option is specified, looking for a pattern to match module name 'foo'.", "Module name 'foo', matched pattern 'foo'.", "Trying substitution 'foo/foo.ts', candidate module location: 'foo/foo.ts'.", "File '/foo/foo.ts' does not exist.", "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", "Directory '/node_modules' does not exist, skipping all lookups in it.", - "'baseUrl' option is set to '/', using this value to resolve non-relative module name 'foo'", + "'baseUrl' option is set to '/', using this value to resolve non-relative module name 'foo'.", "'paths' option is specified, looking for a pattern to match module name 'foo'.", "Module name 'foo', matched pattern 'foo'.", "Trying substitution 'foo/foo.ts', candidate module location: 'foo/foo.ts'.", diff --git a/tests/baselines/reference/primitiveTypeAsClassName.errors.txt b/tests/baselines/reference/primitiveTypeAsClassName.errors.txt index 1ce55c30034..7c02830357d 100644 --- a/tests/baselines/reference/primitiveTypeAsClassName.errors.txt +++ b/tests/baselines/reference/primitiveTypeAsClassName.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/primitiveTypeAsClassName.ts(1,7): error TS2414: Class name cannot be 'any' +tests/cases/compiler/primitiveTypeAsClassName.ts(1,7): error TS2414: Class name cannot be 'any'. ==== tests/cases/compiler/primitiveTypeAsClassName.ts (1 errors) ==== class any {} ~~~ -!!! error TS2414: Class name cannot be 'any' \ No newline at end of file +!!! error TS2414: Class name cannot be 'any'. \ No newline at end of file diff --git a/tests/baselines/reference/primitiveTypeAsInterfaceName.errors.txt b/tests/baselines/reference/primitiveTypeAsInterfaceName.errors.txt index 7876ec7f85f..d260fc77574 100644 --- a/tests/baselines/reference/primitiveTypeAsInterfaceName.errors.txt +++ b/tests/baselines/reference/primitiveTypeAsInterfaceName.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/primitiveTypeAsInterfaceName.ts(1,11): error TS2427: Interface name cannot be 'number' +tests/cases/compiler/primitiveTypeAsInterfaceName.ts(1,11): error TS2427: Interface name cannot be 'number'. ==== tests/cases/compiler/primitiveTypeAsInterfaceName.ts (1 errors) ==== interface number {} ~~~~~~ -!!! error TS2427: Interface name cannot be 'number' \ No newline at end of file +!!! error TS2427: Interface name cannot be 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/primitiveTypeAsInterfaceNameGeneric.errors.txt b/tests/baselines/reference/primitiveTypeAsInterfaceNameGeneric.errors.txt index 3054df57431..5757d27c41c 100644 --- a/tests/baselines/reference/primitiveTypeAsInterfaceNameGeneric.errors.txt +++ b/tests/baselines/reference/primitiveTypeAsInterfaceNameGeneric.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/primitiveTypeAsInterfaceNameGeneric.ts(1,11): error TS2427: Interface name cannot be 'number' +tests/cases/compiler/primitiveTypeAsInterfaceNameGeneric.ts(1,11): error TS2427: Interface name cannot be 'number'. ==== tests/cases/compiler/primitiveTypeAsInterfaceNameGeneric.ts (1 errors) ==== interface number {} ~~~~~~ -!!! error TS2427: Interface name cannot be 'number' \ No newline at end of file +!!! error TS2427: Interface name cannot be 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt index 668f037a03b..eadcbd8ca99 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt @@ -1,11 +1,11 @@ error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. error TS5055: Cannot write file 'SameNameDTsNotSpecifiedWithAllowJs/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. !!! error TS5055: Cannot write file 'SameNameDTsNotSpecifiedWithAllowJs/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== SameNameDTsNotSpecifiedWithAllowJs/a.d.ts (0 errors) ==== declare var a: number; ==== SameNameDTsNotSpecifiedWithAllowJs/a.js (0 errors) ==== diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt index 668f037a03b..eadcbd8ca99 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt @@ -1,11 +1,11 @@ error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. error TS5055: Cannot write file 'SameNameDTsNotSpecifiedWithAllowJs/a.js' because it would overwrite input file. - Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. !!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. !!! error TS5055: Cannot write file 'SameNameDTsNotSpecifiedWithAllowJs/a.js' because it would overwrite input file. -!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. ==== SameNameDTsNotSpecifiedWithAllowJs/a.d.ts (0 errors) ==== declare var a: number; ==== SameNameDTsNotSpecifiedWithAllowJs/a.js (0 errors) ==== diff --git a/tests/baselines/reference/propertyAssignment.errors.txt b/tests/baselines/reference/propertyAssignment.errors.txt index 815d0a44d53..a8411ca490c 100644 --- a/tests/baselines/reference/propertyAssignment.errors.txt +++ b/tests/baselines/reference/propertyAssignment.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/propertyAssignment.ts(6,13): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/compiler/propertyAssignment.ts(6,14): error TS2304: Cannot find name 'index'. tests/cases/compiler/propertyAssignment.ts(14,1): error TS2322: Type '{ x: number; }' is not assignable to type 'new () => any'. - Type '{ x: number; }' provides no match for the signature 'new (): any' + Type '{ x: number; }' provides no match for the signature 'new (): any'. tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: number; }' is not assignable to type '() => void'. - Type '{ x: number; }' provides no match for the signature '(): void' + Type '{ x: number; }' provides no match for the signature '(): void'. ==== tests/cases/compiler/propertyAssignment.ts (4 errors) ==== @@ -27,9 +27,9 @@ tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: numbe foo1 = bar1; // should be an error ~~~~ !!! error TS2322: Type '{ x: number; }' is not assignable to type 'new () => any'. -!!! error TS2322: Type '{ x: number; }' provides no match for the signature 'new (): any' +!!! error TS2322: Type '{ x: number; }' provides no match for the signature 'new (): any'. foo2 = bar2; foo3 = bar3; // should be an error ~~~~ !!! error TS2322: Type '{ x: number; }' is not assignable to type '() => void'. -!!! error TS2322: Type '{ x: number; }' provides no match for the signature '(): void' \ No newline at end of file +!!! error TS2322: Type '{ x: number; }' provides no match for the signature '(): void'. \ No newline at end of file diff --git a/tests/baselines/reference/qualify.errors.txt b/tests/baselines/reference/qualify.errors.txt index 53c9927737f..6c12823c964 100644 --- a/tests/baselines/reference/qualify.errors.txt +++ b/tests/baselines/reference/qualify.errors.txt @@ -5,9 +5,9 @@ tests/cases/compiler/qualify.ts(45,13): error TS2322: Type 'I4' is not assignabl tests/cases/compiler/qualify.ts(46,13): error TS2322: Type 'I4' is not assignable to type 'I3[]'. Property 'length' is missing in type 'I4'. tests/cases/compiler/qualify.ts(47,13): error TS2322: Type 'I4' is not assignable to type '() => I3'. - Type 'I4' provides no match for the signature '(): I3' + Type 'I4' provides no match for the signature '(): I3'. tests/cases/compiler/qualify.ts(48,13): error TS2322: Type 'I4' is not assignable to type '(k: I3) => void'. - Type 'I4' provides no match for the signature '(k: I3): void' + Type 'I4' provides no match for the signature '(k: I3): void'. tests/cases/compiler/qualify.ts(49,13): error TS2322: Type 'I4' is not assignable to type '{ k: I3; }'. Property 'k' is missing in type 'I4'. tests/cases/compiler/qualify.ts(58,5): error TS2322: Type 'I' is not assignable to type 'T.I'. @@ -74,11 +74,11 @@ tests/cases/compiler/qualify.ts(58,5): error TS2322: Type 'I' is not assignable var v4:()=>K1.I3=v1; ~~ !!! error TS2322: Type 'I4' is not assignable to type '() => I3'. -!!! error TS2322: Type 'I4' provides no match for the signature '(): I3' +!!! error TS2322: Type 'I4' provides no match for the signature '(): I3'. var v5:(k:K1.I3)=>void=v1; ~~ !!! error TS2322: Type 'I4' is not assignable to type '(k: I3) => void'. -!!! error TS2322: Type 'I4' provides no match for the signature '(k: I3): void' +!!! error TS2322: Type 'I4' provides no match for the signature '(k: I3): void'. var v6:{k:K1.I3;}=v1; ~~ !!! error TS2322: Type 'I4' is not assignable to type '{ k: I3; }'. diff --git a/tests/baselines/reference/reboundIdentifierOnImportAlias.errors.txt b/tests/baselines/reference/reboundIdentifierOnImportAlias.errors.txt index 27969d0e0cb..9e51575bdc8 100644 --- a/tests/baselines/reference/reboundIdentifierOnImportAlias.errors.txt +++ b/tests/baselines/reference/reboundIdentifierOnImportAlias.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/reboundIdentifierOnImportAlias.ts(6,16): error TS2437: Module 'Foo' is hidden by a local declaration with the same name +tests/cases/compiler/reboundIdentifierOnImportAlias.ts(6,16): error TS2437: Module 'Foo' is hidden by a local declaration with the same name. ==== tests/cases/compiler/reboundIdentifierOnImportAlias.ts (1 errors) ==== @@ -9,5 +9,5 @@ tests/cases/compiler/reboundIdentifierOnImportAlias.ts(6,16): error TS2437: Modu var Foo = 1; import F = Foo; ~~~ -!!! error TS2437: Module 'Foo' is hidden by a local declaration with the same name +!!! error TS2437: Module 'Foo' is hidden by a local declaration with the same name. } \ No newline at end of file diff --git a/tests/baselines/reference/redeclareParameterInCatchBlock.errors.txt b/tests/baselines/reference/redeclareParameterInCatchBlock.errors.txt index 9fd4c63f02f..9b1cad852ab 100644 --- a/tests/baselines/reference/redeclareParameterInCatchBlock.errors.txt +++ b/tests/baselines/reference/redeclareParameterInCatchBlock.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/redeclareParameterInCatchBlock.ts(5,11): error TS2492: Cannot redeclare identifier 'e' in catch clause -tests/cases/compiler/redeclareParameterInCatchBlock.ts(11,9): error TS2492: Cannot redeclare identifier 'e' in catch clause -tests/cases/compiler/redeclareParameterInCatchBlock.ts(17,15): error TS2492: Cannot redeclare identifier 'b' in catch clause +tests/cases/compiler/redeclareParameterInCatchBlock.ts(5,11): error TS2492: Cannot redeclare identifier 'e' in catch clause. +tests/cases/compiler/redeclareParameterInCatchBlock.ts(11,9): error TS2492: Cannot redeclare identifier 'e' in catch clause. +tests/cases/compiler/redeclareParameterInCatchBlock.ts(17,15): error TS2492: Cannot redeclare identifier 'b' in catch clause. tests/cases/compiler/redeclareParameterInCatchBlock.ts(22,15): error TS2451: Cannot redeclare block-scoped variable 'x'. tests/cases/compiler/redeclareParameterInCatchBlock.ts(22,21): error TS2451: Cannot redeclare block-scoped variable 'x'. @@ -12,7 +12,7 @@ tests/cases/compiler/redeclareParameterInCatchBlock.ts(22,21): error TS2451: Can } catch(e) { const e = null; ~ -!!! error TS2492: Cannot redeclare identifier 'e' in catch clause +!!! error TS2492: Cannot redeclare identifier 'e' in catch clause. } try { @@ -20,7 +20,7 @@ tests/cases/compiler/redeclareParameterInCatchBlock.ts(22,21): error TS2451: Can } catch(e) { let e; ~ -!!! error TS2492: Cannot redeclare identifier 'e' in catch clause +!!! error TS2492: Cannot redeclare identifier 'e' in catch clause. } try { @@ -28,7 +28,7 @@ tests/cases/compiler/redeclareParameterInCatchBlock.ts(22,21): error TS2451: Can } catch ([a, b]) { const [c, b] = [0, 1]; ~ -!!! error TS2492: Cannot redeclare identifier 'b' in catch clause +!!! error TS2492: Cannot redeclare identifier 'b' in catch clause. } try { diff --git a/tests/baselines/reference/reservedNameOnInterfaceImport.errors.txt b/tests/baselines/reference/reservedNameOnInterfaceImport.errors.txt index dac57eae5ef..ddaa8fc7a4a 100644 --- a/tests/baselines/reference/reservedNameOnInterfaceImport.errors.txt +++ b/tests/baselines/reference/reservedNameOnInterfaceImport.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/reservedNameOnInterfaceImport.ts(5,12): error TS2438: Import name cannot be 'string' +tests/cases/compiler/reservedNameOnInterfaceImport.ts(5,12): error TS2438: Import name cannot be 'string'. ==== tests/cases/compiler/reservedNameOnInterfaceImport.ts (1 errors) ==== @@ -8,6 +8,6 @@ tests/cases/compiler/reservedNameOnInterfaceImport.ts(5,12): error TS2438: Impor // Should error; 'test.istring' is a type, so this import conflicts with the 'string' type. import string = test.istring; ~~~~~~ -!!! error TS2438: Import name cannot be 'string' +!!! error TS2438: Import name cannot be 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/reservedNameOnModuleImportWithInterface.errors.txt b/tests/baselines/reference/reservedNameOnModuleImportWithInterface.errors.txt index 7704ff74013..860c8864e4c 100644 --- a/tests/baselines/reference/reservedNameOnModuleImportWithInterface.errors.txt +++ b/tests/baselines/reference/reservedNameOnModuleImportWithInterface.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/reservedNameOnModuleImportWithInterface.ts(6,12): error TS2438: Import name cannot be 'string' +tests/cases/compiler/reservedNameOnModuleImportWithInterface.ts(6,12): error TS2438: Import name cannot be 'string'. ==== tests/cases/compiler/reservedNameOnModuleImportWithInterface.ts (1 errors) ==== @@ -9,6 +9,6 @@ tests/cases/compiler/reservedNameOnModuleImportWithInterface.ts(6,12): error TS2 // Should error; imports both a type and a module, which means it conflicts with the 'string' type. import string = mi_string; ~~~~~~ -!!! error TS2438: Import name cannot be 'string' +!!! error TS2438: Import name cannot be 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/reservedNamesInAliases.errors.txt b/tests/baselines/reference/reservedNamesInAliases.errors.txt index 22894f8f6a6..fc5ed8ae9c9 100644 --- a/tests/baselines/reference/reservedNamesInAliases.errors.txt +++ b/tests/baselines/reference/reservedNamesInAliases.errors.txt @@ -1,28 +1,28 @@ -tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(2,6): error TS2457: Type alias name cannot be 'any' -tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(3,6): error TS2457: Type alias name cannot be 'number' -tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(4,6): error TS2457: Type alias name cannot be 'boolean' -tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(5,6): error TS2457: Type alias name cannot be 'string' +tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(2,6): error TS2457: Type alias name cannot be 'any'. +tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(3,6): error TS2457: Type alias name cannot be 'number'. +tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(4,6): error TS2457: Type alias name cannot be 'boolean'. +tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(5,6): error TS2457: Type alias name cannot be 'string'. tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,1): error TS2304: Cannot find name 'type'. tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,6): error TS1005: ';' expected. tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,11): error TS1109: Expression expected. tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,13): error TS2693: 'I' only refers to a type, but is being used as a value here. -tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(7,6): error TS2457: Type alias name cannot be 'object' +tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(7,6): error TS2457: Type alias name cannot be 'object'. ==== tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts (9 errors) ==== interface I {} type any = I; ~~~ -!!! error TS2457: Type alias name cannot be 'any' +!!! error TS2457: Type alias name cannot be 'any'. type number = I; ~~~~~~ -!!! error TS2457: Type alias name cannot be 'number' +!!! error TS2457: Type alias name cannot be 'number'. type boolean = I; ~~~~~~~ -!!! error TS2457: Type alias name cannot be 'boolean' +!!! error TS2457: Type alias name cannot be 'boolean'. type string = I; ~~~~~~ -!!! error TS2457: Type alias name cannot be 'string' +!!! error TS2457: Type alias name cannot be 'string'. type void = I; ~~~~ !!! error TS2304: Cannot find name 'type'. @@ -34,5 +34,5 @@ tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(7,6): error !!! error TS2693: 'I' only refers to a type, but is being used as a value here. type object = I; ~~~~~~ -!!! error TS2457: Type alias name cannot be 'object' +!!! error TS2457: Type alias name cannot be 'object'. \ No newline at end of file diff --git a/tests/baselines/reference/restElementMustBeLast.errors.txt b/tests/baselines/reference/restElementMustBeLast.errors.txt index 5eb5a4cd208..1eda6fbd011 100644 --- a/tests/baselines/reference/restElementMustBeLast.errors.txt +++ b/tests/baselines/reference/restElementMustBeLast.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/types/rest/restElementMustBeLast.ts(1,9): error TS2462: A rest element must be last in a destructuring pattern -tests/cases/conformance/types/rest/restElementMustBeLast.ts(2,2): error TS2462: A rest element must be last in a destructuring pattern +tests/cases/conformance/types/rest/restElementMustBeLast.ts(1,9): error TS2462: A rest element must be last in a destructuring pattern. +tests/cases/conformance/types/rest/restElementMustBeLast.ts(2,2): error TS2462: A rest element must be last in a destructuring pattern. ==== tests/cases/conformance/types/rest/restElementMustBeLast.ts (2 errors) ==== var [...a, x] = [1, 2, 3]; // Error, rest must be last element ~ -!!! error TS2462: A rest element must be last in a destructuring pattern +!!! error TS2462: A rest element must be last in a destructuring pattern. [...a, x] = [1, 2, 3]; // Error, rest must be last element ~~~~ -!!! error TS2462: A rest element must be last in a destructuring pattern +!!! error TS2462: A rest element must be last in a destructuring pattern. \ No newline at end of file diff --git a/tests/baselines/reference/returnInConstructor1.errors.txt b/tests/baselines/reference/returnInConstructor1.errors.txt index 939d303ec65..d4fb6a0b50e 100644 --- a/tests/baselines/reference/returnInConstructor1.errors.txt +++ b/tests/baselines/reference/returnInConstructor1.errors.txt @@ -1,15 +1,15 @@ tests/cases/compiler/returnInConstructor1.ts(11,9): error TS2322: Type '1' is not assignable to type 'B'. -tests/cases/compiler/returnInConstructor1.ts(11,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/compiler/returnInConstructor1.ts(11,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. tests/cases/compiler/returnInConstructor1.ts(25,9): error TS2322: Type '"test"' is not assignable to type 'D'. -tests/cases/compiler/returnInConstructor1.ts(25,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/compiler/returnInConstructor1.ts(25,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. tests/cases/compiler/returnInConstructor1.ts(39,9): error TS2322: Type '{ foo: number; }' is not assignable to type 'F'. Types of property 'foo' are incompatible. Type 'number' is not assignable to type 'string'. -tests/cases/compiler/returnInConstructor1.ts(39,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/compiler/returnInConstructor1.ts(39,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. tests/cases/compiler/returnInConstructor1.ts(55,9): error TS2322: Type 'G' is not assignable to type 'H'. Types of property 'foo' are incompatible. Type '() => void' is not assignable to type 'string'. -tests/cases/compiler/returnInConstructor1.ts(55,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/compiler/returnInConstructor1.ts(55,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. ==== tests/cases/compiler/returnInConstructor1.ts (8 errors) ==== @@ -27,7 +27,7 @@ tests/cases/compiler/returnInConstructor1.ts(55,9): error TS2409: Return type of ~~~~~~~~~ !!! error TS2322: Type '1' is not assignable to type 'B'. ~~~~~~~~~ -!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class +!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. } } @@ -45,7 +45,7 @@ tests/cases/compiler/returnInConstructor1.ts(55,9): error TS2409: Return type of ~~~~~~~~~~~~~~ !!! error TS2322: Type '"test"' is not assignable to type 'D'. ~~~~~~~~~~~~~~ -!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class +!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. } } @@ -65,7 +65,7 @@ tests/cases/compiler/returnInConstructor1.ts(55,9): error TS2409: Return type of !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type 'number' is not assignable to type 'string'. ~~~~~~~~~~~~~~~~~~ -!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class +!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. } } @@ -87,7 +87,7 @@ tests/cases/compiler/returnInConstructor1.ts(55,9): error TS2409: Return type of !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '() => void' is not assignable to type 'string'. ~~~~~~~~~~~~~~~ -!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class +!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. } } diff --git a/tests/baselines/reference/scanner10.1.1-8gs.errors.txt b/tests/baselines/reference/scanner10.1.1-8gs.errors.txt index 23d89cdf7ff..6e75f195c26 100644 --- a/tests/baselines/reference/scanner10.1.1-8gs.errors.txt +++ b/tests/baselines/reference/scanner10.1.1-8gs.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts(16,7): error TS2304: Cannot find name 'NotEarlyError'. tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts(17,1): error TS7027: Unreachable code detected. -tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts(17,5): error TS1212: Identifier expected. 'public' is a reserved word in strict mode +tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts(17,5): error TS1212: Identifier expected. 'public' is a reserved word in strict mode. ==== tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts (3 errors) ==== @@ -26,5 +26,5 @@ tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts(17,5): error TS ~~~ !!! error TS7027: Unreachable code detected. ~~~~~~ -!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode. \ No newline at end of file diff --git a/tests/baselines/reference/shadowedInternalModule.errors.txt b/tests/baselines/reference/shadowedInternalModule.errors.txt index 0873b1f0cf1..f278ebcb606 100644 --- a/tests/baselines/reference/shadowedInternalModule.errors.txt +++ b/tests/baselines/reference/shadowedInternalModule.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/internalModules/importDeclarations/shadowedInternalModule.ts(13,20): error TS2437: Module 'A' is hidden by a local declaration with the same name -tests/cases/conformance/internalModules/importDeclarations/shadowedInternalModule.ts(30,5): error TS2440: Import declaration conflicts with local declaration of 'Y' +tests/cases/conformance/internalModules/importDeclarations/shadowedInternalModule.ts(13,20): error TS2437: Module 'A' is hidden by a local declaration with the same name. +tests/cases/conformance/internalModules/importDeclarations/shadowedInternalModule.ts(30,5): error TS2440: Import declaration conflicts with local declaration of 'Y'. ==== tests/cases/conformance/internalModules/importDeclarations/shadowedInternalModule.ts (2 errors) ==== @@ -17,7 +17,7 @@ tests/cases/conformance/internalModules/importDeclarations/shadowedInternalModul var A = { x: 0, y: 0 }; import Point = A; ~ -!!! error TS2437: Module 'A' is hidden by a local declaration with the same name +!!! error TS2437: Module 'A' is hidden by a local declaration with the same name. } module X { @@ -36,7 +36,7 @@ tests/cases/conformance/internalModules/importDeclarations/shadowedInternalModul module Z { import Y = X.Y; ~~~~~~~~~~~~~~~ -!!! error TS2440: Import declaration conflicts with local declaration of 'Y' +!!! error TS2440: Import declaration conflicts with local declaration of 'Y'. var Y = 12; } \ No newline at end of file diff --git a/tests/baselines/reference/spreadIntersectionJsx.js b/tests/baselines/reference/spreadIntersectionJsx.js new file mode 100644 index 00000000000..9ba086dd765 --- /dev/null +++ b/tests/baselines/reference/spreadIntersectionJsx.js @@ -0,0 +1,30 @@ +//// [spreadIntersectionJsx.tsx] +const React: any = null; +class A { a; } +class C { c; } +let intersected: A & C; +let element =
; + + +//// [spreadIntersectionJsx.js] +var __assign = (this && this.__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; +}; +var React = null; +var A = (function () { + function A() { + } + return A; +}()); +var C = (function () { + function C() { + } + return C; +}()); +var intersected; +var element = React.createElement("div", __assign({}, intersected)); diff --git a/tests/baselines/reference/spreadIntersectionJsx.symbols b/tests/baselines/reference/spreadIntersectionJsx.symbols new file mode 100644 index 00000000000..24d7c90be1f --- /dev/null +++ b/tests/baselines/reference/spreadIntersectionJsx.symbols @@ -0,0 +1,22 @@ +=== tests/cases/compiler/spreadIntersectionJsx.tsx === +const React: any = null; +>React : Symbol(React, Decl(spreadIntersectionJsx.tsx, 0, 5)) + +class A { a; } +>A : Symbol(A, Decl(spreadIntersectionJsx.tsx, 0, 24)) +>a : Symbol(A.a, Decl(spreadIntersectionJsx.tsx, 1, 9)) + +class C { c; } +>C : Symbol(C, Decl(spreadIntersectionJsx.tsx, 1, 14)) +>c : Symbol(C.c, Decl(spreadIntersectionJsx.tsx, 2, 9)) + +let intersected: A & C; +>intersected : Symbol(intersected, Decl(spreadIntersectionJsx.tsx, 3, 3)) +>A : Symbol(A, Decl(spreadIntersectionJsx.tsx, 0, 24)) +>C : Symbol(C, Decl(spreadIntersectionJsx.tsx, 1, 14)) + +let element =
; +>element : Symbol(element, Decl(spreadIntersectionJsx.tsx, 4, 3)) +>div : Symbol(unknown) +>intersected : Symbol(intersected, Decl(spreadIntersectionJsx.tsx, 3, 3)) + diff --git a/tests/baselines/reference/spreadIntersectionJsx.types b/tests/baselines/reference/spreadIntersectionJsx.types new file mode 100644 index 00000000000..4756f73c5af --- /dev/null +++ b/tests/baselines/reference/spreadIntersectionJsx.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/spreadIntersectionJsx.tsx === +const React: any = null; +>React : any +>null : null + +class A { a; } +>A : A +>a : any + +class C { c; } +>C : C +>c : any + +let intersected: A & C; +>intersected : A & C +>A : A +>C : C + +let element =
; +>element : any +>
: any +>div : any +>intersected : A & C + diff --git a/tests/baselines/reference/staticPropertyNameConflicts.errors.txt b/tests/baselines/reference/staticPropertyNameConflicts.errors.txt index 4c051ace0ac..1b22bbbf759 100644 --- a/tests/baselines/reference/staticPropertyNameConflicts.errors.txt +++ b/tests/baselines/reference/staticPropertyNameConflicts.errors.txt @@ -9,17 +9,17 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(41,12): error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCallerFn'. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(47,12): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArguments'. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(52,12): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArgumentsFn'. -tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(62,12): error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function '(Anonymous class)'. -tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(67,12): error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function '(Anonymous class)'. -tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(73,12): error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function '(Anonymous class)'. -tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(78,12): error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function '(Anonymous class)'. -tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(84,12): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function '(Anonymous class)'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(62,12): error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticName_Anonymous'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(67,12): error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticNameFn_Anonymous'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(73,12): error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLength_Anonymous'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(78,12): error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLengthFn_Anonymous'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(84,12): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototype_Anonymous'. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(89,12): error TS2300: Duplicate identifier 'prototype'. -tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(89,12): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function '(Anonymous class)'. -tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(95,12): error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function '(Anonymous class)'. -tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(100,12): error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function '(Anonymous class)'. -tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(106,12): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function '(Anonymous class)'. -tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(111,12): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function '(Anonymous class)'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(89,12): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototypeFn_Anonymous'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(95,12): error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCaller_Anonymous'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(100,12): error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCallerFn_Anonymous'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(106,12): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArguments_Anonymous'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(111,12): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArgumentsFn_Anonymous'. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(121,16): error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticName'. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(128,16): error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticNameFn'. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(136,16): error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLength'. @@ -119,14 +119,14 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon var StaticName_Anonymous = class { static name: number; // error ~~~~ -!!! error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function '(Anonymous class)'. +!!! error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticName_Anonymous'. name: string; // ok } var StaticNameFn_Anonymous = class { static name() {} // error ~~~~ -!!! error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function '(Anonymous class)'. +!!! error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticNameFn_Anonymous'. name() {} // ok } @@ -134,14 +134,14 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon var StaticLength_Anonymous = class { static length: number; // error ~~~~~~ -!!! error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function '(Anonymous class)'. +!!! error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLength_Anonymous'. length: string; // ok } var StaticLengthFn_Anonymous = class { static length() {} // error ~~~~~~ -!!! error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function '(Anonymous class)'. +!!! error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLengthFn_Anonymous'. length() {} // ok } @@ -149,7 +149,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon var StaticPrototype_Anonymous = class { static prototype: number; // error ~~~~~~~~~ -!!! error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function '(Anonymous class)'. +!!! error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototype_Anonymous'. prototype: string; // ok } @@ -158,7 +158,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon ~~~~~~~~~ !!! error TS2300: Duplicate identifier 'prototype'. ~~~~~~~~~ -!!! error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function '(Anonymous class)'. +!!! error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototypeFn_Anonymous'. prototype() {} // ok } @@ -166,14 +166,14 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon var StaticCaller_Anonymous = class { static caller: number; // error ~~~~~~ -!!! error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function '(Anonymous class)'. +!!! error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCaller_Anonymous'. caller: string; // ok } var StaticCallerFn_Anonymous = class { static caller() {} // error ~~~~~~ -!!! error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function '(Anonymous class)'. +!!! error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCallerFn_Anonymous'. caller() {} // ok } @@ -181,14 +181,14 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon var StaticArguments_Anonymous = class { static arguments: number; // error ~~~~~~~~~ -!!! error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function '(Anonymous class)'. +!!! error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArguments_Anonymous'. arguments: string; // ok } var StaticArgumentsFn_Anonymous = class { static arguments() {} // error ~~~~~~~~~ -!!! error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function '(Anonymous class)'. +!!! error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArgumentsFn_Anonymous'. arguments() {} // ok } diff --git a/tests/baselines/reference/strictModeReservedWord.errors.txt b/tests/baselines/reference/strictModeReservedWord.errors.txt index 7a1bacbb525..5a6de7792b7 100644 --- a/tests/baselines/reference/strictModeReservedWord.errors.txt +++ b/tests/baselines/reference/strictModeReservedWord.errors.txt @@ -1,45 +1,45 @@ tests/cases/compiler/strictModeReservedWord.ts(1,5): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. -tests/cases/compiler/strictModeReservedWord.ts(5,9): error TS1212: Identifier expected. 'public' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(6,9): error TS1212: Identifier expected. 'static' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(7,9): error TS1212: Identifier expected. 'let' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWord.ts(5,9): error TS1212: Identifier expected. 'public' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord.ts(6,9): error TS1212: Identifier expected. 'static' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord.ts(7,9): error TS1212: Identifier expected. 'let' is a reserved word in strict mode. tests/cases/compiler/strictModeReservedWord.ts(7,9): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. -tests/cases/compiler/strictModeReservedWord.ts(8,9): error TS1212: Identifier expected. 'package' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWord.ts(8,9): error TS1212: Identifier expected. 'package' is a reserved word in strict mode. tests/cases/compiler/strictModeReservedWord.ts(8,9): error TS2300: Duplicate identifier 'package'. -tests/cases/compiler/strictModeReservedWord.ts(9,14): error TS1212: Identifier expected. 'package' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWord.ts(9,14): error TS1212: Identifier expected. 'package' is a reserved word in strict mode. tests/cases/compiler/strictModeReservedWord.ts(9,14): error TS2300: Duplicate identifier 'package'. -tests/cases/compiler/strictModeReservedWord.ts(10,18): error TS1212: Identifier expected. 'private' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(10,27): error TS1212: Identifier expected. 'implements' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(10,39): error TS1212: Identifier expected. 'let' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(11,18): error TS1212: Identifier expected. 'implements' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(11,30): error TS1212: Identifier expected. 'protected' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(12,24): error TS1212: Identifier expected. 'private' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(12,33): error TS1212: Identifier expected. 'public' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(12,41): error TS1212: Identifier expected. 'package' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(13,11): error TS1212: Identifier expected. 'private' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(13,20): error TS1212: Identifier expected. 'public' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(13,28): error TS1212: Identifier expected. 'package' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWord.ts(10,18): error TS1212: Identifier expected. 'private' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord.ts(10,27): error TS1212: Identifier expected. 'implements' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord.ts(10,39): error TS1212: Identifier expected. 'let' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord.ts(11,18): error TS1212: Identifier expected. 'implements' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord.ts(11,30): error TS1212: Identifier expected. 'protected' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord.ts(12,24): error TS1212: Identifier expected. 'private' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord.ts(12,33): error TS1212: Identifier expected. 'public' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord.ts(12,41): error TS1212: Identifier expected. 'package' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord.ts(13,11): error TS1212: Identifier expected. 'private' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord.ts(13,20): error TS1212: Identifier expected. 'public' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord.ts(13,28): error TS1212: Identifier expected. 'package' is a reserved word in strict mode. tests/cases/compiler/strictModeReservedWord.ts(15,25): error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeReservedWord.ts(15,41): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeReservedWord.ts(15,41): error TS2507: Type 'number' is not a constructor function type. tests/cases/compiler/strictModeReservedWord.ts(17,9): error TS2300: Duplicate identifier 'b'. -tests/cases/compiler/strictModeReservedWord.ts(17,12): error TS1212: Identifier expected. 'public' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWord.ts(17,12): error TS1212: Identifier expected. 'public' is a reserved word in strict mode. tests/cases/compiler/strictModeReservedWord.ts(17,12): error TS2503: Cannot find namespace 'public'. -tests/cases/compiler/strictModeReservedWord.ts(19,21): error TS1212: Identifier expected. 'private' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWord.ts(19,21): error TS1212: Identifier expected. 'private' is a reserved word in strict mode. tests/cases/compiler/strictModeReservedWord.ts(19,21): error TS2503: Cannot find namespace 'private'. -tests/cases/compiler/strictModeReservedWord.ts(20,22): error TS1212: Identifier expected. 'private' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWord.ts(20,22): error TS1212: Identifier expected. 'private' is a reserved word in strict mode. tests/cases/compiler/strictModeReservedWord.ts(20,22): error TS2503: Cannot find namespace 'private'. -tests/cases/compiler/strictModeReservedWord.ts(20,30): error TS1212: Identifier expected. 'package' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(21,22): error TS1212: Identifier expected. 'private' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWord.ts(20,30): error TS1212: Identifier expected. 'package' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord.ts(21,22): error TS1212: Identifier expected. 'private' is a reserved word in strict mode. tests/cases/compiler/strictModeReservedWord.ts(21,22): error TS2503: Cannot find namespace 'private'. -tests/cases/compiler/strictModeReservedWord.ts(21,30): error TS1212: Identifier expected. 'package' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(21,38): error TS1212: Identifier expected. 'protected' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWord.ts(21,30): error TS1212: Identifier expected. 'package' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord.ts(21,38): error TS1212: Identifier expected. 'protected' is a reserved word in strict mode. tests/cases/compiler/strictModeReservedWord.ts(22,9): error TS2300: Duplicate identifier 'b'. -tests/cases/compiler/strictModeReservedWord.ts(22,12): error TS1212: Identifier expected. 'interface' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWord.ts(22,12): error TS1212: Identifier expected. 'interface' is a reserved word in strict mode. tests/cases/compiler/strictModeReservedWord.ts(22,12): error TS2503: Cannot find namespace 'interface'. -tests/cases/compiler/strictModeReservedWord.ts(22,22): error TS1212: Identifier expected. 'package' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(22,30): error TS1212: Identifier expected. 'implements' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWord.ts(22,22): error TS1212: Identifier expected. 'package' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord.ts(22,30): error TS1212: Identifier expected. 'implements' is a reserved word in strict mode. tests/cases/compiler/strictModeReservedWord.ts(23,5): error TS2304: Cannot find name 'ublic'. -tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS1212: Identifier expected. 'static' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS1212: Identifier expected. 'static' is a reserved word in strict mode. tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. @@ -52,51 +52,51 @@ tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: Cannot invok "use strict" var public = 10; ~~~~~~ -!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode. var static = "hi"; ~~~~~~ -!!! error TS1212: Identifier expected. 'static' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'static' is a reserved word in strict mode. let let = "blah"; ~~~ -!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode. ~~~ !!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. var package = "hello" ~~~~~~~ -!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode. ~~~~~~~ !!! error TS2300: Duplicate identifier 'package'. function package() { } ~~~~~~~ -!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode. ~~~~~~~ !!! error TS2300: Duplicate identifier 'package'. function bar(private, implements, let) { } ~~~~~~~ -!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode. ~~~~~~~~~~ -!!! error TS1212: Identifier expected. 'implements' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'implements' is a reserved word in strict mode. ~~~ -!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode. function baz() { } ~~~~~~~~~~ -!!! error TS1212: Identifier expected. 'implements' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'implements' is a reserved word in strict mode. ~~~~~~~~~ -!!! error TS1212: Identifier expected. 'protected' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'protected' is a reserved word in strict mode. function barn(cb: (private, public, package) => void) { } ~~~~~~~ -!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode. ~~~~~~ -!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode. ~~~~~~~ -!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode. barn((private, public, package) => { }); ~~~~~~~ -!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode. ~~~~~~ -!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode. ~~~~~~~ -!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode. var myClass = class package extends public {} ~~~~~~~ @@ -110,48 +110,48 @@ tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: Cannot invok ~ !!! error TS2300: Duplicate identifier 'b'. ~~~~~~ -!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode. ~~~~~~ !!! error TS2503: Cannot find namespace 'public'. function foo(x: private.x) { } ~~~~~~~ -!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode. ~~~~~~~ !!! error TS2503: Cannot find namespace 'private'. function foo1(x: private.package.x) { } ~~~~~~~ -!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode. ~~~~~~~ !!! error TS2503: Cannot find namespace 'private'. ~~~~~~~ -!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode. function foo2(x: private.package.protected) { } ~~~~~~~ -!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode. ~~~~~~~ !!! error TS2503: Cannot find namespace 'private'. ~~~~~~~ -!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode. ~~~~~~~~~ -!!! error TS1212: Identifier expected. 'protected' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'protected' is a reserved word in strict mode. let b: interface.package.implements.B; ~ !!! error TS2300: Duplicate identifier 'b'. ~~~~~~~~~ -!!! error TS1212: Identifier expected. 'interface' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'interface' is a reserved word in strict mode. ~~~~~~~~~ !!! error TS2503: Cannot find namespace 'interface'. ~~~~~~~ -!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode. ~~~~~~~~~~ -!!! error TS1212: Identifier expected. 'implements' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'implements' is a reserved word in strict mode. ublic(); ~~~~~ !!! error TS2304: Cannot find name 'ublic'. static(); ~~~~~~ -!!! error TS1212: Identifier expected. 'static' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'static' is a reserved word in strict mode. ~~~~~~~~ !!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. } diff --git a/tests/baselines/reference/strictModeReservedWord2.errors.txt b/tests/baselines/reference/strictModeReservedWord2.errors.txt index 8fbc79bbce0..39e8182c3d1 100644 --- a/tests/baselines/reference/strictModeReservedWord2.errors.txt +++ b/tests/baselines/reference/strictModeReservedWord2.errors.txt @@ -1,28 +1,28 @@ -tests/cases/compiler/strictModeReservedWord2.ts(2,11): error TS1212: Identifier expected. 'public' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord2.ts(3,11): error TS1212: Identifier expected. 'implements' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord2.ts(4,9): error TS1212: Identifier expected. 'package' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord2.ts(4,18): error TS1212: Identifier expected. 'protected' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord2.ts(6,6): error TS1212: Identifier expected. 'package' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord2.ts(13,12): error TS1212: Identifier expected. 'private' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWord2.ts(2,11): error TS1212: Identifier expected. 'public' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord2.ts(3,11): error TS1212: Identifier expected. 'implements' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord2.ts(4,9): error TS1212: Identifier expected. 'package' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord2.ts(4,18): error TS1212: Identifier expected. 'protected' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord2.ts(6,6): error TS1212: Identifier expected. 'package' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWord2.ts(13,12): error TS1212: Identifier expected. 'private' is a reserved word in strict mode. ==== tests/cases/compiler/strictModeReservedWord2.ts (6 errors) ==== "use strict" interface public { } ~~~~~~ -!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode. interface implements { ~~~~~~~~~~ -!!! error TS1212: Identifier expected. 'implements' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'implements' is a reserved word in strict mode. foo(package, protected); ~~~~~~~ -!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode. ~~~~~~~~~ -!!! error TS1212: Identifier expected. 'protected' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'protected' is a reserved word in strict mode. } enum package { } ~~~~~~~ -!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode. enum foo { public, private, @@ -31,7 +31,7 @@ tests/cases/compiler/strictModeReservedWord2.ts(13,12): error TS1212: Identifier const enum private { ~~~~~~~ -!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode. public, private, pacakge diff --git a/tests/baselines/reference/strictModeReservedWordInDestructuring.errors.txt b/tests/baselines/reference/strictModeReservedWordInDestructuring.errors.txt index 3ae9ca2d09a..488804ae1a7 100644 --- a/tests/baselines/reference/strictModeReservedWordInDestructuring.errors.txt +++ b/tests/baselines/reference/strictModeReservedWordInDestructuring.errors.txt @@ -1,32 +1,32 @@ -tests/cases/compiler/strictModeReservedWordInDestructuring.ts(2,6): error TS1212: Identifier expected. 'public' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWordInDestructuring.ts(3,10): error TS1212: Identifier expected. 'public' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWordInDestructuring.ts(4,7): error TS1212: Identifier expected. 'private' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWordInDestructuring.ts(5,15): error TS1212: Identifier expected. 'static' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWordInDestructuring.ts(5,38): error TS1212: Identifier expected. 'package' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWordInDestructuring.ts(6,7): error TS1212: Identifier expected. 'public' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWordInDestructuring.ts(6,15): error TS1212: Identifier expected. 'protected' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWordInDestructuring.ts(2,6): error TS1212: Identifier expected. 'public' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWordInDestructuring.ts(3,10): error TS1212: Identifier expected. 'public' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWordInDestructuring.ts(4,7): error TS1212: Identifier expected. 'private' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWordInDestructuring.ts(5,15): error TS1212: Identifier expected. 'static' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWordInDestructuring.ts(5,38): error TS1212: Identifier expected. 'package' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWordInDestructuring.ts(6,7): error TS1212: Identifier expected. 'public' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWordInDestructuring.ts(6,15): error TS1212: Identifier expected. 'protected' is a reserved word in strict mode. ==== tests/cases/compiler/strictModeReservedWordInDestructuring.ts (7 errors) ==== "use strict" var [public] = [1]; ~~~~~~ -!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode. var { x: public } = { x: 1 }; ~~~~~~ -!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode. var [[private]] = [["hello"]]; ~~~~~~~ -!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode. var { y: { s: static }, z: { o: { p: package } }} = { y: { s: 1 }, z: { o: { p: 'h' } } }; ~~~~~~ -!!! error TS1212: Identifier expected. 'static' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'static' is a reserved word in strict mode. ~~~~~~~ -!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode. var { public, protected } = { public: 1, protected: 2 }; ~~~~~~ -!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode. ~~~~~~~~~ -!!! error TS1212: Identifier expected. 'protected' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'protected' is a reserved word in strict mode. var { public: a, protected: b } = { public: 1, protected: 2 }; \ No newline at end of file diff --git a/tests/baselines/reference/strictModeReservedWordInModuleDeclaration.errors.txt b/tests/baselines/reference/strictModeReservedWordInModuleDeclaration.errors.txt index f745f93f79e..43ee55f06c3 100644 --- a/tests/baselines/reference/strictModeReservedWordInModuleDeclaration.errors.txt +++ b/tests/baselines/reference/strictModeReservedWordInModuleDeclaration.errors.txt @@ -1,24 +1,24 @@ -tests/cases/compiler/strictModeReservedWordInModuleDeclaration.ts(2,8): error TS1212: Identifier expected. 'public' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWordInModuleDeclaration.ts(3,8): error TS1212: Identifier expected. 'private' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWordInModuleDeclaration.ts(4,8): error TS1212: Identifier expected. 'public' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWordInModuleDeclaration.ts(6,8): error TS1212: Identifier expected. 'private' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWordInModuleDeclaration.ts(6,16): error TS1212: Identifier expected. 'public' is a reserved word in strict mode +tests/cases/compiler/strictModeReservedWordInModuleDeclaration.ts(2,8): error TS1212: Identifier expected. 'public' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWordInModuleDeclaration.ts(3,8): error TS1212: Identifier expected. 'private' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWordInModuleDeclaration.ts(4,8): error TS1212: Identifier expected. 'public' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWordInModuleDeclaration.ts(6,8): error TS1212: Identifier expected. 'private' is a reserved word in strict mode. +tests/cases/compiler/strictModeReservedWordInModuleDeclaration.ts(6,16): error TS1212: Identifier expected. 'public' is a reserved word in strict mode. ==== tests/cases/compiler/strictModeReservedWordInModuleDeclaration.ts (5 errors) ==== "use strict" module public { } ~~~~~~ -!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode. module private { } ~~~~~~~ -!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode. module public.whatever { ~~~~~~ -!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode. } module private.public.foo { } ~~~~~~~ -!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode +!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode. ~~~~~~ -!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode \ No newline at end of file +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode. \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt b/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt index 1a639a1c222..2534a07132e 100644 --- a/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesInVariableDeclarations01.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(5,7): error TS1155: 'const' declarations must be initialized +tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(5,7): error TS1155: 'const' declarations must be initialized. ==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts (1 errors) ==== @@ -8,7 +8,7 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarat let c: "bar"; const d: "baz"; ~ -!!! error TS1155: 'const' declarations must be initialized +!!! error TS1155: 'const' declarations must be initialized. a = ""; b = "foo"; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing4.errors.txt b/tests/baselines/reference/superCallBeforeThisAccessing4.errors.txt index 91c3e7763f6..5ce0278ab60 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing4.errors.txt +++ b/tests/baselines/reference/superCallBeforeThisAccessing4.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing4.ts(5,9): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null' -tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing4.ts(12,9): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null' +tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing4.ts(5,9): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null'. +tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing4.ts(12,9): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null'. ==== tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing4.ts (2 errors) ==== @@ -9,7 +9,7 @@ tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing4.ts(12 this._t; super(); ~~~~~~~ -!!! error TS17005: A constructor cannot contain a 'super' call when its class extends 'null' +!!! error TS17005: A constructor cannot contain a 'super' call when its class extends 'null'. } } @@ -18,7 +18,7 @@ tests/cases/conformance/es6/classDeclaration/superCallBeforeThisAccessing4.ts(12 constructor() { super(); ~~~~~~~ -!!! error TS17005: A constructor cannot contain a 'super' call when its class extends 'null' +!!! error TS17005: A constructor cannot contain a 'super' call when its class extends 'null'. this._t; } } \ No newline at end of file diff --git a/tests/baselines/reference/symbolType2.errors.txt b/tests/baselines/reference/symbolType2.errors.txt index 441db917718..7ca8a6e7519 100644 --- a/tests/baselines/reference/symbolType2.errors.txt +++ b/tests/baselines/reference/symbolType2.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/Symbols/symbolType2.ts(2,7): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +tests/cases/conformance/es6/Symbols/symbolType2.ts(2,7): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. ==== tests/cases/conformance/es6/Symbols/symbolType2.ts (1 errors) ==== Symbol.isConcatSpreadable in {}; "" in Symbol.toPrimitive; ~~~~~~~~~~~~~~~~~~ -!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter \ No newline at end of file +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType20.errors.txt b/tests/baselines/reference/symbolType20.errors.txt index 41345e371f8..095dd808479 100644 --- a/tests/baselines/reference/symbolType20.errors.txt +++ b/tests/baselines/reference/symbolType20.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/Symbols/symbolType20.ts(1,11): error TS2427: Interface name cannot be 'symbol' +tests/cases/conformance/es6/Symbols/symbolType20.ts(1,11): error TS2427: Interface name cannot be 'symbol'. ==== tests/cases/conformance/es6/Symbols/symbolType20.ts (1 errors) ==== interface symbol { } ~~~~~~ -!!! error TS2427: Interface name cannot be 'symbol' \ No newline at end of file +!!! error TS2427: Interface name cannot be 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType3.errors.txt b/tests/baselines/reference/symbolType3.errors.txt index 04a71789031..bd9754f7121 100644 --- a/tests/baselines/reference/symbolType3.errors.txt +++ b/tests/baselines/reference/symbolType3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/Symbols/symbolType3.ts(2,8): error TS2704: The operand of a delete operator cannot be a read-only property +tests/cases/conformance/es6/Symbols/symbolType3.ts(2,8): error TS2704: The operand of a delete operator cannot be a read-only property. tests/cases/conformance/es6/Symbols/symbolType3.ts(5,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/es6/Symbols/symbolType3.ts(6,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/es6/Symbols/symbolType3.ts(7,3): error TS2469: The '+' operator cannot be applied to type 'symbol'. @@ -11,7 +11,7 @@ tests/cases/conformance/es6/Symbols/symbolType3.ts(12,2): error TS2469: The '+' var s = Symbol(); delete Symbol.iterator; ~~~~~~~~~~~~~~~ -!!! error TS2704: The operand of a delete operator cannot be a read-only property +!!! error TS2704: The operand of a delete operator cannot be a read-only property. void Symbol.toPrimitive; typeof Symbol.toStringTag; ++s; diff --git a/tests/baselines/reference/targetTypeVoidFunc.errors.txt b/tests/baselines/reference/targetTypeVoidFunc.errors.txt index 6c0efe288bd..2afb8e95977 100644 --- a/tests/baselines/reference/targetTypeVoidFunc.errors.txt +++ b/tests/baselines/reference/targetTypeVoidFunc.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/targetTypeVoidFunc.ts(2,5): error TS2322: Type '() => void' is not assignable to type 'new () => number'. - Type '() => void' provides no match for the signature 'new (): number' + Type '() => void' provides no match for the signature 'new (): number'. ==== tests/cases/compiler/targetTypeVoidFunc.ts (1 errors) ==== @@ -7,7 +7,7 @@ tests/cases/compiler/targetTypeVoidFunc.ts(2,5): error TS2322: Type '() => void' return function () { return; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '() => void' is not assignable to type 'new () => number'. -!!! error TS2322: Type '() => void' provides no match for the signature 'new (): number' +!!! error TS2322: Type '() => void' provides no match for the signature 'new (): number'. }; var x = f1(); diff --git a/tests/baselines/reference/templateStringInDeleteExpression.errors.txt b/tests/baselines/reference/templateStringInDeleteExpression.errors.txt index 6cc310969b6..2827231ebc5 100644 --- a/tests/baselines/reference/templateStringInDeleteExpression.errors.txt +++ b/tests/baselines/reference/templateStringInDeleteExpression.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/templates/templateStringInDeleteExpression.ts(1,8): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es6/templates/templateStringInDeleteExpression.ts(1,8): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/es6/templates/templateStringInDeleteExpression.ts (1 errors) ==== delete `abc${0}abc`; ~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference \ No newline at end of file +!!! error TS2703: The operand of a delete operator must be a property reference. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt b/tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt index a3b89c880c8..bdc53343fb1 100644 --- a/tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt +++ b/tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/templates/templateStringInDeleteExpressionES6.ts(1,8): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/es6/templates/templateStringInDeleteExpressionES6.ts(1,8): error TS2703: The operand of a delete operator must be a property reference. ==== tests/cases/conformance/es6/templates/templateStringInDeleteExpressionES6.ts (1 errors) ==== delete `abc${0}abc`; ~~~~~~~~~~~~ -!!! error TS2703: The operand of a delete operator must be a property reference \ No newline at end of file +!!! error TS2703: The operand of a delete operator must be a property reference. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInYieldKeyword.errors.txt b/tests/baselines/reference/templateStringInYieldKeyword.errors.txt deleted file mode 100644 index 578c24e7ce9..00000000000 --- a/tests/baselines/reference/templateStringInYieldKeyword.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts (1 errors) ==== - function* gen() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - // Once this is supported, the inner expression does not need to be parenthesized. - var x = yield `abc${ x }def`; - } - \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInYieldKeyword.js b/tests/baselines/reference/templateStringInYieldKeyword.js index e23eaa17c9c..aaab38c194f 100644 --- a/tests/baselines/reference/templateStringInYieldKeyword.js +++ b/tests/baselines/reference/templateStringInYieldKeyword.js @@ -8,5 +8,5 @@ function* gen() { //// [templateStringInYieldKeyword.js] function* gen() { // Once this is supported, the inner expression does not need to be parenthesized. - var x = yield "abc" + x + "def"; + var x = yield `abc${x}def`; } diff --git a/tests/baselines/reference/templateStringInYieldKeyword.symbols b/tests/baselines/reference/templateStringInYieldKeyword.symbols new file mode 100644 index 00000000000..3e8e63d2954 --- /dev/null +++ b/tests/baselines/reference/templateStringInYieldKeyword.symbols @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts === +function* gen() { +>gen : Symbol(gen, Decl(templateStringInYieldKeyword.ts, 0, 0)) + + // Once this is supported, the inner expression does not need to be parenthesized. + var x = yield `abc${ x }def`; +>x : Symbol(x, Decl(templateStringInYieldKeyword.ts, 2, 7)) +>x : Symbol(x, Decl(templateStringInYieldKeyword.ts, 2, 7)) +} + diff --git a/tests/baselines/reference/templateStringInYieldKeyword.types b/tests/baselines/reference/templateStringInYieldKeyword.types new file mode 100644 index 00000000000..3eff79cf796 --- /dev/null +++ b/tests/baselines/reference/templateStringInYieldKeyword.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts === +function* gen() { +>gen : () => IterableIterator + + // Once this is supported, the inner expression does not need to be parenthesized. + var x = yield `abc${ x }def`; +>x : any +>yield `abc${ x }def` : any +>`abc${ x }def` : string +>x : any +} + diff --git a/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt b/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt index 28f33943732..ce0d781d824 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt +++ b/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt @@ -1,6 +1,8 @@ +error TS2318: Cannot find global type 'IterableIterator'. tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(1,15): error TS1005: '(' expected. +!!! error TS2318: Cannot find global type 'IterableIterator'. ==== tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts (1 errors) ==== function* gen { ~ diff --git a/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.js b/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.js index 8230f0ec8f1..4192fc6fbe2 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.js +++ b/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.js @@ -6,7 +6,43 @@ function* gen { //// [templateStringWithEmbeddedYieldKeyword.js] -function* gen() { - // Once this is supported, yield *must* be parenthesized. - var x = "abc" + (yield 10) + "def"; +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; + return g = { next: verb(0), "throw": verb(1), "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 (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, 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 gen() { + var x, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + _a = "abc"; + return [4 /*yield*/, 10]; + case 1: + x = _a + (_b.sent()) + "def"; + return [2 /*return*/]; + } + }); } diff --git a/tests/baselines/reference/transformApi/transformsCorrectly.substitution.js b/tests/baselines/reference/transformApi/transformsCorrectly.substitution.js new file mode 100644 index 00000000000..40686768759 --- /dev/null +++ b/tests/baselines/reference/transformApi/transformsCorrectly.substitution.js @@ -0,0 +1 @@ +var a = void 0 /*undefined*/; diff --git a/tests/baselines/reference/transformNestedGeneratorsWithTry.js b/tests/baselines/reference/transformNestedGeneratorsWithTry.js index 04bac08d307..28f405e47b9 100644 --- a/tests/baselines/reference/transformNestedGeneratorsWithTry.js +++ b/tests/baselines/reference/transformNestedGeneratorsWithTry.js @@ -33,8 +33,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; 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; - return { next: verb(0), "throw": verb(1), "return": verb(2) }; + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "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."); diff --git a/tests/baselines/reference/transformsElideNullUndefinedType.types b/tests/baselines/reference/transformsElideNullUndefinedType.types index 7f48d8a00e9..ffc26ddaa60 100644 --- a/tests/baselines/reference/transformsElideNullUndefinedType.types +++ b/tests/baselines/reference/transformsElideNullUndefinedType.types @@ -140,14 +140,14 @@ class C5 { } var C6 = class { constructor(p12: null) { } } ->C6 : typeof (Anonymous class) ->class { constructor(p12: null) { } } : typeof (Anonymous class) +>C6 : typeof C6 +>class { constructor(p12: null) { } } : typeof C6 >p12 : null >null : null var C7 = class { constructor(p13: undefined) { } } ->C7 : typeof (Anonymous class) ->class { constructor(p13: undefined) { } } : typeof (Anonymous class) +>C7 : typeof C7 +>class { constructor(p13: undefined) { } } : typeof C7 >p13 : undefined declare function fn(); diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt index 7778f6c23c5..d746f35cbe7 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt +++ b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt @@ -1,6 +1,6 @@ -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015' +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015'. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015' +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015'. ==== file.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt index 7778f6c23c5..d746f35cbe7 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt +++ b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt @@ -1,6 +1,6 @@ -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015' +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015'. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015' +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015'. ==== file.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/tsxAttributeResolution16.js b/tests/baselines/reference/tsxAttributeResolution16.js new file mode 100644 index 00000000000..1182c886b94 --- /dev/null +++ b/tests/baselines/reference/tsxAttributeResolution16.js @@ -0,0 +1,53 @@ +//// [file.tsx] + +import React = require('react'); + +interface Address { + street: string; + country: string; +} + +interface CanadianAddress extends Address { + postalCode: string; +} + +interface AmericanAddress extends Address { + zipCode: string; +} + +type Properties = CanadianAddress | AmericanAddress; + +export class AddressComp extends React.Component { + public render() { + return null; + } +} + +let a = + +//// [file.jsx] +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +exports.__esModule = true; +var React = require("react"); +var AddressComp = (function (_super) { + __extends(AddressComp, _super); + function AddressComp() { + return _super !== null && _super.apply(this, arguments) || this; + } + AddressComp.prototype.render = function () { + return null; + }; + return AddressComp; +}(React.Component)); +exports.AddressComp = AddressComp; +var a = ; diff --git a/tests/baselines/reference/tsxAttributeResolution16.symbols b/tests/baselines/reference/tsxAttributeResolution16.symbols new file mode 100644 index 00000000000..0c271566de9 --- /dev/null +++ b/tests/baselines/reference/tsxAttributeResolution16.symbols @@ -0,0 +1,57 @@ +=== tests/cases/conformance/jsx/file.tsx === + +import React = require('react'); +>React : Symbol(React, Decl(file.tsx, 0, 0)) + +interface Address { +>Address : Symbol(Address, Decl(file.tsx, 1, 32)) + + street: string; +>street : Symbol(Address.street, Decl(file.tsx, 3, 19)) + + country: string; +>country : Symbol(Address.country, Decl(file.tsx, 4, 17)) +} + +interface CanadianAddress extends Address { +>CanadianAddress : Symbol(CanadianAddress, Decl(file.tsx, 6, 1)) +>Address : Symbol(Address, Decl(file.tsx, 1, 32)) + + postalCode: string; +>postalCode : Symbol(CanadianAddress.postalCode, Decl(file.tsx, 8, 43)) +} + +interface AmericanAddress extends Address { +>AmericanAddress : Symbol(AmericanAddress, Decl(file.tsx, 10, 1)) +>Address : Symbol(Address, Decl(file.tsx, 1, 32)) + + zipCode: string; +>zipCode : Symbol(AmericanAddress.zipCode, Decl(file.tsx, 12, 43)) +} + +type Properties = CanadianAddress | AmericanAddress; +>Properties : Symbol(Properties, Decl(file.tsx, 14, 1)) +>CanadianAddress : Symbol(CanadianAddress, Decl(file.tsx, 6, 1)) +>AmericanAddress : Symbol(AmericanAddress, Decl(file.tsx, 10, 1)) + +export class AddressComp extends React.Component { +>AddressComp : Symbol(AddressComp, Decl(file.tsx, 16, 52)) +>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55)) +>React : Symbol(React, Decl(file.tsx, 0, 0)) +>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55)) +>Properties : Symbol(Properties, Decl(file.tsx, 14, 1)) + + public render() { +>render : Symbol(AddressComp.render, Decl(file.tsx, 18, 68)) + + return null; + } +} + +let a = +>a : Symbol(a, Decl(file.tsx, 24, 3)) +>AddressComp : Symbol(AddressComp, Decl(file.tsx, 16, 52)) +>postalCode : Symbol(postalCode, Decl(file.tsx, 24, 20)) +>street : Symbol(street, Decl(file.tsx, 24, 41)) +>country : Symbol(country, Decl(file.tsx, 24, 60)) + diff --git a/tests/baselines/reference/tsxAttributeResolution16.types b/tests/baselines/reference/tsxAttributeResolution16.types new file mode 100644 index 00000000000..68134d7ac2d --- /dev/null +++ b/tests/baselines/reference/tsxAttributeResolution16.types @@ -0,0 +1,59 @@ +=== tests/cases/conformance/jsx/file.tsx === + +import React = require('react'); +>React : typeof React + +interface Address { +>Address : Address + + street: string; +>street : string + + country: string; +>country : string +} + +interface CanadianAddress extends Address { +>CanadianAddress : CanadianAddress +>Address : Address + + postalCode: string; +>postalCode : string +} + +interface AmericanAddress extends Address { +>AmericanAddress : AmericanAddress +>Address : Address + + zipCode: string; +>zipCode : string +} + +type Properties = CanadianAddress | AmericanAddress; +>Properties : CanadianAddress | AmericanAddress +>CanadianAddress : CanadianAddress +>AmericanAddress : AmericanAddress + +export class AddressComp extends React.Component { +>AddressComp : AddressComp +>React.Component : React.Component +>React : typeof React +>Component : typeof React.Component +>Properties : CanadianAddress | AmericanAddress + + public render() { +>render : () => any + + return null; +>null : null + } +} + +let a = +>a : JSX.Element +> : JSX.Element +>AddressComp : typeof AddressComp +>postalCode : string +>street : string +>country : string + diff --git a/tests/baselines/reference/tsxElementResolution12.errors.txt b/tests/baselines/reference/tsxElementResolution12.errors.txt index e55ec837332..1f481b756bd 100644 --- a/tests/baselines/reference/tsxElementResolution12.errors.txt +++ b/tests/baselines/reference/tsxElementResolution12.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/jsx/file.tsx(23,1): error TS2607: JSX element class does not support attributes because it does not have a 'pr' property -tests/cases/conformance/jsx/file.tsx(25,1): error TS2607: JSX element class does not support attributes because it does not have a 'pr' property +tests/cases/conformance/jsx/file.tsx(23,1): error TS2607: JSX element class does not support attributes because it does not have a 'pr' property. +tests/cases/conformance/jsx/file.tsx(25,1): error TS2607: JSX element class does not support attributes because it does not have a 'pr' property. tests/cases/conformance/jsx/file.tsx(33,7): error TS2322: Type '{ x: "10"; }' is not assignable to type '{ x: number; }'. Types of property 'x' are incompatible. Type '"10"' is not assignable to type 'number'. @@ -30,11 +30,11 @@ tests/cases/conformance/jsx/file.tsx(33,7): error TS2322: Type '{ x: "10"; }' is var Obj3: Obj3type; ; // Error ~~~~~~~~~~~~~~~ -!!! error TS2607: JSX element class does not support attributes because it does not have a 'pr' property +!!! error TS2607: JSX element class does not support attributes because it does not have a 'pr' property. var attributes: any; ; // Error ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2607: JSX element class does not support attributes because it does not have a 'pr' property +!!! error TS2607: JSX element class does not support attributes because it does not have a 'pr' property. ; // OK interface Obj4type { diff --git a/tests/baselines/reference/tsxElementResolution15.errors.txt b/tests/baselines/reference/tsxElementResolution15.errors.txt index 79cbd1a37af..35126294f67 100644 --- a/tests/baselines/reference/tsxElementResolution15.errors.txt +++ b/tests/baselines/reference/tsxElementResolution15.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(3,12): error TS2608: The global type 'JSX.ElementAttributesProperty' may not have more than one property +tests/cases/conformance/jsx/file.tsx(3,12): error TS2608: The global type 'JSX.ElementAttributesProperty' may not have more than one property. ==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/conformance/jsx/file.tsx(3,12): error TS2608: The global type 'JSX.E interface Element { } interface ElementAttributesProperty { pr1: any; pr2: any; } ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2608: The global type 'JSX.ElementAttributesProperty' may not have more than one property +!!! error TS2608: The global type 'JSX.ElementAttributesProperty' may not have more than one property. interface IntrinsicElements { } } diff --git a/tests/baselines/reference/tsxElementResolution16.errors.txt b/tests/baselines/reference/tsxElementResolution16.errors.txt index 1a887c39995..b68c442c36d 100644 --- a/tests/baselines/reference/tsxElementResolution16.errors.txt +++ b/tests/baselines/reference/tsxElementResolution16.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/jsx/file.tsx(8,1): error TS2602: JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist. -tests/cases/conformance/jsx/file.tsx(8,1): error TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists +tests/cases/conformance/jsx/file.tsx(8,1): error TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists. ==== tests/cases/conformance/jsx/file.tsx (2 errors) ==== @@ -14,5 +14,5 @@ tests/cases/conformance/jsx/file.tsx(8,1): error TS7026: JSX element implicitly ~~~~~~~~~~~~~~~ !!! error TS2602: JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist. ~~~~~~~~~~~~~~~ -!!! error TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists +!!! error TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists. \ No newline at end of file diff --git a/tests/baselines/reference/tsxElementResolution18.errors.txt b/tests/baselines/reference/tsxElementResolution18.errors.txt index 5b8468696c0..47dbbbd56f4 100644 --- a/tests/baselines/reference/tsxElementResolution18.errors.txt +++ b/tests/baselines/reference/tsxElementResolution18.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file1.tsx(6,1): error TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists +tests/cases/conformance/jsx/file1.tsx(6,1): error TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists. ==== tests/cases/conformance/jsx/file1.tsx (1 errors) ==== @@ -9,5 +9,5 @@ tests/cases/conformance/jsx/file1.tsx(6,1): error TS7026: JSX element implicitly // Error under implicit any
; ~~~~~~~~~~~~~ -!!! error TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists +!!! error TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists. \ No newline at end of file diff --git a/tests/baselines/reference/tsxErrorRecovery2.errors.txt b/tests/baselines/reference/tsxErrorRecovery2.errors.txt index 472b94654aa..b64bad49d5f 100644 --- a/tests/baselines/reference/tsxErrorRecovery2.errors.txt +++ b/tests/baselines/reference/tsxErrorRecovery2.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/jsx/file1.tsx(4,1): error TS2695: Left side of comma operator is unused and has no side effects. -tests/cases/conformance/jsx/file1.tsx(6,1): error TS2657: JSX expressions must have one parent element +tests/cases/conformance/jsx/file1.tsx(6,1): error TS2657: JSX expressions must have one parent element. tests/cases/conformance/jsx/file2.tsx(1,9): error TS2695: Left side of comma operator is unused and has no side effects. -tests/cases/conformance/jsx/file2.tsx(2,1): error TS2657: JSX expressions must have one parent element +tests/cases/conformance/jsx/file2.tsx(2,1): error TS2657: JSX expressions must have one parent element. ==== tests/cases/conformance/jsx/file1.tsx (2 errors) ==== @@ -14,11 +14,11 @@ tests/cases/conformance/jsx/file2.tsx(2,1): error TS2657: JSX expressions must h
-!!! error TS2657: JSX expressions must have one parent element +!!! error TS2657: JSX expressions must have one parent element. ==== tests/cases/conformance/jsx/file2.tsx (2 errors) ==== var x =
~~~~~~~~~~~ !!! error TS2695: Left side of comma operator is unused and has no side effects. -!!! error TS2657: JSX expressions must have one parent element \ No newline at end of file +!!! error TS2657: JSX expressions must have one parent element. \ No newline at end of file diff --git a/tests/baselines/reference/tsxErrorRecovery3.errors.txt b/tests/baselines/reference/tsxErrorRecovery3.errors.txt index 5e7c5bffcb5..1c9e7bd8f41 100644 --- a/tests/baselines/reference/tsxErrorRecovery3.errors.txt +++ b/tests/baselines/reference/tsxErrorRecovery3.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/jsx/file1.tsx(4,1): error TS2695: Left side of comma operator is unused and has no side effects. tests/cases/conformance/jsx/file1.tsx(4,2): error TS2304: Cannot find name 'React'. tests/cases/conformance/jsx/file1.tsx(5,2): error TS2304: Cannot find name 'React'. -tests/cases/conformance/jsx/file1.tsx(6,1): error TS2657: JSX expressions must have one parent element +tests/cases/conformance/jsx/file1.tsx(6,1): error TS2657: JSX expressions must have one parent element. tests/cases/conformance/jsx/file2.tsx(1,9): error TS2695: Left side of comma operator is unused and has no side effects. tests/cases/conformance/jsx/file2.tsx(1,10): error TS2304: Cannot find name 'React'. tests/cases/conformance/jsx/file2.tsx(1,21): error TS2304: Cannot find name 'React'. -tests/cases/conformance/jsx/file2.tsx(2,1): error TS2657: JSX expressions must have one parent element +tests/cases/conformance/jsx/file2.tsx(2,1): error TS2657: JSX expressions must have one parent element. ==== tests/cases/conformance/jsx/file1.tsx (4 errors) ==== @@ -22,7 +22,7 @@ tests/cases/conformance/jsx/file2.tsx(2,1): error TS2657: JSX expressions must h !!! error TS2304: Cannot find name 'React'. -!!! error TS2657: JSX expressions must have one parent element +!!! error TS2657: JSX expressions must have one parent element. ==== tests/cases/conformance/jsx/file2.tsx (4 errors) ==== var x =
~~~~~~~~~~~ @@ -33,4 +33,4 @@ tests/cases/conformance/jsx/file2.tsx(2,1): error TS2657: JSX expressions must h !!! error TS2304: Cannot find name 'React'. -!!! error TS2657: JSX expressions must have one parent element \ No newline at end of file +!!! error TS2657: JSX expressions must have one parent element. \ No newline at end of file diff --git a/tests/baselines/reference/tsxSpreadAttributesResolution6.errors.txt b/tests/baselines/reference/tsxSpreadAttributesResolution6.errors.txt index c3bd7484fbf..968fa3764a8 100644 --- a/tests/baselines/reference/tsxSpreadAttributesResolution6.errors.txt +++ b/tests/baselines/reference/tsxSpreadAttributesResolution6.errors.txt @@ -1,4 +1,7 @@ -tests/cases/conformance/jsx/file.tsx(14,10): error TS2600: JSX element attributes type '({ editable: false; } & { children?: ReactNode; }) | ({ editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; })' may not be a union type. +tests/cases/conformance/jsx/file.tsx(14,24): error TS2322: Type '{ editable: true; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes & { editable: false; } & { children?: ReactNode; }) | (IntrinsicAttributes & IntrinsicClassAttributes & { editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; })'. + Type '{ editable: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & { editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; }'. + Type '{ editable: true; }' is not assignable to type '{ editable: true; onEdit: (newText: string) => void; }'. + Property 'onEdit' is missing in type '{ editable: true; }'. ==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== @@ -16,8 +19,11 @@ tests/cases/conformance/jsx/file.tsx(14,10): error TS2600: JSX element attribute // Error let x = - ~~~~~~~~~~~~~ -!!! error TS2600: JSX element attributes type '({ editable: false; } & { children?: ReactNode; }) | ({ editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; })' may not be a union type. + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type '{ editable: true; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes & { editable: false; } & { children?: ReactNode; }) | (IntrinsicAttributes & IntrinsicClassAttributes & { editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; })'. +!!! error TS2322: Type '{ editable: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & { editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; }'. +!!! error TS2322: Type '{ editable: true; }' is not assignable to type '{ editable: true; onEdit: (newText: string) => void; }'. +!!! error TS2322: Property 'onEdit' is missing in type '{ editable: true; }'. const textProps: TextProps = { editable: false diff --git a/tests/baselines/reference/tsxSpreadAttributesResolution7.errors.txt b/tests/baselines/reference/tsxSpreadAttributesResolution7.errors.txt deleted file mode 100644 index c71459c4a38..00000000000 --- a/tests/baselines/reference/tsxSpreadAttributesResolution7.errors.txt +++ /dev/null @@ -1,34 +0,0 @@ -tests/cases/conformance/jsx/file.tsx(18,11): error TS2600: JSX element attributes type '({ editable: false; } & { children?: ReactNode; }) | ({ editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; })' may not be a union type. -tests/cases/conformance/jsx/file.tsx(25,11): error TS2600: JSX element attributes type '({ editable: false; } & { children?: ReactNode; }) | ({ editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; })' may not be a union type. - - -==== tests/cases/conformance/jsx/file.tsx (2 errors) ==== - - import React = require('react'); - - type TextProps = { editable: false } - | { editable: true, onEdit: (newText: string) => void }; - - class TextComponent extends React.Component { - render() { - return Some Text..; - } - } - - // OK - const textPropsFalse: TextProps = { - editable: false - }; - - let y1 = - ~~~~~~~~~~~~~ -!!! error TS2600: JSX element attributes type '({ editable: false; } & { children?: ReactNode; }) | ({ editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; })' may not be a union type. - - const textPropsTrue: TextProps = { - editable: true, - onEdit: () => {} - }; - - let y2 = - ~~~~~~~~~~~~~ -!!! error TS2600: JSX element attributes type '({ editable: false; } & { children?: ReactNode; }) | ({ editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; })' may not be a union type. \ No newline at end of file diff --git a/tests/baselines/reference/tsxSpreadAttributesResolution7.symbols b/tests/baselines/reference/tsxSpreadAttributesResolution7.symbols new file mode 100644 index 00000000000..f40b79ae616 --- /dev/null +++ b/tests/baselines/reference/tsxSpreadAttributesResolution7.symbols @@ -0,0 +1,62 @@ +=== tests/cases/conformance/jsx/file.tsx === + +import React = require('react'); +>React : Symbol(React, Decl(file.tsx, 0, 0)) + +type TextProps = { editable: false } +>TextProps : Symbol(TextProps, Decl(file.tsx, 1, 32)) +>editable : Symbol(editable, Decl(file.tsx, 3, 18)) + + | { editable: true, onEdit: (newText: string) => void }; +>editable : Symbol(editable, Decl(file.tsx, 4, 18)) +>onEdit : Symbol(onEdit, Decl(file.tsx, 4, 34)) +>newText : Symbol(newText, Decl(file.tsx, 4, 44)) + +class TextComponent extends React.Component { +>TextComponent : Symbol(TextComponent, Decl(file.tsx, 4, 71)) +>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55)) +>React : Symbol(React, Decl(file.tsx, 0, 0)) +>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55)) +>TextProps : Symbol(TextProps, Decl(file.tsx, 1, 32)) + + render() { +>render : Symbol(TextComponent.render, Decl(file.tsx, 6, 60)) + + return Some Text..; +>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2458, 51)) +>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2458, 51)) + } +} + +// OK +const textPropsFalse: TextProps = { +>textPropsFalse : Symbol(textPropsFalse, Decl(file.tsx, 13, 5)) +>TextProps : Symbol(TextProps, Decl(file.tsx, 1, 32)) + + editable: false +>editable : Symbol(editable, Decl(file.tsx, 13, 35)) + +}; + +let y1 = +>y1 : Symbol(y1, Decl(file.tsx, 17, 3)) +>TextComponent : Symbol(TextComponent, Decl(file.tsx, 4, 71)) +>textPropsFalse : Symbol(textPropsFalse, Decl(file.tsx, 13, 5)) + +const textPropsTrue: TextProps = { +>textPropsTrue : Symbol(textPropsTrue, Decl(file.tsx, 19, 5)) +>TextProps : Symbol(TextProps, Decl(file.tsx, 1, 32)) + + editable: true, +>editable : Symbol(editable, Decl(file.tsx, 19, 34)) + + onEdit: () => {} +>onEdit : Symbol(onEdit, Decl(file.tsx, 20, 19)) + +}; + +let y2 = +>y2 : Symbol(y2, Decl(file.tsx, 24, 3)) +>TextComponent : Symbol(TextComponent, Decl(file.tsx, 4, 71)) +>textPropsTrue : Symbol(textPropsTrue, Decl(file.tsx, 19, 5)) + diff --git a/tests/baselines/reference/tsxSpreadAttributesResolution7.types b/tests/baselines/reference/tsxSpreadAttributesResolution7.types new file mode 100644 index 00000000000..db423de0904 --- /dev/null +++ b/tests/baselines/reference/tsxSpreadAttributesResolution7.types @@ -0,0 +1,72 @@ +=== tests/cases/conformance/jsx/file.tsx === + +import React = require('react'); +>React : typeof React + +type TextProps = { editable: false } +>TextProps : { editable: false; } | { editable: true; onEdit: (newText: string) => void; } +>editable : false +>false : false + + | { editable: true, onEdit: (newText: string) => void }; +>editable : true +>true : true +>onEdit : (newText: string) => void +>newText : string + +class TextComponent extends React.Component { +>TextComponent : TextComponent +>React.Component : React.Component<{ editable: false; } | { editable: true; onEdit: (newText: string) => void; }, {}> +>React : typeof React +>Component : typeof React.Component +>TextProps : { editable: false; } | { editable: true; onEdit: (newText: string) => void; } + + render() { +>render : () => JSX.Element + + return Some Text..; +>Some Text.. : JSX.Element +>span : any +>span : any + } +} + +// OK +const textPropsFalse: TextProps = { +>textPropsFalse : { editable: false; } | { editable: true; onEdit: (newText: string) => void; } +>TextProps : { editable: false; } | { editable: true; onEdit: (newText: string) => void; } +>{ editable: false} : { editable: false; } + + editable: false +>editable : boolean +>false : false + +}; + +let y1 = +>y1 : JSX.Element +> : JSX.Element +>TextComponent : typeof TextComponent +>textPropsFalse : { editable: false; } + +const textPropsTrue: TextProps = { +>textPropsTrue : { editable: false; } | { editable: true; onEdit: (newText: string) => void; } +>TextProps : { editable: false; } | { editable: true; onEdit: (newText: string) => void; } +>{ editable: true, onEdit: () => {}} : { editable: true; onEdit: () => void; } + + editable: true, +>editable : boolean +>true : true + + onEdit: () => {} +>onEdit : () => void +>() => {} : () => void + +}; + +let y2 = +>y2 : JSX.Element +> : JSX.Element +>TextComponent : typeof TextComponent +>textPropsTrue : { editable: true; onEdit: (newText: string) => void; } + diff --git a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt index e9dfbf5bf27..db5479f3946 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt +++ b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt @@ -48,7 +48,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(98,25) tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(98,27): error TS1005: ';' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(104,25): error TS1228: A type predicate is only allowed in return type position for functions and methods. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(105,9): error TS2322: Type 'true' is not assignable to type 'D'. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(105,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(105,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(107,20): error TS1228: A type predicate is only allowed in return type position for functions and methods. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(110,20): error TS1228: A type predicate is only allowed in return type position for functions and methods. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(111,9): error TS2408: Setters cannot return a value. @@ -261,7 +261,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39 ~~~~~~~~~~~~ !!! error TS2322: Type 'true' is not assignable to type 'D'. ~~~~~~~~~~~~ -!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class +!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. } get m1(p1: A): p1 is C { ~~~~~~~ diff --git a/tests/baselines/reference/typeReferenceDirectives1.trace.json b/tests/baselines/reference/typeReferenceDirectives1.trace.json index 8532d21da89..64994ab00b5 100644 --- a/tests/baselines/reference/typeReferenceDirectives1.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives1.trace.json @@ -1,14 +1,14 @@ [ "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives10.trace.json b/tests/baselines/reference/typeReferenceDirectives10.trace.json index 910ec0cafa6..a91414a8ce1 100644 --- a/tests/baselines/reference/typeReferenceDirectives10.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives10.trace.json @@ -1,9 +1,9 @@ [ "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving module './ref' from '/app.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -13,9 +13,9 @@ "File '/ref.d.ts' exist - use it as a name resolution result.", "======== Module name './ref' was successfully resolved to '/ref.d.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives11.trace.json b/tests/baselines/reference/typeReferenceDirectives11.trace.json index ae6786cba55..572648804ae 100644 --- a/tests/baselines/reference/typeReferenceDirectives11.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives11.trace.json @@ -5,9 +5,9 @@ "File '/mod1.ts' exist - use it as a name resolution result.", "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives12.trace.json b/tests/baselines/reference/typeReferenceDirectives12.trace.json index 96c6aee65ec..62a3b31fa1c 100644 --- a/tests/baselines/reference/typeReferenceDirectives12.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives12.trace.json @@ -10,18 +10,18 @@ "File '/mod1.ts' exist - use it as a name resolution result.", "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/mod1.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving module './main' from '/mod1.ts'. ========", "Resolution for module './main' was found in cache.", "======== Module name './main' was successfully resolved to '/main.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives13.trace.json b/tests/baselines/reference/typeReferenceDirectives13.trace.json index 910ec0cafa6..a91414a8ce1 100644 --- a/tests/baselines/reference/typeReferenceDirectives13.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives13.trace.json @@ -1,9 +1,9 @@ [ "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving module './ref' from '/app.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -13,9 +13,9 @@ "File '/ref.d.ts' exist - use it as a name resolution result.", "======== Module name './ref' was successfully resolved to '/ref.d.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives2.trace.json b/tests/baselines/reference/typeReferenceDirectives2.trace.json index 1258ecdaa2b..47ae2761584 100644 --- a/tests/baselines/reference/typeReferenceDirectives2.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives2.trace.json @@ -1,8 +1,8 @@ [ "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives3.trace.json b/tests/baselines/reference/typeReferenceDirectives3.trace.json index 8532d21da89..64994ab00b5 100644 --- a/tests/baselines/reference/typeReferenceDirectives3.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives3.trace.json @@ -1,14 +1,14 @@ [ "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives4.trace.json b/tests/baselines/reference/typeReferenceDirectives4.trace.json index 8532d21da89..64994ab00b5 100644 --- a/tests/baselines/reference/typeReferenceDirectives4.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives4.trace.json @@ -1,14 +1,14 @@ [ "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives5.trace.json b/tests/baselines/reference/typeReferenceDirectives5.trace.json index 910ec0cafa6..a91414a8ce1 100644 --- a/tests/baselines/reference/typeReferenceDirectives5.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives5.trace.json @@ -1,9 +1,9 @@ [ "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving module './ref' from '/app.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -13,9 +13,9 @@ "File '/ref.d.ts' exist - use it as a name resolution result.", "======== Module name './ref' was successfully resolved to '/ref.d.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives6.trace.json b/tests/baselines/reference/typeReferenceDirectives6.trace.json index 8532d21da89..64994ab00b5 100644 --- a/tests/baselines/reference/typeReferenceDirectives6.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives6.trace.json @@ -1,14 +1,14 @@ [ "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives7.trace.json b/tests/baselines/reference/typeReferenceDirectives7.trace.json index 8532d21da89..64994ab00b5 100644 --- a/tests/baselines/reference/typeReferenceDirectives7.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives7.trace.json @@ -1,14 +1,14 @@ [ "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives8.trace.json b/tests/baselines/reference/typeReferenceDirectives8.trace.json index ae6786cba55..572648804ae 100644 --- a/tests/baselines/reference/typeReferenceDirectives8.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives8.trace.json @@ -5,9 +5,9 @@ "File '/mod1.ts' exist - use it as a name resolution result.", "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives9.trace.json b/tests/baselines/reference/typeReferenceDirectives9.trace.json index 96c6aee65ec..62a3b31fa1c 100644 --- a/tests/baselines/reference/typeReferenceDirectives9.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives9.trace.json @@ -10,18 +10,18 @@ "File '/mod1.ts' exist - use it as a name resolution result.", "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/mod1.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving module './main' from '/mod1.ts'. ========", "Resolution for module './main' was found in cache.", "======== Module name './main' was successfully resolved to '/main.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", - "Resolving with primary search path '/types'", + "Resolving with primary search path '/types'.", "File '/types/lib/package.json' does not exist.", "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", + "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'.", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typeRootsFromMultipleNodeModulesDirectories.trace.json b/tests/baselines/reference/typeRootsFromMultipleNodeModulesDirectories.trace.json index 8074424995e..fdcbcdb7ab1 100644 --- a/tests/baselines/reference/typeRootsFromMultipleNodeModulesDirectories.trace.json +++ b/tests/baselines/reference/typeRootsFromMultipleNodeModulesDirectories.trace.json @@ -57,21 +57,21 @@ "File '/node_modules/abc.jsx' does not exist.", "======== Module name 'abc' was not resolved. ========", "======== Resolving type reference directive 'grumpy', containing file '/foo/bar/__inferred type names__.ts', root directory '/foo/node_modules/@types,/node_modules/@types'. ========", - "Resolving with primary search path '/foo/node_modules/@types, /node_modules/@types'", + "Resolving with primary search path '/foo/node_modules/@types, /node_modules/@types'.", "File '/foo/node_modules/@types/grumpy/package.json' does not exist.", "File '/foo/node_modules/@types/grumpy/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/foo/node_modules/@types/grumpy/index.d.ts', result '/foo/node_modules/@types/grumpy/index.d.ts'", + "Resolving real path for '/foo/node_modules/@types/grumpy/index.d.ts', result '/foo/node_modules/@types/grumpy/index.d.ts'.", "======== Type reference directive 'grumpy' was successfully resolved to '/foo/node_modules/@types/grumpy/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'sneezy', containing file '/foo/bar/__inferred type names__.ts', root directory '/foo/node_modules/@types,/node_modules/@types'. ========", - "Resolving with primary search path '/foo/node_modules/@types, /node_modules/@types'", + "Resolving with primary search path '/foo/node_modules/@types, /node_modules/@types'.", "File '/foo/node_modules/@types/sneezy/package.json' does not exist.", "File '/foo/node_modules/@types/sneezy/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/foo/node_modules/@types/sneezy/index.d.ts', result '/foo/node_modules/@types/sneezy/index.d.ts'", + "Resolving real path for '/foo/node_modules/@types/sneezy/index.d.ts', result '/foo/node_modules/@types/sneezy/index.d.ts'.", "======== Type reference directive 'sneezy' was successfully resolved to '/foo/node_modules/@types/sneezy/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'dopey', containing file '/foo/bar/__inferred type names__.ts', root directory '/foo/node_modules/@types,/node_modules/@types'. ========", - "Resolving with primary search path '/foo/node_modules/@types, /node_modules/@types'", + "Resolving with primary search path '/foo/node_modules/@types, /node_modules/@types'.", "File '/node_modules/@types/dopey/package.json' does not exist.", "File '/node_modules/@types/dopey/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/dopey/index.d.ts', result '/node_modules/@types/dopey/index.d.ts'", + "Resolving real path for '/node_modules/@types/dopey/index.d.ts', result '/node_modules/@types/dopey/index.d.ts'.", "======== Type reference directive 'dopey' was successfully resolved to '/node_modules/@types/dopey/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typeRootsFromNodeModulesInParentDirectory.trace.json b/tests/baselines/reference/typeRootsFromNodeModulesInParentDirectory.trace.json index dc21070f1ae..a15e20239c6 100644 --- a/tests/baselines/reference/typeRootsFromNodeModulesInParentDirectory.trace.json +++ b/tests/baselines/reference/typeRootsFromNodeModulesInParentDirectory.trace.json @@ -13,9 +13,9 @@ "File '/node_modules/xyz.jsx' does not exist.", "======== Module name 'xyz' was not resolved. ========", "======== Resolving type reference directive 'foo', containing file '/src/__inferred type names__.ts', root directory '/node_modules/@types'. ========", - "Resolving with primary search path '/node_modules/@types'", + "Resolving with primary search path '/node_modules/@types'.", "File '/node_modules/@types/foo/package.json' does not exist.", "File '/node_modules/@types/foo/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/foo/index.d.ts', result '/node_modules/@types/foo/index.d.ts'", + "Resolving real path for '/node_modules/@types/foo/index.d.ts', result '/node_modules/@types/foo/index.d.ts'.", "======== Type reference directive 'foo' was successfully resolved to '/node_modules/@types/foo/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/types.asyncGenerators.esnext.1.symbols b/tests/baselines/reference/types.asyncGenerators.esnext.1.symbols new file mode 100644 index 00000000000..0514b4e1424 --- /dev/null +++ b/tests/baselines/reference/types.asyncGenerators.esnext.1.symbols @@ -0,0 +1,152 @@ +=== tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.1.ts === +async function * inferReturnType1() { +>inferReturnType1 : Symbol(inferReturnType1, Decl(types.asyncGenerators.esnext.1.ts, 0, 0)) +} +async function * inferReturnType2() { +>inferReturnType2 : Symbol(inferReturnType2, Decl(types.asyncGenerators.esnext.1.ts, 1, 1)) + + yield; +} +async function * inferReturnType3() { +>inferReturnType3 : Symbol(inferReturnType3, Decl(types.asyncGenerators.esnext.1.ts, 4, 1)) + + yield 1; +} +async function * inferReturnType4() { +>inferReturnType4 : Symbol(inferReturnType4, Decl(types.asyncGenerators.esnext.1.ts, 7, 1)) + + yield* [1, 2]; +} +async function * inferReturnType5() { +>inferReturnType5 : Symbol(inferReturnType5, Decl(types.asyncGenerators.esnext.1.ts, 10, 1)) + + yield* (async function * () { yield 1; })(); +} +const assignability1: () => AsyncIterableIterator = async function * () { +>assignability1 : Symbol(assignability1, Decl(types.asyncGenerators.esnext.1.ts, 14, 5)) +>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield 1; +}; +const assignability2: () => AsyncIterableIterator = async function * () { +>assignability2 : Symbol(assignability2, Decl(types.asyncGenerators.esnext.1.ts, 17, 5)) +>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield* [1, 2]; +}; +const assignability3: () => AsyncIterableIterator = async function * () { +>assignability3 : Symbol(assignability3, Decl(types.asyncGenerators.esnext.1.ts, 20, 5)) +>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield* (async function * () { yield 1; })(); +}; +const assignability4: () => AsyncIterable = async function * () { +>assignability4 : Symbol(assignability4, Decl(types.asyncGenerators.esnext.1.ts, 23, 5)) +>AsyncIterable : Symbol(AsyncIterable, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield 1; +}; +const assignability5: () => AsyncIterable = async function * () { +>assignability5 : Symbol(assignability5, Decl(types.asyncGenerators.esnext.1.ts, 26, 5)) +>AsyncIterable : Symbol(AsyncIterable, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield* [1, 2]; +}; +const assignability6: () => AsyncIterable = async function * () { +>assignability6 : Symbol(assignability6, Decl(types.asyncGenerators.esnext.1.ts, 29, 5)) +>AsyncIterable : Symbol(AsyncIterable, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield* (async function * () { yield 1; })(); +}; +const assignability7: () => AsyncIterator = async function * () { +>assignability7 : Symbol(assignability7, Decl(types.asyncGenerators.esnext.1.ts, 32, 5)) +>AsyncIterator : Symbol(AsyncIterator, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield 1; +}; +const assignability8: () => AsyncIterator = async function * () { +>assignability8 : Symbol(assignability8, Decl(types.asyncGenerators.esnext.1.ts, 35, 5)) +>AsyncIterator : Symbol(AsyncIterator, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield* [1, 2]; +}; +const assignability9: () => AsyncIterator = async function * () { +>assignability9 : Symbol(assignability9, Decl(types.asyncGenerators.esnext.1.ts, 38, 5)) +>AsyncIterator : Symbol(AsyncIterator, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield* (async function * () { yield 1; })(); +}; +async function * explicitReturnType1(): AsyncIterableIterator { +>explicitReturnType1 : Symbol(explicitReturnType1, Decl(types.asyncGenerators.esnext.1.ts, 40, 2)) +>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield 1; +} +async function * explicitReturnType2(): AsyncIterableIterator { +>explicitReturnType2 : Symbol(explicitReturnType2, Decl(types.asyncGenerators.esnext.1.ts, 43, 1)) +>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield* [1, 2]; +} +async function * explicitReturnType3(): AsyncIterableIterator { +>explicitReturnType3 : Symbol(explicitReturnType3, Decl(types.asyncGenerators.esnext.1.ts, 46, 1)) +>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield* (async function * () { yield 1; })(); +} +async function * explicitReturnType4(): AsyncIterable { +>explicitReturnType4 : Symbol(explicitReturnType4, Decl(types.asyncGenerators.esnext.1.ts, 49, 1)) +>AsyncIterable : Symbol(AsyncIterable, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield 1; +} +async function * explicitReturnType5(): AsyncIterable { +>explicitReturnType5 : Symbol(explicitReturnType5, Decl(types.asyncGenerators.esnext.1.ts, 52, 1)) +>AsyncIterable : Symbol(AsyncIterable, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield* [1, 2]; +} +async function * explicitReturnType6(): AsyncIterable { +>explicitReturnType6 : Symbol(explicitReturnType6, Decl(types.asyncGenerators.esnext.1.ts, 55, 1)) +>AsyncIterable : Symbol(AsyncIterable, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield* (async function * () { yield 1; })(); +} +async function * explicitReturnType7(): AsyncIterator { +>explicitReturnType7 : Symbol(explicitReturnType7, Decl(types.asyncGenerators.esnext.1.ts, 58, 1)) +>AsyncIterator : Symbol(AsyncIterator, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield 1; +} +async function * explicitReturnType8(): AsyncIterator { +>explicitReturnType8 : Symbol(explicitReturnType8, Decl(types.asyncGenerators.esnext.1.ts, 61, 1)) +>AsyncIterator : Symbol(AsyncIterator, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield* [1, 2]; +} +async function * explicitReturnType9(): AsyncIterator { +>explicitReturnType9 : Symbol(explicitReturnType9, Decl(types.asyncGenerators.esnext.1.ts, 64, 1)) +>AsyncIterator : Symbol(AsyncIterator, Decl(lib.esnext.asynciterable.d.ts, --, --)) + + yield* (async function * () { yield 1; })(); +} +async function * explicitReturnType10(): {} { +>explicitReturnType10 : Symbol(explicitReturnType10, Decl(types.asyncGenerators.esnext.1.ts, 67, 1)) + + yield 1; +} +async function * awaitedType1() { +>awaitedType1 : Symbol(awaitedType1, Decl(types.asyncGenerators.esnext.1.ts, 70, 1)) + + const x = await 1; +>x : Symbol(x, Decl(types.asyncGenerators.esnext.1.ts, 72, 9)) +} +async function * awaitedType2() { +>awaitedType2 : Symbol(awaitedType2, Decl(types.asyncGenerators.esnext.1.ts, 73, 1)) + + const x = await Promise.resolve(1); +>x : Symbol(x, Decl(types.asyncGenerators.esnext.1.ts, 75, 9)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +} diff --git a/tests/baselines/reference/types.asyncGenerators.esnext.1.types b/tests/baselines/reference/types.asyncGenerators.esnext.1.types new file mode 100644 index 00000000000..a788f2d349f --- /dev/null +++ b/tests/baselines/reference/types.asyncGenerators.esnext.1.types @@ -0,0 +1,262 @@ +=== tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.1.ts === +async function * inferReturnType1() { +>inferReturnType1 : () => AsyncIterableIterator +} +async function * inferReturnType2() { +>inferReturnType2 : () => AsyncIterableIterator + + yield; +>yield : any +} +async function * inferReturnType3() { +>inferReturnType3 : () => AsyncIterableIterator<1> + + yield 1; +>yield 1 : any +>1 : 1 +} +async function * inferReturnType4() { +>inferReturnType4 : () => AsyncIterableIterator + + yield* [1, 2]; +>yield* [1, 2] : any +>[1, 2] : number[] +>1 : 1 +>2 : 2 +} +async function * inferReturnType5() { +>inferReturnType5 : () => AsyncIterableIterator<1> + + yield* (async function * () { yield 1; })(); +>yield* (async function * () { yield 1; })() : any +>(async function * () { yield 1; })() : AsyncIterableIterator<1> +>(async function * () { yield 1; }) : () => AsyncIterableIterator<1> +>async function * () { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 +} +const assignability1: () => AsyncIterableIterator = async function * () { +>assignability1 : () => AsyncIterableIterator +>AsyncIterableIterator : AsyncIterableIterator +>async function * () { yield 1;} : () => AsyncIterableIterator<1> + + yield 1; +>yield 1 : any +>1 : 1 + +}; +const assignability2: () => AsyncIterableIterator = async function * () { +>assignability2 : () => AsyncIterableIterator +>AsyncIterableIterator : AsyncIterableIterator +>async function * () { yield* [1, 2];} : () => AsyncIterableIterator + + yield* [1, 2]; +>yield* [1, 2] : any +>[1, 2] : number[] +>1 : 1 +>2 : 2 + +}; +const assignability3: () => AsyncIterableIterator = async function * () { +>assignability3 : () => AsyncIterableIterator +>AsyncIterableIterator : AsyncIterableIterator +>async function * () { yield* (async function * () { yield 1; })();} : () => AsyncIterableIterator<1> + + yield* (async function * () { yield 1; })(); +>yield* (async function * () { yield 1; })() : any +>(async function * () { yield 1; })() : AsyncIterableIterator<1> +>(async function * () { yield 1; }) : () => AsyncIterableIterator<1> +>async function * () { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 + +}; +const assignability4: () => AsyncIterable = async function * () { +>assignability4 : () => AsyncIterable +>AsyncIterable : AsyncIterable +>async function * () { yield 1;} : () => AsyncIterableIterator<1> + + yield 1; +>yield 1 : any +>1 : 1 + +}; +const assignability5: () => AsyncIterable = async function * () { +>assignability5 : () => AsyncIterable +>AsyncIterable : AsyncIterable +>async function * () { yield* [1, 2];} : () => AsyncIterableIterator + + yield* [1, 2]; +>yield* [1, 2] : any +>[1, 2] : number[] +>1 : 1 +>2 : 2 + +}; +const assignability6: () => AsyncIterable = async function * () { +>assignability6 : () => AsyncIterable +>AsyncIterable : AsyncIterable +>async function * () { yield* (async function * () { yield 1; })();} : () => AsyncIterableIterator<1> + + yield* (async function * () { yield 1; })(); +>yield* (async function * () { yield 1; })() : any +>(async function * () { yield 1; })() : AsyncIterableIterator<1> +>(async function * () { yield 1; }) : () => AsyncIterableIterator<1> +>async function * () { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 + +}; +const assignability7: () => AsyncIterator = async function * () { +>assignability7 : () => AsyncIterator +>AsyncIterator : AsyncIterator +>async function * () { yield 1;} : () => AsyncIterableIterator<1> + + yield 1; +>yield 1 : any +>1 : 1 + +}; +const assignability8: () => AsyncIterator = async function * () { +>assignability8 : () => AsyncIterator +>AsyncIterator : AsyncIterator +>async function * () { yield* [1, 2];} : () => AsyncIterableIterator + + yield* [1, 2]; +>yield* [1, 2] : any +>[1, 2] : number[] +>1 : 1 +>2 : 2 + +}; +const assignability9: () => AsyncIterator = async function * () { +>assignability9 : () => AsyncIterator +>AsyncIterator : AsyncIterator +>async function * () { yield* (async function * () { yield 1; })();} : () => AsyncIterableIterator<1> + + yield* (async function * () { yield 1; })(); +>yield* (async function * () { yield 1; })() : any +>(async function * () { yield 1; })() : AsyncIterableIterator<1> +>(async function * () { yield 1; }) : () => AsyncIterableIterator<1> +>async function * () { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 + +}; +async function * explicitReturnType1(): AsyncIterableIterator { +>explicitReturnType1 : () => AsyncIterableIterator +>AsyncIterableIterator : AsyncIterableIterator + + yield 1; +>yield 1 : any +>1 : 1 +} +async function * explicitReturnType2(): AsyncIterableIterator { +>explicitReturnType2 : () => AsyncIterableIterator +>AsyncIterableIterator : AsyncIterableIterator + + yield* [1, 2]; +>yield* [1, 2] : any +>[1, 2] : number[] +>1 : 1 +>2 : 2 +} +async function * explicitReturnType3(): AsyncIterableIterator { +>explicitReturnType3 : () => AsyncIterableIterator +>AsyncIterableIterator : AsyncIterableIterator + + yield* (async function * () { yield 1; })(); +>yield* (async function * () { yield 1; })() : any +>(async function * () { yield 1; })() : AsyncIterableIterator<1> +>(async function * () { yield 1; }) : () => AsyncIterableIterator<1> +>async function * () { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 +} +async function * explicitReturnType4(): AsyncIterable { +>explicitReturnType4 : () => AsyncIterable +>AsyncIterable : AsyncIterable + + yield 1; +>yield 1 : any +>1 : 1 +} +async function * explicitReturnType5(): AsyncIterable { +>explicitReturnType5 : () => AsyncIterable +>AsyncIterable : AsyncIterable + + yield* [1, 2]; +>yield* [1, 2] : any +>[1, 2] : number[] +>1 : 1 +>2 : 2 +} +async function * explicitReturnType6(): AsyncIterable { +>explicitReturnType6 : () => AsyncIterable +>AsyncIterable : AsyncIterable + + yield* (async function * () { yield 1; })(); +>yield* (async function * () { yield 1; })() : any +>(async function * () { yield 1; })() : AsyncIterableIterator<1> +>(async function * () { yield 1; }) : () => AsyncIterableIterator<1> +>async function * () { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 +} +async function * explicitReturnType7(): AsyncIterator { +>explicitReturnType7 : () => AsyncIterator +>AsyncIterator : AsyncIterator + + yield 1; +>yield 1 : any +>1 : 1 +} +async function * explicitReturnType8(): AsyncIterator { +>explicitReturnType8 : () => AsyncIterator +>AsyncIterator : AsyncIterator + + yield* [1, 2]; +>yield* [1, 2] : any +>[1, 2] : number[] +>1 : 1 +>2 : 2 +} +async function * explicitReturnType9(): AsyncIterator { +>explicitReturnType9 : () => AsyncIterator +>AsyncIterator : AsyncIterator + + yield* (async function * () { yield 1; })(); +>yield* (async function * () { yield 1; })() : any +>(async function * () { yield 1; })() : AsyncIterableIterator<1> +>(async function * () { yield 1; }) : () => AsyncIterableIterator<1> +>async function * () { yield 1; } : () => AsyncIterableIterator<1> +>yield 1 : any +>1 : 1 +} +async function * explicitReturnType10(): {} { +>explicitReturnType10 : () => {} + + yield 1; +>yield 1 : any +>1 : 1 +} +async function * awaitedType1() { +>awaitedType1 : () => AsyncIterableIterator + + const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 +} +async function * awaitedType2() { +>awaitedType2 : () => AsyncIterableIterator + + const x = await Promise.resolve(1); +>x : number +>await Promise.resolve(1) : number +>Promise.resolve(1) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>1 : 1 +} diff --git a/tests/baselines/reference/types.asyncGenerators.esnext.2.errors.txt b/tests/baselines/reference/types.asyncGenerators.esnext.2.errors.txt new file mode 100644 index 00000000000..c13620a7f9e --- /dev/null +++ b/tests/baselines/reference/types.asyncGenerators.esnext.2.errors.txt @@ -0,0 +1,212 @@ +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(2,12): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(7,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterableIterator'. + Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterableIterator'. + Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(10,7): error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterableIterator'. + Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterableIterator'. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(13,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterableIterator'. + Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterableIterator'. + Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(16,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterable'. + Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterable'. + Types of property '[Symbol.asyncIterator]' are incompatible. + Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator'. + Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterator'. + Types of property 'next' are incompatible. + Type '(value?: any) => Promise>' is not assignable to type '(value?: any) => Promise>'. + Type 'Promise>' is not assignable to type 'Promise>'. + Type 'IteratorResult<"a">' is not assignable to type 'IteratorResult'. + Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(19,7): error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterable'. + Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterable'. + Types of property '[Symbol.asyncIterator]' are incompatible. + Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterator'. + Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterator'. + Types of property 'next' are incompatible. + Type '(value?: any) => Promise>' is not assignable to type '(value?: any) => Promise>'. + Type 'Promise>' is not assignable to type 'Promise>'. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(22,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterable'. + Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterable'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(25,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator'. + Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterator'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(28,7): error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterator'. + Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterator'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(31,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator'. + Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterator'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(35,11): error TS2322: Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(38,12): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(41,12): error TS2322: Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(44,11): error TS2322: Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(47,12): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(50,12): error TS2322: Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(53,11): error TS2322: Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(56,12): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(59,12): error TS2322: Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(61,42): error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'IterableIterator'. + Property '[Symbol.iterator]' is missing in type 'AsyncIterableIterator'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(64,42): error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'Iterable'. + Property '[Symbol.iterator]' is missing in type 'AsyncIterableIterator'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(67,42): error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'Iterator'. + Types of property 'next' are incompatible. + Type '(value?: any) => Promise>' is not assignable to type '(value?: any) => IteratorResult'. + Type 'Promise>' is not assignable to type 'IteratorResult'. + Property 'done' is missing in type 'Promise>'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(71,12): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. + + +==== tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts (23 errors) ==== + async function * inferReturnType1() { + yield* {}; + ~~ +!!! error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. + } + async function * inferReturnType2() { + yield* inferReturnType2(); + } + const assignability1: () => AsyncIterableIterator = async function * () { + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterableIterator'. +!!! error TS2322: Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterableIterator'. +!!! error TS2322: Type '"a"' is not assignable to type 'number'. + yield "a"; + }; + const assignability2: () => AsyncIterableIterator = async function * () { + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterableIterator'. +!!! error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterableIterator'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + yield* ["a", "b"]; + }; + const assignability3: () => AsyncIterableIterator = async function * () { + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterableIterator'. +!!! error TS2322: Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterableIterator'. +!!! error TS2322: Type '"a"' is not assignable to type 'number'. + yield* (async function * () { yield "a"; })(); + }; + const assignability4: () => AsyncIterable = async function * () { + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterable'. +!!! error TS2322: Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterable'. +!!! error TS2322: Types of property '[Symbol.asyncIterator]' are incompatible. +!!! error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator'. +!!! error TS2322: Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterator'. +!!! error TS2322: Types of property 'next' are incompatible. +!!! error TS2322: Type '(value?: any) => Promise>' is not assignable to type '(value?: any) => Promise>'. +!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. +!!! error TS2322: Type 'IteratorResult<"a">' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type '"a"' is not assignable to type 'number'. + yield "a"; + }; + const assignability5: () => AsyncIterable = async function * () { + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterable'. +!!! error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterable'. +!!! error TS2322: Types of property '[Symbol.asyncIterator]' are incompatible. +!!! error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterator'. +!!! error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterator'. +!!! error TS2322: Types of property 'next' are incompatible. +!!! error TS2322: Type '(value?: any) => Promise>' is not assignable to type '(value?: any) => Promise>'. +!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. +!!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + yield* ["a", "b"]; + }; + const assignability6: () => AsyncIterable = async function * () { + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterable'. +!!! error TS2322: Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterable'. + yield* (async function * () { yield "a"; })(); + }; + const assignability7: () => AsyncIterator = async function * () { + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator'. +!!! error TS2322: Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterator'. + yield "a"; + }; + const assignability8: () => AsyncIterator = async function * () { + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterator'. +!!! error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterator'. + yield* ["a", "b"]; + }; + const assignability9: () => AsyncIterator = async function * () { + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator'. +!!! error TS2322: Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterator'. + yield* (async function * () { yield "a"; })(); + }; + async function * explicitReturnType1(): AsyncIterableIterator { + yield "a"; + ~~~ +!!! error TS2322: Type '"a"' is not assignable to type 'number'. + } + async function * explicitReturnType2(): AsyncIterableIterator { + yield* ["a", "b"]; + ~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + } + async function * explicitReturnType3(): AsyncIterableIterator { + yield* (async function * () { yield "a"; })(); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '"a"' is not assignable to type 'number'. + } + async function * explicitReturnType4(): AsyncIterable { + yield "a"; + ~~~ +!!! error TS2322: Type '"a"' is not assignable to type 'number'. + } + async function * explicitReturnType5(): AsyncIterable { + yield* ["a", "b"]; + ~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + } + async function * explicitReturnType6(): AsyncIterable { + yield* (async function * () { yield "a"; })(); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '"a"' is not assignable to type 'number'. + } + async function * explicitReturnType7(): AsyncIterator { + yield "a"; + ~~~ +!!! error TS2322: Type '"a"' is not assignable to type 'number'. + } + async function * explicitReturnType8(): AsyncIterator { + yield* ["a", "b"]; + ~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + } + async function * explicitReturnType9(): AsyncIterator { + yield* (async function * () { yield "a"; })(); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '"a"' is not assignable to type 'number'. + } + async function * explicitReturnType10(): IterableIterator { + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'IterableIterator'. +!!! error TS2322: Property '[Symbol.iterator]' is missing in type 'AsyncIterableIterator'. + yield 1; + } + async function * explicitReturnType11(): Iterable { + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'Iterable'. +!!! error TS2322: Property '[Symbol.iterator]' is missing in type 'AsyncIterableIterator'. + yield 1; + } + async function * explicitReturnType12(): Iterator { + ~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'Iterator'. +!!! error TS2322: Types of property 'next' are incompatible. +!!! error TS2322: Type '(value?: any) => Promise>' is not assignable to type '(value?: any) => IteratorResult'. +!!! error TS2322: Type 'Promise>' is not assignable to type 'IteratorResult'. +!!! error TS2322: Property 'done' is missing in type 'Promise>'. + yield 1; + } + async function * yieldStar() { + yield* {}; + ~~ +!!! error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. + } \ No newline at end of file diff --git a/tests/baselines/reference/types.forAwait.esnext.1.symbols b/tests/baselines/reference/types.forAwait.esnext.1.symbols new file mode 100644 index 00000000000..286f0a8555c --- /dev/null +++ b/tests/baselines/reference/types.forAwait.esnext.1.symbols @@ -0,0 +1,55 @@ +=== tests/cases/conformance/types/forAwait/types.forAwait.esnext.1.ts === +declare const asyncIterable: AsyncIterable; +>asyncIterable : Symbol(asyncIterable, Decl(types.forAwait.esnext.1.ts, 0, 13)) +>AsyncIterable : Symbol(AsyncIterable, Decl(lib.esnext.asynciterable.d.ts, --, --)) + +declare const iterable: Iterable; +>iterable : Symbol(iterable, Decl(types.forAwait.esnext.1.ts, 1, 13)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) + +async function f1() { +>f1 : Symbol(f1, Decl(types.forAwait.esnext.1.ts, 1, 41)) + + let y: number; +>y : Symbol(y, Decl(types.forAwait.esnext.1.ts, 3, 7)) + + for await (const x of asyncIterable) { +>x : Symbol(x, Decl(types.forAwait.esnext.1.ts, 4, 20)) +>asyncIterable : Symbol(asyncIterable, Decl(types.forAwait.esnext.1.ts, 0, 13)) + } + for await (const x of iterable) { +>x : Symbol(x, Decl(types.forAwait.esnext.1.ts, 6, 20)) +>iterable : Symbol(iterable, Decl(types.forAwait.esnext.1.ts, 1, 13)) + } + for await (y of asyncIterable) { +>y : Symbol(y, Decl(types.forAwait.esnext.1.ts, 3, 7)) +>asyncIterable : Symbol(asyncIterable, Decl(types.forAwait.esnext.1.ts, 0, 13)) + } + for await (y of iterable) { +>y : Symbol(y, Decl(types.forAwait.esnext.1.ts, 3, 7)) +>iterable : Symbol(iterable, Decl(types.forAwait.esnext.1.ts, 1, 13)) + } +} +async function * f2() { +>f2 : Symbol(f2, Decl(types.forAwait.esnext.1.ts, 12, 1)) + + let y: number; +>y : Symbol(y, Decl(types.forAwait.esnext.1.ts, 14, 7)) + + for await (const x of asyncIterable) { +>x : Symbol(x, Decl(types.forAwait.esnext.1.ts, 15, 20)) +>asyncIterable : Symbol(asyncIterable, Decl(types.forAwait.esnext.1.ts, 0, 13)) + } + for await (const x of iterable) { +>x : Symbol(x, Decl(types.forAwait.esnext.1.ts, 17, 20)) +>iterable : Symbol(iterable, Decl(types.forAwait.esnext.1.ts, 1, 13)) + } + for await (y of asyncIterable) { +>y : Symbol(y, Decl(types.forAwait.esnext.1.ts, 14, 7)) +>asyncIterable : Symbol(asyncIterable, Decl(types.forAwait.esnext.1.ts, 0, 13)) + } + for await (y of iterable) { +>y : Symbol(y, Decl(types.forAwait.esnext.1.ts, 14, 7)) +>iterable : Symbol(iterable, Decl(types.forAwait.esnext.1.ts, 1, 13)) + } +} diff --git a/tests/baselines/reference/types.forAwait.esnext.1.types b/tests/baselines/reference/types.forAwait.esnext.1.types new file mode 100644 index 00000000000..6b20101ecbb --- /dev/null +++ b/tests/baselines/reference/types.forAwait.esnext.1.types @@ -0,0 +1,55 @@ +=== tests/cases/conformance/types/forAwait/types.forAwait.esnext.1.ts === +declare const asyncIterable: AsyncIterable; +>asyncIterable : AsyncIterable +>AsyncIterable : AsyncIterable + +declare const iterable: Iterable; +>iterable : Iterable +>Iterable : Iterable + +async function f1() { +>f1 : () => Promise + + let y: number; +>y : number + + for await (const x of asyncIterable) { +>x : number +>asyncIterable : AsyncIterable + } + for await (const x of iterable) { +>x : number +>iterable : Iterable + } + for await (y of asyncIterable) { +>y : number +>asyncIterable : AsyncIterable + } + for await (y of iterable) { +>y : number +>iterable : Iterable + } +} +async function * f2() { +>f2 : () => AsyncIterableIterator + + let y: number; +>y : number + + for await (const x of asyncIterable) { +>x : number +>asyncIterable : AsyncIterable + } + for await (const x of iterable) { +>x : number +>iterable : Iterable + } + for await (y of asyncIterable) { +>y : number +>asyncIterable : AsyncIterable + } + for await (y of iterable) { +>y : number +>iterable : Iterable + } +} diff --git a/tests/baselines/reference/types.forAwait.esnext.2.errors.txt b/tests/baselines/reference/types.forAwait.esnext.2.errors.txt new file mode 100644 index 00000000000..367dc5a282f --- /dev/null +++ b/tests/baselines/reference/types.forAwait.esnext.2.errors.txt @@ -0,0 +1,39 @@ +tests/cases/conformance/types/forAwait/types.forAwait.esnext.2.ts(6,27): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. +tests/cases/conformance/types/forAwait/types.forAwait.esnext.2.ts(8,21): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. +tests/cases/conformance/types/forAwait/types.forAwait.esnext.2.ts(10,16): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/forAwait/types.forAwait.esnext.2.ts(12,16): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/forAwait/types.forAwait.esnext.2.ts(14,21): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. +tests/cases/conformance/types/forAwait/types.forAwait.esnext.2.ts(16,15): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. + + +==== tests/cases/conformance/types/forAwait/types.forAwait.esnext.2.ts (6 errors) ==== + declare const asyncIterable: AsyncIterable; + declare const iterable: Iterable; + async function f() { + let y: number; + let z: string; + for await (const x of {}) { + ~~ +!!! error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. + } + for await (y of {}) { + ~~ +!!! error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. + } + for await (z of asyncIterable) { + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + } + for await (z of iterable) { + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + } + for (const x of asyncIterable) { + ~~~~~~~~~~~~~ +!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. + } + for (y of asyncIterable) { + ~~~~~~~~~~~~~ +!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/types.forAwait.esnext.3.errors.txt b/tests/baselines/reference/types.forAwait.esnext.3.errors.txt new file mode 100644 index 00000000000..234e2eb0751 --- /dev/null +++ b/tests/baselines/reference/types.forAwait.esnext.3.errors.txt @@ -0,0 +1,31 @@ +error TS2318: Cannot find global type 'AsyncIterableIterator'. +tests/cases/conformance/types/forAwait/types.forAwait.esnext.3.ts(3,27): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. +tests/cases/conformance/types/forAwait/types.forAwait.esnext.3.ts(5,21): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. +tests/cases/conformance/types/forAwait/types.forAwait.esnext.3.ts(10,27): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. +tests/cases/conformance/types/forAwait/types.forAwait.esnext.3.ts(12,21): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. + + +!!! error TS2318: Cannot find global type 'AsyncIterableIterator'. +==== tests/cases/conformance/types/forAwait/types.forAwait.esnext.3.ts (4 errors) ==== + async function f1() { + let y: number; + for await (const x of {}) { + ~~ +!!! error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. + } + for await (y of {}) { + ~~ +!!! error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. + } + } + async function* f2() { + let y: number; + for await (const x of {}) { + ~~ +!!! error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. + } + for await (y of {}) { + ~~ +!!! error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/typesWithPublicConstructor.errors.txt b/tests/baselines/reference/typesWithPublicConstructor.errors.txt index 54bee79dae0..17abc57f6df 100644 --- a/tests/baselines/reference/typesWithPublicConstructor.errors.txt +++ b/tests/baselines/reference/typesWithPublicConstructor.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/types/members/typesWithPublicConstructor.ts(8,5): error TS2322: Type 'Function' is not assignable to type '() => void'. - Type 'Function' provides no match for the signature '(): void' + Type 'Function' provides no match for the signature '(): void'. tests/cases/conformance/types/members/typesWithPublicConstructor.ts(15,10): error TS2346: Supplied parameters do not match any signature of call target. @@ -14,7 +14,7 @@ tests/cases/conformance/types/members/typesWithPublicConstructor.ts(15,10): erro var r: () => void = c.constructor; ~ !!! error TS2322: Type 'Function' is not assignable to type '() => void'. -!!! error TS2322: Type 'Function' provides no match for the signature '(): void' +!!! error TS2322: Type 'Function' provides no match for the signature '(): void'. class C2 { public constructor(x: number); diff --git a/tests/baselines/reference/typingsLookup1.trace.json b/tests/baselines/reference/typingsLookup1.trace.json index 9445b8564d9..9efcb84d490 100644 --- a/tests/baselines/reference/typingsLookup1.trace.json +++ b/tests/baselines/reference/typingsLookup1.trace.json @@ -1,14 +1,14 @@ [ "======== Resolving type reference directive 'jquery', containing file '/a.ts', root directory '/node_modules/@types'. ========", - "Resolving with primary search path '/node_modules/@types'", + "Resolving with primary search path '/node_modules/@types'.", "File '/node_modules/@types/jquery/package.json' does not exist.", "File '/node_modules/@types/jquery/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/jquery/index.d.ts', result '/node_modules/@types/jquery/index.d.ts'", + "Resolving real path for '/node_modules/@types/jquery/index.d.ts', result '/node_modules/@types/jquery/index.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/node_modules/@types/jquery/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'jquery', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========", - "Resolving with primary search path '/node_modules/@types'", + "Resolving with primary search path '/node_modules/@types'.", "File '/node_modules/@types/jquery/package.json' does not exist.", "File '/node_modules/@types/jquery/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/jquery/index.d.ts', result '/node_modules/@types/jquery/index.d.ts'", + "Resolving real path for '/node_modules/@types/jquery/index.d.ts', result '/node_modules/@types/jquery/index.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/node_modules/@types/jquery/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typingsLookup3.trace.json b/tests/baselines/reference/typingsLookup3.trace.json index 9445b8564d9..9efcb84d490 100644 --- a/tests/baselines/reference/typingsLookup3.trace.json +++ b/tests/baselines/reference/typingsLookup3.trace.json @@ -1,14 +1,14 @@ [ "======== Resolving type reference directive 'jquery', containing file '/a.ts', root directory '/node_modules/@types'. ========", - "Resolving with primary search path '/node_modules/@types'", + "Resolving with primary search path '/node_modules/@types'.", "File '/node_modules/@types/jquery/package.json' does not exist.", "File '/node_modules/@types/jquery/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/jquery/index.d.ts', result '/node_modules/@types/jquery/index.d.ts'", + "Resolving real path for '/node_modules/@types/jquery/index.d.ts', result '/node_modules/@types/jquery/index.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/node_modules/@types/jquery/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'jquery', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========", - "Resolving with primary search path '/node_modules/@types'", + "Resolving with primary search path '/node_modules/@types'.", "File '/node_modules/@types/jquery/package.json' does not exist.", "File '/node_modules/@types/jquery/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/jquery/index.d.ts', result '/node_modules/@types/jquery/index.d.ts'", + "Resolving real path for '/node_modules/@types/jquery/index.d.ts', result '/node_modules/@types/jquery/index.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/node_modules/@types/jquery/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typingsLookup4.trace.json b/tests/baselines/reference/typingsLookup4.trace.json index 332d9ffa416..d2087308d8e 100644 --- a/tests/baselines/reference/typingsLookup4.trace.json +++ b/tests/baselines/reference/typingsLookup4.trace.json @@ -9,7 +9,7 @@ "Found 'package.json' at '/node_modules/@types/jquery/package.json'.", "'package.json' has 'typings' field 'jquery.d.ts' that references '/node_modules/@types/jquery/jquery.d.ts'.", "File '/node_modules/@types/jquery/jquery.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/jquery/jquery.d.ts', result '/node_modules/@types/jquery/jquery.d.ts'", + "Resolving real path for '/node_modules/@types/jquery/jquery.d.ts', result '/node_modules/@types/jquery/jquery.d.ts'.", "======== Module name 'jquery' was successfully resolved to '/node_modules/@types/jquery/jquery.d.ts'. ========", "======== Resolving module 'kquery' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -25,7 +25,7 @@ "File '/node_modules/@types/kquery/kquery.ts' does not exist.", "File '/node_modules/@types/kquery/kquery.tsx' does not exist.", "File '/node_modules/@types/kquery/kquery.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/kquery/kquery.d.ts', result '/node_modules/@types/kquery/kquery.d.ts'", + "Resolving real path for '/node_modules/@types/kquery/kquery.d.ts', result '/node_modules/@types/kquery/kquery.d.ts'.", "======== Module name 'kquery' was successfully resolved to '/node_modules/@types/kquery/kquery.d.ts'. ========", "======== Resolving module 'lquery' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -39,7 +39,7 @@ "File '/node_modules/@types/lquery/lquery' does not exist.", "Loading module as file / folder, candidate module location '/node_modules/@types/lquery/lquery', target file type 'TypeScript'.", "File '/node_modules/@types/lquery/lquery.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/lquery/lquery.ts', result '/node_modules/@types/lquery/lquery.ts'", + "Resolving real path for '/node_modules/@types/lquery/lquery.ts', result '/node_modules/@types/lquery/lquery.ts'.", "======== Module name 'lquery' was successfully resolved to '/node_modules/@types/lquery/lquery.ts'. ========", "======== Resolving module 'mquery' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -57,17 +57,17 @@ "File '/node_modules/@types/mquery/mquery.d.ts' does not exist.", "File '/node_modules/@types/mquery/mquery/index.ts' does not exist.", "File '/node_modules/@types/mquery/mquery/index.tsx' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/mquery/mquery/index.tsx', result '/node_modules/@types/mquery/mquery/index.tsx'", + "Resolving real path for '/node_modules/@types/mquery/mquery/index.tsx', result '/node_modules/@types/mquery/mquery/index.tsx'.", "======== Module name 'mquery' was successfully resolved to '/node_modules/@types/mquery/mquery/index.tsx'. ========", "======== Resolving type reference directive 'jquery', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========", - "Resolving with primary search path '/node_modules/@types'", + "Resolving with primary search path '/node_modules/@types'.", "Found 'package.json' at '/node_modules/@types/jquery/package.json'.", "'package.json' has 'typings' field 'jquery.d.ts' that references '/node_modules/@types/jquery/jquery.d.ts'.", "File '/node_modules/@types/jquery/jquery.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/jquery/jquery.d.ts', result '/node_modules/@types/jquery/jquery.d.ts'", + "Resolving real path for '/node_modules/@types/jquery/jquery.d.ts', result '/node_modules/@types/jquery/jquery.d.ts'.", "======== Type reference directive 'jquery' was successfully resolved to '/node_modules/@types/jquery/jquery.d.ts', primary: true. ========", "======== Resolving type reference directive 'kquery', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========", - "Resolving with primary search path '/node_modules/@types'", + "Resolving with primary search path '/node_modules/@types'.", "Found 'package.json' at '/node_modules/@types/kquery/package.json'.", "'package.json' has 'typings' field 'kquery' that references '/node_modules/@types/kquery/kquery'.", "File '/node_modules/@types/kquery/kquery' does not exist.", @@ -75,19 +75,19 @@ "File '/node_modules/@types/kquery/kquery.ts' does not exist.", "File '/node_modules/@types/kquery/kquery.tsx' does not exist.", "File '/node_modules/@types/kquery/kquery.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/kquery/kquery.d.ts', result '/node_modules/@types/kquery/kquery.d.ts'", + "Resolving real path for '/node_modules/@types/kquery/kquery.d.ts', result '/node_modules/@types/kquery/kquery.d.ts'.", "======== Type reference directive 'kquery' was successfully resolved to '/node_modules/@types/kquery/kquery.d.ts', primary: true. ========", "======== Resolving type reference directive 'lquery', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========", - "Resolving with primary search path '/node_modules/@types'", + "Resolving with primary search path '/node_modules/@types'.", "Found 'package.json' at '/node_modules/@types/lquery/package.json'.", "'package.json' has 'typings' field 'lquery' that references '/node_modules/@types/lquery/lquery'.", "File '/node_modules/@types/lquery/lquery' does not exist.", "Loading module as file / folder, candidate module location '/node_modules/@types/lquery/lquery', target file type 'TypeScript'.", "File '/node_modules/@types/lquery/lquery.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/lquery/lquery.ts', result '/node_modules/@types/lquery/lquery.ts'", + "Resolving real path for '/node_modules/@types/lquery/lquery.ts', result '/node_modules/@types/lquery/lquery.ts'.", "======== Type reference directive 'lquery' was successfully resolved to '/node_modules/@types/lquery/lquery.ts', primary: true. ========", "======== Resolving type reference directive 'mquery', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========", - "Resolving with primary search path '/node_modules/@types'", + "Resolving with primary search path '/node_modules/@types'.", "Found 'package.json' at '/node_modules/@types/mquery/package.json'.", "'package.json' has 'typings' field 'mquery' that references '/node_modules/@types/mquery/mquery'.", "File '/node_modules/@types/mquery/mquery' does not exist.", @@ -97,6 +97,6 @@ "File '/node_modules/@types/mquery/mquery.d.ts' does not exist.", "File '/node_modules/@types/mquery/mquery/index.ts' does not exist.", "File '/node_modules/@types/mquery/mquery/index.tsx' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/mquery/mquery/index.tsx', result '/node_modules/@types/mquery/mquery/index.tsx'", + "Resolving real path for '/node_modules/@types/mquery/mquery/index.tsx', result '/node_modules/@types/mquery/mquery/index.tsx'.", "======== Type reference directive 'mquery' was successfully resolved to '/node_modules/@types/mquery/mquery/index.tsx', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typingsLookupAmd.trace.json b/tests/baselines/reference/typingsLookupAmd.trace.json index 49abda2815d..ca64cf8fdf4 100644 --- a/tests/baselines/reference/typingsLookupAmd.trace.json +++ b/tests/baselines/reference/typingsLookupAmd.trace.json @@ -40,9 +40,9 @@ "File '/node_modules/@types/a/index.d.ts' exist - use it as a name resolution result.", "======== Module name 'a' was successfully resolved to '/node_modules/@types/a/index.d.ts'. ========", "======== Resolving type reference directive 'a', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========", - "Resolving with primary search path '/node_modules/@types'", + "Resolving with primary search path '/node_modules/@types'.", "File '/node_modules/@types/a/package.json' does not exist.", "File '/node_modules/@types/a/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for '/node_modules/@types/a/index.d.ts', result '/node_modules/@types/a/index.d.ts'", + "Resolving real path for '/node_modules/@types/a/index.d.ts', result '/node_modules/@types/a/index.d.ts'.", "======== Type reference directive 'a' was successfully resolved to '/node_modules/@types/a/index.d.ts', primary: true. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/underscoreTest1.js b/tests/baselines/reference/underscoreTest1.js index 687a210e670..63e4c16ea1e 100644 --- a/tests/baselines/reference/underscoreTest1.js +++ b/tests/baselines/reference/underscoreTest1.js @@ -5,7 +5,7 @@ interface Dictionary { [x: string]: T; } -interface Iterator { +interface Iterator_ { (value: T, index: any, list: any): U; } @@ -81,10 +81,10 @@ module Underscore { } export interface WrappedArray extends WrappedObject> { - each(iterator: Iterator, context?: any): void; - forEach(iterator: Iterator, context?: any): void; - map(iterator: Iterator, context?: any): U[]; - collect(iterator: Iterator, context?: any): U[]; + each(iterator: Iterator_, context?: any): void; + forEach(iterator: Iterator_, context?: any): void; + map(iterator: Iterator_, context?: any): U[]; + collect(iterator: Iterator_, context?: any): U[]; reduce(iterator: Reducer, initialValue?: T, context?: any): T; reduce(iterator: Reducer, initialValue: U, context?: any): U; foldl(iterator: Reducer, initialValue?: T, context?: any): T; @@ -95,28 +95,28 @@ module Underscore { reduceRight(iterator: Reducer, initialValue: U, context?: any): U; foldr(iterator: Reducer, initialValue?: T, context?: any): T; foldr(iterator: Reducer, initialValue: U, context?: any): U; - find(iterator: Iterator, context?: any): T; - detect(iterator: Iterator, context?: any): T; - filter(iterator: Iterator, context?: any): T[]; - select(iterator: Iterator, context?: any): T[]; + find(iterator: Iterator_, context?: any): T; + detect(iterator: Iterator_, context?: any): T; + filter(iterator: Iterator_, context?: any): T[]; + select(iterator: Iterator_, context?: any): T[]; where(properties: Object): T[]; findWhere(properties: Object): T; - reject(iterator: Iterator, context?: any): T[]; - every(iterator?: Iterator, context?: any): boolean; - all(iterator?: Iterator, context?: any): boolean; - some(iterator?: Iterator, context?: any): boolean; - any(iterator?: Iterator, context?: any): boolean; + reject(iterator: Iterator_, context?: any): T[]; + every(iterator?: Iterator_, context?: any): boolean; + all(iterator?: Iterator_, context?: any): boolean; + some(iterator?: Iterator_, context?: any): boolean; + any(iterator?: Iterator_, context?: any): boolean; contains(value: T): boolean; include(value: T): boolean; invoke(methodName: string, ...args: any[]): any[]; pluck(propertyName: string): any[]; - max(iterator?: Iterator, context?: any): T; - min(iterator?: Iterator, context?: any): T; - sortBy(iterator: Iterator, context?: any): T[]; + max(iterator?: Iterator_, context?: any): T; + min(iterator?: Iterator_, context?: any): T; + sortBy(iterator: Iterator_, context?: any): T[]; sortBy(propertyName: string): T[]; - groupBy(iterator?: Iterator, context?: any): Dictionary; + groupBy(iterator?: Iterator_, context?: any): Dictionary; groupBy(propertyName: string): Dictionary; - countBy(iterator?: Iterator, context?: any): Dictionary; + countBy(iterator?: Iterator_, context?: any): Dictionary; countBy(propertyName: string): Dictionary; shuffle(): T[]; toArray(): T[]; @@ -139,16 +139,16 @@ module Underscore { intersection(...arrays: T[][]): T[]; difference(...others: T[][]): T[]; uniq(isSorted?: boolean): T[]; - uniq(isSorted: boolean, iterator: Iterator, context?: any): U[]; + uniq(isSorted: boolean, iterator: Iterator_, context?: any): U[]; unique(isSorted?: boolean): T[]; - unique(isSorted: boolean, iterator: Iterator, context?: any): U[]; + unique(isSorted: boolean, iterator: Iterator_, context?: any): U[]; zip(...arrays: any[][]): any[][]; object(): any; object(values: any[]): any; indexOf(value: T, isSorted?: boolean): number; lastIndexOf(value: T, fromIndex?: number): number; sortedIndex(obj: T, propertyName: string): number; - sortedIndex(obj: T, iterator?: Iterator, context?: any): number; + sortedIndex(obj: T, iterator?: Iterator_, context?: any): number; // Methods from Array concat(...items: T[]): T[]; join(separator?: string): string; @@ -164,10 +164,10 @@ module Underscore { } export interface WrappedDictionary extends WrappedObject> { - each(iterator: Iterator, context?: any): void; - forEach(iterator: Iterator, context?: any): void; - map(iterator: Iterator, context?: any): U[]; - collect(iterator: Iterator, context?: any): U[]; + each(iterator: Iterator_, context?: any): void; + forEach(iterator: Iterator_, context?: any): void; + map(iterator: Iterator_, context?: any): U[]; + collect(iterator: Iterator_, context?: any): U[]; reduce(iterator: Reducer, initialValue?: T, context?: any): T; reduce(iterator: Reducer, initialValue: U, context?: any): U; foldl(iterator: Reducer, initialValue?: T, context?: any): T; @@ -178,28 +178,28 @@ module Underscore { reduceRight(iterator: Reducer, initialValue: U, context?: any): U; foldr(iterator: Reducer, initialValue?: T, context?: any): T; foldr(iterator: Reducer, initialValue: U, context?: any): U; - find(iterator: Iterator, context?: any): T; - detect(iterator: Iterator, context?: any): T; - filter(iterator: Iterator, context?: any): T[]; - select(iterator: Iterator, context?: any): T[]; + find(iterator: Iterator_, context?: any): T; + detect(iterator: Iterator_, context?: any): T; + filter(iterator: Iterator_, context?: any): T[]; + select(iterator: Iterator_, context?: any): T[]; where(properties: Object): T[]; findWhere(properties: Object): T; - reject(iterator: Iterator, context?: any): T[]; - every(iterator?: Iterator, context?: any): boolean; - all(iterator?: Iterator, context?: any): boolean; - some(iterator?: Iterator, context?: any): boolean; - any(iterator?: Iterator, context?: any): boolean; + reject(iterator: Iterator_, context?: any): T[]; + every(iterator?: Iterator_, context?: any): boolean; + all(iterator?: Iterator_, context?: any): boolean; + some(iterator?: Iterator_, context?: any): boolean; + any(iterator?: Iterator_, context?: any): boolean; contains(value: T): boolean; include(value: T): boolean; invoke(methodName: string, ...args: any[]): any[]; pluck(propertyName: string): any[]; - max(iterator?: Iterator, context?: any): T; - min(iterator?: Iterator, context?: any): T; - sortBy(iterator: Iterator, context?: any): T[]; + max(iterator?: Iterator_, context?: any): T; + min(iterator?: Iterator_, context?: any): T; + sortBy(iterator: Iterator_, context?: any): T[]; sortBy(propertyName: string): T[]; - groupBy(iterator?: Iterator, context?: any): Dictionary; + groupBy(iterator?: Iterator_, context?: any): Dictionary; groupBy(propertyName: string): Dictionary; - countBy(iterator?: Iterator, context?: any): Dictionary; + countBy(iterator?: Iterator_, context?: any): Dictionary; countBy(propertyName: string): Dictionary; shuffle(): T[]; toArray(): T[]; @@ -240,10 +240,10 @@ module Underscore { } export interface ChainedArray extends ChainedObject> { - each(iterator: Iterator, context?: any): ChainedObject; - forEach(iterator: Iterator, context?: any): ChainedObject; - map(iterator: Iterator, context?: any): ChainedArray; - collect(iterator: Iterator, context?: any): ChainedArray; + each(iterator: Iterator_, context?: any): ChainedObject; + forEach(iterator: Iterator_, context?: any): ChainedObject; + map(iterator: Iterator_, context?: any): ChainedArray; + collect(iterator: Iterator_, context?: any): ChainedArray; reduce(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; reduce(iterator: Reducer, initialValue: U, context?: any): ChainedObject; foldl(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; @@ -254,29 +254,29 @@ module Underscore { reduceRight(iterator: Reducer, initialValue: U, context?: any): ChainedObject; foldr(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; foldr(iterator: Reducer, initialValue: U, context?: any): ChainedObject; - find(iterator: Iterator, context?: any): ChainedObject; - detect(iterator: Iterator, context?: any): ChainedObject; - filter(iterator: Iterator, context?: any): ChainedArray; - select(iterator: Iterator, context?: any): ChainedArray; + find(iterator: Iterator_, context?: any): ChainedObject; + detect(iterator: Iterator_, context?: any): ChainedObject; + filter(iterator: Iterator_, context?: any): ChainedArray; + select(iterator: Iterator_, context?: any): ChainedArray; where(properties: Object): ChainedArray; findWhere(properties: Object): ChainedObject; - reject(iterator: Iterator, context?: any): ChainedArray; - every(iterator?: Iterator, context?: any): ChainedObject; - all(iterator?: Iterator, context?: any): ChainedObject; - some(iterator?: Iterator, context?: any): ChainedObject; - any(iterator?: Iterator, context?: any): ChainedObject; + reject(iterator: Iterator_, context?: any): ChainedArray; + every(iterator?: Iterator_, context?: any): ChainedObject; + all(iterator?: Iterator_, context?: any): ChainedObject; + some(iterator?: Iterator_, context?: any): ChainedObject; + any(iterator?: Iterator_, context?: any): ChainedObject; contains(value: T): ChainedObject; include(value: T): ChainedObject; invoke(methodName: string, ...args: any[]): ChainedArray; pluck(propertyName: string): ChainedArray; - max(iterator?: Iterator, context?: any): ChainedObject; - min(iterator?: Iterator, context?: any): ChainedObject; - sortBy(iterator: Iterator, context?: any): ChainedArray; + max(iterator?: Iterator_, context?: any): ChainedObject; + min(iterator?: Iterator_, context?: any): ChainedObject; + sortBy(iterator: Iterator_, context?: any): ChainedArray; sortBy(propertyName: string): ChainedArray; // Should return ChainedDictionary, but expansive recursion not allowed - groupBy(iterator?: Iterator, context?: any): ChainedDictionary; + groupBy(iterator?: Iterator_, context?: any): ChainedDictionary; groupBy(propertyName: string): ChainedDictionary; - countBy(iterator?: Iterator, context?: any): ChainedDictionary; + countBy(iterator?: Iterator_, context?: any): ChainedDictionary; countBy(propertyName: string): ChainedDictionary; shuffle(): ChainedArray; toArray(): ChainedArray; @@ -299,16 +299,16 @@ module Underscore { intersection(...arrays: T[][]): ChainedArray; difference(...others: T[][]): ChainedArray; uniq(isSorted?: boolean): ChainedArray; - uniq(isSorted: boolean, iterator: Iterator, context?: any): ChainedArray; + uniq(isSorted: boolean, iterator: Iterator_, context?: any): ChainedArray; unique(isSorted?: boolean): ChainedArray; - unique(isSorted: boolean, iterator: Iterator, context?: any): ChainedArray; + unique(isSorted: boolean, iterator: Iterator_, context?: any): ChainedArray; zip(...arrays: any[][]): ChainedArray; object(): ChainedObject; object(values: any[]): ChainedObject; indexOf(value: T, isSorted?: boolean): ChainedObject; lastIndexOf(value: T, fromIndex?: number): ChainedObject; sortedIndex(obj: T, propertyName: string): ChainedObject; - sortedIndex(obj: T, iterator?: Iterator, context?: any): ChainedObject; + sortedIndex(obj: T, iterator?: Iterator_, context?: any): ChainedObject; // Methods from Array concat(...items: T[]): ChainedArray; join(separator?: string): ChainedObject; @@ -331,10 +331,10 @@ module Underscore { } export interface ChainedDictionary extends ChainedObject> { - each(iterator: Iterator, context?: any): ChainedObject; - forEach(iterator: Iterator, context?: any): ChainedObject; - map(iterator: Iterator, context?: any): ChainedArray; - collect(iterator: Iterator, context?: any): ChainedArray; + each(iterator: Iterator_, context?: any): ChainedObject; + forEach(iterator: Iterator_, context?: any): ChainedObject; + map(iterator: Iterator_, context?: any): ChainedArray; + collect(iterator: Iterator_, context?: any): ChainedArray; reduce(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; reduce(iterator: Reducer, initialValue: U, context?: any): ChainedObject; foldl(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; @@ -345,29 +345,29 @@ module Underscore { reduceRight(iterator: Reducer, initialValue: U, context?: any): ChainedObject; foldr(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; foldr(iterator: Reducer, initialValue: U, context?: any): ChainedObject; - find(iterator: Iterator, context?: any): ChainedObject; - detect(iterator: Iterator, context?: any): ChainedObject; - filter(iterator: Iterator, context?: any): ChainedArray; - select(iterator: Iterator, context?: any): ChainedArray; + find(iterator: Iterator_, context?: any): ChainedObject; + detect(iterator: Iterator_, context?: any): ChainedObject; + filter(iterator: Iterator_, context?: any): ChainedArray; + select(iterator: Iterator_, context?: any): ChainedArray; where(properties: Object): ChainedArray; findWhere(properties: Object): ChainedObject; - reject(iterator: Iterator, context?: any): ChainedArray; - every(iterator?: Iterator, context?: any): ChainedObject; - all(iterator?: Iterator, context?: any): ChainedObject; - some(iterator?: Iterator, context?: any): ChainedObject; - any(iterator?: Iterator, context?: any): ChainedObject; + reject(iterator: Iterator_, context?: any): ChainedArray; + every(iterator?: Iterator_, context?: any): ChainedObject; + all(iterator?: Iterator_, context?: any): ChainedObject; + some(iterator?: Iterator_, context?: any): ChainedObject; + any(iterator?: Iterator_, context?: any): ChainedObject; contains(value: T): ChainedObject; include(value: T): ChainedObject; invoke(methodName: string, ...args: any[]): ChainedArray; pluck(propertyName: string): ChainedArray; - max(iterator?: Iterator, context?: any): ChainedObject; - min(iterator?: Iterator, context?: any): ChainedObject; - sortBy(iterator: Iterator, context?: any): ChainedArray; + max(iterator?: Iterator_, context?: any): ChainedObject; + min(iterator?: Iterator_, context?: any): ChainedObject; + sortBy(iterator: Iterator_, context?: any): ChainedArray; sortBy(propertyName: string): ChainedArray; // Should return ChainedDictionary, but expansive recursion not allowed - groupBy(iterator?: Iterator, context?: any): ChainedDictionary; + groupBy(iterator?: Iterator_, context?: any): ChainedDictionary; groupBy(propertyName: string): ChainedDictionary; - countBy(iterator?: Iterator, context?: any): ChainedDictionary; + countBy(iterator?: Iterator_, context?: any): ChainedDictionary; countBy(propertyName: string): ChainedDictionary; shuffle(): ChainedArray; toArray(): ChainedArray; @@ -398,15 +398,15 @@ module Underscore { chain(list: Dictionary): ChainedDictionary; chain(obj: T): ChainedObject; - each(list: T[], iterator: Iterator, context?: any): void; - each(list: Dictionary, iterator: Iterator, context?: any): void; - forEach(list: T[], iterator: Iterator, context?: any): void; - forEach(list: Dictionary, iterator: Iterator, context?: any): void; + each(list: T[], iterator: Iterator_, context?: any): void; + each(list: Dictionary, iterator: Iterator_, context?: any): void; + forEach(list: T[], iterator: Iterator_, context?: any): void; + forEach(list: Dictionary, iterator: Iterator_, context?: any): void; - map(list: T[], iterator: Iterator, context?: any): U[]; - map(list: Dictionary, iterator: Iterator, context?: any): U[]; - collect(list: T[], iterator: Iterator, context?: any): U[]; - collect(list: Dictionary, iterator: Iterator, context?: any): U[]; + map(list: T[], iterator: Iterator_, context?: any): U[]; + map(list: Dictionary, iterator: Iterator_, context?: any): U[]; + collect(list: T[], iterator: Iterator_, context?: any): U[]; + collect(list: Dictionary, iterator: Iterator_, context?: any): U[]; reduce(list: T[], iterator: Reducer, initialValue?: T, context?: any): T; reduce(list: T[], iterator: Reducer, initialValue: U, context?: any): U; @@ -430,15 +430,15 @@ module Underscore { foldr(list: Dictionary, iterator: Reducer, initialValue?: T, context?: any): T; foldr(list: Dictionary, iterator: Reducer, initialValue: U, context?: any): U; - find(list: T[], iterator: Iterator, context?: any): T; - find(list: Dictionary, iterator: Iterator, context?: any): T; - detect(list: T[], iterator: Iterator, context?: any): T; - detect(list: Dictionary, iterator: Iterator, context?: any): T; + find(list: T[], iterator: Iterator_, context?: any): T; + find(list: Dictionary, iterator: Iterator_, context?: any): T; + detect(list: T[], iterator: Iterator_, context?: any): T; + detect(list: Dictionary, iterator: Iterator_, context?: any): T; - filter(list: T[], iterator: Iterator, context?: any): T[]; - filter(list: Dictionary, iterator: Iterator, context?: any): T[]; - select(list: T[], iterator: Iterator, context?: any): T[]; - select(list: Dictionary, iterator: Iterator, context?: any): T[]; + filter(list: T[], iterator: Iterator_, context?: any): T[]; + filter(list: Dictionary, iterator: Iterator_, context?: any): T[]; + select(list: T[], iterator: Iterator_, context?: any): T[]; + select(list: Dictionary, iterator: Iterator_, context?: any): T[]; where(list: T[], properties: Object): T[]; where(list: Dictionary, properties: Object): T[]; @@ -446,18 +446,18 @@ module Underscore { findWhere(list: T[], properties: Object): T; findWhere(list: Dictionary, properties: Object): T; - reject(list: T[], iterator: Iterator, context?: any): T[]; - reject(list: Dictionary, iterator: Iterator, context?: any): T[]; + reject(list: T[], iterator: Iterator_, context?: any): T[]; + reject(list: Dictionary, iterator: Iterator_, context?: any): T[]; - every(list: T[], iterator?: Iterator, context?: any): boolean; - every(list: Dictionary, iterator?: Iterator, context?: any): boolean; - all(list: T[], iterator?: Iterator, context?: any): boolean; - all(list: Dictionary, iterator?: Iterator, context?: any): boolean; + every(list: T[], iterator?: Iterator_, context?: any): boolean; + every(list: Dictionary, iterator?: Iterator_, context?: any): boolean; + all(list: T[], iterator?: Iterator_, context?: any): boolean; + all(list: Dictionary, iterator?: Iterator_, context?: any): boolean; - some(list: T[], iterator?: Iterator, context?: any): boolean; - some(list: Dictionary, iterator?: Iterator, context?: any): boolean; - any(list: T[], iterator?: Iterator, context?: any): boolean; - any(list: Dictionary, iterator?: Iterator, context?: any): boolean; + some(list: T[], iterator?: Iterator_, context?: any): boolean; + some(list: Dictionary, iterator?: Iterator_, context?: any): boolean; + any(list: T[], iterator?: Iterator_, context?: any): boolean; + any(list: Dictionary, iterator?: Iterator_, context?: any): boolean; contains(list: T[], value: T): boolean; contains(list: Dictionary, value: T): boolean; @@ -470,24 +470,24 @@ module Underscore { pluck(list: any[], propertyName: string): any[]; pluck(list: Dictionary, propertyName: string): any[]; - max(list: T[], iterator?: Iterator, context?: any): T; - max(list: Dictionary, iterator?: Iterator, context?: any): T; + max(list: T[], iterator?: Iterator_, context?: any): T; + max(list: Dictionary, iterator?: Iterator_, context?: any): T; - min(list: T[], iterator?: Iterator, context?: any): T; - min(list: Dictionary, iterator?: Iterator, context?: any): T; + min(list: T[], iterator?: Iterator_, context?: any): T; + min(list: Dictionary, iterator?: Iterator_, context?: any): T; - sortBy(list: T[], iterator: Iterator, context?: any): T[]; - sortBy(list: Dictionary, iterator: Iterator, context?: any): T[]; + sortBy(list: T[], iterator: Iterator_, context?: any): T[]; + sortBy(list: Dictionary, iterator: Iterator_, context?: any): T[]; sortBy(list: T[], propertyName: string): T[]; sortBy(list: Dictionary, propertyName: string): T[]; - groupBy(list: T[], iterator?: Iterator, context?: any): Dictionary; - groupBy(list: Dictionary, iterator?: Iterator, context?: any): Dictionary; + groupBy(list: T[], iterator?: Iterator_, context?: any): Dictionary; + groupBy(list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; groupBy(list: T[], propertyName: string): Dictionary; groupBy(list: Dictionary, propertyName: string): Dictionary; - countBy(list: T[], iterator?: Iterator, context?: any): Dictionary; - countBy(list: Dictionary, iterator?: Iterator, context?: any): Dictionary; + countBy(list: T[], iterator?: Iterator_, context?: any): Dictionary; + countBy(list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; countBy(list: T[], propertyName: string): Dictionary; countBy(list: Dictionary, propertyName: string): Dictionary; @@ -529,9 +529,9 @@ module Underscore { difference(list: T[], ...others: T[][]): T[]; uniq(list: T[], isSorted?: boolean): T[]; - uniq(list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; + uniq(list: T[], isSorted: boolean, iterator: Iterator_, context?: any): U[]; unique(list: T[], isSorted?: boolean): T[]; - unique(list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; + unique(list: T[], isSorted: boolean, iterator: Iterator_, context?: any): U[]; zip(a0: T0[], a1: T1[]): Tuple2[]; zip(a0: T0[], a1: T1[], a2: T2[]): Tuple3[]; @@ -546,7 +546,7 @@ module Underscore { lastIndexOf(list: T[], value: T, fromIndex?: number): number; sortedIndex(list: T[], obj: T, propertyName: string): number; - sortedIndex(list: T[], obj: T, iterator?: Iterator, context?: any): number; + sortedIndex(list: T[], obj: T, iterator?: Iterator_, context?: any): number; range(stop: number): number[]; range(start: number, stop: number, step?: number): number[]; @@ -623,7 +623,7 @@ module Underscore { identity(value: T): T; - times(n: number, iterator: Iterator, context?: any): U[]; + times(n: number, iterator: Iterator_, context?: any): U[]; random(max: number): number; random(min: number, max: number): number; diff --git a/tests/baselines/reference/underscoreTest1.symbols b/tests/baselines/reference/underscoreTest1.symbols index 89815bd2371..41b0c811027 100644 --- a/tests/baselines/reference/underscoreTest1.symbols +++ b/tests/baselines/reference/underscoreTest1.symbols @@ -9,9 +9,9 @@ declare function alert(x: string): void; >x : Symbol(x, Decl(underscoreTest1_underscoreTests.ts, 3, 23)) _.each([1, 2, 3], (num) => alert(num.toString())); ->_.each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) +>_.each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 78)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) +>each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 78)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 5, 19)) >alert : Symbol(alert, Decl(underscoreTest1_underscoreTests.ts, 2, 14)) >num.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) @@ -19,9 +19,9 @@ _.each([1, 2, 3], (num) => alert(num.toString())); >toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) _.each({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => alert(value.toString())); ->_.each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) +>_.each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 78)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) +>each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 78)) >one : Symbol(one, Decl(underscoreTest1_underscoreTests.ts, 6, 8)) >two : Symbol(two, Decl(underscoreTest1_underscoreTests.ts, 6, 16)) >three : Symbol(three, Decl(underscoreTest1_underscoreTests.ts, 6, 24)) @@ -33,16 +33,16 @@ _.each({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => alert(valu >toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) _.map([1, 2, 3], (num) => num * 3); ->_.map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 400, 90), Decl(underscoreTest1_underscore.ts, 402, 75)) +>_.map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 400, 91), Decl(underscoreTest1_underscore.ts, 402, 76)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 400, 90), Decl(underscoreTest1_underscore.ts, 402, 75)) +>map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 400, 91), Decl(underscoreTest1_underscore.ts, 402, 76)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 8, 18)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 8, 18)) _.map({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => value * 3); ->_.map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 400, 90), Decl(underscoreTest1_underscore.ts, 402, 75)) +>_.map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 400, 91), Decl(underscoreTest1_underscore.ts, 402, 76)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 400, 90), Decl(underscoreTest1_underscore.ts, 402, 75)) +>map : Symbol(Underscore.Static.map, Decl(underscoreTest1_underscore.ts, 400, 91), Decl(underscoreTest1_underscore.ts, 402, 76)) >one : Symbol(one, Decl(underscoreTest1_underscoreTests.ts, 9, 7)) >two : Symbol(two, Decl(underscoreTest1_underscoreTests.ts, 9, 15)) >three : Symbol(three, Decl(underscoreTest1_underscoreTests.ts, 9, 23)) @@ -52,9 +52,9 @@ _.map({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => value * 3); var sum = _.reduce([1, 2, 3], (memo, num) => memo + num, 0); >sum : Symbol(sum, Decl(underscoreTest1_underscoreTests.ts, 11, 3)) ->_.reduce : Symbol(Underscore.Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) +>_.reduce : Symbol(Underscore.Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 90), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->reduce : Symbol(Underscore.Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) +>reduce : Symbol(Underscore.Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 90), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) >memo : Symbol(memo, Decl(underscoreTest1_underscoreTests.ts, 11, 31)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 11, 36)) >memo : Symbol(memo, Decl(underscoreTest1_underscoreTests.ts, 11, 31)) @@ -78,17 +78,17 @@ var flat = _.reduceRight(list, (a, b) => a.concat(b), []); var even = _.find([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); >even : Symbol(even, Decl(underscoreTest1_underscoreTests.ts, 16, 3)) ->_.find : Symbol(Underscore.Static.find, Decl(underscoreTest1_underscore.ts, 427, 101), Decl(underscoreTest1_underscore.ts, 429, 77)) +>_.find : Symbol(Underscore.Static.find, Decl(underscoreTest1_underscore.ts, 427, 101), Decl(underscoreTest1_underscore.ts, 429, 78)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->find : Symbol(Underscore.Static.find, Decl(underscoreTest1_underscore.ts, 427, 101), Decl(underscoreTest1_underscore.ts, 429, 77)) +>find : Symbol(Underscore.Static.find, Decl(underscoreTest1_underscore.ts, 427, 101), Decl(underscoreTest1_underscore.ts, 429, 78)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 16, 39)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 16, 39)) var evens = _.filter([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); >evens : Symbol(evens, Decl(underscoreTest1_underscoreTests.ts, 18, 3)) ->_.filter : Symbol(Underscore.Static.filter, Decl(underscoreTest1_underscore.ts, 432, 89), Decl(underscoreTest1_underscore.ts, 434, 81)) +>_.filter : Symbol(Underscore.Static.filter, Decl(underscoreTest1_underscore.ts, 432, 90), Decl(underscoreTest1_underscore.ts, 434, 82)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->filter : Symbol(Underscore.Static.filter, Decl(underscoreTest1_underscore.ts, 432, 89), Decl(underscoreTest1_underscore.ts, 434, 81)) +>filter : Symbol(Underscore.Static.filter, Decl(underscoreTest1_underscore.ts, 432, 90), Decl(underscoreTest1_underscore.ts, 434, 82)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 18, 42)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 18, 42)) @@ -105,38 +105,38 @@ var listOfPlays = [{ title: "Cymbeline", author: "Shakespeare", year: 1611 }, { >year : Symbol(year, Decl(underscoreTest1_underscoreTests.ts, 20, 183)) _.where(listOfPlays, { author: "Shakespeare", year: 1611 }); ->_.where : Symbol(Underscore.Static.where, Decl(underscoreTest1_underscore.ts, 437, 91), Decl(underscoreTest1_underscore.ts, 439, 53)) +>_.where : Symbol(Underscore.Static.where, Decl(underscoreTest1_underscore.ts, 437, 92), Decl(underscoreTest1_underscore.ts, 439, 53)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->where : Symbol(Underscore.Static.where, Decl(underscoreTest1_underscore.ts, 437, 91), Decl(underscoreTest1_underscore.ts, 439, 53)) +>where : Symbol(Underscore.Static.where, Decl(underscoreTest1_underscore.ts, 437, 92), Decl(underscoreTest1_underscore.ts, 439, 53)) >listOfPlays : Symbol(listOfPlays, Decl(underscoreTest1_underscoreTests.ts, 20, 3)) >author : Symbol(author, Decl(underscoreTest1_underscoreTests.ts, 21, 22)) >year : Symbol(year, Decl(underscoreTest1_underscoreTests.ts, 21, 45)) var odds = _.reject([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); >odds : Symbol(odds, Decl(underscoreTest1_underscoreTests.ts, 23, 3)) ->_.reject : Symbol(Underscore.Static.reject, Decl(underscoreTest1_underscore.ts, 443, 65), Decl(underscoreTest1_underscore.ts, 445, 81)) +>_.reject : Symbol(Underscore.Static.reject, Decl(underscoreTest1_underscore.ts, 443, 65), Decl(underscoreTest1_underscore.ts, 445, 82)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->reject : Symbol(Underscore.Static.reject, Decl(underscoreTest1_underscore.ts, 443, 65), Decl(underscoreTest1_underscore.ts, 445, 81)) +>reject : Symbol(Underscore.Static.reject, Decl(underscoreTest1_underscore.ts, 443, 65), Decl(underscoreTest1_underscore.ts, 445, 82)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 23, 41)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 23, 41)) _.all([true, 1, null, 'yes'], _.identity); ->_.all : Symbol(Underscore.Static.all, Decl(underscoreTest1_underscore.ts, 449, 95), Decl(underscoreTest1_underscore.ts, 450, 83)) +>_.all : Symbol(Underscore.Static.all, Decl(underscoreTest1_underscore.ts, 449, 96), Decl(underscoreTest1_underscore.ts, 450, 84)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->all : Symbol(Underscore.Static.all, Decl(underscoreTest1_underscore.ts, 449, 95), Decl(underscoreTest1_underscore.ts, 450, 83)) +>all : Symbol(Underscore.Static.all, Decl(underscoreTest1_underscore.ts, 449, 96), Decl(underscoreTest1_underscore.ts, 450, 84)) >_.identity : Symbol(Underscore.Static.identity, Decl(underscoreTest1_underscore.ts, 618, 29)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) >identity : Symbol(Underscore.Static.identity, Decl(underscoreTest1_underscore.ts, 618, 29)) _.any([null, 0, 'yes', false]); ->_.any : Symbol(Underscore.Static.any, Decl(underscoreTest1_underscore.ts, 454, 94), Decl(underscoreTest1_underscore.ts, 455, 83)) +>_.any : Symbol(Underscore.Static.any, Decl(underscoreTest1_underscore.ts, 454, 95), Decl(underscoreTest1_underscore.ts, 455, 84)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->any : Symbol(Underscore.Static.any, Decl(underscoreTest1_underscore.ts, 454, 94), Decl(underscoreTest1_underscore.ts, 455, 83)) +>any : Symbol(Underscore.Static.any, Decl(underscoreTest1_underscore.ts, 454, 95), Decl(underscoreTest1_underscore.ts, 455, 84)) _.contains([1, 2, 3], 3); ->_.contains : Symbol(Underscore.Static.contains, Decl(underscoreTest1_underscore.ts, 456, 93), Decl(underscoreTest1_underscore.ts, 458, 50)) +>_.contains : Symbol(Underscore.Static.contains, Decl(underscoreTest1_underscore.ts, 456, 94), Decl(underscoreTest1_underscore.ts, 458, 50)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->contains : Symbol(Underscore.Static.contains, Decl(underscoreTest1_underscore.ts, 456, 93), Decl(underscoreTest1_underscore.ts, 458, 50)) +>contains : Symbol(Underscore.Static.contains, Decl(underscoreTest1_underscore.ts, 456, 94), Decl(underscoreTest1_underscore.ts, 458, 50)) _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); >_.invoke : Symbol(Underscore.Static.invoke, Decl(underscoreTest1_underscore.ts, 461, 59), Decl(underscoreTest1_underscore.ts, 463, 71)) @@ -159,9 +159,9 @@ _.pluck(stooges, 'name'); >stooges : Symbol(stooges, Decl(underscoreTest1_underscoreTests.ts, 33, 3)) _.max(stooges, (stooge) => stooge.age); ->_.max : Symbol(Underscore.Static.max, Decl(underscoreTest1_underscore.ts, 467, 66), Decl(underscoreTest1_underscore.ts, 469, 73)) +>_.max : Symbol(Underscore.Static.max, Decl(underscoreTest1_underscore.ts, 467, 66), Decl(underscoreTest1_underscore.ts, 469, 74)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->max : Symbol(Underscore.Static.max, Decl(underscoreTest1_underscore.ts, 467, 66), Decl(underscoreTest1_underscore.ts, 469, 73)) +>max : Symbol(Underscore.Static.max, Decl(underscoreTest1_underscore.ts, 467, 66), Decl(underscoreTest1_underscore.ts, 469, 74)) >stooges : Symbol(stooges, Decl(underscoreTest1_underscoreTests.ts, 33, 3)) >stooge : Symbol(stooge, Decl(underscoreTest1_underscoreTests.ts, 36, 16)) >stooge.age : Symbol(age, Decl(underscoreTest1_underscoreTests.ts, 33, 29)) @@ -172,15 +172,15 @@ var numbers = [10, 5, 100, 2, 1000]; >numbers : Symbol(numbers, Decl(underscoreTest1_underscoreTests.ts, 38, 3)) _.min(numbers); ->_.min : Symbol(Underscore.Static.min, Decl(underscoreTest1_underscore.ts, 470, 83), Decl(underscoreTest1_underscore.ts, 472, 73)) +>_.min : Symbol(Underscore.Static.min, Decl(underscoreTest1_underscore.ts, 470, 84), Decl(underscoreTest1_underscore.ts, 472, 74)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->min : Symbol(Underscore.Static.min, Decl(underscoreTest1_underscore.ts, 470, 83), Decl(underscoreTest1_underscore.ts, 472, 73)) +>min : Symbol(Underscore.Static.min, Decl(underscoreTest1_underscore.ts, 470, 84), Decl(underscoreTest1_underscore.ts, 472, 74)) >numbers : Symbol(numbers, Decl(underscoreTest1_underscoreTests.ts, 38, 3)) _.sortBy([1, 2, 3, 4, 5, 6], (num) => Math.sin(num)); ->_.sortBy : Symbol(Underscore.Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) +>_.sortBy : Symbol(Underscore.Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 84), Decl(underscoreTest1_underscore.ts, 475, 78), Decl(underscoreTest1_underscore.ts, 476, 88), Decl(underscoreTest1_underscore.ts, 477, 56)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->sortBy : Symbol(Underscore.Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) +>sortBy : Symbol(Underscore.Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 84), Decl(underscoreTest1_underscore.ts, 475, 78), Decl(underscoreTest1_underscore.ts, 476, 88), Decl(underscoreTest1_underscore.ts, 477, 56)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 41, 30)) >Math.sin : Symbol(Math.sin, Decl(lib.d.ts, --, --)) >Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) @@ -190,9 +190,9 @@ _.sortBy([1, 2, 3, 4, 5, 6], (num) => Math.sin(num)); // not sure how this is typechecking at all.. Math.floor(e) is number not string..? _([1.3, 2.1, 2.4]).groupBy((e: number, i?: number, list?: number[]) => Math.floor(e)); ->_([1.3, 2.1, 2.4]).groupBy : Symbol(Underscore.WrappedArray.groupBy, Decl(underscoreTest1_underscore.ts, 112, 42), Decl(underscoreTest1_underscore.ts, 113, 77)) +>_([1.3, 2.1, 2.4]).groupBy : Symbol(Underscore.WrappedArray.groupBy, Decl(underscoreTest1_underscore.ts, 112, 42), Decl(underscoreTest1_underscore.ts, 113, 78)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->groupBy : Symbol(Underscore.WrappedArray.groupBy, Decl(underscoreTest1_underscore.ts, 112, 42), Decl(underscoreTest1_underscore.ts, 113, 77)) +>groupBy : Symbol(Underscore.WrappedArray.groupBy, Decl(underscoreTest1_underscore.ts, 112, 42), Decl(underscoreTest1_underscore.ts, 113, 78)) >e : Symbol(e, Decl(underscoreTest1_underscoreTests.ts, 45, 28)) >i : Symbol(i, Decl(underscoreTest1_underscoreTests.ts, 45, 38)) >list : Symbol(list, Decl(underscoreTest1_underscoreTests.ts, 45, 50)) @@ -202,9 +202,9 @@ _([1.3, 2.1, 2.4]).groupBy((e: number, i?: number, list?: number[]) => Math.floo >e : Symbol(e, Decl(underscoreTest1_underscoreTests.ts, 45, 28)) _.groupBy([1.3, 2.1, 2.4], (num: number) => Math.floor(num)); ->_.groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) +>_.groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 92), Decl(underscoreTest1_underscore.ts, 481, 102), Decl(underscoreTest1_underscore.ts, 482, 69)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) +>groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 92), Decl(underscoreTest1_underscore.ts, 481, 102), Decl(underscoreTest1_underscore.ts, 482, 69)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 46, 28)) >Math.floor : Symbol(Math.floor, Decl(lib.d.ts, --, --)) >Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) @@ -212,14 +212,14 @@ _.groupBy([1.3, 2.1, 2.4], (num: number) => Math.floor(num)); >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 46, 28)) _.groupBy(['one', 'two', 'three'], 'length'); ->_.groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) +>_.groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 92), Decl(underscoreTest1_underscore.ts, 481, 102), Decl(underscoreTest1_underscore.ts, 482, 69)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) +>groupBy : Symbol(Underscore.Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 92), Decl(underscoreTest1_underscore.ts, 481, 102), Decl(underscoreTest1_underscore.ts, 482, 69)) _.countBy([1, 2, 3, 4, 5], (num) => num % 2 == 0 ? 'even' : 'odd'); ->_.countBy : Symbol(Underscore.Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) +>_.countBy : Symbol(Underscore.Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 95), Decl(underscoreTest1_underscore.ts, 486, 105), Decl(underscoreTest1_underscore.ts, 487, 72)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->countBy : Symbol(Underscore.Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) +>countBy : Symbol(Underscore.Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 95), Decl(underscoreTest1_underscore.ts, 486, 105), Decl(underscoreTest1_underscore.ts, 487, 72)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 49, 28)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 49, 28)) @@ -312,9 +312,9 @@ _.uniq([1, 2, 1, 3, 1, 4]); >uniq : Symbol(Underscore.Static.uniq, Decl(underscoreTest1_underscore.ts, 525, 56), Decl(underscoreTest1_underscore.ts, 527, 52)) _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); ->_.zip : Symbol(Underscore.Static.zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) +>_.zip : Symbol(Underscore.Static.zip, Decl(underscoreTest1_underscore.ts, 530, 98), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->zip : Symbol(Underscore.Static.zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) +>zip : Symbol(Underscore.Static.zip, Decl(underscoreTest1_underscore.ts, 530, 98), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) _.object(['moe', 'larry', 'curly'], [30, 40, 50]); >_.object : Symbol(Underscore.Static.object, Decl(underscoreTest1_underscore.ts, 535, 41), Decl(underscoreTest1_underscore.ts, 537, 35)) @@ -342,29 +342,29 @@ _.sortedIndex([10, 20, 30, 40, 50], 35); >sortedIndex : Symbol(Underscore.Static.sortedIndex, Decl(underscoreTest1_underscore.ts, 542, 72), Decl(underscoreTest1_underscore.ts, 544, 72)) _.range(10); ->_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 95), Decl(underscoreTest1_underscore.ts, 547, 38)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 95), Decl(underscoreTest1_underscore.ts, 547, 38)) _.range(1, 11); ->_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 95), Decl(underscoreTest1_underscore.ts, 547, 38)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 95), Decl(underscoreTest1_underscore.ts, 547, 38)) _.range(0, 30, 5); ->_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 95), Decl(underscoreTest1_underscore.ts, 547, 38)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 95), Decl(underscoreTest1_underscore.ts, 547, 38)) _.range(0, 30, 5); ->_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 95), Decl(underscoreTest1_underscore.ts, 547, 38)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 95), Decl(underscoreTest1_underscore.ts, 547, 38)) _.range(0); ->_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>_.range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 95), Decl(underscoreTest1_underscore.ts, 547, 38)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>range : Symbol(Underscore.Static.range, Decl(underscoreTest1_underscore.ts, 545, 95), Decl(underscoreTest1_underscore.ts, 547, 38)) /////////////////////////////////////////////////////////////////////////////////////// @@ -516,9 +516,9 @@ var renderNotes = _.after(notes.length, render); >render : Symbol(render, Decl(underscoreTest1_underscoreTests.ts, 127, 3)) _.each(notes, (note) => note.asyncSave({ success: renderNotes })); ->_.each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) +>_.each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 78)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) +>each : Symbol(Underscore.Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 78)) >notes : Symbol(notes, Decl(underscoreTest1_underscoreTests.ts, 126, 3)) >note : Symbol(note, Decl(underscoreTest1_underscoreTests.ts, 129, 15)) >note : Symbol(note, Decl(underscoreTest1_underscoreTests.ts, 129, 15)) @@ -648,15 +648,15 @@ _.clone({ name: 'moe' }); _.chain([1, 2, 3, 200]) >_.chain([1, 2, 3, 200]) .filter(function (num) { return num % 2 == 0; }) .tap(alert) .map(function (num) { return num * num }) .value : Symbol(Underscore.ChainedObject.value, Decl(underscoreTest1_underscore.ts, 234, 46)) ->_.chain([1, 2, 3, 200]) .filter(function (num) { return num % 2 == 0; }) .tap(alert) .map : Symbol(Underscore.ChainedArray.map, Decl(underscoreTest1_underscore.ts, 240, 81)) +>_.chain([1, 2, 3, 200]) .filter(function (num) { return num % 2 == 0; }) .tap(alert) .map : Symbol(Underscore.ChainedArray.map, Decl(underscoreTest1_underscore.ts, 240, 82)) >_.chain([1, 2, 3, 200]) .filter(function (num) { return num % 2 == 0; }) .tap : Symbol(Underscore.ChainedArray.tap, Decl(underscoreTest1_underscore.ts, 325, 33)) ->_.chain([1, 2, 3, 200]) .filter : Symbol(Underscore.ChainedArray.filter, Decl(underscoreTest1_underscore.ts, 254, 80)) +>_.chain([1, 2, 3, 200]) .filter : Symbol(Underscore.ChainedArray.filter, Decl(underscoreTest1_underscore.ts, 254, 81)) >_.chain : Symbol(Underscore.Static.chain, Decl(underscoreTest1_underscore.ts, 391, 38), Decl(underscoreTest1_underscore.ts, 393, 45), Decl(underscoreTest1_underscore.ts, 394, 60)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) >chain : Symbol(Underscore.Static.chain, Decl(underscoreTest1_underscore.ts, 391, 38), Decl(underscoreTest1_underscore.ts, 393, 45), Decl(underscoreTest1_underscore.ts, 394, 60)) .filter(function (num) { return num % 2 == 0; }) ->filter : Symbol(Underscore.ChainedArray.filter, Decl(underscoreTest1_underscore.ts, 254, 80)) +>filter : Symbol(Underscore.ChainedArray.filter, Decl(underscoreTest1_underscore.ts, 254, 81)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 157, 22)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 157, 22)) @@ -665,7 +665,7 @@ _.chain([1, 2, 3, 200]) >alert : Symbol(alert, Decl(underscoreTest1_underscoreTests.ts, 2, 14)) .map(function (num) { return num * num }) ->map : Symbol(Underscore.ChainedArray.map, Decl(underscoreTest1_underscore.ts, 240, 81)) +>map : Symbol(Underscore.ChainedArray.map, Decl(underscoreTest1_underscore.ts, 240, 82)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 159, 19)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 159, 19)) >num : Symbol(num, Decl(underscoreTest1_underscoreTests.ts, 159, 19)) @@ -852,9 +852,9 @@ _.times(3, function (n) { genie.grantWishNumber(n); }); >n : Symbol(n, Decl(underscoreTest1_underscoreTests.ts, 218, 21)) _.random(0, 100); ->_.random : Symbol(Underscore.Static.random, Decl(underscoreTest1_underscore.ts, 622, 79), Decl(underscoreTest1_underscore.ts, 624, 36)) +>_.random : Symbol(Underscore.Static.random, Decl(underscoreTest1_underscore.ts, 622, 80), Decl(underscoreTest1_underscore.ts, 624, 36)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) ->random : Symbol(Underscore.Static.random, Decl(underscoreTest1_underscore.ts, 622, 79), Decl(underscoreTest1_underscore.ts, 624, 36)) +>random : Symbol(Underscore.Static.random, Decl(underscoreTest1_underscore.ts, 622, 80), Decl(underscoreTest1_underscore.ts, 624, 36)) _.mixin({ >_.mixin : Symbol(Underscore.Static.mixin, Decl(underscoreTest1_underscore.ts, 625, 49)) @@ -976,17 +976,17 @@ interface Dictionary { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 0, 21)) } -interface Iterator { ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) ->T : Symbol(T, Decl(underscoreTest1_underscore.ts, 4, 19)) ->U : Symbol(U, Decl(underscoreTest1_underscore.ts, 4, 21)) +interface Iterator_ { +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) +>T : Symbol(T, Decl(underscoreTest1_underscore.ts, 4, 20)) +>U : Symbol(U, Decl(underscoreTest1_underscore.ts, 4, 22)) (value: T, index: any, list: any): U; >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 5, 5)) ->T : Symbol(T, Decl(underscoreTest1_underscore.ts, 4, 19)) +>T : Symbol(T, Decl(underscoreTest1_underscore.ts, 4, 20)) >index : Symbol(index, Decl(underscoreTest1_underscore.ts, 5, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 5, 26)) ->U : Symbol(U, Decl(underscoreTest1_underscore.ts, 4, 21)) +>U : Symbol(U, Decl(underscoreTest1_underscore.ts, 4, 22)) } interface Reducer { @@ -1250,42 +1250,42 @@ module Underscore { >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) - each(iterator: Iterator, context?: any): void; + each(iterator: Iterator_, context?: any): void; >each : Symbol(WrappedArray.each, Decl(underscoreTest1_underscore.ts, 79, 70)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 80, 13)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 80, 41)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 80, 42)) - forEach(iterator: Iterator, context?: any): void; ->forEach : Symbol(WrappedArray.forEach, Decl(underscoreTest1_underscore.ts, 80, 63)) + forEach(iterator: Iterator_, context?: any): void; +>forEach : Symbol(WrappedArray.forEach, Decl(underscoreTest1_underscore.ts, 80, 64)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 81, 16)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 81, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 81, 45)) - map(iterator: Iterator, context?: any): U[]; ->map : Symbol(WrappedArray.map, Decl(underscoreTest1_underscore.ts, 81, 66)) + map(iterator: Iterator_, context?: any): U[]; +>map : Symbol(WrappedArray.map, Decl(underscoreTest1_underscore.ts, 81, 67)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 82, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 82, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 82, 12)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 82, 40)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 82, 41)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 82, 12)) - collect(iterator: Iterator, context?: any): U[]; ->collect : Symbol(WrappedArray.collect, Decl(underscoreTest1_underscore.ts, 82, 61)) + collect(iterator: Iterator_, context?: any): U[]; +>collect : Symbol(WrappedArray.collect, Decl(underscoreTest1_underscore.ts, 82, 62)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 83, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 83, 19)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 83, 16)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 83, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 83, 45)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 83, 16)) reduce(iterator: Reducer, initialValue?: T, context?: any): T; ->reduce : Symbol(WrappedArray.reduce, Decl(underscoreTest1_underscore.ts, 83, 65), Decl(underscoreTest1_underscore.ts, 84, 76)) +>reduce : Symbol(WrappedArray.reduce, Decl(underscoreTest1_underscore.ts, 83, 66), Decl(underscoreTest1_underscore.ts, 84, 76)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 84, 15)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1296,7 +1296,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) reduce(iterator: Reducer, initialValue: U, context?: any): U; ->reduce : Symbol(WrappedArray.reduce, Decl(underscoreTest1_underscore.ts, 83, 65), Decl(underscoreTest1_underscore.ts, 84, 76)) +>reduce : Symbol(WrappedArray.reduce, Decl(underscoreTest1_underscore.ts, 83, 66), Decl(underscoreTest1_underscore.ts, 84, 76)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 85, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 85, 18)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -1399,40 +1399,40 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 93, 58)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 93, 14)) - find(iterator: Iterator, context?: any): T; + find(iterator: Iterator_, context?: any): T; >find : Symbol(WrappedArray.find, Decl(underscoreTest1_underscore.ts, 93, 77)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 94, 13)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 94, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 94, 45)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) - detect(iterator: Iterator, context?: any): T; ->detect : Symbol(WrappedArray.detect, Decl(underscoreTest1_underscore.ts, 94, 63)) + detect(iterator: Iterator_, context?: any): T; +>detect : Symbol(WrappedArray.detect, Decl(underscoreTest1_underscore.ts, 94, 64)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 95, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 95, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 95, 47)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) - filter(iterator: Iterator, context?: any): T[]; ->filter : Symbol(WrappedArray.filter, Decl(underscoreTest1_underscore.ts, 95, 65)) + filter(iterator: Iterator_, context?: any): T[]; +>filter : Symbol(WrappedArray.filter, Decl(underscoreTest1_underscore.ts, 95, 66)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 96, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 96, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 96, 47)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) - select(iterator: Iterator, context?: any): T[]; ->select : Symbol(WrappedArray.select, Decl(underscoreTest1_underscore.ts, 96, 67)) + select(iterator: Iterator_, context?: any): T[]; +>select : Symbol(WrappedArray.select, Decl(underscoreTest1_underscore.ts, 96, 68)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 97, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 97, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 97, 47)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) where(properties: Object): T[]; ->where : Symbol(WrappedArray.where, Decl(underscoreTest1_underscore.ts, 97, 67)) +>where : Symbol(WrappedArray.where, Decl(underscoreTest1_underscore.ts, 97, 68)) >properties : Symbol(properties, Decl(underscoreTest1_underscore.ts, 98, 14)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1443,44 +1443,44 @@ module Underscore { >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) - reject(iterator: Iterator, context?: any): T[]; + reject(iterator: Iterator_, context?: any): T[]; >reject : Symbol(WrappedArray.reject, Decl(underscoreTest1_underscore.ts, 99, 41)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 100, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 100, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 100, 47)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) - every(iterator?: Iterator, context?: any): boolean; ->every : Symbol(WrappedArray.every, Decl(underscoreTest1_underscore.ts, 100, 67)) + every(iterator?: Iterator_, context?: any): boolean; +>every : Symbol(WrappedArray.every, Decl(underscoreTest1_underscore.ts, 100, 68)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 101, 14)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 101, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 101, 47)) - all(iterator?: Iterator, context?: any): boolean; ->all : Symbol(WrappedArray.all, Decl(underscoreTest1_underscore.ts, 101, 71)) + all(iterator?: Iterator_, context?: any): boolean; +>all : Symbol(WrappedArray.all, Decl(underscoreTest1_underscore.ts, 101, 72)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 102, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 102, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 102, 45)) - some(iterator?: Iterator, context?: any): boolean; ->some : Symbol(WrappedArray.some, Decl(underscoreTest1_underscore.ts, 102, 69)) + some(iterator?: Iterator_, context?: any): boolean; +>some : Symbol(WrappedArray.some, Decl(underscoreTest1_underscore.ts, 102, 70)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 103, 13)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 103, 45)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 103, 46)) - any(iterator?: Iterator, context?: any): boolean; ->any : Symbol(WrappedArray.any, Decl(underscoreTest1_underscore.ts, 103, 70)) + any(iterator?: Iterator_, context?: any): boolean; +>any : Symbol(WrappedArray.any, Decl(underscoreTest1_underscore.ts, 103, 71)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 104, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 104, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 104, 45)) contains(value: T): boolean; ->contains : Symbol(WrappedArray.contains, Decl(underscoreTest1_underscore.ts, 104, 69)) +>contains : Symbol(WrappedArray.contains, Decl(underscoreTest1_underscore.ts, 104, 70)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 105, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1498,60 +1498,60 @@ module Underscore { >pluck : Symbol(WrappedArray.pluck, Decl(underscoreTest1_underscore.ts, 107, 58)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 108, 14)) - max(iterator?: Iterator, context?: any): T; + max(iterator?: Iterator_, context?: any): T; >max : Symbol(WrappedArray.max, Decl(underscoreTest1_underscore.ts, 108, 43)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 109, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 109, 40)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 109, 41)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) - min(iterator?: Iterator, context?: any): T; ->min : Symbol(WrappedArray.min, Decl(underscoreTest1_underscore.ts, 109, 59)) + min(iterator?: Iterator_, context?: any): T; +>min : Symbol(WrappedArray.min, Decl(underscoreTest1_underscore.ts, 109, 60)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 110, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 110, 40)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 110, 41)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) - sortBy(iterator: Iterator, context?: any): T[]; ->sortBy : Symbol(WrappedArray.sortBy, Decl(underscoreTest1_underscore.ts, 110, 59), Decl(underscoreTest1_underscore.ts, 111, 63)) + sortBy(iterator: Iterator_, context?: any): T[]; +>sortBy : Symbol(WrappedArray.sortBy, Decl(underscoreTest1_underscore.ts, 110, 60), Decl(underscoreTest1_underscore.ts, 111, 64)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 111, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 111, 42)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 111, 43)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) sortBy(propertyName: string): T[]; ->sortBy : Symbol(WrappedArray.sortBy, Decl(underscoreTest1_underscore.ts, 110, 59), Decl(underscoreTest1_underscore.ts, 111, 63)) +>sortBy : Symbol(WrappedArray.sortBy, Decl(underscoreTest1_underscore.ts, 110, 60), Decl(underscoreTest1_underscore.ts, 111, 64)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 112, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) - groupBy(iterator?: Iterator, context?: any): Dictionary; ->groupBy : Symbol(WrappedArray.groupBy, Decl(underscoreTest1_underscore.ts, 112, 42), Decl(underscoreTest1_underscore.ts, 113, 77)) + groupBy(iterator?: Iterator_, context?: any): Dictionary; +>groupBy : Symbol(WrappedArray.groupBy, Decl(underscoreTest1_underscore.ts, 112, 42), Decl(underscoreTest1_underscore.ts, 113, 78)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 113, 16)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 113, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 113, 45)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) groupBy(propertyName: string): Dictionary; ->groupBy : Symbol(WrappedArray.groupBy, Decl(underscoreTest1_underscore.ts, 112, 42), Decl(underscoreTest1_underscore.ts, 113, 77)) +>groupBy : Symbol(WrappedArray.groupBy, Decl(underscoreTest1_underscore.ts, 112, 42), Decl(underscoreTest1_underscore.ts, 113, 78)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 114, 16)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) - countBy(iterator?: Iterator, context?: any): Dictionary; ->countBy : Symbol(WrappedArray.countBy, Decl(underscoreTest1_underscore.ts, 114, 55), Decl(underscoreTest1_underscore.ts, 115, 80)) + countBy(iterator?: Iterator_, context?: any): Dictionary; +>countBy : Symbol(WrappedArray.countBy, Decl(underscoreTest1_underscore.ts, 114, 55), Decl(underscoreTest1_underscore.ts, 115, 81)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 115, 16)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 115, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 115, 45)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) countBy(propertyName: string): Dictionary; ->countBy : Symbol(WrappedArray.countBy, Decl(underscoreTest1_underscore.ts, 114, 55), Decl(underscoreTest1_underscore.ts, 115, 80)) +>countBy : Symbol(WrappedArray.countBy, Decl(underscoreTest1_underscore.ts, 114, 55), Decl(underscoreTest1_underscore.ts, 115, 81)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 116, 16)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -1655,35 +1655,35 @@ module Underscore { >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 137, 13)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) - uniq(isSorted: boolean, iterator: Iterator, context?: any): U[]; + uniq(isSorted: boolean, iterator: Iterator_, context?: any): U[]; >uniq : Symbol(WrappedArray.uniq, Decl(underscoreTest1_underscore.ts, 136, 42), Decl(underscoreTest1_underscore.ts, 137, 38)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 138, 13)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 138, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 138, 34)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 138, 13)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 138, 60)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 138, 61)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 138, 13)) unique(isSorted?: boolean): T[]; ->unique : Symbol(WrappedArray.unique, Decl(underscoreTest1_underscore.ts, 138, 81), Decl(underscoreTest1_underscore.ts, 139, 40)) +>unique : Symbol(WrappedArray.unique, Decl(underscoreTest1_underscore.ts, 138, 82), Decl(underscoreTest1_underscore.ts, 139, 40)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 139, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) - unique(isSorted: boolean, iterator: Iterator, context?: any): U[]; ->unique : Symbol(WrappedArray.unique, Decl(underscoreTest1_underscore.ts, 138, 81), Decl(underscoreTest1_underscore.ts, 139, 40)) + unique(isSorted: boolean, iterator: Iterator_, context?: any): U[]; +>unique : Symbol(WrappedArray.unique, Decl(underscoreTest1_underscore.ts, 138, 82), Decl(underscoreTest1_underscore.ts, 139, 40)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 140, 15)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 140, 18)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 140, 36)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 140, 15)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 140, 62)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 140, 63)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 140, 15)) zip(...arrays: any[][]): any[][]; ->zip : Symbol(WrappedArray.zip, Decl(underscoreTest1_underscore.ts, 140, 83)) +>zip : Symbol(WrappedArray.zip, Decl(underscoreTest1_underscore.ts, 140, 84)) >arrays : Symbol(arrays, Decl(underscoreTest1_underscore.ts, 141, 12)) object(): any; @@ -1711,18 +1711,18 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 146, 27)) - sortedIndex(obj: T, iterator?: Iterator, context?: any): number; + sortedIndex(obj: T, iterator?: Iterator_, context?: any): number; >sortedIndex : Symbol(WrappedArray.sortedIndex, Decl(underscoreTest1_underscore.ts, 145, 58), Decl(underscoreTest1_underscore.ts, 146, 58)) >obj : Symbol(obj, Decl(underscoreTest1_underscore.ts, 147, 20)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 147, 27)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 147, 56)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 147, 57)) // Methods from Array concat(...items: T[]): T[]; ->concat : Symbol(WrappedArray.concat, Decl(underscoreTest1_underscore.ts, 147, 80)) +>concat : Symbol(WrappedArray.concat, Decl(underscoreTest1_underscore.ts, 147, 81)) >items : Symbol(items, Decl(underscoreTest1_underscore.ts, 149, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 79, 34)) @@ -1789,42 +1789,42 @@ module Underscore { >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) - each(iterator: Iterator, context?: any): void; + each(iterator: Iterator_, context?: any): void; >each : Symbol(WrappedDictionary.each, Decl(underscoreTest1_underscore.ts, 162, 80)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 163, 13)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 163, 41)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 163, 42)) - forEach(iterator: Iterator, context?: any): void; ->forEach : Symbol(WrappedDictionary.forEach, Decl(underscoreTest1_underscore.ts, 163, 63)) + forEach(iterator: Iterator_, context?: any): void; +>forEach : Symbol(WrappedDictionary.forEach, Decl(underscoreTest1_underscore.ts, 163, 64)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 164, 16)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 164, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 164, 45)) - map(iterator: Iterator, context?: any): U[]; ->map : Symbol(WrappedDictionary.map, Decl(underscoreTest1_underscore.ts, 164, 66)) + map(iterator: Iterator_, context?: any): U[]; +>map : Symbol(WrappedDictionary.map, Decl(underscoreTest1_underscore.ts, 164, 67)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 165, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 165, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 165, 12)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 165, 40)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 165, 41)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 165, 12)) - collect(iterator: Iterator, context?: any): U[]; ->collect : Symbol(WrappedDictionary.collect, Decl(underscoreTest1_underscore.ts, 165, 61)) + collect(iterator: Iterator_, context?: any): U[]; +>collect : Symbol(WrappedDictionary.collect, Decl(underscoreTest1_underscore.ts, 165, 62)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 166, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 166, 19)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 166, 16)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 166, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 166, 45)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 166, 16)) reduce(iterator: Reducer, initialValue?: T, context?: any): T; ->reduce : Symbol(WrappedDictionary.reduce, Decl(underscoreTest1_underscore.ts, 166, 65), Decl(underscoreTest1_underscore.ts, 167, 76)) +>reduce : Symbol(WrappedDictionary.reduce, Decl(underscoreTest1_underscore.ts, 166, 66), Decl(underscoreTest1_underscore.ts, 167, 76)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 167, 15)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -1835,7 +1835,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) reduce(iterator: Reducer, initialValue: U, context?: any): U; ->reduce : Symbol(WrappedDictionary.reduce, Decl(underscoreTest1_underscore.ts, 166, 65), Decl(underscoreTest1_underscore.ts, 167, 76)) +>reduce : Symbol(WrappedDictionary.reduce, Decl(underscoreTest1_underscore.ts, 166, 66), Decl(underscoreTest1_underscore.ts, 167, 76)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 168, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 168, 18)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -1938,40 +1938,40 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 176, 58)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 176, 14)) - find(iterator: Iterator, context?: any): T; + find(iterator: Iterator_, context?: any): T; >find : Symbol(WrappedDictionary.find, Decl(underscoreTest1_underscore.ts, 176, 77)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 177, 13)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 177, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 177, 45)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) - detect(iterator: Iterator, context?: any): T; ->detect : Symbol(WrappedDictionary.detect, Decl(underscoreTest1_underscore.ts, 177, 63)) + detect(iterator: Iterator_, context?: any): T; +>detect : Symbol(WrappedDictionary.detect, Decl(underscoreTest1_underscore.ts, 177, 64)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 178, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 178, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 178, 47)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) - filter(iterator: Iterator, context?: any): T[]; ->filter : Symbol(WrappedDictionary.filter, Decl(underscoreTest1_underscore.ts, 178, 65)) + filter(iterator: Iterator_, context?: any): T[]; +>filter : Symbol(WrappedDictionary.filter, Decl(underscoreTest1_underscore.ts, 178, 66)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 179, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 179, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 179, 47)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) - select(iterator: Iterator, context?: any): T[]; ->select : Symbol(WrappedDictionary.select, Decl(underscoreTest1_underscore.ts, 179, 67)) + select(iterator: Iterator_, context?: any): T[]; +>select : Symbol(WrappedDictionary.select, Decl(underscoreTest1_underscore.ts, 179, 68)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 180, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 180, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 180, 47)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) where(properties: Object): T[]; ->where : Symbol(WrappedDictionary.where, Decl(underscoreTest1_underscore.ts, 180, 67)) +>where : Symbol(WrappedDictionary.where, Decl(underscoreTest1_underscore.ts, 180, 68)) >properties : Symbol(properties, Decl(underscoreTest1_underscore.ts, 181, 14)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -1982,44 +1982,44 @@ module Underscore { >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) - reject(iterator: Iterator, context?: any): T[]; + reject(iterator: Iterator_, context?: any): T[]; >reject : Symbol(WrappedDictionary.reject, Decl(underscoreTest1_underscore.ts, 182, 41)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 183, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 183, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 183, 47)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) - every(iterator?: Iterator, context?: any): boolean; ->every : Symbol(WrappedDictionary.every, Decl(underscoreTest1_underscore.ts, 183, 67)) + every(iterator?: Iterator_, context?: any): boolean; +>every : Symbol(WrappedDictionary.every, Decl(underscoreTest1_underscore.ts, 183, 68)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 184, 14)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 184, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 184, 47)) - all(iterator?: Iterator, context?: any): boolean; ->all : Symbol(WrappedDictionary.all, Decl(underscoreTest1_underscore.ts, 184, 71)) + all(iterator?: Iterator_, context?: any): boolean; +>all : Symbol(WrappedDictionary.all, Decl(underscoreTest1_underscore.ts, 184, 72)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 185, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 185, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 185, 45)) - some(iterator?: Iterator, context?: any): boolean; ->some : Symbol(WrappedDictionary.some, Decl(underscoreTest1_underscore.ts, 185, 69)) + some(iterator?: Iterator_, context?: any): boolean; +>some : Symbol(WrappedDictionary.some, Decl(underscoreTest1_underscore.ts, 185, 70)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 186, 13)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 186, 45)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 186, 46)) - any(iterator?: Iterator, context?: any): boolean; ->any : Symbol(WrappedDictionary.any, Decl(underscoreTest1_underscore.ts, 186, 70)) + any(iterator?: Iterator_, context?: any): boolean; +>any : Symbol(WrappedDictionary.any, Decl(underscoreTest1_underscore.ts, 186, 71)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 187, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 187, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 187, 45)) contains(value: T): boolean; ->contains : Symbol(WrappedDictionary.contains, Decl(underscoreTest1_underscore.ts, 187, 69)) +>contains : Symbol(WrappedDictionary.contains, Decl(underscoreTest1_underscore.ts, 187, 70)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 188, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) @@ -2037,60 +2037,60 @@ module Underscore { >pluck : Symbol(WrappedDictionary.pluck, Decl(underscoreTest1_underscore.ts, 190, 58)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 191, 14)) - max(iterator?: Iterator, context?: any): T; + max(iterator?: Iterator_, context?: any): T; >max : Symbol(WrappedDictionary.max, Decl(underscoreTest1_underscore.ts, 191, 43)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 192, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 192, 40)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 192, 41)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) - min(iterator?: Iterator, context?: any): T; ->min : Symbol(WrappedDictionary.min, Decl(underscoreTest1_underscore.ts, 192, 59)) + min(iterator?: Iterator_, context?: any): T; +>min : Symbol(WrappedDictionary.min, Decl(underscoreTest1_underscore.ts, 192, 60)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 193, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 193, 40)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 193, 41)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) - sortBy(iterator: Iterator, context?: any): T[]; ->sortBy : Symbol(WrappedDictionary.sortBy, Decl(underscoreTest1_underscore.ts, 193, 59), Decl(underscoreTest1_underscore.ts, 194, 63)) + sortBy(iterator: Iterator_, context?: any): T[]; +>sortBy : Symbol(WrappedDictionary.sortBy, Decl(underscoreTest1_underscore.ts, 193, 60), Decl(underscoreTest1_underscore.ts, 194, 64)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 194, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 194, 42)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 194, 43)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) sortBy(propertyName: string): T[]; ->sortBy : Symbol(WrappedDictionary.sortBy, Decl(underscoreTest1_underscore.ts, 193, 59), Decl(underscoreTest1_underscore.ts, 194, 63)) +>sortBy : Symbol(WrappedDictionary.sortBy, Decl(underscoreTest1_underscore.ts, 193, 60), Decl(underscoreTest1_underscore.ts, 194, 64)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 195, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) - groupBy(iterator?: Iterator, context?: any): Dictionary; ->groupBy : Symbol(WrappedDictionary.groupBy, Decl(underscoreTest1_underscore.ts, 195, 42), Decl(underscoreTest1_underscore.ts, 196, 77)) + groupBy(iterator?: Iterator_, context?: any): Dictionary; +>groupBy : Symbol(WrappedDictionary.groupBy, Decl(underscoreTest1_underscore.ts, 195, 42), Decl(underscoreTest1_underscore.ts, 196, 78)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 196, 16)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 196, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 196, 45)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) groupBy(propertyName: string): Dictionary; ->groupBy : Symbol(WrappedDictionary.groupBy, Decl(underscoreTest1_underscore.ts, 195, 42), Decl(underscoreTest1_underscore.ts, 196, 77)) +>groupBy : Symbol(WrappedDictionary.groupBy, Decl(underscoreTest1_underscore.ts, 195, 42), Decl(underscoreTest1_underscore.ts, 196, 78)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 197, 16)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) - countBy(iterator?: Iterator, context?: any): Dictionary; ->countBy : Symbol(WrappedDictionary.countBy, Decl(underscoreTest1_underscore.ts, 197, 55), Decl(underscoreTest1_underscore.ts, 198, 80)) + countBy(iterator?: Iterator_, context?: any): Dictionary; +>countBy : Symbol(WrappedDictionary.countBy, Decl(underscoreTest1_underscore.ts, 197, 55), Decl(underscoreTest1_underscore.ts, 198, 81)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 198, 16)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 162, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 198, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 198, 45)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) countBy(propertyName: string): Dictionary; ->countBy : Symbol(WrappedDictionary.countBy, Decl(underscoreTest1_underscore.ts, 197, 55), Decl(underscoreTest1_underscore.ts, 198, 80)) +>countBy : Symbol(WrappedDictionary.countBy, Decl(underscoreTest1_underscore.ts, 197, 55), Decl(underscoreTest1_underscore.ts, 198, 81)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 199, 16)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -2254,46 +2254,46 @@ module Underscore { >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) - each(iterator: Iterator, context?: any): ChainedObject; + each(iterator: Iterator_, context?: any): ChainedObject; >each : Symbol(ChainedArray.each, Decl(underscoreTest1_underscore.ts, 238, 70)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 239, 13)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 239, 41)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 239, 42)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) - forEach(iterator: Iterator, context?: any): ChainedObject; ->forEach : Symbol(ChainedArray.forEach, Decl(underscoreTest1_underscore.ts, 239, 78)) + forEach(iterator: Iterator_, context?: any): ChainedObject; +>forEach : Symbol(ChainedArray.forEach, Decl(underscoreTest1_underscore.ts, 239, 79)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 240, 16)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 240, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 240, 45)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) - map(iterator: Iterator, context?: any): ChainedArray; ->map : Symbol(ChainedArray.map, Decl(underscoreTest1_underscore.ts, 240, 81)) + map(iterator: Iterator_, context?: any): ChainedArray; +>map : Symbol(ChainedArray.map, Decl(underscoreTest1_underscore.ts, 240, 82)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 241, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 241, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 241, 12)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 241, 40)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 241, 41)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 241, 12)) - collect(iterator: Iterator, context?: any): ChainedArray; ->collect : Symbol(ChainedArray.collect, Decl(underscoreTest1_underscore.ts, 241, 73)) + collect(iterator: Iterator_, context?: any): ChainedArray; +>collect : Symbol(ChainedArray.collect, Decl(underscoreTest1_underscore.ts, 241, 74)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 242, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 242, 19)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 242, 16)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 242, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 242, 45)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 242, 16)) reduce(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; ->reduce : Symbol(ChainedArray.reduce, Decl(underscoreTest1_underscore.ts, 242, 77), Decl(underscoreTest1_underscore.ts, 243, 91)) +>reduce : Symbol(ChainedArray.reduce, Decl(underscoreTest1_underscore.ts, 242, 78), Decl(underscoreTest1_underscore.ts, 243, 91)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 243, 15)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) @@ -2305,7 +2305,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) reduce(iterator: Reducer, initialValue: U, context?: any): ChainedObject; ->reduce : Symbol(ChainedArray.reduce, Decl(underscoreTest1_underscore.ts, 242, 77), Decl(underscoreTest1_underscore.ts, 243, 91)) +>reduce : Symbol(ChainedArray.reduce, Decl(underscoreTest1_underscore.ts, 242, 78), Decl(underscoreTest1_underscore.ts, 243, 91)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 244, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 244, 18)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -2417,44 +2417,44 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 252, 14)) - find(iterator: Iterator, context?: any): ChainedObject; + find(iterator: Iterator_, context?: any): ChainedObject; >find : Symbol(ChainedArray.find, Decl(underscoreTest1_underscore.ts, 252, 92)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 253, 13)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 253, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 253, 45)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) - detect(iterator: Iterator, context?: any): ChainedObject; ->detect : Symbol(ChainedArray.detect, Decl(underscoreTest1_underscore.ts, 253, 78)) + detect(iterator: Iterator_, context?: any): ChainedObject; +>detect : Symbol(ChainedArray.detect, Decl(underscoreTest1_underscore.ts, 253, 79)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 254, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 254, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 254, 47)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) - filter(iterator: Iterator, context?: any): ChainedArray; ->filter : Symbol(ChainedArray.filter, Decl(underscoreTest1_underscore.ts, 254, 80)) + filter(iterator: Iterator_, context?: any): ChainedArray; +>filter : Symbol(ChainedArray.filter, Decl(underscoreTest1_underscore.ts, 254, 81)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 255, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 255, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 255, 47)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) - select(iterator: Iterator, context?: any): ChainedArray; ->select : Symbol(ChainedArray.select, Decl(underscoreTest1_underscore.ts, 255, 79)) + select(iterator: Iterator_, context?: any): ChainedArray; +>select : Symbol(ChainedArray.select, Decl(underscoreTest1_underscore.ts, 255, 80)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 256, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 256, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 256, 47)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) where(properties: Object): ChainedArray; ->where : Symbol(ChainedArray.where, Decl(underscoreTest1_underscore.ts, 256, 79)) +>where : Symbol(ChainedArray.where, Decl(underscoreTest1_underscore.ts, 256, 80)) >properties : Symbol(properties, Decl(underscoreTest1_underscore.ts, 257, 14)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) @@ -2467,49 +2467,49 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) - reject(iterator: Iterator, context?: any): ChainedArray; + reject(iterator: Iterator_, context?: any): ChainedArray; >reject : Symbol(ChainedArray.reject, Decl(underscoreTest1_underscore.ts, 258, 56)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 259, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 259, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 259, 47)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) - every(iterator?: Iterator, context?: any): ChainedObject; ->every : Symbol(ChainedArray.every, Decl(underscoreTest1_underscore.ts, 259, 79)) + every(iterator?: Iterator_, context?: any): ChainedObject; +>every : Symbol(ChainedArray.every, Decl(underscoreTest1_underscore.ts, 259, 80)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 260, 14)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 260, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 260, 47)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) - all(iterator?: Iterator, context?: any): ChainedObject; ->all : Symbol(ChainedArray.all, Decl(underscoreTest1_underscore.ts, 260, 86)) + all(iterator?: Iterator_, context?: any): ChainedObject; +>all : Symbol(ChainedArray.all, Decl(underscoreTest1_underscore.ts, 260, 87)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 261, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 261, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 261, 45)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) - some(iterator?: Iterator, context?: any): ChainedObject; ->some : Symbol(ChainedArray.some, Decl(underscoreTest1_underscore.ts, 261, 84)) + some(iterator?: Iterator_, context?: any): ChainedObject; +>some : Symbol(ChainedArray.some, Decl(underscoreTest1_underscore.ts, 261, 85)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 262, 13)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 262, 45)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 262, 46)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) - any(iterator?: Iterator, context?: any): ChainedObject; ->any : Symbol(ChainedArray.any, Decl(underscoreTest1_underscore.ts, 262, 85)) + any(iterator?: Iterator_, context?: any): ChainedObject; +>any : Symbol(ChainedArray.any, Decl(underscoreTest1_underscore.ts, 262, 86)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 263, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 263, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 263, 45)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) contains(value: T): ChainedObject; ->contains : Symbol(ChainedArray.contains, Decl(underscoreTest1_underscore.ts, 263, 84)) +>contains : Symbol(ChainedArray.contains, Decl(underscoreTest1_underscore.ts, 263, 85)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 264, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) @@ -2531,63 +2531,63 @@ module Underscore { >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 267, 14)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) - max(iterator?: Iterator, context?: any): ChainedObject; + max(iterator?: Iterator_, context?: any): ChainedObject; >max : Symbol(ChainedArray.max, Decl(underscoreTest1_underscore.ts, 267, 55)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 268, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 268, 40)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 268, 41)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) - min(iterator?: Iterator, context?: any): ChainedObject; ->min : Symbol(ChainedArray.min, Decl(underscoreTest1_underscore.ts, 268, 74)) + min(iterator?: Iterator_, context?: any): ChainedObject; +>min : Symbol(ChainedArray.min, Decl(underscoreTest1_underscore.ts, 268, 75)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 269, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 269, 40)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 269, 41)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) - sortBy(iterator: Iterator, context?: any): ChainedArray; ->sortBy : Symbol(ChainedArray.sortBy, Decl(underscoreTest1_underscore.ts, 269, 74), Decl(underscoreTest1_underscore.ts, 270, 75)) + sortBy(iterator: Iterator_, context?: any): ChainedArray; +>sortBy : Symbol(ChainedArray.sortBy, Decl(underscoreTest1_underscore.ts, 269, 75), Decl(underscoreTest1_underscore.ts, 270, 76)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 270, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 270, 42)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 270, 43)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) sortBy(propertyName: string): ChainedArray; ->sortBy : Symbol(ChainedArray.sortBy, Decl(underscoreTest1_underscore.ts, 269, 74), Decl(underscoreTest1_underscore.ts, 270, 75)) +>sortBy : Symbol(ChainedArray.sortBy, Decl(underscoreTest1_underscore.ts, 269, 75), Decl(underscoreTest1_underscore.ts, 270, 76)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 271, 15)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) // Should return ChainedDictionary, but expansive recursion not allowed - groupBy(iterator?: Iterator, context?: any): ChainedDictionary; ->groupBy : Symbol(ChainedArray.groupBy, Decl(underscoreTest1_underscore.ts, 271, 54), Decl(underscoreTest1_underscore.ts, 273, 86)) + groupBy(iterator?: Iterator_, context?: any): ChainedDictionary; +>groupBy : Symbol(ChainedArray.groupBy, Decl(underscoreTest1_underscore.ts, 271, 54), Decl(underscoreTest1_underscore.ts, 273, 87)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 273, 16)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 273, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 273, 45)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) groupBy(propertyName: string): ChainedDictionary; ->groupBy : Symbol(ChainedArray.groupBy, Decl(underscoreTest1_underscore.ts, 271, 54), Decl(underscoreTest1_underscore.ts, 273, 86)) +>groupBy : Symbol(ChainedArray.groupBy, Decl(underscoreTest1_underscore.ts, 271, 54), Decl(underscoreTest1_underscore.ts, 273, 87)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 274, 16)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) - countBy(iterator?: Iterator, context?: any): ChainedDictionary; ->countBy : Symbol(ChainedArray.countBy, Decl(underscoreTest1_underscore.ts, 274, 64), Decl(underscoreTest1_underscore.ts, 275, 87)) + countBy(iterator?: Iterator_, context?: any): ChainedDictionary; +>countBy : Symbol(ChainedArray.countBy, Decl(underscoreTest1_underscore.ts, 274, 64), Decl(underscoreTest1_underscore.ts, 275, 88)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 275, 16)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 275, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 275, 45)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) countBy(propertyName: string): ChainedDictionary; ->countBy : Symbol(ChainedArray.countBy, Decl(underscoreTest1_underscore.ts, 274, 64), Decl(underscoreTest1_underscore.ts, 275, 87)) +>countBy : Symbol(ChainedArray.countBy, Decl(underscoreTest1_underscore.ts, 274, 64), Decl(underscoreTest1_underscore.ts, 275, 88)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 276, 16)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) @@ -2712,38 +2712,38 @@ module Underscore { >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) - uniq(isSorted: boolean, iterator: Iterator, context?: any): ChainedArray; + uniq(isSorted: boolean, iterator: Iterator_, context?: any): ChainedArray; >uniq : Symbol(ChainedArray.uniq, Decl(underscoreTest1_underscore.ts, 296, 54), Decl(underscoreTest1_underscore.ts, 297, 50)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 298, 13)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 298, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 298, 34)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 298, 13)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 298, 60)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 298, 61)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 298, 13)) unique(isSorted?: boolean): ChainedArray; ->unique : Symbol(ChainedArray.unique, Decl(underscoreTest1_underscore.ts, 298, 93), Decl(underscoreTest1_underscore.ts, 299, 52)) +>unique : Symbol(ChainedArray.unique, Decl(underscoreTest1_underscore.ts, 298, 94), Decl(underscoreTest1_underscore.ts, 299, 52)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 299, 15)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) - unique(isSorted: boolean, iterator: Iterator, context?: any): ChainedArray; ->unique : Symbol(ChainedArray.unique, Decl(underscoreTest1_underscore.ts, 298, 93), Decl(underscoreTest1_underscore.ts, 299, 52)) + unique(isSorted: boolean, iterator: Iterator_, context?: any): ChainedArray; +>unique : Symbol(ChainedArray.unique, Decl(underscoreTest1_underscore.ts, 298, 94), Decl(underscoreTest1_underscore.ts, 299, 52)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 300, 15)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 300, 18)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 300, 36)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 300, 15)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 300, 62)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 300, 63)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 300, 15)) zip(...arrays: any[][]): ChainedArray; ->zip : Symbol(ChainedArray.zip, Decl(underscoreTest1_underscore.ts, 300, 95)) +>zip : Symbol(ChainedArray.zip, Decl(underscoreTest1_underscore.ts, 300, 96)) >arrays : Symbol(arrays, Decl(underscoreTest1_underscore.ts, 301, 12)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) @@ -2777,19 +2777,19 @@ module Underscore { >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 306, 27)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) - sortedIndex(obj: T, iterator?: Iterator, context?: any): ChainedObject; + sortedIndex(obj: T, iterator?: Iterator_, context?: any): ChainedObject; >sortedIndex : Symbol(ChainedArray.sortedIndex, Decl(underscoreTest1_underscore.ts, 305, 73), Decl(underscoreTest1_underscore.ts, 306, 73)) >obj : Symbol(obj, Decl(underscoreTest1_underscore.ts, 307, 20)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 307, 27)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 307, 56)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 307, 57)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) // Methods from Array concat(...items: T[]): ChainedArray; ->concat : Symbol(ChainedArray.concat, Decl(underscoreTest1_underscore.ts, 307, 95)) +>concat : Symbol(ChainedArray.concat, Decl(underscoreTest1_underscore.ts, 307, 96)) >items : Symbol(items, Decl(underscoreTest1_underscore.ts, 309, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 238, 34)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) @@ -2905,46 +2905,46 @@ module Underscore { >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) - each(iterator: Iterator, context?: any): ChainedObject; + each(iterator: Iterator_, context?: any): ChainedObject; >each : Symbol(ChainedDictionary.each, Decl(underscoreTest1_underscore.ts, 329, 80)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 330, 13)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 330, 41)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 330, 42)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) - forEach(iterator: Iterator, context?: any): ChainedObject; ->forEach : Symbol(ChainedDictionary.forEach, Decl(underscoreTest1_underscore.ts, 330, 78)) + forEach(iterator: Iterator_, context?: any): ChainedObject; +>forEach : Symbol(ChainedDictionary.forEach, Decl(underscoreTest1_underscore.ts, 330, 79)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 331, 16)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 331, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 331, 45)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) - map(iterator: Iterator, context?: any): ChainedArray; ->map : Symbol(ChainedDictionary.map, Decl(underscoreTest1_underscore.ts, 331, 81)) + map(iterator: Iterator_, context?: any): ChainedArray; +>map : Symbol(ChainedDictionary.map, Decl(underscoreTest1_underscore.ts, 331, 82)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 332, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 332, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 332, 12)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 332, 40)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 332, 41)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 332, 12)) - collect(iterator: Iterator, context?: any): ChainedArray; ->collect : Symbol(ChainedDictionary.collect, Decl(underscoreTest1_underscore.ts, 332, 73)) + collect(iterator: Iterator_, context?: any): ChainedArray; +>collect : Symbol(ChainedDictionary.collect, Decl(underscoreTest1_underscore.ts, 332, 74)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 333, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 333, 19)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 333, 16)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 333, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 333, 45)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 333, 16)) reduce(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; ->reduce : Symbol(ChainedDictionary.reduce, Decl(underscoreTest1_underscore.ts, 333, 77), Decl(underscoreTest1_underscore.ts, 334, 91)) +>reduce : Symbol(ChainedDictionary.reduce, Decl(underscoreTest1_underscore.ts, 333, 78), Decl(underscoreTest1_underscore.ts, 334, 91)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 334, 15)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) @@ -2956,7 +2956,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) reduce(iterator: Reducer, initialValue: U, context?: any): ChainedObject; ->reduce : Symbol(ChainedDictionary.reduce, Decl(underscoreTest1_underscore.ts, 333, 77), Decl(underscoreTest1_underscore.ts, 334, 91)) +>reduce : Symbol(ChainedDictionary.reduce, Decl(underscoreTest1_underscore.ts, 333, 78), Decl(underscoreTest1_underscore.ts, 334, 91)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 335, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 335, 18)) >Reducer : Symbol(Reducer, Decl(underscoreTest1_underscore.ts, 6, 1)) @@ -3068,44 +3068,44 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 343, 14)) - find(iterator: Iterator, context?: any): ChainedObject; + find(iterator: Iterator_, context?: any): ChainedObject; >find : Symbol(ChainedDictionary.find, Decl(underscoreTest1_underscore.ts, 343, 92)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 344, 13)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 344, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 344, 45)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) - detect(iterator: Iterator, context?: any): ChainedObject; ->detect : Symbol(ChainedDictionary.detect, Decl(underscoreTest1_underscore.ts, 344, 78)) + detect(iterator: Iterator_, context?: any): ChainedObject; +>detect : Symbol(ChainedDictionary.detect, Decl(underscoreTest1_underscore.ts, 344, 79)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 345, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 345, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 345, 47)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) - filter(iterator: Iterator, context?: any): ChainedArray; ->filter : Symbol(ChainedDictionary.filter, Decl(underscoreTest1_underscore.ts, 345, 80)) + filter(iterator: Iterator_, context?: any): ChainedArray; +>filter : Symbol(ChainedDictionary.filter, Decl(underscoreTest1_underscore.ts, 345, 81)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 346, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 346, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 346, 47)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) - select(iterator: Iterator, context?: any): ChainedArray; ->select : Symbol(ChainedDictionary.select, Decl(underscoreTest1_underscore.ts, 346, 79)) + select(iterator: Iterator_, context?: any): ChainedArray; +>select : Symbol(ChainedDictionary.select, Decl(underscoreTest1_underscore.ts, 346, 80)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 347, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 347, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 347, 47)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) where(properties: Object): ChainedArray; ->where : Symbol(ChainedDictionary.where, Decl(underscoreTest1_underscore.ts, 347, 79)) +>where : Symbol(ChainedDictionary.where, Decl(underscoreTest1_underscore.ts, 347, 80)) >properties : Symbol(properties, Decl(underscoreTest1_underscore.ts, 348, 14)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) @@ -3118,49 +3118,49 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) - reject(iterator: Iterator, context?: any): ChainedArray; + reject(iterator: Iterator_, context?: any): ChainedArray; >reject : Symbol(ChainedDictionary.reject, Decl(underscoreTest1_underscore.ts, 349, 56)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 350, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 350, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 350, 47)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) - every(iterator?: Iterator, context?: any): ChainedObject; ->every : Symbol(ChainedDictionary.every, Decl(underscoreTest1_underscore.ts, 350, 79)) + every(iterator?: Iterator_, context?: any): ChainedObject; +>every : Symbol(ChainedDictionary.every, Decl(underscoreTest1_underscore.ts, 350, 80)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 351, 14)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 351, 46)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 351, 47)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) - all(iterator?: Iterator, context?: any): ChainedObject; ->all : Symbol(ChainedDictionary.all, Decl(underscoreTest1_underscore.ts, 351, 86)) + all(iterator?: Iterator_, context?: any): ChainedObject; +>all : Symbol(ChainedDictionary.all, Decl(underscoreTest1_underscore.ts, 351, 87)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 352, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 352, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 352, 45)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) - some(iterator?: Iterator, context?: any): ChainedObject; ->some : Symbol(ChainedDictionary.some, Decl(underscoreTest1_underscore.ts, 352, 84)) + some(iterator?: Iterator_, context?: any): ChainedObject; +>some : Symbol(ChainedDictionary.some, Decl(underscoreTest1_underscore.ts, 352, 85)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 353, 13)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 353, 45)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 353, 46)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) - any(iterator?: Iterator, context?: any): ChainedObject; ->any : Symbol(ChainedDictionary.any, Decl(underscoreTest1_underscore.ts, 353, 85)) + any(iterator?: Iterator_, context?: any): ChainedObject; +>any : Symbol(ChainedDictionary.any, Decl(underscoreTest1_underscore.ts, 353, 86)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 354, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 354, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 354, 45)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) contains(value: T): ChainedObject; ->contains : Symbol(ChainedDictionary.contains, Decl(underscoreTest1_underscore.ts, 354, 84)) +>contains : Symbol(ChainedDictionary.contains, Decl(underscoreTest1_underscore.ts, 354, 85)) >value : Symbol(value, Decl(underscoreTest1_underscore.ts, 355, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) @@ -3182,63 +3182,63 @@ module Underscore { >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 358, 14)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) - max(iterator?: Iterator, context?: any): ChainedObject; + max(iterator?: Iterator_, context?: any): ChainedObject; >max : Symbol(ChainedDictionary.max, Decl(underscoreTest1_underscore.ts, 358, 55)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 359, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 359, 40)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 359, 41)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) - min(iterator?: Iterator, context?: any): ChainedObject; ->min : Symbol(ChainedDictionary.min, Decl(underscoreTest1_underscore.ts, 359, 74)) + min(iterator?: Iterator_, context?: any): ChainedObject; +>min : Symbol(ChainedDictionary.min, Decl(underscoreTest1_underscore.ts, 359, 75)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 360, 12)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 360, 40)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 360, 41)) >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) - sortBy(iterator: Iterator, context?: any): ChainedArray; ->sortBy : Symbol(ChainedDictionary.sortBy, Decl(underscoreTest1_underscore.ts, 360, 74), Decl(underscoreTest1_underscore.ts, 361, 75)) + sortBy(iterator: Iterator_, context?: any): ChainedArray; +>sortBy : Symbol(ChainedDictionary.sortBy, Decl(underscoreTest1_underscore.ts, 360, 75), Decl(underscoreTest1_underscore.ts, 361, 76)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 361, 15)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 361, 42)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 361, 43)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) sortBy(propertyName: string): ChainedArray; ->sortBy : Symbol(ChainedDictionary.sortBy, Decl(underscoreTest1_underscore.ts, 360, 74), Decl(underscoreTest1_underscore.ts, 361, 75)) +>sortBy : Symbol(ChainedDictionary.sortBy, Decl(underscoreTest1_underscore.ts, 360, 75), Decl(underscoreTest1_underscore.ts, 361, 76)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 362, 15)) >ChainedArray : Symbol(ChainedArray, Decl(underscoreTest1_underscore.ts, 236, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) // Should return ChainedDictionary, but expansive recursion not allowed - groupBy(iterator?: Iterator, context?: any): ChainedDictionary; ->groupBy : Symbol(ChainedDictionary.groupBy, Decl(underscoreTest1_underscore.ts, 362, 54), Decl(underscoreTest1_underscore.ts, 364, 86)) + groupBy(iterator?: Iterator_, context?: any): ChainedDictionary; +>groupBy : Symbol(ChainedDictionary.groupBy, Decl(underscoreTest1_underscore.ts, 362, 54), Decl(underscoreTest1_underscore.ts, 364, 87)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 364, 16)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 364, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 364, 45)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) groupBy(propertyName: string): ChainedDictionary; ->groupBy : Symbol(ChainedDictionary.groupBy, Decl(underscoreTest1_underscore.ts, 362, 54), Decl(underscoreTest1_underscore.ts, 364, 86)) +>groupBy : Symbol(ChainedDictionary.groupBy, Decl(underscoreTest1_underscore.ts, 362, 54), Decl(underscoreTest1_underscore.ts, 364, 87)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 365, 16)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) - countBy(iterator?: Iterator, context?: any): ChainedDictionary; ->countBy : Symbol(ChainedDictionary.countBy, Decl(underscoreTest1_underscore.ts, 365, 64), Decl(underscoreTest1_underscore.ts, 366, 87)) + countBy(iterator?: Iterator_, context?: any): ChainedDictionary; +>countBy : Symbol(ChainedDictionary.countBy, Decl(underscoreTest1_underscore.ts, 365, 64), Decl(underscoreTest1_underscore.ts, 366, 88)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 366, 16)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 329, 39)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 366, 44)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 366, 45)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) countBy(propertyName: string): ChainedDictionary; ->countBy : Symbol(ChainedDictionary.countBy, Decl(underscoreTest1_underscore.ts, 365, 64), Decl(underscoreTest1_underscore.ts, 366, 87)) +>countBy : Symbol(ChainedDictionary.countBy, Decl(underscoreTest1_underscore.ts, 365, 64), Decl(underscoreTest1_underscore.ts, 366, 88)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 367, 16)) >ChainedDictionary : Symbol(ChainedDictionary, Decl(underscoreTest1_underscore.ts, 327, 5)) @@ -3373,104 +3373,104 @@ module Underscore { >ChainedObject : Symbol(ChainedObject, Decl(underscoreTest1_underscore.ts, 203, 5)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 395, 14)) - each(list: T[], iterator: Iterator, context?: any): void; ->each : Symbol(Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) + each(list: T[], iterator: Iterator_, context?: any): void; +>each : Symbol(Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 78)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 397, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 397, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 397, 13)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 397, 26)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 397, 13)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 397, 55)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 397, 56)) - each(list: Dictionary, iterator: Iterator, context?: any): void; ->each : Symbol(Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 77)) + each(list: Dictionary, iterator: Iterator_, context?: any): void; +>each : Symbol(Static.each, Decl(underscoreTest1_underscore.ts, 395, 43), Decl(underscoreTest1_underscore.ts, 397, 78)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 398, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 398, 16)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 398, 13)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 398, 36)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 398, 13)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 398, 65)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 398, 66)) - forEach(list: T[], iterator: Iterator, context?: any): void; ->forEach : Symbol(Static.forEach, Decl(underscoreTest1_underscore.ts, 398, 87), Decl(underscoreTest1_underscore.ts, 399, 80)) + forEach(list: T[], iterator: Iterator_, context?: any): void; +>forEach : Symbol(Static.forEach, Decl(underscoreTest1_underscore.ts, 398, 88), Decl(underscoreTest1_underscore.ts, 399, 81)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 399, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 399, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 399, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 399, 29)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 399, 16)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 399, 58)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 399, 59)) - forEach(list: Dictionary, iterator: Iterator, context?: any): void; ->forEach : Symbol(Static.forEach, Decl(underscoreTest1_underscore.ts, 398, 87), Decl(underscoreTest1_underscore.ts, 399, 80)) + forEach(list: Dictionary, iterator: Iterator_, context?: any): void; +>forEach : Symbol(Static.forEach, Decl(underscoreTest1_underscore.ts, 398, 88), Decl(underscoreTest1_underscore.ts, 399, 81)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 400, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 400, 19)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 400, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 400, 39)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 400, 16)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 400, 68)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 400, 69)) - map(list: T[], iterator: Iterator, context?: any): U[]; ->map : Symbol(Static.map, Decl(underscoreTest1_underscore.ts, 400, 90), Decl(underscoreTest1_underscore.ts, 402, 75)) + map(list: T[], iterator: Iterator_, context?: any): U[]; +>map : Symbol(Static.map, Decl(underscoreTest1_underscore.ts, 400, 91), Decl(underscoreTest1_underscore.ts, 402, 76)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 402, 12)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 402, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 402, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 402, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 402, 28)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 402, 12)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 402, 14)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 402, 54)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 402, 55)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 402, 14)) - map(list: Dictionary, iterator: Iterator, context?: any): U[]; ->map : Symbol(Static.map, Decl(underscoreTest1_underscore.ts, 400, 90), Decl(underscoreTest1_underscore.ts, 402, 75)) + map(list: Dictionary, iterator: Iterator_, context?: any): U[]; +>map : Symbol(Static.map, Decl(underscoreTest1_underscore.ts, 400, 91), Decl(underscoreTest1_underscore.ts, 402, 76)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 403, 12)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 403, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 403, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 403, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 403, 38)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 403, 12)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 403, 14)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 403, 64)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 403, 65)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 403, 14)) - collect(list: T[], iterator: Iterator, context?: any): U[]; ->collect : Symbol(Static.collect, Decl(underscoreTest1_underscore.ts, 403, 85), Decl(underscoreTest1_underscore.ts, 404, 79)) + collect(list: T[], iterator: Iterator_, context?: any): U[]; +>collect : Symbol(Static.collect, Decl(underscoreTest1_underscore.ts, 403, 86), Decl(underscoreTest1_underscore.ts, 404, 80)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 404, 16)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 404, 18)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 404, 22)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 404, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 404, 32)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 404, 16)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 404, 18)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 404, 58)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 404, 59)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 404, 18)) - collect(list: Dictionary, iterator: Iterator, context?: any): U[]; ->collect : Symbol(Static.collect, Decl(underscoreTest1_underscore.ts, 403, 85), Decl(underscoreTest1_underscore.ts, 404, 79)) + collect(list: Dictionary, iterator: Iterator_, context?: any): U[]; +>collect : Symbol(Static.collect, Decl(underscoreTest1_underscore.ts, 403, 86), Decl(underscoreTest1_underscore.ts, 404, 80)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 405, 16)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 405, 18)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 405, 22)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 405, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 405, 42)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 405, 16)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 405, 18)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 405, 68)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 405, 69)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 405, 18)) reduce(list: T[], iterator: Reducer, initialValue?: T, context?: any): T; ->reduce : Symbol(Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) +>reduce : Symbol(Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 90), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 407, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 407, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 407, 15)) @@ -3484,7 +3484,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 407, 15)) reduce(list: T[], iterator: Reducer, initialValue: U, context?: any): U; ->reduce : Symbol(Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) +>reduce : Symbol(Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 90), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 408, 15)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 408, 17)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 408, 21)) @@ -3499,7 +3499,7 @@ module Underscore { >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 408, 17)) reduce(list: Dictionary, iterator: Reducer, initialValue?: T, context?: any): T; ->reduce : Symbol(Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) +>reduce : Symbol(Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 90), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 409, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 409, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3514,7 +3514,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 409, 15)) reduce(list: Dictionary, iterator: Reducer, initialValue: U, context?: any): U; ->reduce : Symbol(Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 89), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) +>reduce : Symbol(Static.reduce, Decl(underscoreTest1_underscore.ts, 405, 90), Decl(underscoreTest1_underscore.ts, 407, 90), Decl(underscoreTest1_underscore.ts, 408, 92), Decl(underscoreTest1_underscore.ts, 409, 100)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 410, 15)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 410, 17)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 410, 21)) @@ -3769,100 +3769,100 @@ module Underscore { >context : Symbol(context, Decl(underscoreTest1_underscore.ts, 427, 82)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 427, 16)) - find(list: T[], iterator: Iterator, context?: any): T; ->find : Symbol(Static.find, Decl(underscoreTest1_underscore.ts, 427, 101), Decl(underscoreTest1_underscore.ts, 429, 77)) + find(list: T[], iterator: Iterator_, context?: any): T; +>find : Symbol(Static.find, Decl(underscoreTest1_underscore.ts, 427, 101), Decl(underscoreTest1_underscore.ts, 429, 78)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 429, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 429, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 429, 13)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 429, 26)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 429, 13)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 429, 58)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 429, 59)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 429, 13)) - find(list: Dictionary, iterator: Iterator, context?: any): T; ->find : Symbol(Static.find, Decl(underscoreTest1_underscore.ts, 427, 101), Decl(underscoreTest1_underscore.ts, 429, 77)) + find(list: Dictionary, iterator: Iterator_, context?: any): T; +>find : Symbol(Static.find, Decl(underscoreTest1_underscore.ts, 427, 101), Decl(underscoreTest1_underscore.ts, 429, 78)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 430, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 430, 16)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 430, 13)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 430, 36)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 430, 13)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 430, 68)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 430, 69)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 430, 13)) - detect(list: T[], iterator: Iterator, context?: any): T; ->detect : Symbol(Static.detect, Decl(underscoreTest1_underscore.ts, 430, 87), Decl(underscoreTest1_underscore.ts, 431, 79)) + detect(list: T[], iterator: Iterator_, context?: any): T; +>detect : Symbol(Static.detect, Decl(underscoreTest1_underscore.ts, 430, 88), Decl(underscoreTest1_underscore.ts, 431, 80)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 431, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 431, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 431, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 431, 28)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 431, 15)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 431, 60)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 431, 61)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 431, 15)) - detect(list: Dictionary, iterator: Iterator, context?: any): T; ->detect : Symbol(Static.detect, Decl(underscoreTest1_underscore.ts, 430, 87), Decl(underscoreTest1_underscore.ts, 431, 79)) + detect(list: Dictionary, iterator: Iterator_, context?: any): T; +>detect : Symbol(Static.detect, Decl(underscoreTest1_underscore.ts, 430, 88), Decl(underscoreTest1_underscore.ts, 431, 80)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 432, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 432, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 432, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 432, 38)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 432, 15)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 432, 70)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 432, 71)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 432, 15)) - filter(list: T[], iterator: Iterator, context?: any): T[]; ->filter : Symbol(Static.filter, Decl(underscoreTest1_underscore.ts, 432, 89), Decl(underscoreTest1_underscore.ts, 434, 81)) + filter(list: T[], iterator: Iterator_, context?: any): T[]; +>filter : Symbol(Static.filter, Decl(underscoreTest1_underscore.ts, 432, 90), Decl(underscoreTest1_underscore.ts, 434, 82)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 434, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 434, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 434, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 434, 28)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 434, 15)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 434, 60)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 434, 61)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 434, 15)) - filter(list: Dictionary, iterator: Iterator, context?: any): T[]; ->filter : Symbol(Static.filter, Decl(underscoreTest1_underscore.ts, 432, 89), Decl(underscoreTest1_underscore.ts, 434, 81)) + filter(list: Dictionary, iterator: Iterator_, context?: any): T[]; +>filter : Symbol(Static.filter, Decl(underscoreTest1_underscore.ts, 432, 90), Decl(underscoreTest1_underscore.ts, 434, 82)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 435, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 435, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 435, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 435, 38)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 435, 15)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 435, 70)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 435, 71)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 435, 15)) - select(list: T[], iterator: Iterator, context?: any): T[]; ->select : Symbol(Static.select, Decl(underscoreTest1_underscore.ts, 435, 91), Decl(underscoreTest1_underscore.ts, 436, 81)) + select(list: T[], iterator: Iterator_, context?: any): T[]; +>select : Symbol(Static.select, Decl(underscoreTest1_underscore.ts, 435, 92), Decl(underscoreTest1_underscore.ts, 436, 82)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 436, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 436, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 436, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 436, 28)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 436, 15)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 436, 60)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 436, 61)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 436, 15)) - select(list: Dictionary, iterator: Iterator, context?: any): T[]; ->select : Symbol(Static.select, Decl(underscoreTest1_underscore.ts, 435, 91), Decl(underscoreTest1_underscore.ts, 436, 81)) + select(list: Dictionary, iterator: Iterator_, context?: any): T[]; +>select : Symbol(Static.select, Decl(underscoreTest1_underscore.ts, 435, 92), Decl(underscoreTest1_underscore.ts, 436, 82)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 437, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 437, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 437, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 437, 38)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 437, 15)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 437, 70)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 437, 71)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 437, 15)) where(list: T[], properties: Object): T[]; ->where : Symbol(Static.where, Decl(underscoreTest1_underscore.ts, 437, 91), Decl(underscoreTest1_underscore.ts, 439, 53)) +>where : Symbol(Static.where, Decl(underscoreTest1_underscore.ts, 437, 92), Decl(underscoreTest1_underscore.ts, 439, 53)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 439, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 439, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 439, 14)) @@ -3871,7 +3871,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 439, 14)) where(list: Dictionary, properties: Object): T[]; ->where : Symbol(Static.where, Decl(underscoreTest1_underscore.ts, 437, 91), Decl(underscoreTest1_underscore.ts, 439, 53)) +>where : Symbol(Static.where, Decl(underscoreTest1_underscore.ts, 437, 92), Decl(underscoreTest1_underscore.ts, 439, 53)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 440, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 440, 17)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -3899,115 +3899,115 @@ module Underscore { >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 443, 18)) - reject(list: T[], iterator: Iterator, context?: any): T[]; ->reject : Symbol(Static.reject, Decl(underscoreTest1_underscore.ts, 443, 65), Decl(underscoreTest1_underscore.ts, 445, 81)) + reject(list: T[], iterator: Iterator_, context?: any): T[]; +>reject : Symbol(Static.reject, Decl(underscoreTest1_underscore.ts, 443, 65), Decl(underscoreTest1_underscore.ts, 445, 82)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 445, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 445, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 445, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 445, 28)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 445, 15)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 445, 60)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 445, 61)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 445, 15)) - reject(list: Dictionary, iterator: Iterator, context?: any): T[]; ->reject : Symbol(Static.reject, Decl(underscoreTest1_underscore.ts, 443, 65), Decl(underscoreTest1_underscore.ts, 445, 81)) + reject(list: Dictionary, iterator: Iterator_, context?: any): T[]; +>reject : Symbol(Static.reject, Decl(underscoreTest1_underscore.ts, 443, 65), Decl(underscoreTest1_underscore.ts, 445, 82)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 446, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 446, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 446, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 446, 38)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 446, 15)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 446, 70)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 446, 71)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 446, 15)) - every(list: T[], iterator?: Iterator, context?: any): boolean; ->every : Symbol(Static.every, Decl(underscoreTest1_underscore.ts, 446, 91), Decl(underscoreTest1_underscore.ts, 448, 85)) + every(list: T[], iterator?: Iterator_, context?: any): boolean; +>every : Symbol(Static.every, Decl(underscoreTest1_underscore.ts, 446, 92), Decl(underscoreTest1_underscore.ts, 448, 86)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 448, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 448, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 448, 14)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 448, 27)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 448, 14)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 448, 60)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 448, 61)) - every(list: Dictionary, iterator?: Iterator, context?: any): boolean; ->every : Symbol(Static.every, Decl(underscoreTest1_underscore.ts, 446, 91), Decl(underscoreTest1_underscore.ts, 448, 85)) + every(list: Dictionary, iterator?: Iterator_, context?: any): boolean; +>every : Symbol(Static.every, Decl(underscoreTest1_underscore.ts, 446, 92), Decl(underscoreTest1_underscore.ts, 448, 86)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 449, 14)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 449, 17)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 449, 14)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 449, 37)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 449, 14)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 449, 70)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 449, 71)) - all(list: T[], iterator?: Iterator, context?: any): boolean; ->all : Symbol(Static.all, Decl(underscoreTest1_underscore.ts, 449, 95), Decl(underscoreTest1_underscore.ts, 450, 83)) + all(list: T[], iterator?: Iterator_, context?: any): boolean; +>all : Symbol(Static.all, Decl(underscoreTest1_underscore.ts, 449, 96), Decl(underscoreTest1_underscore.ts, 450, 84)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 450, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 450, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 450, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 450, 25)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 450, 12)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 450, 58)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 450, 59)) - all(list: Dictionary, iterator?: Iterator, context?: any): boolean; ->all : Symbol(Static.all, Decl(underscoreTest1_underscore.ts, 449, 95), Decl(underscoreTest1_underscore.ts, 450, 83)) + all(list: Dictionary, iterator?: Iterator_, context?: any): boolean; +>all : Symbol(Static.all, Decl(underscoreTest1_underscore.ts, 449, 96), Decl(underscoreTest1_underscore.ts, 450, 84)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 451, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 451, 15)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 451, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 451, 35)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 451, 12)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 451, 68)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 451, 69)) - some(list: T[], iterator?: Iterator, context?: any): boolean; ->some : Symbol(Static.some, Decl(underscoreTest1_underscore.ts, 451, 93), Decl(underscoreTest1_underscore.ts, 453, 84)) + some(list: T[], iterator?: Iterator_, context?: any): boolean; +>some : Symbol(Static.some, Decl(underscoreTest1_underscore.ts, 451, 94), Decl(underscoreTest1_underscore.ts, 453, 85)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 453, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 453, 16)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 453, 13)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 453, 26)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 453, 13)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 453, 59)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 453, 60)) - some(list: Dictionary, iterator?: Iterator, context?: any): boolean; ->some : Symbol(Static.some, Decl(underscoreTest1_underscore.ts, 451, 93), Decl(underscoreTest1_underscore.ts, 453, 84)) + some(list: Dictionary, iterator?: Iterator_, context?: any): boolean; +>some : Symbol(Static.some, Decl(underscoreTest1_underscore.ts, 451, 94), Decl(underscoreTest1_underscore.ts, 453, 85)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 454, 13)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 454, 16)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 454, 13)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 454, 36)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 454, 13)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 454, 69)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 454, 70)) - any(list: T[], iterator?: Iterator, context?: any): boolean; ->any : Symbol(Static.any, Decl(underscoreTest1_underscore.ts, 454, 94), Decl(underscoreTest1_underscore.ts, 455, 83)) + any(list: T[], iterator?: Iterator_, context?: any): boolean; +>any : Symbol(Static.any, Decl(underscoreTest1_underscore.ts, 454, 95), Decl(underscoreTest1_underscore.ts, 455, 84)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 455, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 455, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 455, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 455, 25)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 455, 12)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 455, 58)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 455, 59)) - any(list: Dictionary, iterator?: Iterator, context?: any): boolean; ->any : Symbol(Static.any, Decl(underscoreTest1_underscore.ts, 454, 94), Decl(underscoreTest1_underscore.ts, 455, 83)) + any(list: Dictionary, iterator?: Iterator_, context?: any): boolean; +>any : Symbol(Static.any, Decl(underscoreTest1_underscore.ts, 454, 95), Decl(underscoreTest1_underscore.ts, 455, 84)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 456, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 456, 15)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 456, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 456, 35)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 456, 12)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 456, 68)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 456, 69)) contains(list: T[], value: T): boolean; ->contains : Symbol(Static.contains, Decl(underscoreTest1_underscore.ts, 456, 93), Decl(underscoreTest1_underscore.ts, 458, 50)) +>contains : Symbol(Static.contains, Decl(underscoreTest1_underscore.ts, 456, 94), Decl(underscoreTest1_underscore.ts, 458, 50)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 458, 17)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 458, 20)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 458, 17)) @@ -4015,7 +4015,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 458, 17)) contains(list: Dictionary, value: T): boolean; ->contains : Symbol(Static.contains, Decl(underscoreTest1_underscore.ts, 456, 93), Decl(underscoreTest1_underscore.ts, 458, 50)) +>contains : Symbol(Static.contains, Decl(underscoreTest1_underscore.ts, 456, 94), Decl(underscoreTest1_underscore.ts, 458, 50)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 459, 17)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 459, 20)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4064,77 +4064,77 @@ module Underscore { >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 467, 36)) - max(list: T[], iterator?: Iterator, context?: any): T; ->max : Symbol(Static.max, Decl(underscoreTest1_underscore.ts, 467, 66), Decl(underscoreTest1_underscore.ts, 469, 73)) + max(list: T[], iterator?: Iterator_, context?: any): T; +>max : Symbol(Static.max, Decl(underscoreTest1_underscore.ts, 467, 66), Decl(underscoreTest1_underscore.ts, 469, 74)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 469, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 469, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 469, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 469, 25)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 469, 12)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 469, 54)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 469, 55)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 469, 12)) - max(list: Dictionary, iterator?: Iterator, context?: any): T; ->max : Symbol(Static.max, Decl(underscoreTest1_underscore.ts, 467, 66), Decl(underscoreTest1_underscore.ts, 469, 73)) + max(list: Dictionary, iterator?: Iterator_, context?: any): T; +>max : Symbol(Static.max, Decl(underscoreTest1_underscore.ts, 467, 66), Decl(underscoreTest1_underscore.ts, 469, 74)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 470, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 470, 15)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 470, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 470, 35)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 470, 12)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 470, 64)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 470, 65)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 470, 12)) - min(list: T[], iterator?: Iterator, context?: any): T; ->min : Symbol(Static.min, Decl(underscoreTest1_underscore.ts, 470, 83), Decl(underscoreTest1_underscore.ts, 472, 73)) + min(list: T[], iterator?: Iterator_, context?: any): T; +>min : Symbol(Static.min, Decl(underscoreTest1_underscore.ts, 470, 84), Decl(underscoreTest1_underscore.ts, 472, 74)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 472, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 472, 15)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 472, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 472, 25)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 472, 12)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 472, 54)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 472, 55)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 472, 12)) - min(list: Dictionary, iterator?: Iterator, context?: any): T; ->min : Symbol(Static.min, Decl(underscoreTest1_underscore.ts, 470, 83), Decl(underscoreTest1_underscore.ts, 472, 73)) + min(list: Dictionary, iterator?: Iterator_, context?: any): T; +>min : Symbol(Static.min, Decl(underscoreTest1_underscore.ts, 470, 84), Decl(underscoreTest1_underscore.ts, 472, 74)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 473, 12)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 473, 15)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 473, 12)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 473, 35)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 473, 12)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 473, 64)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 473, 65)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 473, 12)) - sortBy(list: T[], iterator: Iterator, context?: any): T[]; ->sortBy : Symbol(Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) + sortBy(list: T[], iterator: Iterator_, context?: any): T[]; +>sortBy : Symbol(Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 84), Decl(underscoreTest1_underscore.ts, 475, 78), Decl(underscoreTest1_underscore.ts, 476, 88), Decl(underscoreTest1_underscore.ts, 477, 56)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 475, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 475, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 475, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 475, 28)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 475, 15)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 475, 56)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 475, 57)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 475, 15)) - sortBy(list: Dictionary, iterator: Iterator, context?: any): T[]; ->sortBy : Symbol(Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) + sortBy(list: Dictionary, iterator: Iterator_, context?: any): T[]; +>sortBy : Symbol(Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 84), Decl(underscoreTest1_underscore.ts, 475, 78), Decl(underscoreTest1_underscore.ts, 476, 88), Decl(underscoreTest1_underscore.ts, 477, 56)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 476, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 476, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 476, 15)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 476, 38)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 476, 15)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 476, 66)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 476, 67)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 476, 15)) sortBy(list: T[], propertyName: string): T[]; ->sortBy : Symbol(Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) +>sortBy : Symbol(Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 84), Decl(underscoreTest1_underscore.ts, 475, 78), Decl(underscoreTest1_underscore.ts, 476, 88), Decl(underscoreTest1_underscore.ts, 477, 56)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 477, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 477, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 477, 15)) @@ -4142,7 +4142,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 477, 15)) sortBy(list: Dictionary, propertyName: string): T[]; ->sortBy : Symbol(Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 83), Decl(underscoreTest1_underscore.ts, 475, 77), Decl(underscoreTest1_underscore.ts, 476, 87), Decl(underscoreTest1_underscore.ts, 477, 56)) +>sortBy : Symbol(Static.sortBy, Decl(underscoreTest1_underscore.ts, 473, 84), Decl(underscoreTest1_underscore.ts, 475, 78), Decl(underscoreTest1_underscore.ts, 476, 88), Decl(underscoreTest1_underscore.ts, 477, 56)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 478, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 478, 18)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4150,33 +4150,33 @@ module Underscore { >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 478, 38)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 478, 15)) - groupBy(list: T[], iterator?: Iterator, context?: any): Dictionary; ->groupBy : Symbol(Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) + groupBy(list: T[], iterator?: Iterator_, context?: any): Dictionary; +>groupBy : Symbol(Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 92), Decl(underscoreTest1_underscore.ts, 481, 102), Decl(underscoreTest1_underscore.ts, 482, 69)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 480, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 480, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 480, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 480, 29)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 480, 16)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 480, 58)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 480, 59)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 480, 16)) - groupBy(list: Dictionary, iterator?: Iterator, context?: any): Dictionary; ->groupBy : Symbol(Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) + groupBy(list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; +>groupBy : Symbol(Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 92), Decl(underscoreTest1_underscore.ts, 481, 102), Decl(underscoreTest1_underscore.ts, 482, 69)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 481, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 481, 19)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 481, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 481, 39)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 481, 16)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 481, 68)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 481, 69)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 481, 16)) groupBy(list: T[], propertyName: string): Dictionary; ->groupBy : Symbol(Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) +>groupBy : Symbol(Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 92), Decl(underscoreTest1_underscore.ts, 481, 102), Decl(underscoreTest1_underscore.ts, 482, 69)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 482, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 482, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 482, 16)) @@ -4185,7 +4185,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 482, 16)) groupBy(list: Dictionary, propertyName: string): Dictionary; ->groupBy : Symbol(Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 91), Decl(underscoreTest1_underscore.ts, 481, 101), Decl(underscoreTest1_underscore.ts, 482, 69)) +>groupBy : Symbol(Static.groupBy, Decl(underscoreTest1_underscore.ts, 478, 66), Decl(underscoreTest1_underscore.ts, 480, 92), Decl(underscoreTest1_underscore.ts, 481, 102), Decl(underscoreTest1_underscore.ts, 482, 69)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 483, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 483, 19)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4194,31 +4194,31 @@ module Underscore { >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 483, 16)) - countBy(list: T[], iterator?: Iterator, context?: any): Dictionary; ->countBy : Symbol(Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) + countBy(list: T[], iterator?: Iterator_, context?: any): Dictionary; +>countBy : Symbol(Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 95), Decl(underscoreTest1_underscore.ts, 486, 105), Decl(underscoreTest1_underscore.ts, 487, 72)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 485, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 485, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 485, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 485, 29)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 485, 16)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 485, 58)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 485, 59)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) - countBy(list: Dictionary, iterator?: Iterator, context?: any): Dictionary; ->countBy : Symbol(Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) + countBy(list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; +>countBy : Symbol(Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 95), Decl(underscoreTest1_underscore.ts, 486, 105), Decl(underscoreTest1_underscore.ts, 487, 72)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 486, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 486, 19)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 486, 16)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 486, 39)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 486, 16)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 486, 68)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 486, 69)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) countBy(list: T[], propertyName: string): Dictionary; ->countBy : Symbol(Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) +>countBy : Symbol(Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 95), Decl(underscoreTest1_underscore.ts, 486, 105), Decl(underscoreTest1_underscore.ts, 487, 72)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 487, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 487, 19)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 487, 16)) @@ -4226,7 +4226,7 @@ module Underscore { >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) countBy(list: Dictionary, propertyName: string): Dictionary; ->countBy : Symbol(Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 94), Decl(underscoreTest1_underscore.ts, 486, 104), Decl(underscoreTest1_underscore.ts, 487, 72)) +>countBy : Symbol(Static.countBy, Decl(underscoreTest1_underscore.ts, 483, 79), Decl(underscoreTest1_underscore.ts, 485, 95), Decl(underscoreTest1_underscore.ts, 486, 105), Decl(underscoreTest1_underscore.ts, 487, 72)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 488, 16)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 488, 19)) >Dictionary : Symbol(Dictionary, Decl(underscoreTest1_underscore.ts, 0, 0)) @@ -4421,7 +4421,7 @@ module Underscore { >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 527, 26)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 527, 13)) - uniq(list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; + uniq(list: T[], isSorted: boolean, iterator: Iterator_, context?: any): U[]; >uniq : Symbol(Static.uniq, Decl(underscoreTest1_underscore.ts, 525, 56), Decl(underscoreTest1_underscore.ts, 527, 52)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 528, 13)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 528, 15)) @@ -4429,36 +4429,36 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 528, 13)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 528, 29)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 528, 48)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 528, 13)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 528, 15)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 528, 74)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 528, 75)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 528, 15)) unique(list: T[], isSorted?: boolean): T[]; ->unique : Symbol(Static.unique, Decl(underscoreTest1_underscore.ts, 528, 95), Decl(underscoreTest1_underscore.ts, 529, 54)) +>unique : Symbol(Static.unique, Decl(underscoreTest1_underscore.ts, 528, 96), Decl(underscoreTest1_underscore.ts, 529, 54)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 529, 15)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 529, 18)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 529, 15)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 529, 28)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 529, 15)) - unique(list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; ->unique : Symbol(Static.unique, Decl(underscoreTest1_underscore.ts, 528, 95), Decl(underscoreTest1_underscore.ts, 529, 54)) + unique(list: T[], isSorted: boolean, iterator: Iterator_, context?: any): U[]; +>unique : Symbol(Static.unique, Decl(underscoreTest1_underscore.ts, 528, 96), Decl(underscoreTest1_underscore.ts, 529, 54)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 530, 15)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 530, 17)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 530, 21)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 530, 15)) >isSorted : Symbol(isSorted, Decl(underscoreTest1_underscore.ts, 530, 31)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 530, 50)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 530, 15)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 530, 17)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 530, 76)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 530, 77)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 530, 17)) zip(a0: T0[], a1: T1[]): Tuple2[]; ->zip : Symbol(Static.zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) +>zip : Symbol(Static.zip, Decl(underscoreTest1_underscore.ts, 530, 98), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) >T0 : Symbol(T0, Decl(underscoreTest1_underscore.ts, 532, 12)) >T1 : Symbol(T1, Decl(underscoreTest1_underscore.ts, 532, 15)) >a0 : Symbol(a0, Decl(underscoreTest1_underscore.ts, 532, 20)) @@ -4470,7 +4470,7 @@ module Underscore { >T1 : Symbol(T1, Decl(underscoreTest1_underscore.ts, 532, 15)) zip(a0: T0[], a1: T1[], a2: T2[]): Tuple3[]; ->zip : Symbol(Static.zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) +>zip : Symbol(Static.zip, Decl(underscoreTest1_underscore.ts, 530, 98), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) >T0 : Symbol(T0, Decl(underscoreTest1_underscore.ts, 533, 12)) >T1 : Symbol(T1, Decl(underscoreTest1_underscore.ts, 533, 15)) >T2 : Symbol(T2, Decl(underscoreTest1_underscore.ts, 533, 19)) @@ -4486,7 +4486,7 @@ module Underscore { >T2 : Symbol(T2, Decl(underscoreTest1_underscore.ts, 533, 19)) zip(a0: T0[], a1: T1[], a2: T2[], a3: T3[]): Tuple4[]; ->zip : Symbol(Static.zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) +>zip : Symbol(Static.zip, Decl(underscoreTest1_underscore.ts, 530, 98), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) >T0 : Symbol(T0, Decl(underscoreTest1_underscore.ts, 534, 12)) >T1 : Symbol(T1, Decl(underscoreTest1_underscore.ts, 534, 15)) >T2 : Symbol(T2, Decl(underscoreTest1_underscore.ts, 534, 19)) @@ -4506,7 +4506,7 @@ module Underscore { >T3 : Symbol(T3, Decl(underscoreTest1_underscore.ts, 534, 23)) zip(...arrays: any[][]): any[][]; ->zip : Symbol(Static.zip, Decl(underscoreTest1_underscore.ts, 530, 97), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) +>zip : Symbol(Static.zip, Decl(underscoreTest1_underscore.ts, 530, 98), Decl(underscoreTest1_underscore.ts, 532, 58), Decl(underscoreTest1_underscore.ts, 533, 76), Decl(underscoreTest1_underscore.ts, 534, 94)) >arrays : Symbol(arrays, Decl(underscoreTest1_underscore.ts, 535, 12)) object(list: any[][]): any; @@ -4545,7 +4545,7 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 544, 20)) >propertyName : Symbol(propertyName, Decl(underscoreTest1_underscore.ts, 544, 41)) - sortedIndex(list: T[], obj: T, iterator?: Iterator, context?: any): number; + sortedIndex(list: T[], obj: T, iterator?: Iterator_, context?: any): number; >sortedIndex : Symbol(Static.sortedIndex, Decl(underscoreTest1_underscore.ts, 542, 72), Decl(underscoreTest1_underscore.ts, 544, 72)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 545, 20)) >list : Symbol(list, Decl(underscoreTest1_underscore.ts, 545, 23)) @@ -4553,16 +4553,16 @@ module Underscore { >obj : Symbol(obj, Decl(underscoreTest1_underscore.ts, 545, 33)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 545, 20)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 545, 41)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 545, 20)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 545, 70)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 545, 71)) range(stop: number): number[]; ->range : Symbol(Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>range : Symbol(Static.range, Decl(underscoreTest1_underscore.ts, 545, 95), Decl(underscoreTest1_underscore.ts, 547, 38)) >stop : Symbol(stop, Decl(underscoreTest1_underscore.ts, 547, 14)) range(start: number, stop: number, step?: number): number[]; ->range : Symbol(Static.range, Decl(underscoreTest1_underscore.ts, 545, 94), Decl(underscoreTest1_underscore.ts, 547, 38)) +>range : Symbol(Static.range, Decl(underscoreTest1_underscore.ts, 545, 95), Decl(underscoreTest1_underscore.ts, 547, 38)) >start : Symbol(start, Decl(underscoreTest1_underscore.ts, 548, 14)) >stop : Symbol(stop, Decl(underscoreTest1_underscore.ts, 548, 28)) >step : Symbol(step, Decl(underscoreTest1_underscore.ts, 548, 42)) @@ -4833,22 +4833,22 @@ module Underscore { >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 620, 17)) >T : Symbol(T, Decl(underscoreTest1_underscore.ts, 620, 17)) - times(n: number, iterator: Iterator, context?: any): U[]; + times(n: number, iterator: Iterator_, context?: any): U[]; >times : Symbol(Static.times, Decl(underscoreTest1_underscore.ts, 620, 33)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 622, 14)) >n : Symbol(n, Decl(underscoreTest1_underscore.ts, 622, 17)) >iterator : Symbol(iterator, Decl(underscoreTest1_underscore.ts, 622, 27)) ->Iterator : Symbol(Iterator, Decl(underscoreTest1_underscore.ts, 2, 1)) +>Iterator_ : Symbol(Iterator_, Decl(underscoreTest1_underscore.ts, 2, 1)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 622, 14)) ->context : Symbol(context, Decl(underscoreTest1_underscore.ts, 622, 58)) +>context : Symbol(context, Decl(underscoreTest1_underscore.ts, 622, 59)) >U : Symbol(U, Decl(underscoreTest1_underscore.ts, 622, 14)) random(max: number): number; ->random : Symbol(Static.random, Decl(underscoreTest1_underscore.ts, 622, 79), Decl(underscoreTest1_underscore.ts, 624, 36)) +>random : Symbol(Static.random, Decl(underscoreTest1_underscore.ts, 622, 80), Decl(underscoreTest1_underscore.ts, 624, 36)) >max : Symbol(max, Decl(underscoreTest1_underscore.ts, 624, 15)) random(min: number, max: number): number; ->random : Symbol(Static.random, Decl(underscoreTest1_underscore.ts, 622, 79), Decl(underscoreTest1_underscore.ts, 624, 36)) +>random : Symbol(Static.random, Decl(underscoreTest1_underscore.ts, 622, 80), Decl(underscoreTest1_underscore.ts, 624, 36)) >min : Symbol(min, Decl(underscoreTest1_underscore.ts, 625, 15)) >max : Symbol(max, Decl(underscoreTest1_underscore.ts, 625, 27)) diff --git a/tests/baselines/reference/underscoreTest1.types b/tests/baselines/reference/underscoreTest1.types index 97e064fb12c..afcc807b756 100644 --- a/tests/baselines/reference/underscoreTest1.types +++ b/tests/baselines/reference/underscoreTest1.types @@ -10,9 +10,9 @@ declare function alert(x: string): void; _.each([1, 2, 3], (num) => alert(num.toString())); >_.each([1, 2, 3], (num) => alert(num.toString())) : void ->_.each : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; } +>_.each : { (list: T[], iterator: Iterator_, context?: any): void; (list: Dictionary, iterator: Iterator_, context?: any): void; } >_ : Underscore.Static ->each : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; } +>each : { (list: T[], iterator: Iterator_, context?: any): void; (list: Dictionary, iterator: Iterator_, context?: any): void; } >[1, 2, 3] : number[] >1 : 1 >2 : 2 @@ -28,9 +28,9 @@ _.each([1, 2, 3], (num) => alert(num.toString())); _.each({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => alert(value.toString())); >_.each({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => alert(value.toString())) : void ->_.each : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; } +>_.each : { (list: T[], iterator: Iterator_, context?: any): void; (list: Dictionary, iterator: Iterator_, context?: any): void; } >_ : Underscore.Static ->each : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; } +>each : { (list: T[], iterator: Iterator_, context?: any): void; (list: Dictionary, iterator: Iterator_, context?: any): void; } >{ one: 1, two: 2, three: 3 } : { one: number; two: number; three: number; } >one : number >1 : 1 @@ -50,9 +50,9 @@ _.each({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => alert(valu _.map([1, 2, 3], (num) => num * 3); >_.map([1, 2, 3], (num) => num * 3) : number[] ->_.map : { (list: T[], iterator: Iterator, context?: any): U[]; (list: Dictionary, iterator: Iterator, context?: any): U[]; } +>_.map : { (list: T[], iterator: Iterator_, context?: any): U[]; (list: Dictionary, iterator: Iterator_, context?: any): U[]; } >_ : Underscore.Static ->map : { (list: T[], iterator: Iterator, context?: any): U[]; (list: Dictionary, iterator: Iterator, context?: any): U[]; } +>map : { (list: T[], iterator: Iterator_, context?: any): U[]; (list: Dictionary, iterator: Iterator_, context?: any): U[]; } >[1, 2, 3] : number[] >1 : 1 >2 : 2 @@ -65,9 +65,9 @@ _.map([1, 2, 3], (num) => num * 3); _.map({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => value * 3); >_.map({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => value * 3) : number[] ->_.map : { (list: T[], iterator: Iterator, context?: any): U[]; (list: Dictionary, iterator: Iterator, context?: any): U[]; } +>_.map : { (list: T[], iterator: Iterator_, context?: any): U[]; (list: Dictionary, iterator: Iterator_, context?: any): U[]; } >_ : Underscore.Static ->map : { (list: T[], iterator: Iterator, context?: any): U[]; (list: Dictionary, iterator: Iterator, context?: any): U[]; } +>map : { (list: T[], iterator: Iterator_, context?: any): U[]; (list: Dictionary, iterator: Iterator_, context?: any): U[]; } >{ one: 1, two: 2, three: 3 } : { one: number; two: number; three: number; } >one : number >1 : 1 @@ -133,9 +133,9 @@ var flat = _.reduceRight(list, (a, b) => a.concat(b), []); var even = _.find([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); >even : number >_.find([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0) : number ->_.find : { (list: T[], iterator: Iterator, context?: any): T; (list: Dictionary, iterator: Iterator, context?: any): T; } +>_.find : { (list: T[], iterator: Iterator_, context?: any): T; (list: Dictionary, iterator: Iterator_, context?: any): T; } >_ : Underscore.Static ->find : { (list: T[], iterator: Iterator, context?: any): T; (list: Dictionary, iterator: Iterator, context?: any): T; } +>find : { (list: T[], iterator: Iterator_, context?: any): T; (list: Dictionary, iterator: Iterator_, context?: any): T; } >[1, 2, 3, 4, 5, 6] : number[] >1 : 1 >2 : 2 @@ -154,9 +154,9 @@ var even = _.find([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); var evens = _.filter([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); >evens : number[] >_.filter([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0) : number[] ->_.filter : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; } +>_.filter : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; } >_ : Underscore.Static ->filter : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; } +>filter : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; } >[1, 2, 3, 4, 5, 6] : number[] >1 : 1 >2 : 2 @@ -212,9 +212,9 @@ _.where(listOfPlays, { author: "Shakespeare", year: 1611 }); var odds = _.reject([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); >odds : number[] >_.reject([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0) : number[] ->_.reject : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; } +>_.reject : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; } >_ : Underscore.Static ->reject : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; } +>reject : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; } >[1, 2, 3, 4, 5, 6] : number[] >1 : 1 >2 : 2 @@ -232,9 +232,9 @@ var odds = _.reject([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); _.all([true, 1, null, 'yes'], _.identity); >_.all([true, 1, null, 'yes'], _.identity) : boolean ->_.all : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } +>_.all : { (list: T[], iterator?: Iterator_, context?: any): boolean; (list: Dictionary, iterator?: Iterator_, context?: any): boolean; } >_ : Underscore.Static ->all : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } +>all : { (list: T[], iterator?: Iterator_, context?: any): boolean; (list: Dictionary, iterator?: Iterator_, context?: any): boolean; } >[true, 1, null, 'yes'] : (true | 1 | "yes")[] >true : true >1 : 1 @@ -246,9 +246,9 @@ _.all([true, 1, null, 'yes'], _.identity); _.any([null, 0, 'yes', false]); >_.any([null, 0, 'yes', false]) : boolean ->_.any : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } +>_.any : { (list: T[], iterator?: Iterator_, context?: any): boolean; (list: Dictionary, iterator?: Iterator_, context?: any): boolean; } >_ : Underscore.Static ->any : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } +>any : { (list: T[], iterator?: Iterator_, context?: any): boolean; (list: Dictionary, iterator?: Iterator_, context?: any): boolean; } >[null, 0, 'yes', false] : (false | 0 | "yes")[] >null : null >0 : 0 @@ -311,9 +311,9 @@ _.pluck(stooges, 'name'); _.max(stooges, (stooge) => stooge.age); >_.max(stooges, (stooge) => stooge.age) : { name: string; age: number; } ->_.max : { (list: T[], iterator?: Iterator, context?: any): T; (list: Dictionary, iterator?: Iterator, context?: any): T; } +>_.max : { (list: T[], iterator?: Iterator_, context?: any): T; (list: Dictionary, iterator?: Iterator_, context?: any): T; } >_ : Underscore.Static ->max : { (list: T[], iterator?: Iterator, context?: any): T; (list: Dictionary, iterator?: Iterator, context?: any): T; } +>max : { (list: T[], iterator?: Iterator_, context?: any): T; (list: Dictionary, iterator?: Iterator_, context?: any): T; } >stooges : { name: string; age: number; }[] >(stooge) => stooge.age : (stooge: { name: string; age: number; }) => number >stooge : { name: string; age: number; } @@ -332,16 +332,16 @@ var numbers = [10, 5, 100, 2, 1000]; _.min(numbers); >_.min(numbers) : number ->_.min : { (list: T[], iterator?: Iterator, context?: any): T; (list: Dictionary, iterator?: Iterator, context?: any): T; } +>_.min : { (list: T[], iterator?: Iterator_, context?: any): T; (list: Dictionary, iterator?: Iterator_, context?: any): T; } >_ : Underscore.Static ->min : { (list: T[], iterator?: Iterator, context?: any): T; (list: Dictionary, iterator?: Iterator, context?: any): T; } +>min : { (list: T[], iterator?: Iterator_, context?: any): T; (list: Dictionary, iterator?: Iterator_, context?: any): T; } >numbers : number[] _.sortBy([1, 2, 3, 4, 5, 6], (num) => Math.sin(num)); >_.sortBy([1, 2, 3, 4, 5, 6], (num) => Math.sin(num)) : number[] ->_.sortBy : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; (list: T[], propertyName: string): T[]; (list: Dictionary, propertyName: string): T[]; } +>_.sortBy : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; (list: T[], propertyName: string): T[]; (list: Dictionary, propertyName: string): T[]; } >_ : Underscore.Static ->sortBy : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; (list: T[], propertyName: string): T[]; (list: Dictionary, propertyName: string): T[]; } +>sortBy : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; (list: T[], propertyName: string): T[]; (list: Dictionary, propertyName: string): T[]; } >[1, 2, 3, 4, 5, 6] : number[] >1 : 1 >2 : 2 @@ -361,14 +361,14 @@ _.sortBy([1, 2, 3, 4, 5, 6], (num) => Math.sin(num)); // not sure how this is typechecking at all.. Math.floor(e) is number not string..? _([1.3, 2.1, 2.4]).groupBy((e: number, i?: number, list?: number[]) => Math.floor(e)); >_([1.3, 2.1, 2.4]).groupBy((e: number, i?: number, list?: number[]) => Math.floor(e)) : Dictionary ->_([1.3, 2.1, 2.4]).groupBy : { (iterator?: Iterator, context?: any): Dictionary; (propertyName: string): Dictionary; } +>_([1.3, 2.1, 2.4]).groupBy : { (iterator?: Iterator_, context?: any): Dictionary; (propertyName: string): Dictionary; } >_([1.3, 2.1, 2.4]) : Underscore.WrappedArray >_ : Underscore.Static >[1.3, 2.1, 2.4] : number[] >1.3 : 1.3 >2.1 : 2.1 >2.4 : 2.4 ->groupBy : { (iterator?: Iterator, context?: any): Dictionary; (propertyName: string): Dictionary; } +>groupBy : { (iterator?: Iterator_, context?: any): Dictionary; (propertyName: string): Dictionary; } >(e: number, i?: number, list?: number[]) => Math.floor(e) : (e: number, i?: number, list?: number[]) => number >e : number >i : number @@ -381,9 +381,9 @@ _([1.3, 2.1, 2.4]).groupBy((e: number, i?: number, list?: number[]) => Math.floo _.groupBy([1.3, 2.1, 2.4], (num: number) => Math.floor(num)); >_.groupBy([1.3, 2.1, 2.4], (num: number) => Math.floor(num)) : Dictionary ->_.groupBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } +>_.groupBy : { (list: T[], iterator?: Iterator_, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } >_ : Underscore.Static ->groupBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } +>groupBy : { (list: T[], iterator?: Iterator_, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } >[1.3, 2.1, 2.4] : number[] >1.3 : 1.3 >2.1 : 2.1 @@ -398,9 +398,9 @@ _.groupBy([1.3, 2.1, 2.4], (num: number) => Math.floor(num)); _.groupBy(['one', 'two', 'three'], 'length'); >_.groupBy(['one', 'two', 'three'], 'length') : Dictionary ->_.groupBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } +>_.groupBy : { (list: T[], iterator?: Iterator_, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } >_ : Underscore.Static ->groupBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } +>groupBy : { (list: T[], iterator?: Iterator_, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } >['one', 'two', 'three'] : string[] >'one' : "one" >'two' : "two" @@ -409,9 +409,9 @@ _.groupBy(['one', 'two', 'three'], 'length'); _.countBy([1, 2, 3, 4, 5], (num) => num % 2 == 0 ? 'even' : 'odd'); >_.countBy([1, 2, 3, 4, 5], (num) => num % 2 == 0 ? 'even' : 'odd') : Dictionary ->_.countBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } +>_.countBy : { (list: T[], iterator?: Iterator_, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } >_ : Underscore.Static ->countBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } +>countBy : { (list: T[], iterator?: Iterator_, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } >[1, 2, 3, 4, 5] : number[] >1 : 1 >2 : 2 @@ -643,9 +643,9 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); _.uniq([1, 2, 1, 3, 1, 4]); >_.uniq([1, 2, 1, 3, 1, 4]) : number[] ->_.uniq : { (list: T[], isSorted?: boolean): T[]; (list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; } +>_.uniq : { (list: T[], isSorted?: boolean): T[]; (list: T[], isSorted: boolean, iterator: Iterator_, context?: any): U[]; } >_ : Underscore.Static ->uniq : { (list: T[], isSorted?: boolean): T[]; (list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; } +>uniq : { (list: T[], isSorted?: boolean): T[]; (list: T[], isSorted: boolean, iterator: Iterator_, context?: any): U[]; } >[1, 2, 1, 3, 1, 4] : number[] >1 : 1 >2 : 2 @@ -729,9 +729,9 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); _.sortedIndex([10, 20, 30, 40, 50], 35); >_.sortedIndex([10, 20, 30, 40, 50], 35) : number ->_.sortedIndex : { (list: T[], obj: T, propertyName: string): number; (list: T[], obj: T, iterator?: Iterator, context?: any): number; } +>_.sortedIndex : { (list: T[], obj: T, propertyName: string): number; (list: T[], obj: T, iterator?: Iterator_, context?: any): number; } >_ : Underscore.Static ->sortedIndex : { (list: T[], obj: T, propertyName: string): number; (list: T[], obj: T, iterator?: Iterator, context?: any): number; } +>sortedIndex : { (list: T[], obj: T, propertyName: string): number; (list: T[], obj: T, iterator?: Iterator_, context?: any): number; } >[10, 20, 30, 40, 50] : number[] >10 : 10 >20 : 20 @@ -1017,9 +1017,9 @@ var renderNotes = _.after(notes.length, render); _.each(notes, (note) => note.asyncSave({ success: renderNotes })); >_.each(notes, (note) => note.asyncSave({ success: renderNotes })) : void ->_.each : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; } +>_.each : { (list: T[], iterator: Iterator_, context?: any): void; (list: Dictionary, iterator: Iterator_, context?: any): void; } >_ : Underscore.Static ->each : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; } +>each : { (list: T[], iterator: Iterator_, context?: any): void; (list: Dictionary, iterator: Iterator_, context?: any): void; } >notes : any[] >(note) => note.asyncSave({ success: renderNotes }) : (note: any) => any >note : any @@ -1226,11 +1226,11 @@ _.chain([1, 2, 3, 200]) >_.chain([1, 2, 3, 200]) .filter(function (num) { return num % 2 == 0; }) .tap(alert) .map(function (num) { return num * num }) .value() : number[] >_.chain([1, 2, 3, 200]) .filter(function (num) { return num % 2 == 0; }) .tap(alert) .map(function (num) { return num * num }) .value : () => number[] >_.chain([1, 2, 3, 200]) .filter(function (num) { return num % 2 == 0; }) .tap(alert) .map(function (num) { return num * num }) : Underscore.ChainedArray ->_.chain([1, 2, 3, 200]) .filter(function (num) { return num % 2 == 0; }) .tap(alert) .map : (iterator: Iterator, context?: any) => Underscore.ChainedArray +>_.chain([1, 2, 3, 200]) .filter(function (num) { return num % 2 == 0; }) .tap(alert) .map : (iterator: Iterator_, context?: any) => Underscore.ChainedArray >_.chain([1, 2, 3, 200]) .filter(function (num) { return num % 2 == 0; }) .tap(alert) : Underscore.ChainedArray >_.chain([1, 2, 3, 200]) .filter(function (num) { return num % 2 == 0; }) .tap : (interceptor: (object: number[]) => void) => Underscore.ChainedArray >_.chain([1, 2, 3, 200]) .filter(function (num) { return num % 2 == 0; }) : Underscore.ChainedArray ->_.chain([1, 2, 3, 200]) .filter : (iterator: Iterator, context?: any) => Underscore.ChainedArray +>_.chain([1, 2, 3, 200]) .filter : (iterator: Iterator_, context?: any) => Underscore.ChainedArray >_.chain([1, 2, 3, 200]) : Underscore.ChainedArray >_.chain : { (list: T[]): Underscore.ChainedArray; (list: Dictionary): Underscore.ChainedDictionary; (obj: T): Underscore.ChainedObject; } >_ : Underscore.Static @@ -1242,7 +1242,7 @@ _.chain([1, 2, 3, 200]) >200 : 200 .filter(function (num) { return num % 2 == 0; }) ->filter : (iterator: Iterator, context?: any) => Underscore.ChainedArray +>filter : (iterator: Iterator_, context?: any) => Underscore.ChainedArray >function (num) { return num % 2 == 0; } : (num: number) => boolean >num : number >num % 2 == 0 : boolean @@ -1257,7 +1257,7 @@ _.chain([1, 2, 3, 200]) >alert : (x: string) => void .map(function (num) { return num * num }) ->map : (iterator: Iterator, context?: any) => Underscore.ChainedArray +>map : (iterator: Iterator_, context?: any) => Underscore.ChainedArray >function (num) { return num * num } : (num: number) => number >num : number >num * num : number @@ -1524,9 +1524,9 @@ var genie; _.times(3, function (n) { genie.grantWishNumber(n); }); >_.times(3, function (n) { genie.grantWishNumber(n); }) : void[] ->_.times : (n: number, iterator: Iterator, context?: any) => U[] +>_.times : (n: number, iterator: Iterator_, context?: any) => U[] >_ : Underscore.Static ->times : (n: number, iterator: Iterator, context?: any) => U[] +>times : (n: number, iterator: Iterator_, context?: any) => U[] >3 : 3 >function (n) { genie.grantWishNumber(n); } : (n: number) => void >n : number @@ -1737,8 +1737,8 @@ interface Dictionary { >T : T } -interface Iterator { ->Iterator : Iterator +interface Iterator_ { +>Iterator_ : Iterator_ >T : T >U : U @@ -2011,35 +2011,35 @@ module Underscore { >Array : T[] >T : T - each(iterator: Iterator, context?: any): void; ->each : (iterator: Iterator, context?: any) => void ->iterator : Iterator ->Iterator : Iterator + each(iterator: Iterator_, context?: any): void; +>each : (iterator: Iterator_, context?: any) => void +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - forEach(iterator: Iterator, context?: any): void; ->forEach : (iterator: Iterator, context?: any) => void ->iterator : Iterator ->Iterator : Iterator + forEach(iterator: Iterator_, context?: any): void; +>forEach : (iterator: Iterator_, context?: any) => void +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - map(iterator: Iterator, context?: any): U[]; ->map : (iterator: Iterator, context?: any) => U[] + map(iterator: Iterator_, context?: any): U[]; +>map : (iterator: Iterator_, context?: any) => U[] >U : U ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any >U : U - collect(iterator: Iterator, context?: any): U[]; ->collect : (iterator: Iterator, context?: any) => U[] + collect(iterator: Iterator_, context?: any): U[]; +>collect : (iterator: Iterator_, context?: any) => U[] >U : U ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any @@ -2160,34 +2160,34 @@ module Underscore { >context : any >U : U - find(iterator: Iterator, context?: any): T; ->find : (iterator: Iterator, context?: any) => T ->iterator : Iterator ->Iterator : Iterator + find(iterator: Iterator_, context?: any): T; +>find : (iterator: Iterator_, context?: any) => T +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - detect(iterator: Iterator, context?: any): T; ->detect : (iterator: Iterator, context?: any) => T ->iterator : Iterator ->Iterator : Iterator + detect(iterator: Iterator_, context?: any): T; +>detect : (iterator: Iterator_, context?: any) => T +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - filter(iterator: Iterator, context?: any): T[]; ->filter : (iterator: Iterator, context?: any) => T[] ->iterator : Iterator ->Iterator : Iterator + filter(iterator: Iterator_, context?: any): T[]; +>filter : (iterator: Iterator_, context?: any) => T[] +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - select(iterator: Iterator, context?: any): T[]; ->select : (iterator: Iterator, context?: any) => T[] ->iterator : Iterator ->Iterator : Iterator + select(iterator: Iterator_, context?: any): T[]; +>select : (iterator: Iterator_, context?: any) => T[] +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T @@ -2204,39 +2204,39 @@ module Underscore { >Object : Object >T : T - reject(iterator: Iterator, context?: any): T[]; ->reject : (iterator: Iterator, context?: any) => T[] ->iterator : Iterator ->Iterator : Iterator + reject(iterator: Iterator_, context?: any): T[]; +>reject : (iterator: Iterator_, context?: any) => T[] +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - every(iterator?: Iterator, context?: any): boolean; ->every : (iterator?: Iterator, context?: any) => boolean ->iterator : Iterator ->Iterator : Iterator + every(iterator?: Iterator_, context?: any): boolean; +>every : (iterator?: Iterator_, context?: any) => boolean +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - all(iterator?: Iterator, context?: any): boolean; ->all : (iterator?: Iterator, context?: any) => boolean ->iterator : Iterator ->Iterator : Iterator + all(iterator?: Iterator_, context?: any): boolean; +>all : (iterator?: Iterator_, context?: any) => boolean +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - some(iterator?: Iterator, context?: any): boolean; ->some : (iterator?: Iterator, context?: any) => boolean ->iterator : Iterator ->Iterator : Iterator + some(iterator?: Iterator_, context?: any): boolean; +>some : (iterator?: Iterator_, context?: any) => boolean +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - any(iterator?: Iterator, context?: any): boolean; ->any : (iterator?: Iterator, context?: any) => boolean ->iterator : Iterator ->Iterator : Iterator + any(iterator?: Iterator_, context?: any): boolean; +>any : (iterator?: Iterator_, context?: any) => boolean +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any @@ -2259,60 +2259,60 @@ module Underscore { >pluck : (propertyName: string) => any[] >propertyName : string - max(iterator?: Iterator, context?: any): T; ->max : (iterator?: Iterator, context?: any) => T ->iterator : Iterator ->Iterator : Iterator + max(iterator?: Iterator_, context?: any): T; +>max : (iterator?: Iterator_, context?: any) => T +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - min(iterator?: Iterator, context?: any): T; ->min : (iterator?: Iterator, context?: any) => T ->iterator : Iterator ->Iterator : Iterator + min(iterator?: Iterator_, context?: any): T; +>min : (iterator?: Iterator_, context?: any) => T +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - sortBy(iterator: Iterator, context?: any): T[]; ->sortBy : { (iterator: Iterator, context?: any): T[]; (propertyName: string): T[]; } ->iterator : Iterator ->Iterator : Iterator + sortBy(iterator: Iterator_, context?: any): T[]; +>sortBy : { (iterator: Iterator_, context?: any): T[]; (propertyName: string): T[]; } +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T sortBy(propertyName: string): T[]; ->sortBy : { (iterator: Iterator, context?: any): T[]; (propertyName: string): T[]; } +>sortBy : { (iterator: Iterator_, context?: any): T[]; (propertyName: string): T[]; } >propertyName : string >T : T - groupBy(iterator?: Iterator, context?: any): Dictionary; ->groupBy : { (iterator?: Iterator, context?: any): Dictionary; (propertyName: string): Dictionary; } ->iterator : Iterator ->Iterator : Iterator + groupBy(iterator?: Iterator_, context?: any): Dictionary; +>groupBy : { (iterator?: Iterator_, context?: any): Dictionary; (propertyName: string): Dictionary; } +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >Dictionary : Dictionary >T : T groupBy(propertyName: string): Dictionary; ->groupBy : { (iterator?: Iterator, context?: any): Dictionary; (propertyName: string): Dictionary; } +>groupBy : { (iterator?: Iterator_, context?: any): Dictionary; (propertyName: string): Dictionary; } >propertyName : string >Dictionary : Dictionary >T : T - countBy(iterator?: Iterator, context?: any): Dictionary; ->countBy : { (iterator?: Iterator, context?: any): Dictionary; (propertyName: string): Dictionary; } ->iterator : Iterator ->Iterator : Iterator + countBy(iterator?: Iterator_, context?: any): Dictionary; +>countBy : { (iterator?: Iterator_, context?: any): Dictionary; (propertyName: string): Dictionary; } +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >Dictionary : Dictionary countBy(propertyName: string): Dictionary; ->countBy : { (iterator?: Iterator, context?: any): Dictionary; (propertyName: string): Dictionary; } +>countBy : { (iterator?: Iterator_, context?: any): Dictionary; (propertyName: string): Dictionary; } >propertyName : string >Dictionary : Dictionary @@ -2412,32 +2412,32 @@ module Underscore { >T : T uniq(isSorted?: boolean): T[]; ->uniq : { (isSorted?: boolean): T[]; (isSorted: boolean, iterator: Iterator, context?: any): U[]; } +>uniq : { (isSorted?: boolean): T[]; (isSorted: boolean, iterator: Iterator_, context?: any): U[]; } >isSorted : boolean >T : T - uniq(isSorted: boolean, iterator: Iterator, context?: any): U[]; ->uniq : { (isSorted?: boolean): T[]; (isSorted: boolean, iterator: Iterator, context?: any): U[]; } + uniq(isSorted: boolean, iterator: Iterator_, context?: any): U[]; +>uniq : { (isSorted?: boolean): T[]; (isSorted: boolean, iterator: Iterator_, context?: any): U[]; } >U : U >isSorted : boolean ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any >U : U unique(isSorted?: boolean): T[]; ->unique : { (isSorted?: boolean): T[]; (isSorted: boolean, iterator: Iterator, context?: any): U[]; } +>unique : { (isSorted?: boolean): T[]; (isSorted: boolean, iterator: Iterator_, context?: any): U[]; } >isSorted : boolean >T : T - unique(isSorted: boolean, iterator: Iterator, context?: any): U[]; ->unique : { (isSorted?: boolean): T[]; (isSorted: boolean, iterator: Iterator, context?: any): U[]; } + unique(isSorted: boolean, iterator: Iterator_, context?: any): U[]; +>unique : { (isSorted?: boolean): T[]; (isSorted: boolean, iterator: Iterator_, context?: any): U[]; } >U : U >isSorted : boolean ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any @@ -2467,17 +2467,17 @@ module Underscore { >fromIndex : number sortedIndex(obj: T, propertyName: string): number; ->sortedIndex : { (obj: T, propertyName: string): number; (obj: T, iterator?: Iterator, context?: any): number; } +>sortedIndex : { (obj: T, propertyName: string): number; (obj: T, iterator?: Iterator_, context?: any): number; } >obj : T >T : T >propertyName : string - sortedIndex(obj: T, iterator?: Iterator, context?: any): number; ->sortedIndex : { (obj: T, propertyName: string): number; (obj: T, iterator?: Iterator, context?: any): number; } + sortedIndex(obj: T, iterator?: Iterator_, context?: any): number; +>sortedIndex : { (obj: T, propertyName: string): number; (obj: T, iterator?: Iterator_, context?: any): number; } >obj : T >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any @@ -2550,35 +2550,35 @@ module Underscore { >Dictionary : Dictionary >T : T - each(iterator: Iterator, context?: any): void; ->each : (iterator: Iterator, context?: any) => void ->iterator : Iterator ->Iterator : Iterator + each(iterator: Iterator_, context?: any): void; +>each : (iterator: Iterator_, context?: any) => void +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - forEach(iterator: Iterator, context?: any): void; ->forEach : (iterator: Iterator, context?: any) => void ->iterator : Iterator ->Iterator : Iterator + forEach(iterator: Iterator_, context?: any): void; +>forEach : (iterator: Iterator_, context?: any) => void +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - map(iterator: Iterator, context?: any): U[]; ->map : (iterator: Iterator, context?: any) => U[] + map(iterator: Iterator_, context?: any): U[]; +>map : (iterator: Iterator_, context?: any) => U[] >U : U ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any >U : U - collect(iterator: Iterator, context?: any): U[]; ->collect : (iterator: Iterator, context?: any) => U[] + collect(iterator: Iterator_, context?: any): U[]; +>collect : (iterator: Iterator_, context?: any) => U[] >U : U ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any @@ -2699,34 +2699,34 @@ module Underscore { >context : any >U : U - find(iterator: Iterator, context?: any): T; ->find : (iterator: Iterator, context?: any) => T ->iterator : Iterator ->Iterator : Iterator + find(iterator: Iterator_, context?: any): T; +>find : (iterator: Iterator_, context?: any) => T +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - detect(iterator: Iterator, context?: any): T; ->detect : (iterator: Iterator, context?: any) => T ->iterator : Iterator ->Iterator : Iterator + detect(iterator: Iterator_, context?: any): T; +>detect : (iterator: Iterator_, context?: any) => T +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - filter(iterator: Iterator, context?: any): T[]; ->filter : (iterator: Iterator, context?: any) => T[] ->iterator : Iterator ->Iterator : Iterator + filter(iterator: Iterator_, context?: any): T[]; +>filter : (iterator: Iterator_, context?: any) => T[] +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - select(iterator: Iterator, context?: any): T[]; ->select : (iterator: Iterator, context?: any) => T[] ->iterator : Iterator ->Iterator : Iterator + select(iterator: Iterator_, context?: any): T[]; +>select : (iterator: Iterator_, context?: any) => T[] +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T @@ -2743,39 +2743,39 @@ module Underscore { >Object : Object >T : T - reject(iterator: Iterator, context?: any): T[]; ->reject : (iterator: Iterator, context?: any) => T[] ->iterator : Iterator ->Iterator : Iterator + reject(iterator: Iterator_, context?: any): T[]; +>reject : (iterator: Iterator_, context?: any) => T[] +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - every(iterator?: Iterator, context?: any): boolean; ->every : (iterator?: Iterator, context?: any) => boolean ->iterator : Iterator ->Iterator : Iterator + every(iterator?: Iterator_, context?: any): boolean; +>every : (iterator?: Iterator_, context?: any) => boolean +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - all(iterator?: Iterator, context?: any): boolean; ->all : (iterator?: Iterator, context?: any) => boolean ->iterator : Iterator ->Iterator : Iterator + all(iterator?: Iterator_, context?: any): boolean; +>all : (iterator?: Iterator_, context?: any) => boolean +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - some(iterator?: Iterator, context?: any): boolean; ->some : (iterator?: Iterator, context?: any) => boolean ->iterator : Iterator ->Iterator : Iterator + some(iterator?: Iterator_, context?: any): boolean; +>some : (iterator?: Iterator_, context?: any) => boolean +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - any(iterator?: Iterator, context?: any): boolean; ->any : (iterator?: Iterator, context?: any) => boolean ->iterator : Iterator ->Iterator : Iterator + any(iterator?: Iterator_, context?: any): boolean; +>any : (iterator?: Iterator_, context?: any) => boolean +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any @@ -2798,60 +2798,60 @@ module Underscore { >pluck : (propertyName: string) => any[] >propertyName : string - max(iterator?: Iterator, context?: any): T; ->max : (iterator?: Iterator, context?: any) => T ->iterator : Iterator ->Iterator : Iterator + max(iterator?: Iterator_, context?: any): T; +>max : (iterator?: Iterator_, context?: any) => T +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - min(iterator?: Iterator, context?: any): T; ->min : (iterator?: Iterator, context?: any) => T ->iterator : Iterator ->Iterator : Iterator + min(iterator?: Iterator_, context?: any): T; +>min : (iterator?: Iterator_, context?: any) => T +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - sortBy(iterator: Iterator, context?: any): T[]; ->sortBy : { (iterator: Iterator, context?: any): T[]; (propertyName: string): T[]; } ->iterator : Iterator ->Iterator : Iterator + sortBy(iterator: Iterator_, context?: any): T[]; +>sortBy : { (iterator: Iterator_, context?: any): T[]; (propertyName: string): T[]; } +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T sortBy(propertyName: string): T[]; ->sortBy : { (iterator: Iterator, context?: any): T[]; (propertyName: string): T[]; } +>sortBy : { (iterator: Iterator_, context?: any): T[]; (propertyName: string): T[]; } >propertyName : string >T : T - groupBy(iterator?: Iterator, context?: any): Dictionary; ->groupBy : { (iterator?: Iterator, context?: any): Dictionary; (propertyName: string): Dictionary; } ->iterator : Iterator ->Iterator : Iterator + groupBy(iterator?: Iterator_, context?: any): Dictionary; +>groupBy : { (iterator?: Iterator_, context?: any): Dictionary; (propertyName: string): Dictionary; } +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >Dictionary : Dictionary >T : T groupBy(propertyName: string): Dictionary; ->groupBy : { (iterator?: Iterator, context?: any): Dictionary; (propertyName: string): Dictionary; } +>groupBy : { (iterator?: Iterator_, context?: any): Dictionary; (propertyName: string): Dictionary; } >propertyName : string >Dictionary : Dictionary >T : T - countBy(iterator?: Iterator, context?: any): Dictionary; ->countBy : { (iterator?: Iterator, context?: any): Dictionary; (propertyName: string): Dictionary; } ->iterator : Iterator ->Iterator : Iterator + countBy(iterator?: Iterator_, context?: any): Dictionary; +>countBy : { (iterator?: Iterator_, context?: any): Dictionary; (propertyName: string): Dictionary; } +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >Dictionary : Dictionary countBy(propertyName: string): Dictionary; ->countBy : { (iterator?: Iterator, context?: any): Dictionary; (propertyName: string): Dictionary; } +>countBy : { (iterator?: Iterator_, context?: any): Dictionary; (propertyName: string): Dictionary; } >propertyName : string >Dictionary : Dictionary @@ -3015,38 +3015,38 @@ module Underscore { >Array : T[] >T : T - each(iterator: Iterator, context?: any): ChainedObject; ->each : (iterator: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + each(iterator: Iterator_, context?: any): ChainedObject; +>each : (iterator: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject - forEach(iterator: Iterator, context?: any): ChainedObject; ->forEach : (iterator: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + forEach(iterator: Iterator_, context?: any): ChainedObject; +>forEach : (iterator: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject - map(iterator: Iterator, context?: any): ChainedArray; ->map : (iterator: Iterator, context?: any) => ChainedArray + map(iterator: Iterator_, context?: any): ChainedArray; +>map : (iterator: Iterator_, context?: any) => ChainedArray >U : U ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any >ChainedArray : ChainedArray >U : U - collect(iterator: Iterator, context?: any): ChainedArray; ->collect : (iterator: Iterator, context?: any) => ChainedArray + collect(iterator: Iterator_, context?: any): ChainedArray; +>collect : (iterator: Iterator_, context?: any) => ChainedArray >U : U ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any @@ -3178,37 +3178,37 @@ module Underscore { >ChainedObject : ChainedObject >U : U - find(iterator: Iterator, context?: any): ChainedObject; ->find : (iterator: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + find(iterator: Iterator_, context?: any): ChainedObject; +>find : (iterator: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject >T : T - detect(iterator: Iterator, context?: any): ChainedObject; ->detect : (iterator: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + detect(iterator: Iterator_, context?: any): ChainedObject; +>detect : (iterator: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject >T : T - filter(iterator: Iterator, context?: any): ChainedArray; ->filter : (iterator: Iterator, context?: any) => ChainedArray ->iterator : Iterator ->Iterator : Iterator + filter(iterator: Iterator_, context?: any): ChainedArray; +>filter : (iterator: Iterator_, context?: any) => ChainedArray +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedArray : ChainedArray >T : T - select(iterator: Iterator, context?: any): ChainedArray; ->select : (iterator: Iterator, context?: any) => ChainedArray ->iterator : Iterator ->Iterator : Iterator + select(iterator: Iterator_, context?: any): ChainedArray; +>select : (iterator: Iterator_, context?: any) => ChainedArray +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedArray : ChainedArray @@ -3228,43 +3228,43 @@ module Underscore { >ChainedObject : ChainedObject >T : T - reject(iterator: Iterator, context?: any): ChainedArray; ->reject : (iterator: Iterator, context?: any) => ChainedArray ->iterator : Iterator ->Iterator : Iterator + reject(iterator: Iterator_, context?: any): ChainedArray; +>reject : (iterator: Iterator_, context?: any) => ChainedArray +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedArray : ChainedArray >T : T - every(iterator?: Iterator, context?: any): ChainedObject; ->every : (iterator?: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + every(iterator?: Iterator_, context?: any): ChainedObject; +>every : (iterator?: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject - all(iterator?: Iterator, context?: any): ChainedObject; ->all : (iterator?: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + all(iterator?: Iterator_, context?: any): ChainedObject; +>all : (iterator?: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject - some(iterator?: Iterator, context?: any): ChainedObject; ->some : (iterator?: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + some(iterator?: Iterator_, context?: any): ChainedObject; +>some : (iterator?: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject - any(iterator?: Iterator, context?: any): ChainedObject; ->any : (iterator?: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + any(iterator?: Iterator_, context?: any): ChainedObject; +>any : (iterator?: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject @@ -3292,63 +3292,63 @@ module Underscore { >propertyName : string >ChainedArray : ChainedArray - max(iterator?: Iterator, context?: any): ChainedObject; ->max : (iterator?: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + max(iterator?: Iterator_, context?: any): ChainedObject; +>max : (iterator?: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject >T : T - min(iterator?: Iterator, context?: any): ChainedObject; ->min : (iterator?: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + min(iterator?: Iterator_, context?: any): ChainedObject; +>min : (iterator?: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject >T : T - sortBy(iterator: Iterator, context?: any): ChainedArray; ->sortBy : { (iterator: Iterator, context?: any): ChainedArray; (propertyName: string): ChainedArray; } ->iterator : Iterator ->Iterator : Iterator + sortBy(iterator: Iterator_, context?: any): ChainedArray; +>sortBy : { (iterator: Iterator_, context?: any): ChainedArray; (propertyName: string): ChainedArray; } +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedArray : ChainedArray >T : T sortBy(propertyName: string): ChainedArray; ->sortBy : { (iterator: Iterator, context?: any): ChainedArray; (propertyName: string): ChainedArray; } +>sortBy : { (iterator: Iterator_, context?: any): ChainedArray; (propertyName: string): ChainedArray; } >propertyName : string >ChainedArray : ChainedArray >T : T // Should return ChainedDictionary, but expansive recursion not allowed - groupBy(iterator?: Iterator, context?: any): ChainedDictionary; ->groupBy : { (iterator?: Iterator, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } ->iterator : Iterator ->Iterator : Iterator + groupBy(iterator?: Iterator_, context?: any): ChainedDictionary; +>groupBy : { (iterator?: Iterator_, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedDictionary : ChainedDictionary groupBy(propertyName: string): ChainedDictionary; ->groupBy : { (iterator?: Iterator, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } +>groupBy : { (iterator?: Iterator_, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } >propertyName : string >ChainedDictionary : ChainedDictionary - countBy(iterator?: Iterator, context?: any): ChainedDictionary; ->countBy : { (iterator?: Iterator, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } ->iterator : Iterator ->Iterator : Iterator + countBy(iterator?: Iterator_, context?: any): ChainedDictionary; +>countBy : { (iterator?: Iterator_, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedDictionary : ChainedDictionary countBy(propertyName: string): ChainedDictionary; ->countBy : { (iterator?: Iterator, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } +>countBy : { (iterator?: Iterator_, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } >propertyName : string >ChainedDictionary : ChainedDictionary @@ -3468,17 +3468,17 @@ module Underscore { >T : T uniq(isSorted?: boolean): ChainedArray; ->uniq : { (isSorted?: boolean): ChainedArray; (isSorted: boolean, iterator: Iterator, context?: any): ChainedArray; } +>uniq : { (isSorted?: boolean): ChainedArray; (isSorted: boolean, iterator: Iterator_, context?: any): ChainedArray; } >isSorted : boolean >ChainedArray : ChainedArray >T : T - uniq(isSorted: boolean, iterator: Iterator, context?: any): ChainedArray; ->uniq : { (isSorted?: boolean): ChainedArray; (isSorted: boolean, iterator: Iterator, context?: any): ChainedArray; } + uniq(isSorted: boolean, iterator: Iterator_, context?: any): ChainedArray; +>uniq : { (isSorted?: boolean): ChainedArray; (isSorted: boolean, iterator: Iterator_, context?: any): ChainedArray; } >U : U >isSorted : boolean ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any @@ -3486,17 +3486,17 @@ module Underscore { >U : U unique(isSorted?: boolean): ChainedArray; ->unique : { (isSorted?: boolean): ChainedArray; (isSorted: boolean, iterator: Iterator, context?: any): ChainedArray; } +>unique : { (isSorted?: boolean): ChainedArray; (isSorted: boolean, iterator: Iterator_, context?: any): ChainedArray; } >isSorted : boolean >ChainedArray : ChainedArray >T : T - unique(isSorted: boolean, iterator: Iterator, context?: any): ChainedArray; ->unique : { (isSorted?: boolean): ChainedArray; (isSorted: boolean, iterator: Iterator, context?: any): ChainedArray; } + unique(isSorted: boolean, iterator: Iterator_, context?: any): ChainedArray; +>unique : { (isSorted?: boolean): ChainedArray; (isSorted: boolean, iterator: Iterator_, context?: any): ChainedArray; } >U : U >isSorted : boolean ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any @@ -3532,18 +3532,18 @@ module Underscore { >ChainedObject : ChainedObject sortedIndex(obj: T, propertyName: string): ChainedObject; ->sortedIndex : { (obj: T, propertyName: string): ChainedObject; (obj: T, iterator?: Iterator, context?: any): ChainedObject; } +>sortedIndex : { (obj: T, propertyName: string): ChainedObject; (obj: T, iterator?: Iterator_, context?: any): ChainedObject; } >obj : T >T : T >propertyName : string >ChainedObject : ChainedObject - sortedIndex(obj: T, iterator?: Iterator, context?: any): ChainedObject; ->sortedIndex : { (obj: T, propertyName: string): ChainedObject; (obj: T, iterator?: Iterator, context?: any): ChainedObject; } + sortedIndex(obj: T, iterator?: Iterator_, context?: any): ChainedObject; +>sortedIndex : { (obj: T, propertyName: string): ChainedObject; (obj: T, iterator?: Iterator_, context?: any): ChainedObject; } >obj : T >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject @@ -3666,38 +3666,38 @@ module Underscore { >Dictionary : Dictionary >T : T - each(iterator: Iterator, context?: any): ChainedObject; ->each : (iterator: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + each(iterator: Iterator_, context?: any): ChainedObject; +>each : (iterator: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject - forEach(iterator: Iterator, context?: any): ChainedObject; ->forEach : (iterator: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + forEach(iterator: Iterator_, context?: any): ChainedObject; +>forEach : (iterator: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject - map(iterator: Iterator, context?: any): ChainedArray; ->map : (iterator: Iterator, context?: any) => ChainedArray + map(iterator: Iterator_, context?: any): ChainedArray; +>map : (iterator: Iterator_, context?: any) => ChainedArray >U : U ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any >ChainedArray : ChainedArray >U : U - collect(iterator: Iterator, context?: any): ChainedArray; ->collect : (iterator: Iterator, context?: any) => ChainedArray + collect(iterator: Iterator_, context?: any): ChainedArray; +>collect : (iterator: Iterator_, context?: any) => ChainedArray >U : U ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any @@ -3829,37 +3829,37 @@ module Underscore { >ChainedObject : ChainedObject >U : U - find(iterator: Iterator, context?: any): ChainedObject; ->find : (iterator: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + find(iterator: Iterator_, context?: any): ChainedObject; +>find : (iterator: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject >T : T - detect(iterator: Iterator, context?: any): ChainedObject; ->detect : (iterator: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + detect(iterator: Iterator_, context?: any): ChainedObject; +>detect : (iterator: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject >T : T - filter(iterator: Iterator, context?: any): ChainedArray; ->filter : (iterator: Iterator, context?: any) => ChainedArray ->iterator : Iterator ->Iterator : Iterator + filter(iterator: Iterator_, context?: any): ChainedArray; +>filter : (iterator: Iterator_, context?: any) => ChainedArray +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedArray : ChainedArray >T : T - select(iterator: Iterator, context?: any): ChainedArray; ->select : (iterator: Iterator, context?: any) => ChainedArray ->iterator : Iterator ->Iterator : Iterator + select(iterator: Iterator_, context?: any): ChainedArray; +>select : (iterator: Iterator_, context?: any) => ChainedArray +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedArray : ChainedArray @@ -3879,43 +3879,43 @@ module Underscore { >ChainedObject : ChainedObject >T : T - reject(iterator: Iterator, context?: any): ChainedArray; ->reject : (iterator: Iterator, context?: any) => ChainedArray ->iterator : Iterator ->Iterator : Iterator + reject(iterator: Iterator_, context?: any): ChainedArray; +>reject : (iterator: Iterator_, context?: any) => ChainedArray +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedArray : ChainedArray >T : T - every(iterator?: Iterator, context?: any): ChainedObject; ->every : (iterator?: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + every(iterator?: Iterator_, context?: any): ChainedObject; +>every : (iterator?: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject - all(iterator?: Iterator, context?: any): ChainedObject; ->all : (iterator?: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + all(iterator?: Iterator_, context?: any): ChainedObject; +>all : (iterator?: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject - some(iterator?: Iterator, context?: any): ChainedObject; ->some : (iterator?: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + some(iterator?: Iterator_, context?: any): ChainedObject; +>some : (iterator?: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject - any(iterator?: Iterator, context?: any): ChainedObject; ->any : (iterator?: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + any(iterator?: Iterator_, context?: any): ChainedObject; +>any : (iterator?: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject @@ -3943,63 +3943,63 @@ module Underscore { >propertyName : string >ChainedArray : ChainedArray - max(iterator?: Iterator, context?: any): ChainedObject; ->max : (iterator?: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + max(iterator?: Iterator_, context?: any): ChainedObject; +>max : (iterator?: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject >T : T - min(iterator?: Iterator, context?: any): ChainedObject; ->min : (iterator?: Iterator, context?: any) => ChainedObject ->iterator : Iterator ->Iterator : Iterator + min(iterator?: Iterator_, context?: any): ChainedObject; +>min : (iterator?: Iterator_, context?: any) => ChainedObject +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedObject : ChainedObject >T : T - sortBy(iterator: Iterator, context?: any): ChainedArray; ->sortBy : { (iterator: Iterator, context?: any): ChainedArray; (propertyName: string): ChainedArray; } ->iterator : Iterator ->Iterator : Iterator + sortBy(iterator: Iterator_, context?: any): ChainedArray; +>sortBy : { (iterator: Iterator_, context?: any): ChainedArray; (propertyName: string): ChainedArray; } +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedArray : ChainedArray >T : T sortBy(propertyName: string): ChainedArray; ->sortBy : { (iterator: Iterator, context?: any): ChainedArray; (propertyName: string): ChainedArray; } +>sortBy : { (iterator: Iterator_, context?: any): ChainedArray; (propertyName: string): ChainedArray; } >propertyName : string >ChainedArray : ChainedArray >T : T // Should return ChainedDictionary, but expansive recursion not allowed - groupBy(iterator?: Iterator, context?: any): ChainedDictionary; ->groupBy : { (iterator?: Iterator, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } ->iterator : Iterator ->Iterator : Iterator + groupBy(iterator?: Iterator_, context?: any): ChainedDictionary; +>groupBy : { (iterator?: Iterator_, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedDictionary : ChainedDictionary groupBy(propertyName: string): ChainedDictionary; ->groupBy : { (iterator?: Iterator, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } +>groupBy : { (iterator?: Iterator_, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } >propertyName : string >ChainedDictionary : ChainedDictionary - countBy(iterator?: Iterator, context?: any): ChainedDictionary; ->countBy : { (iterator?: Iterator, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } ->iterator : Iterator ->Iterator : Iterator + countBy(iterator?: Iterator_, context?: any): ChainedDictionary; +>countBy : { (iterator?: Iterator_, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >ChainedDictionary : ChainedDictionary countBy(propertyName: string): ChainedDictionary; ->countBy : { (iterator?: Iterator, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } +>countBy : { (iterator?: Iterator_, context?: any): ChainedDictionary; (propertyName: string): ChainedDictionary; } >propertyName : string >ChainedDictionary : ChainedDictionary @@ -4134,97 +4134,97 @@ module Underscore { >ChainedObject : ChainedObject >T : T - each(list: T[], iterator: Iterator, context?: any): void; ->each : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; } + each(list: T[], iterator: Iterator_, context?: any): void; +>each : { (list: T[], iterator: Iterator_, context?: any): void; (list: Dictionary, iterator: Iterator_, context?: any): void; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - each(list: Dictionary, iterator: Iterator, context?: any): void; ->each : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; } + each(list: Dictionary, iterator: Iterator_, context?: any): void; +>each : { (list: T[], iterator: Iterator_, context?: any): void; (list: Dictionary, iterator: Iterator_, context?: any): void; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - forEach(list: T[], iterator: Iterator, context?: any): void; ->forEach : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; } + forEach(list: T[], iterator: Iterator_, context?: any): void; +>forEach : { (list: T[], iterator: Iterator_, context?: any): void; (list: Dictionary, iterator: Iterator_, context?: any): void; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - forEach(list: Dictionary, iterator: Iterator, context?: any): void; ->forEach : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; } + forEach(list: Dictionary, iterator: Iterator_, context?: any): void; +>forEach : { (list: T[], iterator: Iterator_, context?: any): void; (list: Dictionary, iterator: Iterator_, context?: any): void; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - map(list: T[], iterator: Iterator, context?: any): U[]; ->map : { (list: T[], iterator: Iterator, context?: any): U[]; (list: Dictionary, iterator: Iterator, context?: any): U[]; } + map(list: T[], iterator: Iterator_, context?: any): U[]; +>map : { (list: T[], iterator: Iterator_, context?: any): U[]; (list: Dictionary, iterator: Iterator_, context?: any): U[]; } >T : T >U : U >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any >U : U - map(list: Dictionary, iterator: Iterator, context?: any): U[]; ->map : { (list: T[], iterator: Iterator, context?: any): U[]; (list: Dictionary, iterator: Iterator, context?: any): U[]; } + map(list: Dictionary, iterator: Iterator_, context?: any): U[]; +>map : { (list: T[], iterator: Iterator_, context?: any): U[]; (list: Dictionary, iterator: Iterator_, context?: any): U[]; } >T : T >U : U >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any >U : U - collect(list: T[], iterator: Iterator, context?: any): U[]; ->collect : { (list: T[], iterator: Iterator, context?: any): U[]; (list: Dictionary, iterator: Iterator, context?: any): U[]; } + collect(list: T[], iterator: Iterator_, context?: any): U[]; +>collect : { (list: T[], iterator: Iterator_, context?: any): U[]; (list: Dictionary, iterator: Iterator_, context?: any): U[]; } >T : T >U : U >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any >U : U - collect(list: Dictionary, iterator: Iterator, context?: any): U[]; ->collect : { (list: T[], iterator: Iterator, context?: any): U[]; (list: Dictionary, iterator: Iterator, context?: any): U[]; } + collect(list: Dictionary, iterator: Iterator_, context?: any): U[]; +>collect : { (list: T[], iterator: Iterator_, context?: any): U[]; (list: Dictionary, iterator: Iterator_, context?: any): U[]; } >T : T >U : U >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any @@ -4530,94 +4530,94 @@ module Underscore { >context : any >U : U - find(list: T[], iterator: Iterator, context?: any): T; ->find : { (list: T[], iterator: Iterator, context?: any): T; (list: Dictionary, iterator: Iterator, context?: any): T; } + find(list: T[], iterator: Iterator_, context?: any): T; +>find : { (list: T[], iterator: Iterator_, context?: any): T; (list: Dictionary, iterator: Iterator_, context?: any): T; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - find(list: Dictionary, iterator: Iterator, context?: any): T; ->find : { (list: T[], iterator: Iterator, context?: any): T; (list: Dictionary, iterator: Iterator, context?: any): T; } + find(list: Dictionary, iterator: Iterator_, context?: any): T; +>find : { (list: T[], iterator: Iterator_, context?: any): T; (list: Dictionary, iterator: Iterator_, context?: any): T; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - detect(list: T[], iterator: Iterator, context?: any): T; ->detect : { (list: T[], iterator: Iterator, context?: any): T; (list: Dictionary, iterator: Iterator, context?: any): T; } + detect(list: T[], iterator: Iterator_, context?: any): T; +>detect : { (list: T[], iterator: Iterator_, context?: any): T; (list: Dictionary, iterator: Iterator_, context?: any): T; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - detect(list: Dictionary, iterator: Iterator, context?: any): T; ->detect : { (list: T[], iterator: Iterator, context?: any): T; (list: Dictionary, iterator: Iterator, context?: any): T; } + detect(list: Dictionary, iterator: Iterator_, context?: any): T; +>detect : { (list: T[], iterator: Iterator_, context?: any): T; (list: Dictionary, iterator: Iterator_, context?: any): T; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - filter(list: T[], iterator: Iterator, context?: any): T[]; ->filter : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; } + filter(list: T[], iterator: Iterator_, context?: any): T[]; +>filter : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - filter(list: Dictionary, iterator: Iterator, context?: any): T[]; ->filter : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; } + filter(list: Dictionary, iterator: Iterator_, context?: any): T[]; +>filter : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - select(list: T[], iterator: Iterator, context?: any): T[]; ->select : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; } + select(list: T[], iterator: Iterator_, context?: any): T[]; +>select : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - select(list: Dictionary, iterator: Iterator, context?: any): T[]; ->select : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; } + select(list: Dictionary, iterator: Iterator_, context?: any): T[]; +>select : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T @@ -4660,110 +4660,110 @@ module Underscore { >Object : Object >T : T - reject(list: T[], iterator: Iterator, context?: any): T[]; ->reject : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; } + reject(list: T[], iterator: Iterator_, context?: any): T[]; +>reject : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - reject(list: Dictionary, iterator: Iterator, context?: any): T[]; ->reject : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; } + reject(list: Dictionary, iterator: Iterator_, context?: any): T[]; +>reject : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - every(list: T[], iterator?: Iterator, context?: any): boolean; ->every : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } + every(list: T[], iterator?: Iterator_, context?: any): boolean; +>every : { (list: T[], iterator?: Iterator_, context?: any): boolean; (list: Dictionary, iterator?: Iterator_, context?: any): boolean; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - every(list: Dictionary, iterator?: Iterator, context?: any): boolean; ->every : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } + every(list: Dictionary, iterator?: Iterator_, context?: any): boolean; +>every : { (list: T[], iterator?: Iterator_, context?: any): boolean; (list: Dictionary, iterator?: Iterator_, context?: any): boolean; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - all(list: T[], iterator?: Iterator, context?: any): boolean; ->all : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } + all(list: T[], iterator?: Iterator_, context?: any): boolean; +>all : { (list: T[], iterator?: Iterator_, context?: any): boolean; (list: Dictionary, iterator?: Iterator_, context?: any): boolean; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - all(list: Dictionary, iterator?: Iterator, context?: any): boolean; ->all : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } + all(list: Dictionary, iterator?: Iterator_, context?: any): boolean; +>all : { (list: T[], iterator?: Iterator_, context?: any): boolean; (list: Dictionary, iterator?: Iterator_, context?: any): boolean; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - some(list: T[], iterator?: Iterator, context?: any): boolean; ->some : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } + some(list: T[], iterator?: Iterator_, context?: any): boolean; +>some : { (list: T[], iterator?: Iterator_, context?: any): boolean; (list: Dictionary, iterator?: Iterator_, context?: any): boolean; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - some(list: Dictionary, iterator?: Iterator, context?: any): boolean; ->some : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } + some(list: Dictionary, iterator?: Iterator_, context?: any): boolean; +>some : { (list: T[], iterator?: Iterator_, context?: any): boolean; (list: Dictionary, iterator?: Iterator_, context?: any): boolean; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - any(list: T[], iterator?: Iterator, context?: any): boolean; ->any : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } + any(list: T[], iterator?: Iterator_, context?: any): boolean; +>any : { (list: T[], iterator?: Iterator_, context?: any): boolean; (list: Dictionary, iterator?: Iterator_, context?: any): boolean; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any - any(list: Dictionary, iterator?: Iterator, context?: any): boolean; ->any : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; } + any(list: Dictionary, iterator?: Iterator_, context?: any): boolean; +>any : { (list: T[], iterator?: Iterator_, context?: any): boolean; (list: Dictionary, iterator?: Iterator_, context?: any): boolean; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any @@ -4825,77 +4825,77 @@ module Underscore { >Dictionary : Dictionary >propertyName : string - max(list: T[], iterator?: Iterator, context?: any): T; ->max : { (list: T[], iterator?: Iterator, context?: any): T; (list: Dictionary, iterator?: Iterator, context?: any): T; } + max(list: T[], iterator?: Iterator_, context?: any): T; +>max : { (list: T[], iterator?: Iterator_, context?: any): T; (list: Dictionary, iterator?: Iterator_, context?: any): T; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - max(list: Dictionary, iterator?: Iterator, context?: any): T; ->max : { (list: T[], iterator?: Iterator, context?: any): T; (list: Dictionary, iterator?: Iterator, context?: any): T; } + max(list: Dictionary, iterator?: Iterator_, context?: any): T; +>max : { (list: T[], iterator?: Iterator_, context?: any): T; (list: Dictionary, iterator?: Iterator_, context?: any): T; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - min(list: T[], iterator?: Iterator, context?: any): T; ->min : { (list: T[], iterator?: Iterator, context?: any): T; (list: Dictionary, iterator?: Iterator, context?: any): T; } + min(list: T[], iterator?: Iterator_, context?: any): T; +>min : { (list: T[], iterator?: Iterator_, context?: any): T; (list: Dictionary, iterator?: Iterator_, context?: any): T; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - min(list: Dictionary, iterator?: Iterator, context?: any): T; ->min : { (list: T[], iterator?: Iterator, context?: any): T; (list: Dictionary, iterator?: Iterator, context?: any): T; } + min(list: Dictionary, iterator?: Iterator_, context?: any): T; +>min : { (list: T[], iterator?: Iterator_, context?: any): T; (list: Dictionary, iterator?: Iterator_, context?: any): T; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - sortBy(list: T[], iterator: Iterator, context?: any): T[]; ->sortBy : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; (list: T[], propertyName: string): T[]; (list: Dictionary, propertyName: string): T[]; } + sortBy(list: T[], iterator: Iterator_, context?: any): T[]; +>sortBy : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; (list: T[], propertyName: string): T[]; (list: Dictionary, propertyName: string): T[]; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T - sortBy(list: Dictionary, iterator: Iterator, context?: any): T[]; ->sortBy : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; (list: T[], propertyName: string): T[]; (list: Dictionary, propertyName: string): T[]; } + sortBy(list: Dictionary, iterator: Iterator_, context?: any): T[]; +>sortBy : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; (list: T[], propertyName: string): T[]; (list: Dictionary, propertyName: string): T[]; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >T : T sortBy(list: T[], propertyName: string): T[]; ->sortBy : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; (list: T[], propertyName: string): T[]; (list: Dictionary, propertyName: string): T[]; } +>sortBy : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; (list: T[], propertyName: string): T[]; (list: Dictionary, propertyName: string): T[]; } >T : T >list : T[] >T : T @@ -4903,7 +4903,7 @@ module Underscore { >T : T sortBy(list: Dictionary, propertyName: string): T[]; ->sortBy : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; (list: T[], propertyName: string): T[]; (list: Dictionary, propertyName: string): T[]; } +>sortBy : { (list: T[], iterator: Iterator_, context?: any): T[]; (list: Dictionary, iterator: Iterator_, context?: any): T[]; (list: T[], propertyName: string): T[]; (list: Dictionary, propertyName: string): T[]; } >T : T >list : Dictionary >Dictionary : Dictionary @@ -4911,33 +4911,33 @@ module Underscore { >propertyName : string >T : T - groupBy(list: T[], iterator?: Iterator, context?: any): Dictionary; ->groupBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } + groupBy(list: T[], iterator?: Iterator_, context?: any): Dictionary; +>groupBy : { (list: T[], iterator?: Iterator_, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >Dictionary : Dictionary >T : T - groupBy(list: Dictionary, iterator?: Iterator, context?: any): Dictionary; ->groupBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } + groupBy(list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; +>groupBy : { (list: T[], iterator?: Iterator_, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >Dictionary : Dictionary >T : T groupBy(list: T[], propertyName: string): Dictionary; ->groupBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } +>groupBy : { (list: T[], iterator?: Iterator_, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } >T : T >list : T[] >T : T @@ -4946,7 +4946,7 @@ module Underscore { >T : T groupBy(list: Dictionary, propertyName: string): Dictionary; ->groupBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } +>groupBy : { (list: T[], iterator?: Iterator_, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } >T : T >list : Dictionary >Dictionary : Dictionary @@ -4955,31 +4955,31 @@ module Underscore { >Dictionary : Dictionary >T : T - countBy(list: T[], iterator?: Iterator, context?: any): Dictionary; ->countBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } + countBy(list: T[], iterator?: Iterator_, context?: any): Dictionary; +>countBy : { (list: T[], iterator?: Iterator_, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } >T : T >list : T[] >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >Dictionary : Dictionary - countBy(list: Dictionary, iterator?: Iterator, context?: any): Dictionary; ->countBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } + countBy(list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; +>countBy : { (list: T[], iterator?: Iterator_, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } >T : T >list : Dictionary >Dictionary : Dictionary >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any >Dictionary : Dictionary countBy(list: T[], propertyName: string): Dictionary; ->countBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } +>countBy : { (list: T[], iterator?: Iterator_, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } >T : T >list : T[] >T : T @@ -4987,7 +4987,7 @@ module Underscore { >Dictionary : Dictionary countBy(list: Dictionary, propertyName: string): Dictionary; ->countBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } +>countBy : { (list: T[], iterator?: Iterator_, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; } >T : T >list : Dictionary >Dictionary : Dictionary @@ -5175,44 +5175,44 @@ module Underscore { >T : T uniq(list: T[], isSorted?: boolean): T[]; ->uniq : { (list: T[], isSorted?: boolean): T[]; (list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; } +>uniq : { (list: T[], isSorted?: boolean): T[]; (list: T[], isSorted: boolean, iterator: Iterator_, context?: any): U[]; } >T : T >list : T[] >T : T >isSorted : boolean >T : T - uniq(list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; ->uniq : { (list: T[], isSorted?: boolean): T[]; (list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; } + uniq(list: T[], isSorted: boolean, iterator: Iterator_, context?: any): U[]; +>uniq : { (list: T[], isSorted?: boolean): T[]; (list: T[], isSorted: boolean, iterator: Iterator_, context?: any): U[]; } >T : T >U : U >list : T[] >T : T >isSorted : boolean ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any >U : U unique(list: T[], isSorted?: boolean): T[]; ->unique : { (list: T[], isSorted?: boolean): T[]; (list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; } +>unique : { (list: T[], isSorted?: boolean): T[]; (list: T[], isSorted: boolean, iterator: Iterator_, context?: any): U[]; } >T : T >list : T[] >T : T >isSorted : boolean >T : T - unique(list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; ->unique : { (list: T[], isSorted?: boolean): T[]; (list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; } + unique(list: T[], isSorted: boolean, iterator: Iterator_, context?: any): U[]; +>unique : { (list: T[], isSorted?: boolean): T[]; (list: T[], isSorted: boolean, iterator: Iterator_, context?: any): U[]; } >T : T >U : U >list : T[] >T : T >isSorted : boolean ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >U : U >context : any @@ -5298,7 +5298,7 @@ module Underscore { >fromIndex : number sortedIndex(list: T[], obj: T, propertyName: string): number; ->sortedIndex : { (list: T[], obj: T, propertyName: string): number; (list: T[], obj: T, iterator?: Iterator, context?: any): number; } +>sortedIndex : { (list: T[], obj: T, propertyName: string): number; (list: T[], obj: T, iterator?: Iterator_, context?: any): number; } >T : T >list : T[] >T : T @@ -5306,15 +5306,15 @@ module Underscore { >T : T >propertyName : string - sortedIndex(list: T[], obj: T, iterator?: Iterator, context?: any): number; ->sortedIndex : { (list: T[], obj: T, propertyName: string): number; (list: T[], obj: T, iterator?: Iterator, context?: any): number; } + sortedIndex(list: T[], obj: T, iterator?: Iterator_, context?: any): number; +>sortedIndex : { (list: T[], obj: T, propertyName: string): number; (list: T[], obj: T, iterator?: Iterator_, context?: any): number; } >T : T >list : T[] >T : T >obj : T >T : T ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >T : T >context : any @@ -5594,12 +5594,12 @@ module Underscore { >T : T >T : T - times(n: number, iterator: Iterator, context?: any): U[]; ->times : (n: number, iterator: Iterator, context?: any) => U[] + times(n: number, iterator: Iterator_, context?: any): U[]; +>times : (n: number, iterator: Iterator_, context?: any) => U[] >U : U >n : number ->iterator : Iterator ->Iterator : Iterator +>iterator : Iterator_ +>Iterator_ : Iterator_ >U : U >context : any >U : U diff --git a/tests/baselines/reference/varNameConflictsWithImportInDifferentPartOfModule.errors.txt b/tests/baselines/reference/varNameConflictsWithImportInDifferentPartOfModule.errors.txt index 66270913c9f..1ca223783bf 100644 --- a/tests/baselines/reference/varNameConflictsWithImportInDifferentPartOfModule.errors.txt +++ b/tests/baselines/reference/varNameConflictsWithImportInDifferentPartOfModule.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/varNameConflictsWithImportInDifferentPartOfModule.ts(6,5): error TS2440: Import declaration conflicts with local declaration of 'q' +tests/cases/compiler/varNameConflictsWithImportInDifferentPartOfModule.ts(6,5): error TS2440: Import declaration conflicts with local declaration of 'q'. ==== tests/cases/compiler/varNameConflictsWithImportInDifferentPartOfModule.ts (1 errors) ==== @@ -9,5 +9,5 @@ tests/cases/compiler/varNameConflictsWithImportInDifferentPartOfModule.ts(6,5): module M1 { export import q = M1.s; // Should be an error but isn't ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2440: Import declaration conflicts with local declaration of 'q' +!!! error TS2440: Import declaration conflicts with local declaration of 'q'. } \ No newline at end of file diff --git a/tests/baselines/reference/yieldExpression1.errors.txt b/tests/baselines/reference/yieldExpression1.errors.txt deleted file mode 100644 index 2ab6f60fb76..00000000000 --- a/tests/baselines/reference/yieldExpression1.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/compiler/yieldExpression1.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - - -==== tests/cases/compiler/yieldExpression1.ts (1 errors) ==== - function* foo() { - ~ -!!! error TS1220: Generators are only available when targeting ECMAScript 2015 or higher. - yield - } \ No newline at end of file diff --git a/tests/baselines/reference/yieldExpression1.symbols b/tests/baselines/reference/yieldExpression1.symbols new file mode 100644 index 00000000000..7ca46788047 --- /dev/null +++ b/tests/baselines/reference/yieldExpression1.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/yieldExpression1.ts === +function* foo() { +>foo : Symbol(foo, Decl(yieldExpression1.ts, 0, 0)) + + yield +} diff --git a/tests/baselines/reference/yieldExpression1.types b/tests/baselines/reference/yieldExpression1.types new file mode 100644 index 00000000000..1ef54eb5f3d --- /dev/null +++ b/tests/baselines/reference/yieldExpression1.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/yieldExpression1.ts === +function* foo() { +>foo : () => IterableIterator + + yield +>yield : any +} diff --git a/tests/cases/compiler/baseConstraintOfDecorator.ts b/tests/cases/compiler/baseConstraintOfDecorator.ts new file mode 100644 index 00000000000..d8eb00f07da --- /dev/null +++ b/tests/cases/compiler/baseConstraintOfDecorator.ts @@ -0,0 +1,8 @@ +export function classExtender(superClass: TFunction, _instanceModifier: (instance: any, args: any[]) => void): TFunction { + return class decoratorFunc extends superClass { + constructor(...args: any[]) { + super(...args); + _instanceModifier(this, args); + } + }; +} diff --git a/tests/cases/compiler/evalAfter0.ts b/tests/cases/compiler/evalAfter0.ts new file mode 100644 index 00000000000..2245150ce6a --- /dev/null +++ b/tests/cases/compiler/evalAfter0.ts @@ -0,0 +1,4 @@ +(0,eval)("10"); // fine: special case for eval + +declare var eva; +(0,eva)("10"); // error: no side effect left of comma (suspect of missing method name or something) \ No newline at end of file diff --git a/tests/cases/compiler/misspelledNewMetaProperty.ts b/tests/cases/compiler/misspelledNewMetaProperty.ts new file mode 100644 index 00000000000..8882264478c --- /dev/null +++ b/tests/cases/compiler/misspelledNewMetaProperty.ts @@ -0,0 +1 @@ +function foo(){new.targ} \ No newline at end of file diff --git a/tests/cases/compiler/spreadIntersectionJsx.tsx b/tests/cases/compiler/spreadIntersectionJsx.tsx new file mode 100644 index 00000000000..a46220db1c5 --- /dev/null +++ b/tests/cases/compiler/spreadIntersectionJsx.tsx @@ -0,0 +1,6 @@ +// @jsx: react +const React: any = null; +class A { a; } +class C { c; } +let intersected: A & C; +let element =
; diff --git a/tests/cases/compiler/underscoreTest1.ts b/tests/cases/compiler/underscoreTest1.ts index 411bcc58d5f..dfe10cf02e2 100644 --- a/tests/cases/compiler/underscoreTest1.ts +++ b/tests/cases/compiler/underscoreTest1.ts @@ -3,7 +3,7 @@ interface Dictionary { [x: string]: T; } -interface Iterator { +interface Iterator_ { (value: T, index: any, list: any): U; } @@ -79,10 +79,10 @@ module Underscore { } export interface WrappedArray extends WrappedObject> { - each(iterator: Iterator, context?: any): void; - forEach(iterator: Iterator, context?: any): void; - map(iterator: Iterator, context?: any): U[]; - collect(iterator: Iterator, context?: any): U[]; + each(iterator: Iterator_, context?: any): void; + forEach(iterator: Iterator_, context?: any): void; + map(iterator: Iterator_, context?: any): U[]; + collect(iterator: Iterator_, context?: any): U[]; reduce(iterator: Reducer, initialValue?: T, context?: any): T; reduce(iterator: Reducer, initialValue: U, context?: any): U; foldl(iterator: Reducer, initialValue?: T, context?: any): T; @@ -93,28 +93,28 @@ module Underscore { reduceRight(iterator: Reducer, initialValue: U, context?: any): U; foldr(iterator: Reducer, initialValue?: T, context?: any): T; foldr(iterator: Reducer, initialValue: U, context?: any): U; - find(iterator: Iterator, context?: any): T; - detect(iterator: Iterator, context?: any): T; - filter(iterator: Iterator, context?: any): T[]; - select(iterator: Iterator, context?: any): T[]; + find(iterator: Iterator_, context?: any): T; + detect(iterator: Iterator_, context?: any): T; + filter(iterator: Iterator_, context?: any): T[]; + select(iterator: Iterator_, context?: any): T[]; where(properties: Object): T[]; findWhere(properties: Object): T; - reject(iterator: Iterator, context?: any): T[]; - every(iterator?: Iterator, context?: any): boolean; - all(iterator?: Iterator, context?: any): boolean; - some(iterator?: Iterator, context?: any): boolean; - any(iterator?: Iterator, context?: any): boolean; + reject(iterator: Iterator_, context?: any): T[]; + every(iterator?: Iterator_, context?: any): boolean; + all(iterator?: Iterator_, context?: any): boolean; + some(iterator?: Iterator_, context?: any): boolean; + any(iterator?: Iterator_, context?: any): boolean; contains(value: T): boolean; include(value: T): boolean; invoke(methodName: string, ...args: any[]): any[]; pluck(propertyName: string): any[]; - max(iterator?: Iterator, context?: any): T; - min(iterator?: Iterator, context?: any): T; - sortBy(iterator: Iterator, context?: any): T[]; + max(iterator?: Iterator_, context?: any): T; + min(iterator?: Iterator_, context?: any): T; + sortBy(iterator: Iterator_, context?: any): T[]; sortBy(propertyName: string): T[]; - groupBy(iterator?: Iterator, context?: any): Dictionary; + groupBy(iterator?: Iterator_, context?: any): Dictionary; groupBy(propertyName: string): Dictionary; - countBy(iterator?: Iterator, context?: any): Dictionary; + countBy(iterator?: Iterator_, context?: any): Dictionary; countBy(propertyName: string): Dictionary; shuffle(): T[]; toArray(): T[]; @@ -137,16 +137,16 @@ module Underscore { intersection(...arrays: T[][]): T[]; difference(...others: T[][]): T[]; uniq(isSorted?: boolean): T[]; - uniq(isSorted: boolean, iterator: Iterator, context?: any): U[]; + uniq(isSorted: boolean, iterator: Iterator_, context?: any): U[]; unique(isSorted?: boolean): T[]; - unique(isSorted: boolean, iterator: Iterator, context?: any): U[]; + unique(isSorted: boolean, iterator: Iterator_, context?: any): U[]; zip(...arrays: any[][]): any[][]; object(): any; object(values: any[]): any; indexOf(value: T, isSorted?: boolean): number; lastIndexOf(value: T, fromIndex?: number): number; sortedIndex(obj: T, propertyName: string): number; - sortedIndex(obj: T, iterator?: Iterator, context?: any): number; + sortedIndex(obj: T, iterator?: Iterator_, context?: any): number; // Methods from Array concat(...items: T[]): T[]; join(separator?: string): string; @@ -162,10 +162,10 @@ module Underscore { } export interface WrappedDictionary extends WrappedObject> { - each(iterator: Iterator, context?: any): void; - forEach(iterator: Iterator, context?: any): void; - map(iterator: Iterator, context?: any): U[]; - collect(iterator: Iterator, context?: any): U[]; + each(iterator: Iterator_, context?: any): void; + forEach(iterator: Iterator_, context?: any): void; + map(iterator: Iterator_, context?: any): U[]; + collect(iterator: Iterator_, context?: any): U[]; reduce(iterator: Reducer, initialValue?: T, context?: any): T; reduce(iterator: Reducer, initialValue: U, context?: any): U; foldl(iterator: Reducer, initialValue?: T, context?: any): T; @@ -176,28 +176,28 @@ module Underscore { reduceRight(iterator: Reducer, initialValue: U, context?: any): U; foldr(iterator: Reducer, initialValue?: T, context?: any): T; foldr(iterator: Reducer, initialValue: U, context?: any): U; - find(iterator: Iterator, context?: any): T; - detect(iterator: Iterator, context?: any): T; - filter(iterator: Iterator, context?: any): T[]; - select(iterator: Iterator, context?: any): T[]; + find(iterator: Iterator_, context?: any): T; + detect(iterator: Iterator_, context?: any): T; + filter(iterator: Iterator_, context?: any): T[]; + select(iterator: Iterator_, context?: any): T[]; where(properties: Object): T[]; findWhere(properties: Object): T; - reject(iterator: Iterator, context?: any): T[]; - every(iterator?: Iterator, context?: any): boolean; - all(iterator?: Iterator, context?: any): boolean; - some(iterator?: Iterator, context?: any): boolean; - any(iterator?: Iterator, context?: any): boolean; + reject(iterator: Iterator_, context?: any): T[]; + every(iterator?: Iterator_, context?: any): boolean; + all(iterator?: Iterator_, context?: any): boolean; + some(iterator?: Iterator_, context?: any): boolean; + any(iterator?: Iterator_, context?: any): boolean; contains(value: T): boolean; include(value: T): boolean; invoke(methodName: string, ...args: any[]): any[]; pluck(propertyName: string): any[]; - max(iterator?: Iterator, context?: any): T; - min(iterator?: Iterator, context?: any): T; - sortBy(iterator: Iterator, context?: any): T[]; + max(iterator?: Iterator_, context?: any): T; + min(iterator?: Iterator_, context?: any): T; + sortBy(iterator: Iterator_, context?: any): T[]; sortBy(propertyName: string): T[]; - groupBy(iterator?: Iterator, context?: any): Dictionary; + groupBy(iterator?: Iterator_, context?: any): Dictionary; groupBy(propertyName: string): Dictionary; - countBy(iterator?: Iterator, context?: any): Dictionary; + countBy(iterator?: Iterator_, context?: any): Dictionary; countBy(propertyName: string): Dictionary; shuffle(): T[]; toArray(): T[]; @@ -238,10 +238,10 @@ module Underscore { } export interface ChainedArray extends ChainedObject> { - each(iterator: Iterator, context?: any): ChainedObject; - forEach(iterator: Iterator, context?: any): ChainedObject; - map(iterator: Iterator, context?: any): ChainedArray; - collect(iterator: Iterator, context?: any): ChainedArray; + each(iterator: Iterator_, context?: any): ChainedObject; + forEach(iterator: Iterator_, context?: any): ChainedObject; + map(iterator: Iterator_, context?: any): ChainedArray; + collect(iterator: Iterator_, context?: any): ChainedArray; reduce(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; reduce(iterator: Reducer, initialValue: U, context?: any): ChainedObject; foldl(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; @@ -252,29 +252,29 @@ module Underscore { reduceRight(iterator: Reducer, initialValue: U, context?: any): ChainedObject; foldr(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; foldr(iterator: Reducer, initialValue: U, context?: any): ChainedObject; - find(iterator: Iterator, context?: any): ChainedObject; - detect(iterator: Iterator, context?: any): ChainedObject; - filter(iterator: Iterator, context?: any): ChainedArray; - select(iterator: Iterator, context?: any): ChainedArray; + find(iterator: Iterator_, context?: any): ChainedObject; + detect(iterator: Iterator_, context?: any): ChainedObject; + filter(iterator: Iterator_, context?: any): ChainedArray; + select(iterator: Iterator_, context?: any): ChainedArray; where(properties: Object): ChainedArray; findWhere(properties: Object): ChainedObject; - reject(iterator: Iterator, context?: any): ChainedArray; - every(iterator?: Iterator, context?: any): ChainedObject; - all(iterator?: Iterator, context?: any): ChainedObject; - some(iterator?: Iterator, context?: any): ChainedObject; - any(iterator?: Iterator, context?: any): ChainedObject; + reject(iterator: Iterator_, context?: any): ChainedArray; + every(iterator?: Iterator_, context?: any): ChainedObject; + all(iterator?: Iterator_, context?: any): ChainedObject; + some(iterator?: Iterator_, context?: any): ChainedObject; + any(iterator?: Iterator_, context?: any): ChainedObject; contains(value: T): ChainedObject; include(value: T): ChainedObject; invoke(methodName: string, ...args: any[]): ChainedArray; pluck(propertyName: string): ChainedArray; - max(iterator?: Iterator, context?: any): ChainedObject; - min(iterator?: Iterator, context?: any): ChainedObject; - sortBy(iterator: Iterator, context?: any): ChainedArray; + max(iterator?: Iterator_, context?: any): ChainedObject; + min(iterator?: Iterator_, context?: any): ChainedObject; + sortBy(iterator: Iterator_, context?: any): ChainedArray; sortBy(propertyName: string): ChainedArray; // Should return ChainedDictionary, but expansive recursion not allowed - groupBy(iterator?: Iterator, context?: any): ChainedDictionary; + groupBy(iterator?: Iterator_, context?: any): ChainedDictionary; groupBy(propertyName: string): ChainedDictionary; - countBy(iterator?: Iterator, context?: any): ChainedDictionary; + countBy(iterator?: Iterator_, context?: any): ChainedDictionary; countBy(propertyName: string): ChainedDictionary; shuffle(): ChainedArray; toArray(): ChainedArray; @@ -297,16 +297,16 @@ module Underscore { intersection(...arrays: T[][]): ChainedArray; difference(...others: T[][]): ChainedArray; uniq(isSorted?: boolean): ChainedArray; - uniq(isSorted: boolean, iterator: Iterator, context?: any): ChainedArray; + uniq(isSorted: boolean, iterator: Iterator_, context?: any): ChainedArray; unique(isSorted?: boolean): ChainedArray; - unique(isSorted: boolean, iterator: Iterator, context?: any): ChainedArray; + unique(isSorted: boolean, iterator: Iterator_, context?: any): ChainedArray; zip(...arrays: any[][]): ChainedArray; object(): ChainedObject; object(values: any[]): ChainedObject; indexOf(value: T, isSorted?: boolean): ChainedObject; lastIndexOf(value: T, fromIndex?: number): ChainedObject; sortedIndex(obj: T, propertyName: string): ChainedObject; - sortedIndex(obj: T, iterator?: Iterator, context?: any): ChainedObject; + sortedIndex(obj: T, iterator?: Iterator_, context?: any): ChainedObject; // Methods from Array concat(...items: T[]): ChainedArray; join(separator?: string): ChainedObject; @@ -329,10 +329,10 @@ module Underscore { } export interface ChainedDictionary extends ChainedObject> { - each(iterator: Iterator, context?: any): ChainedObject; - forEach(iterator: Iterator, context?: any): ChainedObject; - map(iterator: Iterator, context?: any): ChainedArray; - collect(iterator: Iterator, context?: any): ChainedArray; + each(iterator: Iterator_, context?: any): ChainedObject; + forEach(iterator: Iterator_, context?: any): ChainedObject; + map(iterator: Iterator_, context?: any): ChainedArray; + collect(iterator: Iterator_, context?: any): ChainedArray; reduce(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; reduce(iterator: Reducer, initialValue: U, context?: any): ChainedObject; foldl(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; @@ -343,29 +343,29 @@ module Underscore { reduceRight(iterator: Reducer, initialValue: U, context?: any): ChainedObject; foldr(iterator: Reducer, initialValue?: T, context?: any): ChainedObject; foldr(iterator: Reducer, initialValue: U, context?: any): ChainedObject; - find(iterator: Iterator, context?: any): ChainedObject; - detect(iterator: Iterator, context?: any): ChainedObject; - filter(iterator: Iterator, context?: any): ChainedArray; - select(iterator: Iterator, context?: any): ChainedArray; + find(iterator: Iterator_, context?: any): ChainedObject; + detect(iterator: Iterator_, context?: any): ChainedObject; + filter(iterator: Iterator_, context?: any): ChainedArray; + select(iterator: Iterator_, context?: any): ChainedArray; where(properties: Object): ChainedArray; findWhere(properties: Object): ChainedObject; - reject(iterator: Iterator, context?: any): ChainedArray; - every(iterator?: Iterator, context?: any): ChainedObject; - all(iterator?: Iterator, context?: any): ChainedObject; - some(iterator?: Iterator, context?: any): ChainedObject; - any(iterator?: Iterator, context?: any): ChainedObject; + reject(iterator: Iterator_, context?: any): ChainedArray; + every(iterator?: Iterator_, context?: any): ChainedObject; + all(iterator?: Iterator_, context?: any): ChainedObject; + some(iterator?: Iterator_, context?: any): ChainedObject; + any(iterator?: Iterator_, context?: any): ChainedObject; contains(value: T): ChainedObject; include(value: T): ChainedObject; invoke(methodName: string, ...args: any[]): ChainedArray; pluck(propertyName: string): ChainedArray; - max(iterator?: Iterator, context?: any): ChainedObject; - min(iterator?: Iterator, context?: any): ChainedObject; - sortBy(iterator: Iterator, context?: any): ChainedArray; + max(iterator?: Iterator_, context?: any): ChainedObject; + min(iterator?: Iterator_, context?: any): ChainedObject; + sortBy(iterator: Iterator_, context?: any): ChainedArray; sortBy(propertyName: string): ChainedArray; // Should return ChainedDictionary, but expansive recursion not allowed - groupBy(iterator?: Iterator, context?: any): ChainedDictionary; + groupBy(iterator?: Iterator_, context?: any): ChainedDictionary; groupBy(propertyName: string): ChainedDictionary; - countBy(iterator?: Iterator, context?: any): ChainedDictionary; + countBy(iterator?: Iterator_, context?: any): ChainedDictionary; countBy(propertyName: string): ChainedDictionary; shuffle(): ChainedArray; toArray(): ChainedArray; @@ -396,15 +396,15 @@ module Underscore { chain(list: Dictionary): ChainedDictionary; chain(obj: T): ChainedObject; - each(list: T[], iterator: Iterator, context?: any): void; - each(list: Dictionary, iterator: Iterator, context?: any): void; - forEach(list: T[], iterator: Iterator, context?: any): void; - forEach(list: Dictionary, iterator: Iterator, context?: any): void; + each(list: T[], iterator: Iterator_, context?: any): void; + each(list: Dictionary, iterator: Iterator_, context?: any): void; + forEach(list: T[], iterator: Iterator_, context?: any): void; + forEach(list: Dictionary, iterator: Iterator_, context?: any): void; - map(list: T[], iterator: Iterator, context?: any): U[]; - map(list: Dictionary, iterator: Iterator, context?: any): U[]; - collect(list: T[], iterator: Iterator, context?: any): U[]; - collect(list: Dictionary, iterator: Iterator, context?: any): U[]; + map(list: T[], iterator: Iterator_, context?: any): U[]; + map(list: Dictionary, iterator: Iterator_, context?: any): U[]; + collect(list: T[], iterator: Iterator_, context?: any): U[]; + collect(list: Dictionary, iterator: Iterator_, context?: any): U[]; reduce(list: T[], iterator: Reducer, initialValue?: T, context?: any): T; reduce(list: T[], iterator: Reducer, initialValue: U, context?: any): U; @@ -428,15 +428,15 @@ module Underscore { foldr(list: Dictionary, iterator: Reducer, initialValue?: T, context?: any): T; foldr(list: Dictionary, iterator: Reducer, initialValue: U, context?: any): U; - find(list: T[], iterator: Iterator, context?: any): T; - find(list: Dictionary, iterator: Iterator, context?: any): T; - detect(list: T[], iterator: Iterator, context?: any): T; - detect(list: Dictionary, iterator: Iterator, context?: any): T; + find(list: T[], iterator: Iterator_, context?: any): T; + find(list: Dictionary, iterator: Iterator_, context?: any): T; + detect(list: T[], iterator: Iterator_, context?: any): T; + detect(list: Dictionary, iterator: Iterator_, context?: any): T; - filter(list: T[], iterator: Iterator, context?: any): T[]; - filter(list: Dictionary, iterator: Iterator, context?: any): T[]; - select(list: T[], iterator: Iterator, context?: any): T[]; - select(list: Dictionary, iterator: Iterator, context?: any): T[]; + filter(list: T[], iterator: Iterator_, context?: any): T[]; + filter(list: Dictionary, iterator: Iterator_, context?: any): T[]; + select(list: T[], iterator: Iterator_, context?: any): T[]; + select(list: Dictionary, iterator: Iterator_, context?: any): T[]; where(list: T[], properties: Object): T[]; where(list: Dictionary, properties: Object): T[]; @@ -444,18 +444,18 @@ module Underscore { findWhere(list: T[], properties: Object): T; findWhere(list: Dictionary, properties: Object): T; - reject(list: T[], iterator: Iterator, context?: any): T[]; - reject(list: Dictionary, iterator: Iterator, context?: any): T[]; + reject(list: T[], iterator: Iterator_, context?: any): T[]; + reject(list: Dictionary, iterator: Iterator_, context?: any): T[]; - every(list: T[], iterator?: Iterator, context?: any): boolean; - every(list: Dictionary, iterator?: Iterator, context?: any): boolean; - all(list: T[], iterator?: Iterator, context?: any): boolean; - all(list: Dictionary, iterator?: Iterator, context?: any): boolean; + every(list: T[], iterator?: Iterator_, context?: any): boolean; + every(list: Dictionary, iterator?: Iterator_, context?: any): boolean; + all(list: T[], iterator?: Iterator_, context?: any): boolean; + all(list: Dictionary, iterator?: Iterator_, context?: any): boolean; - some(list: T[], iterator?: Iterator, context?: any): boolean; - some(list: Dictionary, iterator?: Iterator, context?: any): boolean; - any(list: T[], iterator?: Iterator, context?: any): boolean; - any(list: Dictionary, iterator?: Iterator, context?: any): boolean; + some(list: T[], iterator?: Iterator_, context?: any): boolean; + some(list: Dictionary, iterator?: Iterator_, context?: any): boolean; + any(list: T[], iterator?: Iterator_, context?: any): boolean; + any(list: Dictionary, iterator?: Iterator_, context?: any): boolean; contains(list: T[], value: T): boolean; contains(list: Dictionary, value: T): boolean; @@ -468,24 +468,24 @@ module Underscore { pluck(list: any[], propertyName: string): any[]; pluck(list: Dictionary, propertyName: string): any[]; - max(list: T[], iterator?: Iterator, context?: any): T; - max(list: Dictionary, iterator?: Iterator, context?: any): T; + max(list: T[], iterator?: Iterator_, context?: any): T; + max(list: Dictionary, iterator?: Iterator_, context?: any): T; - min(list: T[], iterator?: Iterator, context?: any): T; - min(list: Dictionary, iterator?: Iterator, context?: any): T; + min(list: T[], iterator?: Iterator_, context?: any): T; + min(list: Dictionary, iterator?: Iterator_, context?: any): T; - sortBy(list: T[], iterator: Iterator, context?: any): T[]; - sortBy(list: Dictionary, iterator: Iterator, context?: any): T[]; + sortBy(list: T[], iterator: Iterator_, context?: any): T[]; + sortBy(list: Dictionary, iterator: Iterator_, context?: any): T[]; sortBy(list: T[], propertyName: string): T[]; sortBy(list: Dictionary, propertyName: string): T[]; - groupBy(list: T[], iterator?: Iterator, context?: any): Dictionary; - groupBy(list: Dictionary, iterator?: Iterator, context?: any): Dictionary; + groupBy(list: T[], iterator?: Iterator_, context?: any): Dictionary; + groupBy(list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; groupBy(list: T[], propertyName: string): Dictionary; groupBy(list: Dictionary, propertyName: string): Dictionary; - countBy(list: T[], iterator?: Iterator, context?: any): Dictionary; - countBy(list: Dictionary, iterator?: Iterator, context?: any): Dictionary; + countBy(list: T[], iterator?: Iterator_, context?: any): Dictionary; + countBy(list: Dictionary, iterator?: Iterator_, context?: any): Dictionary; countBy(list: T[], propertyName: string): Dictionary; countBy(list: Dictionary, propertyName: string): Dictionary; @@ -527,9 +527,9 @@ module Underscore { difference(list: T[], ...others: T[][]): T[]; uniq(list: T[], isSorted?: boolean): T[]; - uniq(list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; + uniq(list: T[], isSorted: boolean, iterator: Iterator_, context?: any): U[]; unique(list: T[], isSorted?: boolean): T[]; - unique(list: T[], isSorted: boolean, iterator: Iterator, context?: any): U[]; + unique(list: T[], isSorted: boolean, iterator: Iterator_, context?: any): U[]; zip(a0: T0[], a1: T1[]): Tuple2[]; zip(a0: T0[], a1: T1[], a2: T2[]): Tuple3[]; @@ -544,7 +544,7 @@ module Underscore { lastIndexOf(list: T[], value: T, fromIndex?: number): number; sortedIndex(list: T[], obj: T, propertyName: string): number; - sortedIndex(list: T[], obj: T, iterator?: Iterator, context?: any): number; + sortedIndex(list: T[], obj: T, iterator?: Iterator_, context?: any): number; range(stop: number): number[]; range(start: number, stop: number, step?: number): number[]; @@ -621,7 +621,7 @@ module Underscore { identity(value: T): T; - times(n: number, iterator: Iterator, context?: any): U[]; + times(n: number, iterator: Iterator_, context?: any): U[]; random(max: number): number; random(min: number, max: number): number; @@ -647,255 +647,255 @@ module Underscore { declare var _: Underscore.Static; // @Filename: underscoreTest1_underscoreTests.ts -/// - -declare var $; -declare function alert(x: string): void; - -_.each([1, 2, 3], (num) => alert(num.toString())); -_.each({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => alert(value.toString())); - -_.map([1, 2, 3], (num) => num * 3); -_.map({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => value * 3); - -var sum = _.reduce([1, 2, 3], (memo, num) => memo + num, 0); - -var list = [[0, 1], [2, 3], [4, 5]]; -var flat = _.reduceRight(list, (a, b) => a.concat(b), []); - -var even = _.find([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); - -var evens = _.filter([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); - -var listOfPlays = [{ title: "Cymbeline", author: "Shakespeare", year: 1611 }, { title: "The Tempest", author: "Shakespeare", year: 1611 }, { title: "Other", author: "Not Shakespeare", year: 2012 }]; -_.where(listOfPlays, { author: "Shakespeare", year: 1611 }); - -var odds = _.reject([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); - -_.all([true, 1, null, 'yes'], _.identity); - -_.any([null, 0, 'yes', false]); - -_.contains([1, 2, 3], 3); - -_.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); - -var stooges = [{ name: 'moe', age: 40 }, { name: 'larry', age: 50 }, { name: 'curly', age: 60 }]; -_.pluck(stooges, 'name'); - -_.max(stooges, (stooge) => stooge.age); - -var numbers = [10, 5, 100, 2, 1000]; -_.min(numbers); - -_.sortBy([1, 2, 3, 4, 5, 6], (num) => Math.sin(num)); - - -// not sure how this is typechecking at all.. Math.floor(e) is number not string..? -_([1.3, 2.1, 2.4]).groupBy((e: number, i?: number, list?: number[]) => Math.floor(e)); -_.groupBy([1.3, 2.1, 2.4], (num: number) => Math.floor(num)); -_.groupBy(['one', 'two', 'three'], 'length'); - -_.countBy([1, 2, 3, 4, 5], (num) => num % 2 == 0 ? 'even' : 'odd'); - -_.shuffle([1, 2, 3, 4, 5, 6]); - -// (function(){ return _.toArray(arguments).slice(1); })(1, 2, 3, 4); - -_.size({ one: 1, two: 2, three: 3 }); - -/////////////////////////////////////////////////////////////////////////////////////// - -_.first([5, 4, 3, 2, 1]); -_.initial([5, 4, 3, 2, 1]); -_.last([5, 4, 3, 2, 1]); -_.rest([5, 4, 3, 2, 1]); -_.compact([0, 1, false, 2, '', 3]); - -_.flatten([1, 2, 3, 4]); -_.flatten([1, [2]]); - -// typescript doesn't like the elements being different -_.flatten([1, [2], [3, [[4]]]]); -_.flatten([1, [2], [3, [[4]]]], true); -_.without([1, 2, 1, 0, 3, 1, 4], 0, 1); -_.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); -_.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); -_.difference([1, 2, 3, 4, 5], [5, 2, 10]); -_.uniq([1, 2, 1, 3, 1, 4]); -_.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); -_.object(['moe', 'larry', 'curly'], [30, 40, 50]); -_.object([['moe', 30], ['larry', 40], ['curly', 50]]); -_.indexOf([1, 2, 3], 2); -_.lastIndexOf([1, 2, 3, 1, 2, 3], 2); -_.sortedIndex([10, 20, 30, 40, 50], 35); -_.range(10); -_.range(1, 11); -_.range(0, 30, 5); -_.range(0, 30, 5); -_.range(0); - -/////////////////////////////////////////////////////////////////////////////////////// - -var func = function (greeting) { return greeting + ': ' + this.name }; -// need a second var otherwise typescript thinks func signature is the above func type, -// instead of the newly returned _bind => func type. -var func2 = _.bind(func, { name: 'moe' }, 'hi'); -func2(); - -var buttonView = { - label: 'underscore', - onClick: function () { alert('clicked: ' + this.label); }, - onHover: function () { alert('hovering: ' + this.label); } -}; -_.bindAll(buttonView); -$('#underscore_button').bind('click', buttonView.onClick); - -var fibonacci = _.memoize(function (n) { - return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); -}); - -var log = _.bind((message?: string, ...rest: string[]) => { }, Date); -_.delay(log, 1000, 'logged later'); - -_.defer(function () { alert('deferred'); }); - -var updatePosition = () => alert('updating position...'); -var throttled = _.throttle(updatePosition, 100); -$(null).scroll(throttled); - -var calculateLayout = () => alert('calculating layout...'); -var lazyLayout = _.debounce(calculateLayout, 300); -$(null).resize(lazyLayout); - -var createApplication = () => alert('creating application...'); -var initialize = _.once(createApplication); -initialize(); -initialize(); - -var notes: any[]; -var render = () => alert("rendering..."); -var renderNotes = _.after(notes.length, render); -_.each(notes, (note) => note.asyncSave({ success: renderNotes })); - -var hello = function (name) { return "hello: " + name; }; -hello = _.wrap(hello, (func, arg) => { return "before, " + func(arg) + ", after"; }); -hello("moe"); - -var greet = function (name) { return "hi: " + name; }; -var exclaim = function (statement) { return statement + "!"; }; -var welcome = _.compose(exclaim, greet); -welcome('moe'); - -/////////////////////////////////////////////////////////////////////////////////////// - -_.keys({ one: 1, two: 2, three: 3 }); -_.values({ one: 1, two: 2, three: 3 }); -_.pairs({ one: 1, two: 2, three: 3 }); -_.invert({ Moe: "Moses", Larry: "Louis", Curly: "Jerome" }); -_.functions(_); -_.extend({ name: 'moe' }, { age: 50 }); -_.pick({ name: 'moe', age: 50, userid: 'moe1' }, 'name', 'age'); -_.omit({ name: 'moe', age: 50, userid: 'moe1' }, 'userid'); - -var iceCream = { flavor: "chocolate" }; -_.defaults(iceCream, { flavor: "vanilla", sprinkles: "lots" }); - -_.clone({ name: 'moe' }); - -_.chain([1, 2, 3, 200]) - .filter(function (num) { return num % 2 == 0; }) - .tap(alert) - .map(function (num) { return num * num }) - .value(); - -_.has({ a: 1, b: 2, c: 3 }, "b"); - -var moe = { name: 'moe', luckyNumbers: [13, 27, 34] }; -var clone = { name: 'moe', luckyNumbers: [13, 27, 34] }; -moe == clone; -_.isEqual(moe, clone); - -_.isEmpty([1, 2, 3]); -_.isEmpty({}); - -_.isElement($('body')[0]); - -(function () { return _.isArray(arguments); })(); -_.isArray([1, 2, 3]); - -_.isObject({}); -_.isObject(1); - - -// (() => { return _.isArguments(arguments); })(1, 2, 3); -_.isArguments([1, 2, 3]); - -_.isFunction(alert); - -_.isString("moe"); - -_.isNumber(8.4 * 5); - -_.isFinite(-101); - -_.isFinite(-Infinity); - -_.isBoolean(null); - -_.isDate(new Date()); - -_.isRegExp(/moe/); - -_.isNaN(NaN); -isNaN(undefined); -_.isNaN(undefined); - -_.isNull(null); -_.isNull(undefined); - -_.isUndefined((null).missingVariable); - -/////////////////////////////////////////////////////////////////////////////////////// - -var underscore = _.noConflict(); - -var moe2 = { name: 'moe' }; -moe2 === _.identity(moe); - -var genie; - -_.times(3, function (n) { genie.grantWishNumber(n); }); - -_.random(0, 100); - -_.mixin({ - capitalize: function (string) { - return string.charAt(0).toUpperCase() + string.substring(1).toLowerCase(); - } -}); -(_("fabio")).capitalize(); - -_.uniqueId('contact_'); - -_.escape('Curly, Larry & Moe'); - -var object = { cheese: 'crumpets', stuff: function () { return 'nonsense'; } }; -_.result(object, 'cheese'); - -_.result(object, 'stuff'); - -var compiled = _.template("hello: <%= name %>"); -compiled({ name: 'moe' }); -var list2 = "<% _.each(people, function(name) { %>
  • <%= name %>
  • <% }); %>"; -_.template(list2, { people: ['moe', 'curly', 'larry'] }); -var template = _.template("<%- value %>"); -template({ value: '