From af3d0f0248cbc20366fd5591063958cd9f7ea391 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 9 Apr 2019 11:31:17 -0700 Subject: [PATCH 001/384] Start smart select API --- src/server/protocol.ts | 21 ++++- src/server/session.ts | 63 +++++++++++++- src/testRunner/tsconfig.json | 1 + .../unittests/tsserver/selectionRange.ts | 84 +++++++++++++++++++ src/testRunner/unittests/tsserver/session.ts | 1 + 5 files changed, 167 insertions(+), 3 deletions(-) create mode 100644 src/testRunner/unittests/tsserver/selectionRange.ts diff --git a/src/server/protocol.ts b/src/server/protocol.ts index e5580874369..1709c6196ef 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -130,7 +130,8 @@ namespace ts.server.protocol { GetEditsForFileRename = "getEditsForFileRename", /* @internal */ GetEditsForFileRenameFull = "getEditsForFileRename-full", - ConfigurePlugin = "configurePlugin" + ConfigurePlugin = "configurePlugin", + SelectionRange = "selectionRange", // NOTE: If updating this, be sure to also update `allCommandNames` in `harness/unittests/session.ts`. } @@ -1395,6 +1396,24 @@ namespace ts.server.protocol { export interface ConfigurePluginResponse extends Response { } + export interface SelectionRangeRequest extends FileRequest { + command: CommandTypes.SelectionRange; + arguments: SelectionRangeRequestArgs; + } + + export interface SelectionRangeRequestArgs extends FileRequestArgs { + locations: Location[]; + } + + export interface SelectionRangeResponse extends Response { + body?: SelectionRange[]; + } + + export interface SelectionRange { + textSpan: TextSpan; + parent?: SelectionRange; + } + /** * Information found in an "open" request. */ diff --git a/src/server/session.ts b/src/server/session.ts index 3c202c9aecd..f566340cb28 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1318,11 +1318,11 @@ namespace ts.server { this.projectService.openClientFileWithNormalizedPath(fileName, fileContent, scriptKind, /*hasMixedContent*/ false, projectRootPath); } - private getPosition(args: protocol.FileLocationRequestArgs, scriptInfo: ScriptInfo): number { + private getPosition(args: protocol.Location & { position?: number }, scriptInfo: ScriptInfo): number { return args.position !== undefined ? args.position : scriptInfo.lineOffsetToPosition(args.line, args.offset); } - private getPositionInFile(args: protocol.FileLocationRequestArgs, file: NormalizedPath): number { + private getPositionInFile(args: protocol.Location & { position?: number }, file: NormalizedPath): number { const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; return this.getPosition(args, scriptInfo); } @@ -2059,6 +2059,62 @@ namespace ts.server { this.projectService.configurePlugin(args); } + private getSelectionRange(args: protocol.SelectionRangeRequestArgs): protocol.SelectionRange[] { + const { locations } = args; + const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args); + + const sourceFile = languageService.getNonBoundSourceFile(file); + const scriptInfo = Debug.assertDefined(this.projectService.getScriptInfo(file)); + const fullTextSpan = this.toLocationTextSpan( + createTextSpan(sourceFile.getFullStart(), sourceFile.getEnd() - sourceFile.getFullStart()), + scriptInfo); + + return map(locations, location => { + const pos = this.getPosition(location, scriptInfo); + let selectionRange: protocol.SelectionRange = { textSpan: fullTextSpan }; + // Skip top-level SyntaxList + let current: Node | undefined = sourceFile.getChildAt(0); + while (true) { + const children = current && current.getChildren(sourceFile); + if (!children || !children.length) break; + for (let i = 0; i < children.length; i++) { + const prevNode: Node | undefined = children[i - 1]; + const node: Node = children[i]; + const nextNode: Node | undefined = children[i + 1]; + if (node.getStart(sourceFile) > pos) { + current = undefined; + break; + } + // Blocks are effectively redundant with SyntaxLists; dive in without adding to the list + if (isBlock(node)) { + current = node; + break; + } + if (positionBelongsToNode(node, pos, sourceFile)) { + // Blocks with braces should be selected from brace to brace, non-inclusive + const isBetweenBraces = isSyntaxList(node) + && prevNode && prevNode.kind === SyntaxKind.OpenBraceToken + && nextNode && nextNode.kind === SyntaxKind.CloseBraceToken; + const start = isBetweenBraces ? prevNode.getEnd() : node.getStart(); + const end = isBetweenBraces ? nextNode.getStart() : node.getEnd(); + const textSpan = this.toLocationTextSpan(createTextSpan(start, end - start), scriptInfo); + current = node; + // Skip ranges that are identical to the parent + if (selectionRange.textSpan.start !== textSpan.start || selectionRange.textSpan.end !== textSpan.end) { + selectionRange = { + textSpan, + parent: selectionRange, + }; + Object.defineProperty(selectionRange, "__debugKind", { value: formatSyntaxKind(node.kind) }); + } + break; + } + } + } + return selectionRange; + }); + } + getCanonicalFileName(fileName: string) { const name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); return normalizePath(name); @@ -2414,6 +2470,9 @@ namespace ts.server { this.configurePlugin(request.arguments); this.doOutput(/*info*/ undefined, CommandNames.ConfigurePlugin, request.seq, /*success*/ true); return this.notRequired(); + }, + [CommandNames.SelectionRange]: (request: protocol.SelectionRangeRequest) => { + return this.requiredResponse(this.getSelectionRange(request.arguments)); } }); diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index 6b73324e2f7..5ae94c80c23 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -141,6 +141,7 @@ "unittests/tsserver/reload.ts", "unittests/tsserver/rename.ts", "unittests/tsserver/resolutionCache.ts", + "unittests/tsserver/selectionRange.ts", "unittests/tsserver/session.ts", "unittests/tsserver/skipLibCheck.ts", "unittests/tsserver/symLinks.ts", diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/selectionRange.ts new file mode 100644 index 00000000000..ae67ea5de0a --- /dev/null +++ b/src/testRunner/unittests/tsserver/selectionRange.ts @@ -0,0 +1,84 @@ +namespace ts.projectSystem { + function setup(fileName: string, content: string) { + const file: File = { path: fileName, content }; + const host = createServerHost([file, libFile]); + const session = createSession(host); + openFilesForSession([file], session); + return function getSelectionRange(locations: protocol.SelectionRangeRequestArgs["locations"]) { + return executeSessionRequest( + session, + CommandNames.SelectionRange, + { file: fileName, locations }); + }; + } + + describe("unittests:: tsserver:: selectionRange", () => { + it("works for simple JavaScript", () => { + const getSelectionRange = setup("/file.js", ` +class Foo { + bar(a, b) { + if (a === b) { + return true; + } + return false; + } +}`); + + const locations = getSelectionRange([{ + line: 4, + offset: 13 + }]); + + assert.deepEqual(locations, [ + { + textSpan: { // a + start: { line: 4, offset: 13 }, + end: { line: 4, offset: 14 }, + }, + parent: { + textSpan: { // a === b + start: { line: 4, offset: 13 }, + end: { line: 4, offset: 20 }, + }, + parent: { + textSpan: { // IfStatement + start: { line: 4, offset: 9 }, + end: { line: 6, offset: 10 }, + }, + parent: { + textSpan: { // SyntaxList + whitespace (body of method) + start: { line: 3, offset: 16 }, + end: { line: 8, offset: 5 }, + }, + parent: { + textSpan: { // MethodDeclaration + start: { line: 3, offset: 5 }, + end: { line: 8, offset: 6 }, + }, + parent: { + textSpan: { // SyntaxList + whitespace (body of class) + start: { line: 2, offset: 12 }, + end: { line: 9, offset: 1 }, + }, + parent: { + textSpan: { // ClassDeclaration + start: { line: 2, offset: 1 }, + end: { line: 9, offset: 2 }, + }, + parent: { + textSpan: { // SourceFile (all text) + start: { line: 1, offset: 1 }, + end: { line: 9, offset: 2 }, + } + } + } + } + }, + }, + }, + }, + }, + ]); + }); + }); +} diff --git a/src/testRunner/unittests/tsserver/session.ts b/src/testRunner/unittests/tsserver/session.ts index 715c0ab3324..cf84ffce6e8 100644 --- a/src/testRunner/unittests/tsserver/session.ts +++ b/src/testRunner/unittests/tsserver/session.ts @@ -264,6 +264,7 @@ namespace ts.server { CommandNames.OrganizeImportsFull, CommandNames.GetEditsForFileRename, CommandNames.GetEditsForFileRenameFull, + CommandNames.SelectionRange, ]; it("should not throw when commands are executed with invalid arguments", () => { From f98c00ab9dbf9b37fbadb9a15b6a41f65b06d383 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 9 Apr 2019 15:32:38 -0700 Subject: [PATCH 002/384] Add more tests, special handling for mapped types --- src/server/session.ts | 59 ++++- .../unittests/tsserver/selectionRange.ts | 202 ++++++++++++++---- 2 files changed, 207 insertions(+), 54 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index f566340cb28..307ee37cc1c 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1744,6 +1744,14 @@ namespace ts.server { }; } + private locationsAreEqual(a: protocol.Location, b: protocol.Location): boolean { + return a.line === b.line && a.offset === b.offset; + } + + private locationTextSpansAreEqual(a: protocol.TextSpan, b: protocol.TextSpan): boolean { + return this.locationsAreEqual(a.start, b.start) && this.locationsAreEqual(a.end, b.end); + } + private getNavigationTree(args: protocol.FileRequestArgs, simplifiedResult: boolean): protocol.NavigationTree | NavigationTree | undefined { const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args); const tree = languageService.getNavigationTree(file); @@ -2066,12 +2074,22 @@ namespace ts.server { const sourceFile = languageService.getNonBoundSourceFile(file); const scriptInfo = Debug.assertDefined(this.projectService.getScriptInfo(file)); const fullTextSpan = this.toLocationTextSpan( - createTextSpan(sourceFile.getFullStart(), sourceFile.getEnd() - sourceFile.getFullStart()), + createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd()), scriptInfo); return map(locations, location => { const pos = this.getPosition(location, scriptInfo); let selectionRange: protocol.SelectionRange = { textSpan: fullTextSpan }; + const pushSelectionRange = (textSpan: protocol.TextSpan, syntaxKind?: SyntaxKind): void => { + // Skip ranges that are identical to the parent + if (!this.locationTextSpansAreEqual(textSpan, selectionRange.textSpan)) { + selectionRange = { textSpan, parent: selectionRange }; + if (syntaxKind) { + Object.defineProperty(selectionRange, "__debugKind", { value: formatSyntaxKind(syntaxKind) }); + } + } + }; + // Skip top-level SyntaxList let current: Node | undefined = sourceFile.getChildAt(0); while (true) { @@ -2097,16 +2115,37 @@ namespace ts.server { && nextNode && nextNode.kind === SyntaxKind.CloseBraceToken; const start = isBetweenBraces ? prevNode.getEnd() : node.getStart(); const end = isBetweenBraces ? nextNode.getStart() : node.getEnd(); - const textSpan = this.toLocationTextSpan(createTextSpan(start, end - start), scriptInfo); - current = node; - // Skip ranges that are identical to the parent - if (selectionRange.textSpan.start !== textSpan.start || selectionRange.textSpan.end !== textSpan.end) { - selectionRange = { - textSpan, - parent: selectionRange, - }; - Object.defineProperty(selectionRange, "__debugKind", { value: formatSyntaxKind(node.kind) }); + const textSpan = this.toLocationTextSpan(createTextSpanFromBounds(start, end), scriptInfo); + pushSelectionRange(textSpan, node.kind); + + // Mapped types _look_ like ObjectTypes with a single member, + // but in fact don’t contain a SyntaxList or a node containing + // the “key/value” pair like ObjectTypes do, but it seems intuitive + // that the selection would snap to those points. The philosophy + // of choosing a selection range is not so much about what the + // syntax currently _is_ as what the syntax might easily become + // if the user is making a selection; e.g., we synthesize a selection + // around the “key/value” pair not because there’s a node there, but + // because it allows the mapped type to become an object type with a + // few keystrokes. + if (isMappedTypeNode(node)) { + const openBraceToken = Debug.assertDefined(node.getFirstToken()); + const firstNonBraceToken = Debug.assertDefined(node.getChildAt(1)); + const closeBraceToken = Debug.assertDefined(node.getLastToken()); + Debug.assertEqual(openBraceToken.kind, SyntaxKind.OpenBraceToken); + Debug.assertEqual(closeBraceToken.kind, SyntaxKind.CloseBraceToken); + const spanWithoutBraces = this.toLocationTextSpan(createTextSpanFromBounds( + openBraceToken.getEnd(), + closeBraceToken.getStart(), + ), scriptInfo); + const spanWithoutBracesOrTrivia = this.toLocationTextSpan(createTextSpanFromBounds( + firstNonBraceToken.getStart(), + closeBraceToken.getFullStart(), + ), scriptInfo); + pushSelectionRange(spanWithoutBraces); + pushSelectionRange(spanWithoutBracesOrTrivia); } + current = node; break; } } diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/selectionRange.ts index ae67ea5de0a..80b8b1971c0 100644 --- a/src/testRunner/unittests/tsserver/selectionRange.ts +++ b/src/testRunner/unittests/tsserver/selectionRange.ts @@ -24,61 +24,175 @@ class Foo { } }`); - const locations = getSelectionRange([{ - line: 4, - offset: 13 - }]); + const locations = getSelectionRange([ + { + line: 4, + offset: 13, + }, { + line: 5, + offset: 22, + }, + ]); + + // Common to results for both locations + const ifStatementUp: protocol.SelectionRange = { + textSpan: { // IfStatement + start: { line: 4, offset: 9 }, + end: { line: 6, offset: 10 } }, + parent: { + textSpan: { // SyntaxList + whitespace (body of method) + start: { line: 3, offset: 16 }, + end: { line: 8, offset: 5 } }, + parent: { + textSpan: { // MethodDeclaration + start: { line: 3, offset: 5 }, + end: { line: 8, offset: 6 } }, + parent: { + textSpan: { // SyntaxList + whitespace (body of class) + start: { line: 2, offset: 12 }, + end: { line: 9, offset: 1 } }, + parent: { + textSpan: { // ClassDeclaration + start: { line: 2, offset: 1 }, + end: { line: 9, offset: 2 } }, + parent: { + textSpan: { // SourceFile (all text) + start: { line: 1, offset: 1 }, + end: { line: 9, offset: 2 }, } } } } } } }; assert.deepEqual(locations, [ { textSpan: { // a start: { line: 4, offset: 13 }, - end: { line: 4, offset: 14 }, - }, + end: { line: 4, offset: 14 } }, parent: { textSpan: { // a === b start: { line: 4, offset: 13 }, - end: { line: 4, offset: 20 }, - }, + end: { line: 4, offset: 20 } }, + parent: ifStatementUp } }, + { + textSpan: { // true + start: { line: 5, offset: 20 }, + end: { line: 5, offset: 24 } }, + parent: { + textSpan: { // return true; + start: { line: 5, offset: 13 }, + end: { line: 5, offset: 25 } }, parent: { - textSpan: { // IfStatement - start: { line: 4, offset: 9 }, - end: { line: 6, offset: 10 }, - }, - parent: { - textSpan: { // SyntaxList + whitespace (body of method) - start: { line: 3, offset: 16 }, - end: { line: 8, offset: 5 }, - }, - parent: { - textSpan: { // MethodDeclaration - start: { line: 3, offset: 5 }, - end: { line: 8, offset: 6 }, - }, - parent: { - textSpan: { // SyntaxList + whitespace (body of class) - start: { line: 2, offset: 12 }, - end: { line: 9, offset: 1 }, - }, - parent: { - textSpan: { // ClassDeclaration - start: { line: 2, offset: 1 }, - end: { line: 9, offset: 2 }, - }, - parent: { - textSpan: { // SourceFile (all text) - start: { line: 1, offset: 1 }, - end: { line: 9, offset: 2 }, - } - } - } - } - }, - }, - }, - }, + textSpan: { // SyntaxList + whitespace (body of IfStatement) + start: { line: 4, offset: 23 }, + end: { line: 6, offset: 9 } }, + parent: ifStatementUp } } } + ]); + }); + + it("works for simple TypeScript", () => { + const getSelectionRange = setup("/file.ts", ` +export interface IService { + _serviceBrand: any; + + open(host: number, data: any): Promise; +}`); + const locations = getSelectionRange([ + { + line: 5, + offset: 12, }, ]); + + assert.deepEqual(locations, [ + { + textSpan: { // host + start: { line: 5, offset: 10 }, + end: { line: 5, offset: 14 } }, + parent: { + textSpan: { // host: number + start: { line: 5, offset: 10 }, + end: { line: 5, offset: 22 } }, + parent: { + textSpan: { // host: number, data: any + start: { line: 5, offset: 10 }, + end: { line: 5, offset: 33 } }, + parent: { + textSpan: { // open(host: number, data: any): Promise; + start: { line: 5, offset: 5 }, + end: { line: 5, offset: 49 } }, + parent: { + textSpan: { // SyntaxList + whitespace (body of interface) + start: { line: 2, offset: 28 }, + end: { line: 6, offset: 1 } }, + parent: { + textSpan: { // InterfaceDeclaration + start: { line: 2, offset: 1 }, + end: { line: 6, offset: 2 } }, + parent: { + textSpan: { // SourceFile + start: { line: 1, offset: 1 }, + end: { line: 6, offset: 2 } } } } } } } } }, + ]); + }); + + it("works for complex TypeScript", () => { + const getSelectionRange = setup("/file.ts", ` +type X = IsExactlyAny

extends true ? T : ({ [K in keyof P]: IsExactlyAny extends true ? K extends keyof T ? T[K] : P[K] : P[K]; } & Pick>) +`); + const locations = getSelectionRange([ + { + line: 2, + offset: 133, + }, + ]); + + assert.deepEqual(locations, [ + { + textSpan: { // K + start: { line: 2, offset: 133 }, + end: { line: 2, offset: 134 } }, + parent: { + textSpan: { // P[K] + start: { line: 2, offset: 131 }, + end: { line: 2, offset: 135 } }, + parent: { + textSpan: { // K extends keyof T ? T[K] : P[K] + start: { line: 2, offset: 104 }, + end: { line: 2, offset: 135 } }, + parent: { + textSpan: { // IsExactlyAny extends true ? K extends keyof T ? T[K] : P[K] : P[K] + start: { line: 2, offset: 70 }, + end: { line: 2, offset: 142 } }, + parent: { + textSpan: { // [K in keyof P]: IsExactlyAny extends true ? K extends keyof T ? T[K] : P[K] : P[K]; + start: { line: 2, offset: 54 }, + end: { line: 2, offset: 143 } }, + parent: { // same as above + whitespace + textSpan: { + start: { line: 2, offset: 53 }, + end: { line: 2, offset: 144 } }, + parent: { + textSpan: { // MappedType: same as above + braces + start: { line: 2, offset: 52 }, + end: { line: 2, offset: 145 } }, + parent: { + textSpan: { // IntersectionType: { [K in keyof P]: ... } & Pick> + start: { line: 2, offset: 52 }, + end: { line: 2, offset: 182 } }, + parent: { + textSpan: { // same as above + parens + start: { line: 2, offset: 51 }, + end: { line: 2, offset: 183 } }, + parent: { + textSpan: { // Whole TypeNode of TypeAliasDeclaration + start: { line: 2, offset: 16 }, + end: { line: 2, offset: 183 } }, + parent: { + textSpan: { // Whole TypeAliasDeclaration + start: { line: 2, offset: 1 }, + end: { line: 2, offset: 183 } }, + parent: { + textSpan: { // SourceFile + start: { line: 1, offset: 1 }, + end: { line: 2, offset: 184 } } } } } } } } } } } } } }, + ]); }); }); } From e62c2333eb3398ef835ba4cb561f8f168a8b3a75 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 10 Apr 2019 14:23:25 -0700 Subject: [PATCH 003/384] Add support for string literals --- src/server/session.ts | 46 +++++--- .../unittests/tsserver/selectionRange.ts | 107 ++++++++++++++++++ 2 files changed, 138 insertions(+), 15 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index 307ee37cc1c..9f4fb2b24d6 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -2080,8 +2080,9 @@ namespace ts.server { return map(locations, location => { const pos = this.getPosition(location, scriptInfo); let selectionRange: protocol.SelectionRange = { textSpan: fullTextSpan }; - const pushSelectionRange = (textSpan: protocol.TextSpan, syntaxKind?: SyntaxKind): void => { + const pushSelectionRange = (start: number, end: number, syntaxKind?: SyntaxKind): void => { // Skip ranges that are identical to the parent + const textSpan = this.toLocationTextSpan(createTextSpanFromBounds(start, end), scriptInfo); if (!this.locationTextSpansAreEqual(textSpan, selectionRange.textSpan)) { selectionRange = { textSpan, parent: selectionRange }; if (syntaxKind) { @@ -2092,6 +2093,7 @@ namespace ts.server { // Skip top-level SyntaxList let current: Node | undefined = sourceFile.getChildAt(0); + let isInTemplateSpan = false; while (true) { const children = current && current.getChildren(sourceFile); if (!children || !children.length) break; @@ -2103,20 +2105,32 @@ namespace ts.server { current = undefined; break; } - // Blocks are effectively redundant with SyntaxLists; dive in without adding to the list - if (isBlock(node)) { + // Blocks are effectively redundant with SyntaxLists. + // TemplateSpans are an unintuitive grouping of two things which + // should be considered independently. + // Dive in without pushing a selection range. + const nodeIsTemplateSpan = isTemplateSpan(node); + const nodeIsTemplateSpanList = prevNode && isTemplateHead(prevNode); + if (isBlock(node) || nodeIsTemplateSpan || nodeIsTemplateSpanList) { + isInTemplateSpan = nodeIsTemplateSpan; current = node; break; } if (positionBelongsToNode(node, pos, sourceFile)) { + // Synthesize a stop for '${ ... }' since '${' and '}' actually belong to siblings. + if (isInTemplateSpan && nextNode && isTemplateMiddleOrTemplateTail(nextNode)) { + const start = node.getFullStart() - "${".length; + const end = nextNode.getStart() + "}".length; + pushSelectionRange(start, end, node.kind); + } + // Blocks with braces should be selected from brace to brace, non-inclusive const isBetweenBraces = isSyntaxList(node) && prevNode && prevNode.kind === SyntaxKind.OpenBraceToken && nextNode && nextNode.kind === SyntaxKind.CloseBraceToken; const start = isBetweenBraces ? prevNode.getEnd() : node.getStart(); const end = isBetweenBraces ? nextNode.getStart() : node.getEnd(); - const textSpan = this.toLocationTextSpan(createTextSpanFromBounds(start, end), scriptInfo); - pushSelectionRange(textSpan, node.kind); + pushSelectionRange(start, end, node.kind); // Mapped types _look_ like ObjectTypes with a single member, // but in fact don’t contain a SyntaxList or a node containing @@ -2134,17 +2148,19 @@ namespace ts.server { const closeBraceToken = Debug.assertDefined(node.getLastToken()); Debug.assertEqual(openBraceToken.kind, SyntaxKind.OpenBraceToken); Debug.assertEqual(closeBraceToken.kind, SyntaxKind.CloseBraceToken); - const spanWithoutBraces = this.toLocationTextSpan(createTextSpanFromBounds( - openBraceToken.getEnd(), - closeBraceToken.getStart(), - ), scriptInfo); - const spanWithoutBracesOrTrivia = this.toLocationTextSpan(createTextSpanFromBounds( - firstNonBraceToken.getStart(), - closeBraceToken.getFullStart(), - ), scriptInfo); - pushSelectionRange(spanWithoutBraces); - pushSelectionRange(spanWithoutBracesOrTrivia); + const spanWithoutBraces = [openBraceToken.getEnd(), closeBraceToken.getStart()] as const; + const spanWithoutBracesOrTrivia = [firstNonBraceToken.getStart(), closeBraceToken.getFullStart()] as const; + pushSelectionRange(...spanWithoutBraces); + pushSelectionRange(...spanWithoutBracesOrTrivia); } + + // String literals should have a stop both inside and outside their quotes. + if (isStringLiteral(node) || isTemplateLiteral(node)) { + pushSelectionRange(start + 1, end - 1); + } + + // If we’ve made it here, we’ve already used `isInTemplateSpan` as much as we need + isInTemplateSpan = false; current = node; break; } diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/selectionRange.ts index 80b8b1971c0..9166acecc40 100644 --- a/src/testRunner/unittests/tsserver/selectionRange.ts +++ b/src/testRunner/unittests/tsserver/selectionRange.ts @@ -194,5 +194,112 @@ type X = IsExactlyAny

extends true ? T : ({ [K in keyof P]: IsExactlyAn end: { line: 2, offset: 184 } } } } } } } } } } } } } }, ]); }); + + it.skip("works for object types", () => { + const getSelectionRange = setup("/file.js", ` +type X = { + foo?: string; + readonly bar: number; +}`); + const locations = getSelectionRange([ + { + line: 3, + offset: 5, + }, + { + line: 4, + offset: 5, + }, + { + line: 4, + offset: 14, + }, + ]); + + const allMembersUp: protocol.SelectionRange = { + textSpan: { // all members + whitespace (just inside braces) + start: { line: 2, offset: 11 }, + end: { line: 5, offset: 1 } }, + parent: { + textSpan: { // add braces + start: { line: 2, offset: 10 }, + end: { line: 5, offset: 2 } }, + parent: { + textSpan: { // whole TypeAliasDeclaration + start: { line: 2, offset: 1 }, + end: { line: 5, offset: 2 } }, + parent: { + textSpan: { // SourceFile + start: { line: 1, offset: 1 }, + end: { line: 5, offset: 2 } } } } } }; + + const readonlyBarUp: protocol.SelectionRange = { + textSpan: { // readonly bar + start: { line: 4, offset: 5 }, + end: { line: 4, offset: 17 } }, + parent: { + textSpan: { // readonly bar: number; + start: { line: 4, offset: 5 }, + end: { line: 4, offset: 26 } }, + parent: allMembersUp } }; + + assert.deepEqual(locations, [ + { + textSpan: { // foo + start: { line: 3, offset: 5 }, + end: { line: 3, offset: 8 } }, + parent: { + textSpan: { // foo? + start: { line: 3, offset: 5 }, + end: { line: 3, offset: 9 } }, + parent: { + textSpan: { // foo?: string; + start: { line: 3, offset: 5 }, + end: { line: 3, offset: 18 } }, + parent: allMembersUp } } }, + { + textSpan: { // readonly + start: { line: 4, offset: 5 }, + end: { line: 4, offset: 13 } }, + parent: readonlyBarUp }, + { + textSpan: { // bar + start: { line: 4, offset: 14 }, + end: { line: 4, offset: 17 } }, + parent: readonlyBarUp }, + ]); + }); + + it("works for string literals and template strings", () => { + // tslint:disable-next-line:no-invalid-template-strings + const getSelectionRange = setup("/file.ts", "`a b ${\n 'c'\n} d`"); + const locations = getSelectionRange([{ line: 2, offset: 4 }]); + assert.deepEqual(locations, [ + { + textSpan: { // c + start: { line: 2, offset: 4 }, + end: { line: 2, offset: 5 } }, + parent: { + textSpan: { // 'c' + start: { line: 2, offset: 3 }, + end: { line: 2, offset: 6 } }, + // parent: { + // textSpan: { // just inside braces + // start: { line: 1, offset: 8 }, + // end: { line: 3, offset: 1 } }, + parent: { + textSpan: { // whole TemplateSpan: ${ ... } + start: { line: 1, offset: 6 }, + end: { line: 3, offset: 2 } }, + parent: { + textSpan: { // whole template string without backticks + start: { line: 1, offset: 2 }, + end: { line: 3, offset: 4 } }, + parent: { + textSpan: { // whole template string + start: { line: 1, offset: 1 }, + end: { line: 3, offset: 5 } } } } } } } + ]); + }); }); } From fd88e5225270121e949d4cff67b2a664f21dac07 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 11 Apr 2019 11:38:05 -0700 Subject: [PATCH 004/384] Start imports --- src/server/session.ts | 75 +++++++++++++------ .../unittests/tsserver/selectionRange.ts | 40 ++++++++++ 2 files changed, 92 insertions(+), 23 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index 9f4fb2b24d6..90a8aa2f00f 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -112,6 +112,32 @@ namespace ts.server { return edits.every(edit => textSpanEnd(edit.span) < pos); } + function getGroupBounds(array: ArrayLike, index: number, predicate: (element: T) => boolean): [number, number] { + let first = index; + let last = index; + let i = index; + while (i > 0) { + const element = array[--i]; + if (predicate(element)) { + first = i; + } + else { + break; + } + } + i = index; + while (i < array.length - 1) { + const element = array[++i]; + if (predicate(element)) { + last = i; + } + else { + break; + } + } + return [first, last]; + } + // CommandNames used to be exposed before TS 2.4 as a namespace // In TS 2.4 we switched to an enum, keep this for backward compatibility // The var assignment ensures that even though CommandTypes are a const enum @@ -2071,6 +2097,7 @@ namespace ts.server { const { locations } = args; const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args); + const isImport = or(isImportDeclaration, isImportEqualsDeclaration); const sourceFile = languageService.getNonBoundSourceFile(file); const scriptInfo = Debug.assertDefined(this.projectService.getScriptInfo(file)); const fullTextSpan = this.toLocationTextSpan( @@ -2092,37 +2119,41 @@ namespace ts.server { }; // Skip top-level SyntaxList - let current: Node | undefined = sourceFile.getChildAt(0); - let isInTemplateSpan = false; - while (true) { - const children = current && current.getChildren(sourceFile); - if (!children || !children.length) break; + let parentNode = sourceFile.getChildAt(0); + outer: while (true) { + const children = parentNode.getChildren(sourceFile); + if (!children.length) break; for (let i = 0; i < children.length; i++) { const prevNode: Node | undefined = children[i - 1]; const node: Node = children[i]; const nextNode: Node | undefined = children[i + 1]; if (node.getStart(sourceFile) > pos) { - current = undefined; - break; - } - // Blocks are effectively redundant with SyntaxLists. - // TemplateSpans are an unintuitive grouping of two things which - // should be considered independently. - // Dive in without pushing a selection range. - const nodeIsTemplateSpan = isTemplateSpan(node); - const nodeIsTemplateSpanList = prevNode && isTemplateHead(prevNode); - if (isBlock(node) || nodeIsTemplateSpan || nodeIsTemplateSpanList) { - isInTemplateSpan = nodeIsTemplateSpan; - current = node; - break; + break outer; } + if (positionBelongsToNode(node, pos, sourceFile)) { + // Blocks are effectively redundant with SyntaxLists. + // TemplateSpans, along with the SyntaxLists containing them, + // are a somewhat unintuitive grouping of things that should be + // considered independently. Dive in without pushing a selection range. + if (isBlock(node) || isTemplateSpan(node) || prevNode && isTemplateHead(prevNode)) { + parentNode = node; + break; + } + // Synthesize a stop for '${ ... }' since '${' and '}' actually belong to siblings. - if (isInTemplateSpan && nextNode && isTemplateMiddleOrTemplateTail(nextNode)) { + if (isTemplateSpan(parentNode) && nextNode && isTemplateMiddleOrTemplateTail(nextNode)) { const start = node.getFullStart() - "${".length; const end = nextNode.getStart() + "}".length; pushSelectionRange(start, end, node.kind); } + // Synthesize a stop for group of adjacent imports + else if (isImport(node)) { + const [firstImportIndex, lastImportIndex] = getGroupBounds(children, i, isImport); + pushSelectionRange( + children[firstImportIndex].getStart(), + children[lastImportIndex].getEnd()); + } // Blocks with braces should be selected from brace to brace, non-inclusive const isBetweenBraces = isSyntaxList(node) @@ -2155,13 +2186,11 @@ namespace ts.server { } // String literals should have a stop both inside and outside their quotes. - if (isStringLiteral(node) || isTemplateLiteral(node)) { + else if (isStringLiteral(node) || isTemplateLiteral(node)) { pushSelectionRange(start + 1, end - 1); } - // If we’ve made it here, we’ve already used `isInTemplateSpan` as much as we need - isInTemplateSpan = false; - current = node; + parentNode = node; break; } } diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/selectionRange.ts index 9166acecc40..4b95f929bf9 100644 --- a/src/testRunner/unittests/tsserver/selectionRange.ts +++ b/src/testRunner/unittests/tsserver/selectionRange.ts @@ -301,5 +301,45 @@ type X = { end: { line: 3, offset: 5 } } } } } } } ]); }); + + it.skip("works for ES2015 import lists", () => { + const getSelectionRange = setup("/file.ts", ` +import { x as y, z } from './z'; +import { b } from './'; + +console.log(1);`); + + const locations = getSelectionRange([{ line: 2, offset: 10 }]); + assert.deepEqual(locations, [ + { + textSpan: { // x + start: { line: 2, offset: 10 }, + end: { line: 2, offset: 11 } }, + parent: { + textSpan: { // x as y + start: { line: 2, offset: 10 }, + end: { line: 2, offset: 16 } }, + parent: { + textSpan: { // x as y, z + start: { line: 2, offset: 10 }, + end: { line: 2, offset: 19 } }, + parent: { + textSpan: { // { x as y, z } + start: { line: 2, offset: 8 }, + end: { line: 2, offset: 21 } }, + parent: { + textSpan: { // import { x as y, z } from './z'; + start: { line: 2, offset: 1 }, + end: { line: 2, offset: 33 } }, + parent: { + textSpan: { // all imports + start: { line: 2, offset: 1 }, + end: { line: 3, offset: 24 } }, + parent: { + textSpan: { // SourceFile + start: { line: 1, offset: 1 }, + end: { line: 5, offset: 16 } } } } } } } } } + ]); + }); }); } From 039487c84e518cb6de798d1011dca7e9db624315 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 11 Apr 2019 12:47:10 -0700 Subject: [PATCH 005/384] Also skip TemplateHeads --- src/server/session.ts | 2 +- .../unittests/tsserver/selectionRange.ts | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index 90a8aa2f00f..f64674b129a 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -2136,7 +2136,7 @@ namespace ts.server { // TemplateSpans, along with the SyntaxLists containing them, // are a somewhat unintuitive grouping of things that should be // considered independently. Dive in without pushing a selection range. - if (isBlock(node) || isTemplateSpan(node) || prevNode && isTemplateHead(prevNode)) { + if (isBlock(node) || isTemplateSpan(node) || isTemplateHead(node) || prevNode && isTemplateHead(prevNode)) { parentNode = node; break; } diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/selectionRange.ts index 4b95f929bf9..ce88b4072cc 100644 --- a/src/testRunner/unittests/tsserver/selectionRange.ts +++ b/src/testRunner/unittests/tsserver/selectionRange.ts @@ -273,7 +273,10 @@ type X = { it("works for string literals and template strings", () => { // tslint:disable-next-line:no-invalid-template-strings const getSelectionRange = setup("/file.ts", "`a b ${\n 'c'\n} d`"); - const locations = getSelectionRange([{ line: 2, offset: 4 }]); + const locations = getSelectionRange([ + { line: 2, offset: 4 }, + { line: 1, offset: 4 }, + ]); assert.deepEqual(locations, [ { textSpan: { // c @@ -298,7 +301,15 @@ type X = { parent: { textSpan: { // whole template string start: { line: 1, offset: 1 }, - end: { line: 3, offset: 5 } } } } } } } + end: { line: 3, offset: 5 } } } } } } }, + { + textSpan: { // whole template string without backticks + start: { line: 1, offset: 2 }, + end: { line: 3, offset: 4 } }, + parent: { + textSpan: { // whole template string + start: { line: 1, offset: 1 }, + end: { line: 3, offset: 5 } } } }, ]); }); From 0a4ef0f63069f29beac7689d4b9a579689d732dc Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 11 Apr 2019 13:02:49 -0700 Subject: [PATCH 006/384] Distinguish between same-line and different-line braces --- src/server/session.ts | 12 +++--- .../unittests/tsserver/selectionRange.ts | 37 +++++++++++-------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index f64674b129a..ed9f4d8990a 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -2155,12 +2155,14 @@ namespace ts.server { children[lastImportIndex].getEnd()); } - // Blocks with braces should be selected from brace to brace, non-inclusive - const isBetweenBraces = isSyntaxList(node) + // Blocks with braces on separate lines should be selected from brace to brace, + // including whitespace but not including the braces themselves. + const isBetweenMultiLineBraces = isSyntaxList(node) && prevNode && prevNode.kind === SyntaxKind.OpenBraceToken - && nextNode && nextNode.kind === SyntaxKind.CloseBraceToken; - const start = isBetweenBraces ? prevNode.getEnd() : node.getStart(); - const end = isBetweenBraces ? nextNode.getStart() : node.getEnd(); + && nextNode && nextNode.kind === SyntaxKind.CloseBraceToken + && !positionsAreOnSameLine(prevNode.getStart(), nextNode.getStart(), sourceFile); + const start = isBetweenMultiLineBraces ? prevNode.getEnd() : node.getStart(); + const end = isBetweenMultiLineBraces ? nextNode.getStart() : node.getEnd(); pushSelectionRange(start, end, node.kind); // Mapped types _look_ like ObjectTypes with a single member, diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/selectionRange.ts index ce88b4072cc..b4858407ee8 100644 --- a/src/testRunner/unittests/tsserver/selectionRange.ts +++ b/src/testRunner/unittests/tsserver/selectionRange.ts @@ -199,21 +199,13 @@ type X = IsExactlyAny

extends true ? T : ({ [K in keyof P]: IsExactlyAn const getSelectionRange = setup("/file.js", ` type X = { foo?: string; - readonly bar: number; + readonly bar: { x: number }; }`); const locations = getSelectionRange([ - { - line: 3, - offset: 5, - }, - { - line: 4, - offset: 5, - }, - { - line: 4, - offset: 14, - }, + { line: 3, offset: 5 }, + { line: 4, offset: 5 }, + { line: 4, offset: 14 }, + { line: 4, offset: 27 }, ]); const allMembersUp: protocol.SelectionRange = { @@ -238,9 +230,9 @@ type X = { start: { line: 4, offset: 5 }, end: { line: 4, offset: 17 } }, parent: { - textSpan: { // readonly bar: number; + textSpan: { // readonly bar: { x: number }; start: { line: 4, offset: 5 }, - end: { line: 4, offset: 26 } }, + end: { line: 4, offset: 33 } }, parent: allMembersUp } }; assert.deepEqual(locations, [ @@ -267,6 +259,19 @@ type X = { start: { line: 4, offset: 14 }, end: { line: 4, offset: 17 } }, parent: readonlyBarUp }, + { + textSpan: { // number + start: { line: 4, offset: 24 }, + end: { line: 4, offset: 30 } }, + parent: { + textSpan: { // x: number + start: { line: 4, offset: 21 }, + end: { line: 4, offset: 30 } }, + parent: { + textSpan: { // { x: number } + start: { line: 4, offset: 19 }, + end: { line: 4, offset: 32 } }, + parent: readonlyBarUp } } }, ]); }); @@ -313,7 +318,7 @@ type X = { ]); }); - it.skip("works for ES2015 import lists", () => { + it("works for ES2015 import lists", () => { const getSelectionRange = setup("/file.ts", ` import { x as y, z } from './z'; import { b } from './'; From 61425cb3047bf7144d910dc710be10e7eb0fe45c Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 11 Apr 2019 15:15:17 -0700 Subject: [PATCH 007/384] Move most logic to separate file --- src/server/selectionRange.ts | 116 +++++++++++++++++ src/server/session.ts | 119 +----------------- src/server/tsconfig.json | 55 ++++---- .../unittests/tsserver/selectionRange.ts | 38 +++--- 4 files changed, 167 insertions(+), 161 deletions(-) create mode 100644 src/server/selectionRange.ts diff --git a/src/server/selectionRange.ts b/src/server/selectionRange.ts new file mode 100644 index 00000000000..60027e330dc --- /dev/null +++ b/src/server/selectionRange.ts @@ -0,0 +1,116 @@ +/* @internal */ +namespace ts.server { + const isImport = or(isImportDeclaration, isImportEqualsDeclaration); + + export function getSelectionRange(pos: number, sourceFile: SourceFile, pushSelectionRange: (start: number, end: number, kind?: SyntaxKind) => void) { + pushSelectionRange(sourceFile.getFullStart(), sourceFile.getEnd(), SyntaxKind.SourceFile); + + // Skip top-level SyntaxList + let parentNode = sourceFile.getChildAt(0); + outer: while (true) { + const children = parentNode.getChildren(sourceFile); + if (!children.length) break; + for (let i = 0; i < children.length; i++) { + const prevNode: Node | undefined = children[i - 1]; + const node: Node = children[i]; + const nextNode: Node | undefined = children[i + 1]; + if (node.getStart(sourceFile) > pos) { + break outer; + } + + if (positionBelongsToNode(node, pos, sourceFile)) { + // Blocks are effectively redundant with SyntaxLists. + // TemplateSpans, along with the SyntaxLists containing them, + // are a somewhat unintuitive grouping of things that should be + // considered independently. Dive in without pushing a selection range. + if (isBlock(node) || isTemplateSpan(node) || isTemplateHead(node) || prevNode && isTemplateHead(prevNode)) { + parentNode = node; + break; + } + + // Synthesize a stop for '${ ... }' since '${' and '}' actually belong to siblings. + if (isTemplateSpan(parentNode) && nextNode && isTemplateMiddleOrTemplateTail(nextNode)) { + const start = node.getFullStart() - "${".length; + const end = nextNode.getStart() + "}".length; + pushSelectionRange(start, end, node.kind); + } + // Synthesize a stop for group of adjacent imports + else if (isImport(node)) { + const [firstImportIndex, lastImportIndex] = getGroupBounds(children, i, isImport); + pushSelectionRange( + children[firstImportIndex].getStart(), + children[lastImportIndex].getEnd()); + } + + // Blocks with braces on separate lines should be selected from brace to brace, + // including whitespace but not including the braces themselves. + const isBetweenMultiLineBraces = isSyntaxList(node) + && prevNode && prevNode.kind === SyntaxKind.OpenBraceToken + && nextNode && nextNode.kind === SyntaxKind.CloseBraceToken + && !positionsAreOnSameLine(prevNode.getStart(), nextNode.getStart(), sourceFile); + const start = isBetweenMultiLineBraces ? prevNode.getEnd() : node.getStart(); + const end = isBetweenMultiLineBraces ? nextNode.getStart() : node.getEnd(); + pushSelectionRange(start, end, node.kind); + + // Mapped types _look_ like ObjectTypes with a single member, + // but in fact don’t contain a SyntaxList or a node containing + // the “key/value” pair like ObjectTypes do, but it seems intuitive + // that the selection would snap to those points. The philosophy + // of choosing a selection range is not so much about what the + // syntax currently _is_ as what the syntax might easily become + // if the user is making a selection; e.g., we synthesize a selection + // around the “key/value” pair not because there’s a node there, but + // because it allows the mapped type to become an object type with a + // few keystrokes. + if (isMappedTypeNode(node)) { + const openBraceToken = Debug.assertDefined(node.getFirstToken()); + const firstNonBraceToken = Debug.assertDefined(node.getChildAt(1)); + const closeBraceToken = Debug.assertDefined(node.getLastToken()); + Debug.assertEqual(openBraceToken.kind, SyntaxKind.OpenBraceToken); + Debug.assertEqual(closeBraceToken.kind, SyntaxKind.CloseBraceToken); + const spanWithoutBraces = [openBraceToken.getEnd(), closeBraceToken.getStart()] as const; + const spanWithoutBracesOrTrivia = [firstNonBraceToken.getStart(), closeBraceToken.getFullStart()] as const; + if (!positionsAreOnSameLine(openBraceToken.getStart(), closeBraceToken.getEnd(), sourceFile)) { + pushSelectionRange(...spanWithoutBraces); + } + pushSelectionRange(...spanWithoutBracesOrTrivia); + } + + // String literals should have a stop both inside and outside their quotes. + else if (isStringLiteral(node) || isTemplateLiteral(node)) { + pushSelectionRange(start + 1, end - 1); + } + + parentNode = node; + break; + } + } + } + } + + function getGroupBounds(array: ArrayLike, index: number, predicate: (element: T) => boolean): [number, number] { + let first = index; + let last = index; + let i = index; + while (i > 0) { + const element = array[--i]; + if (predicate(element)) { + first = i; + } + else { + break; + } + } + i = index; + while (i < array.length - 1) { + const element = array[++i]; + if (predicate(element)) { + last = i; + } + else { + break; + } + } + return [first, last]; + } +} diff --git a/src/server/session.ts b/src/server/session.ts index ed9f4d8990a..68c34d27b26 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -112,32 +112,6 @@ namespace ts.server { return edits.every(edit => textSpanEnd(edit.span) < pos); } - function getGroupBounds(array: ArrayLike, index: number, predicate: (element: T) => boolean): [number, number] { - let first = index; - let last = index; - let i = index; - while (i > 0) { - const element = array[--i]; - if (predicate(element)) { - first = i; - } - else { - break; - } - } - i = index; - while (i < array.length - 1) { - const element = array[++i]; - if (predicate(element)) { - last = i; - } - else { - break; - } - } - return [first, last]; - } - // CommandNames used to be exposed before TS 2.4 as a namespace // In TS 2.4 we switched to an enum, keep this for backward compatibility // The var assignment ensures that even though CommandTypes are a const enum @@ -2097,107 +2071,26 @@ namespace ts.server { const { locations } = args; const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args); - const isImport = or(isImportDeclaration, isImportEqualsDeclaration); + const sourceFile = languageService.getNonBoundSourceFile(file); const scriptInfo = Debug.assertDefined(this.projectService.getScriptInfo(file)); - const fullTextSpan = this.toLocationTextSpan( - createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd()), - scriptInfo); return map(locations, location => { const pos = this.getPosition(location, scriptInfo); - let selectionRange: protocol.SelectionRange = { textSpan: fullTextSpan }; + let selectionRange: protocol.SelectionRange | undefined; const pushSelectionRange = (start: number, end: number, syntaxKind?: SyntaxKind): void => { // Skip ranges that are identical to the parent const textSpan = this.toLocationTextSpan(createTextSpanFromBounds(start, end), scriptInfo); - if (!this.locationTextSpansAreEqual(textSpan, selectionRange.textSpan)) { - selectionRange = { textSpan, parent: selectionRange }; + if (!selectionRange || !this.locationTextSpansAreEqual(textSpan, selectionRange.textSpan)) { + selectionRange = { textSpan, ...selectionRange && { parent: selectionRange } }; if (syntaxKind) { Object.defineProperty(selectionRange, "__debugKind", { value: formatSyntaxKind(syntaxKind) }); } } }; - // Skip top-level SyntaxList - let parentNode = sourceFile.getChildAt(0); - outer: while (true) { - const children = parentNode.getChildren(sourceFile); - if (!children.length) break; - for (let i = 0; i < children.length; i++) { - const prevNode: Node | undefined = children[i - 1]; - const node: Node = children[i]; - const nextNode: Node | undefined = children[i + 1]; - if (node.getStart(sourceFile) > pos) { - break outer; - } - - if (positionBelongsToNode(node, pos, sourceFile)) { - // Blocks are effectively redundant with SyntaxLists. - // TemplateSpans, along with the SyntaxLists containing them, - // are a somewhat unintuitive grouping of things that should be - // considered independently. Dive in without pushing a selection range. - if (isBlock(node) || isTemplateSpan(node) || isTemplateHead(node) || prevNode && isTemplateHead(prevNode)) { - parentNode = node; - break; - } - - // Synthesize a stop for '${ ... }' since '${' and '}' actually belong to siblings. - if (isTemplateSpan(parentNode) && nextNode && isTemplateMiddleOrTemplateTail(nextNode)) { - const start = node.getFullStart() - "${".length; - const end = nextNode.getStart() + "}".length; - pushSelectionRange(start, end, node.kind); - } - // Synthesize a stop for group of adjacent imports - else if (isImport(node)) { - const [firstImportIndex, lastImportIndex] = getGroupBounds(children, i, isImport); - pushSelectionRange( - children[firstImportIndex].getStart(), - children[lastImportIndex].getEnd()); - } - - // Blocks with braces on separate lines should be selected from brace to brace, - // including whitespace but not including the braces themselves. - const isBetweenMultiLineBraces = isSyntaxList(node) - && prevNode && prevNode.kind === SyntaxKind.OpenBraceToken - && nextNode && nextNode.kind === SyntaxKind.CloseBraceToken - && !positionsAreOnSameLine(prevNode.getStart(), nextNode.getStart(), sourceFile); - const start = isBetweenMultiLineBraces ? prevNode.getEnd() : node.getStart(); - const end = isBetweenMultiLineBraces ? nextNode.getStart() : node.getEnd(); - pushSelectionRange(start, end, node.kind); - - // Mapped types _look_ like ObjectTypes with a single member, - // but in fact don’t contain a SyntaxList or a node containing - // the “key/value” pair like ObjectTypes do, but it seems intuitive - // that the selection would snap to those points. The philosophy - // of choosing a selection range is not so much about what the - // syntax currently _is_ as what the syntax might easily become - // if the user is making a selection; e.g., we synthesize a selection - // around the “key/value” pair not because there’s a node there, but - // because it allows the mapped type to become an object type with a - // few keystrokes. - if (isMappedTypeNode(node)) { - const openBraceToken = Debug.assertDefined(node.getFirstToken()); - const firstNonBraceToken = Debug.assertDefined(node.getChildAt(1)); - const closeBraceToken = Debug.assertDefined(node.getLastToken()); - Debug.assertEqual(openBraceToken.kind, SyntaxKind.OpenBraceToken); - Debug.assertEqual(closeBraceToken.kind, SyntaxKind.CloseBraceToken); - const spanWithoutBraces = [openBraceToken.getEnd(), closeBraceToken.getStart()] as const; - const spanWithoutBracesOrTrivia = [firstNonBraceToken.getStart(), closeBraceToken.getFullStart()] as const; - pushSelectionRange(...spanWithoutBraces); - pushSelectionRange(...spanWithoutBracesOrTrivia); - } - - // String literals should have a stop both inside and outside their quotes. - else if (isStringLiteral(node) || isTemplateLiteral(node)) { - pushSelectionRange(start + 1, end - 1); - } - - parentNode = node; - break; - } - } - } - return selectionRange; + getSelectionRange(pos, sourceFile, pushSelectionRange); + return selectionRange!; }); } diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json index 3cf28ab40ee..d4f2edb39be 100644 --- a/src/server/tsconfig.json +++ b/src/server/tsconfig.json @@ -1,27 +1,28 @@ -{ - "extends": "../tsconfig-base", - "compilerOptions": { - "removeComments": false, - "outFile": "../../built/local/server.js", - "preserveConstEnums": true, - "types": [ - "node" - ] - }, - "references": [ - { "path": "../compiler" }, - { "path": "../jsTyping" }, - { "path": "../services" } - ], - "files": [ - "types.ts", - "utilities.ts", - "protocol.ts", - "scriptInfo.ts", - "typingsCache.ts", - "project.ts", - "editorServices.ts", - "session.ts", - "scriptVersionCache.ts" - ] -} +{ + "extends": "../tsconfig-base", + "compilerOptions": { + "removeComments": false, + "outFile": "../../built/local/server.js", + "preserveConstEnums": true, + "types": [ + "node" + ] + }, + "references": [ + { "path": "../compiler" }, + { "path": "../jsTyping" }, + { "path": "../services" } + ], + "files": [ + "types.ts", + "utilities.ts", + "protocol.ts", + "scriptInfo.ts", + "typingsCache.ts", + "project.ts", + "editorServices.ts", + "selectionRange.ts", + "session.ts", + "scriptVersionCache.ts" + ] +} diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/selectionRange.ts index b4858407ee8..c2261e041e0 100644 --- a/src/testRunner/unittests/tsserver/selectionRange.ts +++ b/src/testRunner/unittests/tsserver/selectionRange.ts @@ -164,38 +164,34 @@ type X = IsExactlyAny

extends true ? T : ({ [K in keyof P]: IsExactlyAn textSpan: { // [K in keyof P]: IsExactlyAny extends true ? K extends keyof T ? T[K] : P[K] : P[K]; start: { line: 2, offset: 54 }, end: { line: 2, offset: 143 } }, - parent: { // same as above + whitespace - textSpan: { - start: { line: 2, offset: 53 }, - end: { line: 2, offset: 144 } }, + parent: { + textSpan: { // MappedType: same as above + braces + start: { line: 2, offset: 52 }, + end: { line: 2, offset: 145 } }, parent: { - textSpan: { // MappedType: same as above + braces + textSpan: { // IntersectionType: { [K in keyof P]: ... } & Pick> start: { line: 2, offset: 52 }, - end: { line: 2, offset: 145 } }, + end: { line: 2, offset: 182 } }, parent: { - textSpan: { // IntersectionType: { [K in keyof P]: ... } & Pick> - start: { line: 2, offset: 52 }, - end: { line: 2, offset: 182 } }, + textSpan: { // same as above + parens + start: { line: 2, offset: 51 }, + end: { line: 2, offset: 183 } }, parent: { - textSpan: { // same as above + parens - start: { line: 2, offset: 51 }, + textSpan: { // Whole TypeNode of TypeAliasDeclaration + start: { line: 2, offset: 16 }, end: { line: 2, offset: 183 } }, parent: { - textSpan: { // Whole TypeNode of TypeAliasDeclaration - start: { line: 2, offset: 16 }, + textSpan: { // Whole TypeAliasDeclaration + start: { line: 2, offset: 1 }, end: { line: 2, offset: 183 } }, parent: { - textSpan: { // Whole TypeAliasDeclaration - start: { line: 2, offset: 1 }, - end: { line: 2, offset: 183 } }, - parent: { - textSpan: { // SourceFile - start: { line: 1, offset: 1 }, - end: { line: 2, offset: 184 } } } } } } } } } } } } } }, + textSpan: { // SourceFile + start: { line: 1, offset: 1 }, + end: { line: 2, offset: 184 } } } } } } } } } } } } }, ]); }); - it.skip("works for object types", () => { + it("works for object types", () => { const getSelectionRange = setup("/file.js", ` type X = { foo?: string; From 0f7bc0289230a78a4ebc7b21005761034c87b665 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 11 Apr 2019 17:32:40 -0700 Subject: [PATCH 008/384] Move to language service --- src/harness/client.ts | 4 ++ src/harness/harnessLanguageService.ts | 3 ++ src/server/protocol.ts | 2 + src/server/session.ts | 46 +++++++++------------- src/server/tsconfig.json | 1 - src/{server => services}/selectionRange.ts | 31 +++++++++++++-- src/services/services.ts | 5 +++ src/services/shims.ts | 8 ++++ src/services/tsconfig.json | 1 + src/services/types.ts | 7 ++++ 10 files changed, 76 insertions(+), 32 deletions(-) rename src/{server => services}/selectionRange.ts (77%) diff --git a/src/harness/client.ts b/src/harness/client.ts index 03d53344616..bb9e674bbc6 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -424,6 +424,10 @@ namespace ts.server { return renameInfo; } + getSelectionRange() { + return notImplemented(); + } + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[] { if (!this.lastRenameEntry || this.lastRenameEntry.inputs.fileName !== fileName || diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index b70afecb791..fff02e5b94a 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -472,6 +472,9 @@ namespace Harness.LanguageService { getRenameInfo(fileName: string, position: number, options?: ts.RenameInfoOptions): ts.RenameInfo { return unwrapJSONCallResult(this.shim.getRenameInfo(fileName, position, options)); } + getSelectionRange(fileName: string, position: number): ts.SelectionRange { + return unwrapJSONCallResult(this.shim.getSelectionRange(fileName, position)); + } findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): ts.RenameLocation[] { return unwrapJSONCallResult(this.shim.findRenameLocations(fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename)); } diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 1709c6196ef..02ebee1efc5 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -132,6 +132,8 @@ namespace ts.server.protocol { GetEditsForFileRenameFull = "getEditsForFileRename-full", ConfigurePlugin = "configurePlugin", SelectionRange = "selectionRange", + /* @internal */ + SelectionRangeFull = "selectionRange-full", // NOTE: If updating this, be sure to also update `allCommandNames` in `harness/unittests/session.ts`. } diff --git a/src/server/session.ts b/src/server/session.ts index 68c34d27b26..261356f2cd0 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1744,14 +1744,6 @@ namespace ts.server { }; } - private locationsAreEqual(a: protocol.Location, b: protocol.Location): boolean { - return a.line === b.line && a.offset === b.offset; - } - - private locationTextSpansAreEqual(a: protocol.TextSpan, b: protocol.TextSpan): boolean { - return this.locationsAreEqual(a.start, b.start) && this.locationsAreEqual(a.end, b.end); - } - private getNavigationTree(args: protocol.FileRequestArgs, simplifiedResult: boolean): protocol.NavigationTree | NavigationTree | undefined { const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args); const tree = languageService.getNavigationTree(file); @@ -2067,33 +2059,28 @@ namespace ts.server { this.projectService.configurePlugin(args); } - private getSelectionRange(args: protocol.SelectionRangeRequestArgs): protocol.SelectionRange[] { + private getSelectionRange(args: protocol.SelectionRangeRequestArgs, simplifiedResult: boolean) { const { locations } = args; const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args); - - - const sourceFile = languageService.getNonBoundSourceFile(file); const scriptInfo = Debug.assertDefined(this.projectService.getScriptInfo(file)); return map(locations, location => { const pos = this.getPosition(location, scriptInfo); - let selectionRange: protocol.SelectionRange | undefined; - const pushSelectionRange = (start: number, end: number, syntaxKind?: SyntaxKind): void => { - // Skip ranges that are identical to the parent - const textSpan = this.toLocationTextSpan(createTextSpanFromBounds(start, end), scriptInfo); - if (!selectionRange || !this.locationTextSpansAreEqual(textSpan, selectionRange.textSpan)) { - selectionRange = { textSpan, ...selectionRange && { parent: selectionRange } }; - if (syntaxKind) { - Object.defineProperty(selectionRange, "__debugKind", { value: formatSyntaxKind(syntaxKind) }); - } - } - }; - - getSelectionRange(pos, sourceFile, pushSelectionRange); - return selectionRange!; + const selectionRange = languageService.getSelectionRange(file, pos); + return simplifiedResult ? this.mapSelectionRange(selectionRange, scriptInfo) : selectionRange; }); } + private mapSelectionRange(selectionRange: SelectionRange, scriptInfo: ScriptInfo): protocol.SelectionRange { + const result: protocol.SelectionRange = { + textSpan: this.toLocationTextSpan(selectionRange.textSpan, scriptInfo), + }; + if (selectionRange.parent) { + result.parent = this.mapSelectionRange(selectionRange.parent, scriptInfo); + } + return result; + } + getCanonicalFileName(fileName: string) { const name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); return normalizePath(name); @@ -2451,8 +2438,11 @@ namespace ts.server { return this.notRequired(); }, [CommandNames.SelectionRange]: (request: protocol.SelectionRangeRequest) => { - return this.requiredResponse(this.getSelectionRange(request.arguments)); - } + return this.requiredResponse(this.getSelectionRange(request.arguments, /*simplifiedResult*/ true)); + }, + [CommandNames.SelectionRangeFull]: (request: protocol.SelectionRangeRequest) => { + return this.requiredResponse(this.getSelectionRange(request.arguments, /*simplifiedResult*/ false)); + }, }); public addProtocolHandler(command: string, handler: (request: protocol.Request) => HandlerResponse) { diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json index d4f2edb39be..1410440512b 100644 --- a/src/server/tsconfig.json +++ b/src/server/tsconfig.json @@ -21,7 +21,6 @@ "typingsCache.ts", "project.ts", "editorServices.ts", - "selectionRange.ts", "session.ts", "scriptVersionCache.ts" ] diff --git a/src/server/selectionRange.ts b/src/services/selectionRange.ts similarity index 77% rename from src/server/selectionRange.ts rename to src/services/selectionRange.ts index 60027e330dc..7abff8cda88 100644 --- a/src/server/selectionRange.ts +++ b/src/services/selectionRange.ts @@ -1,9 +1,11 @@ /* @internal */ -namespace ts.server { +namespace ts.SelectionRange { const isImport = or(isImportDeclaration, isImportEqualsDeclaration); - export function getSelectionRange(pos: number, sourceFile: SourceFile, pushSelectionRange: (start: number, end: number, kind?: SyntaxKind) => void) { - pushSelectionRange(sourceFile.getFullStart(), sourceFile.getEnd(), SyntaxKind.SourceFile); + export function getSelectionRange(pos: number, sourceFile: SourceFile): ts.SelectionRange { + let selectionRange: SelectionRange = { + textSpan: createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd()) + }; // Skip top-level SyntaxList let parentNode = sourceFile.getChildAt(0); @@ -86,8 +88,31 @@ namespace ts.server { } } } + + return selectionRange; + + function pushSelectionRange(start: number, end: number, syntaxKind?: SyntaxKind): void { + // Skip ranges that are identical to the parent + const textSpan = createTextSpanFromBounds(start, end); + if (!selectionRange || !textSpansEqual(textSpan, selectionRange.textSpan)) { + selectionRange = { textSpan, ...selectionRange && { parent: selectionRange } }; + if (syntaxKind) { + Object.defineProperty(selectionRange, "__debugKind", { value: formatSyntaxKind(syntaxKind) }); + } + } + } } + // function getSiblingExpansionRule(parentNode: T): (SyntaxKind | SyntaxKind[])[] | undefined { + // switch (parentNode.kind) { + // case SyntaxKind.BindingElement: return [SyntaxKind.Identifier, SyntaxKind.DotDotDotToken]; + // case SyntaxKind.Parameter: return [SyntaxKind.Identifier, SyntaxKind.DotDotDotToken, SyntaxKind.QuestionToken]; + // case SyntaxKind.PropertySignature: return [SyntaxKind.Identifier, SyntaxKind.QuestionToken, SyntaxKind.SyntaxList]; + // case SyntaxKind.ElementAccessExpression: return [[SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken]]; + // case SyntaxKind.IndexedAccessType: return [[SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken]]; + // } + // } + function getGroupBounds(array: ArrayLike, index: number, predicate: (element: T) => boolean): [number, number] { let first = index; let last = index; diff --git a/src/services/services.ts b/src/services/services.ts index 5f0d3472a3e..721777c2bad 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2087,6 +2087,10 @@ namespace ts { }; } + function getSelectionRange(fileName: string, position: number): SelectionRange { + return SelectionRange.getSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName)); + } + function getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences = emptyOptions): ApplicableRefactorInfo[] { synchronizeHostData(); const file = getValidSourceFile(fileName); @@ -2134,6 +2138,7 @@ namespace ts { getBreakpointStatementAtPosition, getNavigateToItems, getRenameInfo, + getSelectionRange, findRenameLocations, getNavigationBarItems, getNavigationTree, diff --git a/src/services/shims.ts b/src/services/shims.ts index 208cf3dbc3c..3f3b3c2bef6 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -165,6 +165,7 @@ namespace ts { * { canRename: boolean, localizedErrorMessage: string, displayName: string, fullDisplayName: string, kind: string, kindModifiers: string, triggerSpan: { start; length } } */ getRenameInfo(fileName: string, position: number, options?: RenameInfoOptions): string; + getSelectionRange(fileName: string, position: number): string; /** * Returns a JSON-encoded value of the type: @@ -838,6 +839,13 @@ namespace ts { ); } + public getSelectionRange(fileName: string, position: number): string { + return this.forwardJSONCall( + `getSelectionRange('${fileName}', ${position})`, + () => this.languageService.getSelectionRange(fileName, position) + ); + } + public findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): string { return this.forwardJSONCall( `findRenameLocations('${fileName}', ${position}, ${findInStrings}, ${findInComments}, ${providePrefixAndSuffixTextForRename})`, diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index e3f2358be10..a456fbb957f 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -28,6 +28,7 @@ "patternMatcher.ts", "preProcess.ts", "rename.ts", + "selectionRange.ts", "signatureHelp.ts", "sourcemaps.ts", "suggestionDiagnostics.ts", diff --git a/src/services/types.ts b/src/services/types.ts index 3502e3e0671..d3c9de0f332 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -297,6 +297,8 @@ namespace ts { getRenameInfo(fileName: string, position: number, options?: RenameInfoOptions): RenameInfo; findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): ReadonlyArray | undefined; + getSelectionRange(fileName: string, position: number): SelectionRange; + getDefinitionAtPosition(fileName: string, position: number): ReadonlyArray | undefined; getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan | undefined; getTypeDefinitionAtPosition(fileName: string, position: number): ReadonlyArray | undefined; @@ -859,6 +861,11 @@ namespace ts { isOptional: boolean; } + export interface SelectionRange { + textSpan: TextSpan; + parent?: SelectionRange; + } + /** * Represents a single signature to show in signature help. * The id is used for subsequent calls into the language service to ask questions about the From 70e2672ab3b765672de00502ae8f6347669423ea Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Fri, 12 Apr 2019 10:53:20 -0700 Subject: [PATCH 009/384] Add rules for expanding selection to sibling nodes --- src/services/selectionRange.ts | 51 +++++++++++--- .../unittests/tsserver/selectionRange.ts | 67 ++++++++++--------- 2 files changed, 74 insertions(+), 44 deletions(-) diff --git a/src/services/selectionRange.ts b/src/services/selectionRange.ts index 7abff8cda88..3a3c0cba086 100644 --- a/src/services/selectionRange.ts +++ b/src/services/selectionRange.ts @@ -13,9 +13,9 @@ namespace ts.SelectionRange { const children = parentNode.getChildren(sourceFile); if (!children.length) break; for (let i = 0; i < children.length; i++) { - const prevNode: Node | undefined = children[i - 1]; + let prevNode: Node | undefined = children[i - 1]; const node: Node = children[i]; - const nextNode: Node | undefined = children[i + 1]; + let nextNode: Node | undefined = children[i + 1]; if (node.getStart(sourceFile) > pos) { break outer; } @@ -30,6 +30,26 @@ namespace ts.SelectionRange { break; } + const siblingExpansionRule = getSiblingExpansionRule(parentNode); + let expansionCandidate: SyntaxKind | [SyntaxKind, SyntaxKind] | undefined; + while ((prevNode || nextNode) && (expansionCandidate = siblingExpansionRule.shift())) { + if (isArray(expansionCandidate) + && prevNode && prevNode.kind === expansionCandidate[0] + && nextNode && nextNode.kind === expansionCandidate[1]) { + pushSelectionRange(prevNode.getStart(), nextNode.getEnd()); + prevNode = children[children.indexOf(prevNode) - 1]; + nextNode = children[children.indexOf(nextNode) + 1]; + } + else if (prevNode && prevNode.kind === expansionCandidate) { + pushSelectionRange(prevNode.getStart(), node.getEnd()); + prevNode = children[children.indexOf(prevNode) - 1]; + } + else if (nextNode && nextNode.kind === expansionCandidate) { + pushSelectionRange(node.getStart(), nextNode.getEnd()); + nextNode = children[children.indexOf(nextNode) + 1]; + } + } + // Synthesize a stop for '${ ... }' since '${' and '}' actually belong to siblings. if (isTemplateSpan(parentNode) && nextNode && isTemplateMiddleOrTemplateTail(nextNode)) { const start = node.getFullStart() - "${".length; @@ -103,15 +123,24 @@ namespace ts.SelectionRange { } } - // function getSiblingExpansionRule(parentNode: T): (SyntaxKind | SyntaxKind[])[] | undefined { - // switch (parentNode.kind) { - // case SyntaxKind.BindingElement: return [SyntaxKind.Identifier, SyntaxKind.DotDotDotToken]; - // case SyntaxKind.Parameter: return [SyntaxKind.Identifier, SyntaxKind.DotDotDotToken, SyntaxKind.QuestionToken]; - // case SyntaxKind.PropertySignature: return [SyntaxKind.Identifier, SyntaxKind.QuestionToken, SyntaxKind.SyntaxList]; - // case SyntaxKind.ElementAccessExpression: return [[SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken]]; - // case SyntaxKind.IndexedAccessType: return [[SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken]]; - // } - // } + function getSiblingExpansionRule(parentNode: T): (SyntaxKind | [SyntaxKind, SyntaxKind])[] { + switch (parentNode.kind) { + case SyntaxKind.BindingElement: return [SyntaxKind.Identifier, SyntaxKind.DotDotDotToken]; + case SyntaxKind.Parameter: return [SyntaxKind.Identifier, SyntaxKind.DotDotDotToken, SyntaxKind.QuestionToken]; + case SyntaxKind.PropertySignature: return [SyntaxKind.Identifier, SyntaxKind.QuestionToken, SyntaxKind.SyntaxList]; + case SyntaxKind.ElementAccessExpression: return [[SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken]]; + case SyntaxKind.MappedType: return [ + SyntaxKind.TypeParameter, + [SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken], + SyntaxKind.MinusToken, + SyntaxKind.PlusToken, + SyntaxKind.ReadonlyKeyword, + SyntaxKind.MinusToken, + SyntaxKind.PlusToken, + ]; + default: return []; + } + } function getGroupBounds(array: ArrayLike, index: number, predicate: (element: T) => boolean): [number, number] { let first = index; diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/selectionRange.ts index c2261e041e0..88bc0a6ad10 100644 --- a/src/testRunner/unittests/tsserver/selectionRange.ts +++ b/src/testRunner/unittests/tsserver/selectionRange.ts @@ -231,44 +231,45 @@ type X = { end: { line: 4, offset: 33 } }, parent: allMembersUp } }; - assert.deepEqual(locations, [ - { - textSpan: { // foo + assert.deepEqual(locations![0], { + textSpan: { // foo + start: { line: 3, offset: 5 }, + end: { line: 3, offset: 8 } }, + parent: { + textSpan: { // foo? start: { line: 3, offset: 5 }, - end: { line: 3, offset: 8 } }, + end: { line: 3, offset: 9 } }, parent: { - textSpan: { // foo? + textSpan: { // foo?: string; start: { line: 3, offset: 5 }, - end: { line: 3, offset: 9 } }, - parent: { - textSpan: { // foo?: string; - start: { line: 3, offset: 5 }, - end: { line: 3, offset: 18 } }, - parent: allMembersUp } } }, - { - textSpan: { // readonly - start: { line: 4, offset: 5 }, - end: { line: 4, offset: 13 } }, - parent: readonlyBarUp }, - { - textSpan: { // bar - start: { line: 4, offset: 14 }, - end: { line: 4, offset: 17 } }, - parent: readonlyBarUp }, - { - textSpan: { // number - start: { line: 4, offset: 24 }, + end: { line: 3, offset: 18 } }, + parent: allMembersUp } } }); + + assert.deepEqual(locations![1], { + textSpan: { // readonly + start: { line: 4, offset: 5 }, + end: { line: 4, offset: 13 } }, + parent: readonlyBarUp }); + + assert.deepEqual(locations![2], { + textSpan: { // bar + start: { line: 4, offset: 14 }, + end: { line: 4, offset: 17 } }, + parent: readonlyBarUp }); + + assert.deepEqual(locations![3], { + textSpan: { // number + start: { line: 4, offset: 24 }, + end: { line: 4, offset: 30 } }, + parent: { + textSpan: { // x: number + start: { line: 4, offset: 21 }, end: { line: 4, offset: 30 } }, parent: { - textSpan: { // x: number - start: { line: 4, offset: 21 }, - end: { line: 4, offset: 30 } }, - parent: { - textSpan: { // { x: number } - start: { line: 4, offset: 19 }, - end: { line: 4, offset: 32 } }, - parent: readonlyBarUp } } }, - ]); + textSpan: { // { x: number } + start: { line: 4, offset: 19 }, + end: { line: 4, offset: 32 } }, + parent: readonlyBarUp.parent } } }); }); it("works for string literals and template strings", () => { From fcb7f0152fc8d430510b6b94e52c49e341f0920d Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Sun, 14 Apr 2019 13:58:04 -0700 Subject: [PATCH 010/384] Rethink sibling expansion by creating fake subtrees --- src/compiler/utilities.ts | 1 + src/services/selectionRange.ts | 110 ++++++++---------- .../unittests/tsserver/selectionRange.ts | 50 +++++++- 3 files changed, 96 insertions(+), 65 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 2e6c3ae4f86..91f6e3b4218 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -7624,6 +7624,7 @@ namespace ts { return root + pathComponents.slice(1).join(directorySeparator); } + } /* @internal */ diff --git a/src/services/selectionRange.ts b/src/services/selectionRange.ts index 3a3c0cba086..631ec25fc09 100644 --- a/src/services/selectionRange.ts +++ b/src/services/selectionRange.ts @@ -2,7 +2,7 @@ namespace ts.SelectionRange { const isImport = or(isImportDeclaration, isImportEqualsDeclaration); - export function getSelectionRange(pos: number, sourceFile: SourceFile): ts.SelectionRange { + export function getSelectionRange(pos: number, sourceFile: SourceFile): SelectionRange { let selectionRange: SelectionRange = { textSpan: createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd()) }; @@ -10,12 +10,12 @@ namespace ts.SelectionRange { // Skip top-level SyntaxList let parentNode = sourceFile.getChildAt(0); outer: while (true) { - const children = parentNode.getChildren(sourceFile); + const children = getSelectionChildren(parentNode); if (!children.length) break; for (let i = 0; i < children.length; i++) { - let prevNode: Node | undefined = children[i - 1]; + const prevNode: Node | undefined = children[i - 1]; const node: Node = children[i]; - let nextNode: Node | undefined = children[i + 1]; + const nextNode: Node | undefined = children[i + 1]; if (node.getStart(sourceFile) > pos) { break outer; } @@ -30,26 +30,6 @@ namespace ts.SelectionRange { break; } - const siblingExpansionRule = getSiblingExpansionRule(parentNode); - let expansionCandidate: SyntaxKind | [SyntaxKind, SyntaxKind] | undefined; - while ((prevNode || nextNode) && (expansionCandidate = siblingExpansionRule.shift())) { - if (isArray(expansionCandidate) - && prevNode && prevNode.kind === expansionCandidate[0] - && nextNode && nextNode.kind === expansionCandidate[1]) { - pushSelectionRange(prevNode.getStart(), nextNode.getEnd()); - prevNode = children[children.indexOf(prevNode) - 1]; - nextNode = children[children.indexOf(nextNode) + 1]; - } - else if (prevNode && prevNode.kind === expansionCandidate) { - pushSelectionRange(prevNode.getStart(), node.getEnd()); - prevNode = children[children.indexOf(prevNode) - 1]; - } - else if (nextNode && nextNode.kind === expansionCandidate) { - pushSelectionRange(node.getStart(), nextNode.getEnd()); - nextNode = children[children.indexOf(nextNode) + 1]; - } - } - // Synthesize a stop for '${ ... }' since '${' and '}' actually belong to siblings. if (isTemplateSpan(parentNode) && nextNode && isTemplateMiddleOrTemplateTail(nextNode)) { const start = node.getFullStart() - "${".length; @@ -74,32 +54,8 @@ namespace ts.SelectionRange { const end = isBetweenMultiLineBraces ? nextNode.getStart() : node.getEnd(); pushSelectionRange(start, end, node.kind); - // Mapped types _look_ like ObjectTypes with a single member, - // but in fact don’t contain a SyntaxList or a node containing - // the “key/value” pair like ObjectTypes do, but it seems intuitive - // that the selection would snap to those points. The philosophy - // of choosing a selection range is not so much about what the - // syntax currently _is_ as what the syntax might easily become - // if the user is making a selection; e.g., we synthesize a selection - // around the “key/value” pair not because there’s a node there, but - // because it allows the mapped type to become an object type with a - // few keystrokes. - if (isMappedTypeNode(node)) { - const openBraceToken = Debug.assertDefined(node.getFirstToken()); - const firstNonBraceToken = Debug.assertDefined(node.getChildAt(1)); - const closeBraceToken = Debug.assertDefined(node.getLastToken()); - Debug.assertEqual(openBraceToken.kind, SyntaxKind.OpenBraceToken); - Debug.assertEqual(closeBraceToken.kind, SyntaxKind.CloseBraceToken); - const spanWithoutBraces = [openBraceToken.getEnd(), closeBraceToken.getStart()] as const; - const spanWithoutBracesOrTrivia = [firstNonBraceToken.getStart(), closeBraceToken.getFullStart()] as const; - if (!positionsAreOnSameLine(openBraceToken.getStart(), closeBraceToken.getEnd(), sourceFile)) { - pushSelectionRange(...spanWithoutBraces); - } - pushSelectionRange(...spanWithoutBracesOrTrivia); - } - // String literals should have a stop both inside and outside their quotes. - else if (isStringLiteral(node) || isTemplateLiteral(node)) { + if (isStringLiteral(node) || isTemplateLiteral(node)) { pushSelectionRange(start + 1, end - 1); } @@ -123,23 +79,49 @@ namespace ts.SelectionRange { } } - function getSiblingExpansionRule(parentNode: T): (SyntaxKind | [SyntaxKind, SyntaxKind])[] { - switch (parentNode.kind) { - case SyntaxKind.BindingElement: return [SyntaxKind.Identifier, SyntaxKind.DotDotDotToken]; - case SyntaxKind.Parameter: return [SyntaxKind.Identifier, SyntaxKind.DotDotDotToken, SyntaxKind.QuestionToken]; - case SyntaxKind.PropertySignature: return [SyntaxKind.Identifier, SyntaxKind.QuestionToken, SyntaxKind.SyntaxList]; - case SyntaxKind.ElementAccessExpression: return [[SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken]]; - case SyntaxKind.MappedType: return [ - SyntaxKind.TypeParameter, - [SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken], - SyntaxKind.MinusToken, - SyntaxKind.PlusToken, - SyntaxKind.ReadonlyKeyword, - SyntaxKind.MinusToken, - SyntaxKind.PlusToken, + function getSelectionChildren(node: Node): ReadonlyArray { + // Mapped types _look_ like ObjectTypes with a single member, + // but in fact don’t contain a SyntaxList or a node containing + // the “key/value” pair like ObjectTypes do, but it seems intuitive + // that the selection would snap to those points. The philosophy + // of choosing a selection range is not so much about what the + // syntax currently _is_ as what the syntax might easily become + // if the user is making a selection; e.g., we synthesize a selection + // around the “key/value” pair not because there’s a node there, but + // because it allows the mapped type to become an object type with a + // few keystrokes. + if (isMappedTypeNode(node)) { + const [openBraceToken, ...children] = node.getChildren(); + const closeBraceToken = Debug.assertDefined(children.pop()); + Debug.assertEqual(openBraceToken.kind, SyntaxKind.OpenBraceToken); + Debug.assertEqual(closeBraceToken.kind, SyntaxKind.CloseBraceToken); + const colonTokenIndex = findIndex(children, child => child.kind === SyntaxKind.ColonToken); + const typeNodeIndex = node.type && children.indexOf(node.type); + const leftChildren = children.slice(0, colonTokenIndex); + const colonToken = Debug.assertDefined(children[colonTokenIndex]); + const rightChildren = children.slice(colonTokenIndex + 1, typeNodeIndex && (typeNodeIndex + 1)); + // Possible semicolon + const extraChildren = typeNodeIndex && typeNodeIndex > -1 ? children.slice(typeNodeIndex + 1) : []; + const syntaxList = createSyntaxList([ + createSyntaxList(leftChildren), + colonToken, + createSyntaxList(rightChildren), + createSyntaxList(extraChildren), + ]); + return [ + openBraceToken, + syntaxList, + closeBraceToken, ]; - default: return []; } + return node.getChildren(); + } + + function createSyntaxList(children: Node[]): SyntaxList { + Debug.assertGreaterThanOrEqual(children.length, 1); + const syntaxList = createNode(SyntaxKind.SyntaxList, children[0].pos, last(children).end) as SyntaxList; + syntaxList._children = children; + return syntaxList; } function getGroupBounds(array: ArrayLike, index: number, predicate: (element: T) => boolean): [number, number] { diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/selectionRange.ts index 88bc0a6ad10..837607a58f2 100644 --- a/src/testRunner/unittests/tsserver/selectionRange.ts +++ b/src/testRunner/unittests/tsserver/selectionRange.ts @@ -191,7 +191,7 @@ type X = IsExactlyAny

extends true ? T : ({ [K in keyof P]: IsExactlyAn ]); }); - it("works for object types", () => { + it.skip("works for object types", () => { const getSelectionRange = setup("/file.js", ` type X = { foo?: string; @@ -354,5 +354,53 @@ console.log(1);`); end: { line: 5, offset: 16 } } } } } } } } } ]); }); + + it.skip("works for complex mapped types", () => { + const getSelectionRange = setup("/file.ts", ` +type M = { -readonly [K in keyof any]-?: any };`); + + const locations = getSelectionRange([ + { line: 2, offset: 12 }, // -readonly + { line: 2, offset: 14 }, // eadonly + { line: 2, offset: 22 }, // [ + { line: 2, offset: 30 }, // yof any + { line: 2, offset: 38 }, // -? + { line: 2, offset: 39 }, // ? + ]); + + assert.deepEqual(locations![0], { + textSpan: { // - + start: { line: 2, offset: 12 }, + end: { line: 2, offset: 13 } }, + parent: { + textSpan: { // -readonly + start: { line: 2, offset: 12 }, + end: { line: 2, offset: 21 } }, + parent: { + textSpan: { // -readonly [K in keyof any] + start: { line: 2, offset: 12 }, + end: { line: 2, offset: 38 } }, + parent: { + textSpan: { // -readonly [K in keyof any]-? + start: { line: 2, offset: 12 }, + end: { line: 2, offset: 40 } }, + parent: { + textSpan: { // -readonly [K in keyof any]-?: any + start: { line: 2, offset: 12 }, + end: { line: 2, offset: 45 } }, + parent: { + textSpan: { // { -readonly [K in keyof any]-?: any } + start: { line: 2, offset: 10 }, + end: { line: 2, offset: 47 } }, + parent: { + textSpan: { // whole line + start: { line: 2, offset: 1 }, + end: { line: 2, offset: 48 } }, + parent: { + textSpan: { // SourceFile + start: { line: 1, offset: 1 }, + end: { line: 2, offset: 48 } } } } } } } } } + }); + }); }); } From 4ecdc82736ee45c539b6fd0ddaa16d9fc7a68f28 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 15 Apr 2019 14:51:52 -0700 Subject: [PATCH 011/384] Solidify fake tree approach --- src/services/selectionRange.ts | 157 ++++++++++++------ .../unittests/tsserver/selectionRange.ts | 127 ++++++++++---- 2 files changed, 204 insertions(+), 80 deletions(-) diff --git a/src/services/selectionRange.ts b/src/services/selectionRange.ts index 631ec25fc09..5cf92ec3d69 100644 --- a/src/services/selectionRange.ts +++ b/src/services/selectionRange.ts @@ -1,14 +1,11 @@ /* @internal */ namespace ts.SelectionRange { - const isImport = or(isImportDeclaration, isImportEqualsDeclaration); - export function getSelectionRange(pos: number, sourceFile: SourceFile): SelectionRange { let selectionRange: SelectionRange = { textSpan: createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd()) }; - // Skip top-level SyntaxList - let parentNode = sourceFile.getChildAt(0); + let parentNode: Node = sourceFile; outer: while (true) { const children = getSelectionChildren(parentNode); if (!children.length) break; @@ -36,13 +33,6 @@ namespace ts.SelectionRange { const end = nextNode.getStart() + "}".length; pushSelectionRange(start, end, node.kind); } - // Synthesize a stop for group of adjacent imports - else if (isImport(node)) { - const [firstImportIndex, lastImportIndex] = getGroupBounds(children, i, isImport); - pushSelectionRange( - children[firstImportIndex].getStart(), - children[lastImportIndex].getEnd()); - } // Blocks with braces on separate lines should be selected from brace to brace, // including whitespace but not including the braces themselves. @@ -79,7 +69,22 @@ namespace ts.SelectionRange { } } + const isImport = or(isImportDeclaration, isImportEqualsDeclaration); + + /** + * Gets the children of a node to be considered for selection ranging, + * transforming them into an artificial tree according to their intuitive + * grouping where no grouping actually exists in the parse tree. For example, + * top-level imports are grouped into their own SyntaxList so they can be + * selected all together, even though in the AST they’re just siblings of each + * other as well as of other top-level statements and declarations. + */ function getSelectionChildren(node: Node): ReadonlyArray { + // Group top-level imports + if (isSourceFile(node)) { + return groupChildren(node.getChildAt(0).getChildren(), isImport); + } + // Mapped types _look_ like ObjectTypes with a single member, // but in fact don’t contain a SyntaxList or a node containing // the “key/value” pair like ObjectTypes do, but it seems intuitive @@ -95,58 +100,108 @@ namespace ts.SelectionRange { const closeBraceToken = Debug.assertDefined(children.pop()); Debug.assertEqual(openBraceToken.kind, SyntaxKind.OpenBraceToken); Debug.assertEqual(closeBraceToken.kind, SyntaxKind.CloseBraceToken); - const colonTokenIndex = findIndex(children, child => child.kind === SyntaxKind.ColonToken); - const typeNodeIndex = node.type && children.indexOf(node.type); - const leftChildren = children.slice(0, colonTokenIndex); - const colonToken = Debug.assertDefined(children[colonTokenIndex]); - const rightChildren = children.slice(colonTokenIndex + 1, typeNodeIndex && (typeNodeIndex + 1)); - // Possible semicolon - const extraChildren = typeNodeIndex && typeNodeIndex > -1 ? children.slice(typeNodeIndex + 1) : []; - const syntaxList = createSyntaxList([ - createSyntaxList(leftChildren), - colonToken, - createSyntaxList(rightChildren), - createSyntaxList(extraChildren), - ]); + const [leftOfColon, ...rest] = splitChildren(children, child => child.kind === SyntaxKind.ColonToken); + // Group `-/+readonly` and `-/+?` + const leftChildren = groupChildren(getChildrenOrSingleNode(leftOfColon), child => + child === node.readonlyToken || child.kind === SyntaxKind.ReadonlyKeyword || + child === node.questionToken || child.kind === SyntaxKind.QuestionToken); return [ openBraceToken, - syntaxList, + createSyntaxList([ + // Group type parameter with surrounding brackets + createSyntaxList(groupChildren(leftChildren, ({ kind }) => + kind === SyntaxKind.OpenBracketToken || + kind === SyntaxKind.TypeParameter || + kind === SyntaxKind.CloseBracketToken + )), + ...rest, + ]), closeBraceToken, ]; } + + // Split e.g. `readonly foo?: string` into left and right sides of the colon, + // the group `readonly foo` without the QuestionToken. + if (isPropertySignature(node)) { + const [leftOfColon, ...rest] = splitChildren(node.getChildren(), child => child.kind === SyntaxKind.ColonToken); + return [ + createSyntaxList(groupChildren(getChildrenOrSingleNode(leftOfColon), child => child !== node.questionToken)), + ...rest, + ]; + } + return node.getChildren(); } + /** + * Groups sibling nodes together into their own SyntaxList if they + * a) are adjacent, AND b) match a predicate function. + */ + function groupChildren(children: Node[], groupOn: (child: Node) => boolean): Node[] { + const result: Node[] = []; + let group: Node[] | undefined; + for (const child of children) { + if (groupOn(child)) { + group = group || []; + group.push(child); + } + else { + if (group) { + result.push(createSyntaxList(group)); + group = undefined; + } + result.push(child); + } + } + if (group) { + result.push(createSyntaxList(group)); + } + + return result; + } + + /** + * Splits sibling nodes into up to four partitions: + * 1) everything left of the first node matched by `pivotOn`, + * 2) the first node matched by `pivotOn`, + * 3) everything right of the first node matched by `pivotOn`, + * 4) a trailing semicolon, if `separateTrailingSemicolon` is enabled. + * The left and right groups, if not empty, will each be grouped into their own containing SyntaxList. + * @param children The sibling nodes to split. + * @param pivotOn The predicate function to match the node to be the pivot. The first node that matches + * the predicate will be used; any others that may match will be included into the right-hand group. + * @param separateTrailingSemicolon If the last token is a semicolon, it will be returned as a separate + * child rather than be included in the right-hand group. + */ + function splitChildren(children: Node[], pivotOn: (child: Node) => boolean, separateTrailingSemicolon = true): Node[] { + if (children.length < 2) { + return children; + } + const splitTokenIndex = findIndex(children, pivotOn); + if (splitTokenIndex === -1) { + return children; + } + const leftChildren = children.slice(0, splitTokenIndex); + const splitToken = children[splitTokenIndex]; + const lastToken = last(children); + const separateLastToken = separateTrailingSemicolon && lastToken.kind === SyntaxKind.SemicolonToken; + const rightChildren = children.slice(splitTokenIndex + 1, separateLastToken ? children.length - 1 : undefined); + const result = compact([ + leftChildren.length ? createSyntaxList(leftChildren) : undefined, + splitToken, + rightChildren.length ? createSyntaxList(rightChildren) : undefined, + ]); + return separateLastToken ? result.concat(lastToken) : result; + } + + function getChildrenOrSingleNode(node: Node): Node[] { + return isSyntaxList(node) ? node.getChildren() : [node]; + } + function createSyntaxList(children: Node[]): SyntaxList { Debug.assertGreaterThanOrEqual(children.length, 1); const syntaxList = createNode(SyntaxKind.SyntaxList, children[0].pos, last(children).end) as SyntaxList; syntaxList._children = children; return syntaxList; } - - function getGroupBounds(array: ArrayLike, index: number, predicate: (element: T) => boolean): [number, number] { - let first = index; - let last = index; - let i = index; - while (i > 0) { - const element = array[--i]; - if (predicate(element)) { - first = i; - } - else { - break; - } - } - i = index; - while (i < array.length - 1) { - const element = array[++i]; - if (predicate(element)) { - last = i; - } - else { - break; - } - } - return [first, last]; - } } diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/selectionRange.ts index 837607a58f2..0d36690713d 100644 --- a/src/testRunner/unittests/tsserver/selectionRange.ts +++ b/src/testRunner/unittests/tsserver/selectionRange.ts @@ -191,35 +191,37 @@ type X = IsExactlyAny

extends true ? T : ({ [K in keyof P]: IsExactlyAn ]); }); - it.skip("works for object types", () => { + it("works for object types", () => { const getSelectionRange = setup("/file.js", ` type X = { foo?: string; readonly bar: { x: number }; + meh }`); const locations = getSelectionRange([ { line: 3, offset: 5 }, { line: 4, offset: 5 }, { line: 4, offset: 14 }, { line: 4, offset: 27 }, + { line: 5, offset: 5 }, ]); const allMembersUp: protocol.SelectionRange = { textSpan: { // all members + whitespace (just inside braces) start: { line: 2, offset: 11 }, - end: { line: 5, offset: 1 } }, + end: { line: 6, offset: 1 } }, parent: { textSpan: { // add braces start: { line: 2, offset: 10 }, - end: { line: 5, offset: 2 } }, + end: { line: 6, offset: 2 } }, parent: { textSpan: { // whole TypeAliasDeclaration start: { line: 2, offset: 1 }, - end: { line: 5, offset: 2 } }, + end: { line: 6, offset: 2 } }, parent: { textSpan: { // SourceFile start: { line: 1, offset: 1 }, - end: { line: 5, offset: 2 } } } } } }; + end: { line: 6, offset: 2 } } } } } }; const readonlyBarUp: protocol.SelectionRange = { textSpan: { // readonly bar @@ -270,6 +272,12 @@ type X = { start: { line: 4, offset: 19 }, end: { line: 4, offset: 32 } }, parent: readonlyBarUp.parent } } }); + + assert.deepEqual(locations![4], { + textSpan: { // meh + start: { line: 5, offset: 5 }, + end: { line: 5, offset: 8 } }, + parent: allMembersUp }); }); it("works for string literals and template strings", () => { @@ -355,7 +363,7 @@ console.log(1);`); ]); }); - it.skip("works for complex mapped types", () => { + it("works for complex mapped types", () => { const getSelectionRange = setup("/file.ts", ` type M = { -readonly [K in keyof any]-?: any };`); @@ -368,38 +376,99 @@ type M = { -readonly [K in keyof any]-?: any };`); { line: 2, offset: 39 }, // ? ]); + const leftOfColonUp: protocol.SelectionRange = { + textSpan: { // -readonly [K in keyof any]-? + start: { line: 2, offset: 12 }, + end: { line: 2, offset: 40 } }, + parent: { + textSpan: { // -readonly [K in keyof any]-?: any + start: { line: 2, offset: 12 }, + end: { line: 2, offset: 45 } }, + parent: { + textSpan: { // { -readonly [K in keyof any]-?: any } + start: { line: 2, offset: 10 }, + end: { line: 2, offset: 47 } }, + parent: { + textSpan: { // whole line + start: { line: 2, offset: 1 }, + end: { line: 2, offset: 48 } }, + parent: { + textSpan: { // SourceFile + start: { line: 1, offset: 1 }, + end: { line: 2, offset: 48 } } } } } } }; + assert.deepEqual(locations![0], { - textSpan: { // - + textSpan: { // - (in -readonly) start: { line: 2, offset: 12 }, end: { line: 2, offset: 13 } }, parent: { textSpan: { // -readonly start: { line: 2, offset: 12 }, end: { line: 2, offset: 21 } }, + parent: leftOfColonUp }, + }); + + assert.deepEqual(locations![1], { + textSpan: { // readonly + start: { line: 2, offset: 13 }, + end: { line: 2, offset: 21 } }, + parent: { + textSpan: { // -readonly + start: { line: 2, offset: 12 }, + end: { line: 2, offset: 21 } }, + parent: leftOfColonUp }, + }); + + assert.deepEqual(locations![2], { + textSpan: { // [ + start: { line: 2, offset: 22 }, + end: { line: 2, offset: 23 } }, + parent: { + textSpan: { // [K in keyof any] + start: { line: 2, offset: 22 }, + end: { line: 2, offset: 38 } }, + parent: leftOfColonUp } + }); + + assert.deepEqual(locations![3], { + textSpan: { // keyof + start: { line: 2, offset: 28 }, + end: { line: 2, offset: 33 } }, + parent: { + textSpan: { // keyof any + start: { line: 2, offset: 28 }, + end: { line: 2, offset: 37 } }, parent: { - textSpan: { // -readonly [K in keyof any] - start: { line: 2, offset: 12 }, - end: { line: 2, offset: 38 } }, + textSpan: { // K in keyof any + start: { line: 2, offset: 23 }, + end: { line: 2, offset: 37 } }, parent: { - textSpan: { // -readonly [K in keyof any]-? - start: { line: 2, offset: 12 }, - end: { line: 2, offset: 40 } }, - parent: { - textSpan: { // -readonly [K in keyof any]-?: any - start: { line: 2, offset: 12 }, - end: { line: 2, offset: 45 } }, - parent: { - textSpan: { // { -readonly [K in keyof any]-?: any } - start: { line: 2, offset: 10 }, - end: { line: 2, offset: 47 } }, - parent: { - textSpan: { // whole line - start: { line: 2, offset: 1 }, - end: { line: 2, offset: 48 } }, - parent: { - textSpan: { // SourceFile - start: { line: 1, offset: 1 }, - end: { line: 2, offset: 48 } } } } } } } } } + textSpan: { // [K in keyof any] + start: { line: 2, offset: 22 }, + end: { line: 2, offset: 38 } }, + parent: leftOfColonUp } } }, + }); + + assert.deepEqual(locations![4], { + textSpan: { // - (in -?) + start: { line: 2, offset: 38 }, + end: { line: 2, offset: 39 } }, + parent: { + textSpan: { // -? + start: { line: 2, offset: 38 }, + end: { line: 2, offset: 40 } }, + parent: leftOfColonUp }, + }); + + assert.deepEqual(locations![5], { + textSpan: { // ? + start: { line: 2, offset: 39 }, + end: { line: 2, offset: 40 } }, + parent: { + textSpan: { // -? + start: { line: 2, offset: 38 }, + end: { line: 2, offset: 40 } }, + parent: leftOfColonUp }, }); }); }); From 74fc84ff844c8e4b961b3b9e5dca1086e663b129 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 15 Apr 2019 17:07:38 -0700 Subject: [PATCH 012/384] Snap to nodes directly behind the cursor, create special rules for ParameterNodes --- src/services/selectionRange.ts | 68 ++++++++++++------ .../unittests/tsserver/selectionRange.ts | 70 +++++++++++++++++++ 2 files changed, 115 insertions(+), 23 deletions(-) diff --git a/src/services/selectionRange.ts b/src/services/selectionRange.ts index 5cf92ec3d69..07a7abd7d26 100644 --- a/src/services/selectionRange.ts +++ b/src/services/selectionRange.ts @@ -17,7 +17,7 @@ namespace ts.SelectionRange { break outer; } - if (positionBelongsToNode(node, pos, sourceFile)) { + if (positionShouldSnapToNode(pos, node, nextNode, sourceFile)) { // Blocks are effectively redundant with SyntaxLists. // TemplateSpans, along with the SyntaxLists containing them, // are a somewhat unintuitive grouping of things that should be @@ -69,6 +69,28 @@ namespace ts.SelectionRange { } } + /** + * Like `ts.positionBelongsToNode`, except positions immediately after nodes + * count too, unless that position belongs to the next node. In effect, makes + * selections able to snap to preceding tokens when the cursor is on the tail + * end of them with only whitespace ahead. + * @param pos The position to check. + * @param node The candidate node to snap to. + * @param nextNode The next sibling node in the tree. + * @param sourceFile The source file containing the nodes. + */ + function positionShouldSnapToNode(pos: number, node: Node, nextNode: Node | undefined, sourceFile: SourceFile) { + if (positionBelongsToNode(node, pos, sourceFile)) { + return true; + } + const nodeEnd = node.getEnd(); + const nextNodeStart = nextNode && nextNode.getStart(); + if (nodeEnd === pos) { + return pos !== nextNodeStart; + } + return false; + } + const isImport = or(isImportDeclaration, isImportEqualsDeclaration); /** @@ -100,34 +122,38 @@ namespace ts.SelectionRange { const closeBraceToken = Debug.assertDefined(children.pop()); Debug.assertEqual(openBraceToken.kind, SyntaxKind.OpenBraceToken); Debug.assertEqual(closeBraceToken.kind, SyntaxKind.CloseBraceToken); - const [leftOfColon, ...rest] = splitChildren(children, child => child.kind === SyntaxKind.ColonToken); // Group `-/+readonly` and `-/+?` - const leftChildren = groupChildren(getChildrenOrSingleNode(leftOfColon), child => + const groupedWithPlusMinusTokens = groupChildren(children, child => child === node.readonlyToken || child.kind === SyntaxKind.ReadonlyKeyword || child === node.questionToken || child.kind === SyntaxKind.QuestionToken); + // Group type parameter with surrounding brackets + const groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, ({ kind }) => + kind === SyntaxKind.OpenBracketToken || + kind === SyntaxKind.TypeParameter || + kind === SyntaxKind.CloseBracketToken + ); return [ openBraceToken, - createSyntaxList([ - // Group type parameter with surrounding brackets - createSyntaxList(groupChildren(leftChildren, ({ kind }) => - kind === SyntaxKind.OpenBracketToken || - kind === SyntaxKind.TypeParameter || - kind === SyntaxKind.CloseBracketToken - )), - ...rest, - ]), + // Pivot on `:` + createSyntaxList(splitChildren(groupedWithBrackets, ({ kind }) => kind === SyntaxKind.ColonToken)), closeBraceToken, ]; } - // Split e.g. `readonly foo?: string` into left and right sides of the colon, - // the group `readonly foo` without the QuestionToken. + // Group modifiers and property name, then pivot on `:`. if (isPropertySignature(node)) { - const [leftOfColon, ...rest] = splitChildren(node.getChildren(), child => child.kind === SyntaxKind.ColonToken); - return [ - createSyntaxList(groupChildren(getChildrenOrSingleNode(leftOfColon), child => child !== node.questionToken)), - ...rest, - ]; + const children = groupChildren(node.getChildren(), child => + child === node.name || contains(node.modifiers, child)); + return splitChildren(children, ({ kind }) => kind === SyntaxKind.ColonToken); + } + + // Group the parameter name with its `...`, then that group with its `?`, then pivot on `=`. + if (isParameter(node)) { + const groupedDotDotDotAndName = groupChildren(node.getChildren(), child => + child === node.dotDotDotToken || child === node.name); + const groupedWithQuestionToken = groupChildren(groupedDotDotDotAndName, child => + child === groupedDotDotDotAndName[0] || child === node.questionToken); + return splitChildren(groupedWithQuestionToken, ({ kind }) => kind === SyntaxKind.EqualsToken); } return node.getChildren(); @@ -194,10 +220,6 @@ namespace ts.SelectionRange { return separateLastToken ? result.concat(lastToken) : result; } - function getChildrenOrSingleNode(node: Node): Node[] { - return isSyntaxList(node) ? node.getChildren() : [node]; - } - function createSyntaxList(children: Node[]): SyntaxList { Debug.assertGreaterThanOrEqual(children.length, 1); const syntaxList = createNode(SyntaxKind.SyntaxList, children[0].pos, last(children).end) as SyntaxList; diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/selectionRange.ts index 0d36690713d..5a4bbb41f19 100644 --- a/src/testRunner/unittests/tsserver/selectionRange.ts +++ b/src/testRunner/unittests/tsserver/selectionRange.ts @@ -471,5 +471,75 @@ type M = { -readonly [K in keyof any]-?: any };`); parent: leftOfColonUp }, }); }); + + it("works for parameters", () => { + const getSelectionRange = setup("/file.ts", ` +function f(p, q?, ...r: any[] = []) {}`); + + const locations = getSelectionRange([ + { line: 2, offset: 12 }, // p + { line: 2, offset: 15 }, // q + { line: 2, offset: 19 }, // ... + ]); + + const allParamsUp: protocol.SelectionRange = { + textSpan: { // just inside parens + start: { line: 2, offset: 12 }, + end: { line: 2, offset: 35 } }, + parent: { + textSpan: { + start: { line: 2, offset: 1 }, + end: { line: 2, offset: 39 } }, + parent: { + textSpan: { + start: { line: 1, offset: 1 }, + end: { line: 2, offset: 39 } } } } }; + + assert.deepEqual(locations![0], { + textSpan: { // p + start: { line: 2, offset: 12 }, + end: { line: 2, offset: 13 } }, + parent: allParamsUp, + }); + + assert.deepEqual(locations![1], { + textSpan: { // q + start: { line: 2, offset: 15 }, + end: { line: 2, offset: 16 } }, + parent: { + textSpan: { // q? + start: { line: 2, offset: 15 }, + end: { line: 2, offset: 17 } }, + parent: allParamsUp }, + }); + + assert.deepEqual(locations![2], { + textSpan: { // ... + start: { line: 2, offset: 19 }, + end: { line: 2, offset: 22 } }, + parent: { + textSpan: { // ...r + start: { line: 2, offset: 19 }, + end: { line: 2, offset: 23 } }, + parent: { + textSpan: { // ...r: any[] + start: { line: 2, offset: 19 }, + end: { line: 2, offset: 30 } }, + parent: { + textSpan: { // ...r: any[] = [] + start: { line: 2, offset: 19 }, + end: { line: 2, offset: 35 } }, + parent: allParamsUp } } }, + }); + }); + + it("snaps to nodes directly behind the cursor instead of trivia ahead of the cursor", () => { + const getSelectionRange = setup("/file.ts", `let x: string`); + const locations = getSelectionRange([{ line: 1, offset: 4 }]); + assert.deepEqual(locations![0].textSpan, { + start: { line: 1, offset: 1 }, + end: { line: 1, offset: 4 }, + }); + }); }); } From d73eabd35ac852a7fd7532cafc8779bd0b128584 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 16 Apr 2019 11:23:57 -0700 Subject: [PATCH 013/384] Special rules for binding elements, extend brace/whitespace logic to other kinds of bookended lists --- src/services/selectionRange.ts | 44 +++++++++--- .../unittests/tsserver/selectionRange.ts | 72 +++++++++++++++++++ 2 files changed, 107 insertions(+), 9 deletions(-) diff --git a/src/services/selectionRange.ts b/src/services/selectionRange.ts index 07a7abd7d26..536efbfb8d1 100644 --- a/src/services/selectionRange.ts +++ b/src/services/selectionRange.ts @@ -21,8 +21,13 @@ namespace ts.SelectionRange { // Blocks are effectively redundant with SyntaxLists. // TemplateSpans, along with the SyntaxLists containing them, // are a somewhat unintuitive grouping of things that should be - // considered independently. Dive in without pushing a selection range. - if (isBlock(node) || isTemplateSpan(node) || isTemplateHead(node) || prevNode && isTemplateHead(prevNode)) { + // considered independently. A VariableStatement’s children are just + // a VaraiableDeclarationList and a semicolon. + // Dive in without pushing a selection range. + if (isBlock(node) + || isTemplateSpan(node) || isTemplateHead(node) + || prevNode && isTemplateHead(prevNode) + || isVariableDeclarationList(node) && isVariableStatement(parentNode)) { parentNode = node; break; } @@ -34,14 +39,14 @@ namespace ts.SelectionRange { pushSelectionRange(start, end, node.kind); } - // Blocks with braces on separate lines should be selected from brace to brace, - // including whitespace but not including the braces themselves. - const isBetweenMultiLineBraces = isSyntaxList(node) - && prevNode && prevNode.kind === SyntaxKind.OpenBraceToken - && nextNode && nextNode.kind === SyntaxKind.CloseBraceToken + // Blocks with braces, brackets, parens, or JSX tags on separate lines should be + // selected from open to close, including whitespace but not including the braces/etc. themselves. + const isBetweenMultiLineBookends = isSyntaxList(node) + && isListOpener(prevNode) + && isListCloser(nextNode) && !positionsAreOnSameLine(prevNode.getStart(), nextNode.getStart(), sourceFile); - const start = isBetweenMultiLineBraces ? prevNode.getEnd() : node.getStart(); - const end = isBetweenMultiLineBraces ? nextNode.getStart() : node.getEnd(); + const start = isBetweenMultiLineBookends ? prevNode.getEnd() : node.getStart(); + const end = isBetweenMultiLineBookends ? nextNode.getStart() : node.getEnd(); pushSelectionRange(start, end, node.kind); // String literals should have a stop both inside and outside their quotes. @@ -156,6 +161,11 @@ namespace ts.SelectionRange { return splitChildren(groupedWithQuestionToken, ({ kind }) => kind === SyntaxKind.EqualsToken); } + // Pivot on '=' + if (isBindingElement(node)) { + return splitChildren(node.getChildren(), ({ kind }) => kind === SyntaxKind.EqualsToken); + } + return node.getChildren(); } @@ -226,4 +236,20 @@ namespace ts.SelectionRange { syntaxList._children = children; return syntaxList; } + + function isListOpener(token: Node | undefined): token is Node { + const kind = token && token.kind; + return kind === SyntaxKind.OpenBraceToken + || kind === SyntaxKind.OpenBracketToken + || kind === SyntaxKind.OpenParenToken + || kind === SyntaxKind.JsxOpeningElement; + } + + function isListCloser(token: Node | undefined): token is Node { + const kind = token && token.kind; + return kind === SyntaxKind.CloseBraceToken + || kind === SyntaxKind.CloseBracketToken + || kind === SyntaxKind.CloseParenToken + || kind === SyntaxKind.JsxClosingElement; + } } diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/selectionRange.ts index 5a4bbb41f19..759ae0dd254 100644 --- a/src/testRunner/unittests/tsserver/selectionRange.ts +++ b/src/testRunner/unittests/tsserver/selectionRange.ts @@ -533,6 +533,78 @@ function f(p, q?, ...r: any[] = []) {}`); }); }); + it("works for binding elements", () => { + const getSelectionRange = setup("/file.ts", ` +const { x, y: a, ...zs = {} } = {};`); + const locations = getSelectionRange([ + { line: 2, offset: 9 }, // x + { line: 2, offset: 15 }, // a + { line: 2, offset: 21 }, // zs + ]); + + // Don’t care about checking first two locations, because + // they’re pretty boring, just want to make sure they don’t cause a crash + assert.deepEqual(locations![2], { + textSpan: { // zs + start: { line: 2, offset: 21 }, + end: { line: 2, offset: 23 } }, + parent: { + textSpan: { // ...zs + start: { line: 2, offset: 18 }, + end: { line: 2, offset: 23 } }, + parent: { + textSpan: { // ...zs = {} + start: { line: 2, offset: 18 }, + end: { line: 2, offset: 28 } }, + parent: { + textSpan: { // x, y: a, ...zs = {} + start: { line: 2, offset: 9 }, + end: { line: 2, offset: 28 } }, + parent: { + textSpan: { // { x, y: a, ...zs = {} } + start: { line: 2, offset: 7 }, + end: { line: 2, offset: 30 } }, + parent: { + textSpan: { // { x, y: a, ...zs = {} } = {} + start: { line: 2, offset: 7 }, + end: { line: 2, offset: 35 } }, + parent: { + textSpan: { // whole line + start: { line: 2, offset: 1 }, + end: { line: 2, offset: 36 } }, + parent: { + textSpan: { + start: { line: 1, offset: 1 }, + end: { line: 2, offset: 36 } } } } } } } } }, + }); + }); + + it("consumes all whitespace in a multi-line function parameter list", () => { + const getSelectionRange = setup("/file.ts", ` +function f( + a, + b +) {}`); + const locations = getSelectionRange([{ line: 4, offset: 5 }]); // b + assert.deepEqual(locations, [{ + textSpan: { // b + start: { line: 4, offset: 5 }, + end: { line: 4, offset: 6 } }, + parent: { // all params and whitespace inside parens + textSpan: { + start: { line: 2, offset: 12 }, + end: { line: 5, offset: 1 } }, + parent: { + textSpan: { // whole function declaration + start: { line: 2, offset: 1 }, + end: { line: 5, offset: 5 } }, + parent: { + textSpan: { // SourceFile + start: { line: 1, offset: 1 }, + end: { line: 5, offset: 5 } } } } } + }]); + }); + it("snaps to nodes directly behind the cursor instead of trivia ahead of the cursor", () => { const getSelectionRange = setup("/file.ts", `let x: string`); const locations = getSelectionRange([{ line: 1, offset: 4 }]); From fed910fd0c9e911319dd492b51d410c1e655a090 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 18 Apr 2019 14:22:19 -0700 Subject: [PATCH 014/384] Add stop for JSDoc comments --- src/services/selectionRange.ts | 14 ++- .../unittests/tsserver/selectionRange.ts | 85 +++++++++++++------ 2 files changed, 69 insertions(+), 30 deletions(-) diff --git a/src/services/selectionRange.ts b/src/services/selectionRange.ts index 536efbfb8d1..1c2a525167a 100644 --- a/src/services/selectionRange.ts +++ b/src/services/selectionRange.ts @@ -17,7 +17,7 @@ namespace ts.SelectionRange { break outer; } - if (positionShouldSnapToNode(pos, node, nextNode, sourceFile)) { + if (positionShouldSnapToNode(pos, node, nextNode)) { // Blocks are effectively redundant with SyntaxLists. // TemplateSpans, along with the SyntaxLists containing them, // are a somewhat unintuitive grouping of things that should be @@ -45,8 +45,12 @@ namespace ts.SelectionRange { && isListOpener(prevNode) && isListCloser(nextNode) && !positionsAreOnSameLine(prevNode.getStart(), nextNode.getStart(), sourceFile); + const jsDocCommentStart = hasJSDocNodes(node) && node.jsDoc![0].getStart(); const start = isBetweenMultiLineBookends ? prevNode.getEnd() : node.getStart(); const end = isBetweenMultiLineBookends ? nextNode.getStart() : node.getEnd(); + if (isNumber(jsDocCommentStart)) { + pushSelectionRange(jsDocCommentStart, end); + } pushSelectionRange(start, end, node.kind); // String literals should have a stop both inside and outside their quotes. @@ -84,8 +88,12 @@ namespace ts.SelectionRange { * @param nextNode The next sibling node in the tree. * @param sourceFile The source file containing the nodes. */ - function positionShouldSnapToNode(pos: number, node: Node, nextNode: Node | undefined, sourceFile: SourceFile) { - if (positionBelongsToNode(node, pos, sourceFile)) { + function positionShouldSnapToNode(pos: number, node: Node, nextNode: Node | undefined) { + // Can’t use 'ts.positionBelongsToNode()' here because it cleverly accounts + // for missing nodes, which can’t really be considered when deciding what + // to select. + Debug.assert(node.pos <= pos); + if (pos < node.end) { return true; } const nodeEnd = node.getEnd(); diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/selectionRange.ts index 759ae0dd254..3c0a12a58f7 100644 --- a/src/testRunner/unittests/tsserver/selectionRange.ts +++ b/src/testRunner/unittests/tsserver/selectionRange.ts @@ -92,44 +92,47 @@ export interface IService { _serviceBrand: any; open(host: number, data: any): Promise; + bar(): void }`); const locations = getSelectionRange([ - { - line: 5, - offset: 12, - }, + { line: 5, offset: 12 }, // ho/**/st + { line: 6, offset: 16 }, // void/**/ ]); - assert.deepEqual(locations, [ - { - textSpan: { // host + assert.deepEqual(locations![0], { + textSpan: { // host + start: { line: 5, offset: 10 }, + end: { line: 5, offset: 14 } }, + parent: { + textSpan: { // host: number start: { line: 5, offset: 10 }, - end: { line: 5, offset: 14 } }, + end: { line: 5, offset: 22 } }, parent: { - textSpan: { // host: number + textSpan: { // host: number, data: any start: { line: 5, offset: 10 }, - end: { line: 5, offset: 22 } }, + end: { line: 5, offset: 33 } }, parent: { - textSpan: { // host: number, data: any - start: { line: 5, offset: 10 }, - end: { line: 5, offset: 33 } }, + textSpan: { // open(host: number, data: any): Promise; + start: { line: 5, offset: 5 }, + end: { line: 5, offset: 49 } }, parent: { - textSpan: { // open(host: number, data: any): Promise; - start: { line: 5, offset: 5 }, - end: { line: 5, offset: 49 } }, + textSpan: { // SyntaxList + whitespace (body of interface) + start: { line: 2, offset: 28 }, + end: { line: 7, offset: 1 } }, parent: { - textSpan: { // SyntaxList + whitespace (body of interface) - start: { line: 2, offset: 28 }, - end: { line: 6, offset: 1 } }, + textSpan: { // InterfaceDeclaration + start: { line: 2, offset: 1 }, + end: { line: 7, offset: 2 } }, parent: { - textSpan: { // InterfaceDeclaration - start: { line: 2, offset: 1 }, - end: { line: 6, offset: 2 } }, - parent: { - textSpan: { // SourceFile - start: { line: 1, offset: 1 }, - end: { line: 6, offset: 2 } } } } } } } } }, - ]); + textSpan: { // SourceFile + start: { line: 1, offset: 1 }, + end: { line: 7, offset: 2 } } } } } } } } }); + + // Ensures positions after a zero-width node work, because ts.positionBelongsToNode + // treats them strangely. + assert.deepEqual(locations![1].textSpan, { // void + start: { line: 6, offset: 12 }, + end: { line: 6, offset: 16 }}); }); it("works for complex TypeScript", () => { @@ -613,5 +616,33 @@ function f( end: { line: 1, offset: 4 }, }); }); + + it("creates a stop for JSDoc ranges", () => { + const getSelectionRange = setup("/file.js", "" + +`// Not a JSDoc comment +/** + * @param {number} x The number to square + */ +function square(x) { + return x * x; +}`); + const locations = getSelectionRange([{ line: 5, offset: 10 }]); // square(x) + assert.deepEqual(locations, [{ + textSpan: { // square + start: { line: 5 , offset: 10 }, + end: { line: 5, offset: 16 } }, + parent: { // whole function declaration + textSpan: { + start: { line: 5, offset: 1 }, + end: { line: 7, offset: 2 } }, + parent: { + textSpan: { // add JSDoc + start: { line: 2, offset: 1 }, + end: { line: 7, offset: 2 } }, + parent: { + textSpan: { // SourceFile + start: { line: 1, offset: 1 }, + end: { line: 7, offset: 2 } } } } } }]); + }); }); } From 5479893f009bc92af33413170a0e99a175e5414d Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 18 Apr 2019 16:03:53 -0700 Subject: [PATCH 015/384] Skip lone variable declarations --- src/services/selectionRange.ts | 15 ++++++---- .../unittests/tsserver/selectionRange.ts | 30 ++++++++++++------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/services/selectionRange.ts b/src/services/selectionRange.ts index 1c2a525167a..63a65d42e3b 100644 --- a/src/services/selectionRange.ts +++ b/src/services/selectionRange.ts @@ -18,16 +18,19 @@ namespace ts.SelectionRange { } if (positionShouldSnapToNode(pos, node, nextNode)) { - // Blocks are effectively redundant with SyntaxLists. - // TemplateSpans, along with the SyntaxLists containing them, - // are a somewhat unintuitive grouping of things that should be - // considered independently. A VariableStatement’s children are just - // a VaraiableDeclarationList and a semicolon. + // 1. Blocks are effectively redundant with SyntaxLists. + // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping + // of things that should be considered independently. + // 3. A VariableStatement’s children are just a VaraiableDeclarationList and a semicolon. + // 4. A lone VariableDeclaration in a VaraibleDeclaration feels redundant with the VariableStatement. + // // Dive in without pushing a selection range. if (isBlock(node) || isTemplateSpan(node) || isTemplateHead(node) || prevNode && isTemplateHead(prevNode) - || isVariableDeclarationList(node) && isVariableStatement(parentNode)) { + || isVariableDeclarationList(node) && isVariableStatement(parentNode) + || isSyntaxList(node) && isVariableDeclarationList(parentNode) + || isVariableDeclaration(node) && isSyntaxList(parentNode) && children.length === 1) { parentNode = node; break; } diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/selectionRange.ts index 3c0a12a58f7..7940edcdebb 100644 --- a/src/testRunner/unittests/tsserver/selectionRange.ts +++ b/src/testRunner/unittests/tsserver/selectionRange.ts @@ -568,18 +568,13 @@ const { x, y: a, ...zs = {} } = {};`); start: { line: 2, offset: 7 }, end: { line: 2, offset: 30 } }, parent: { - textSpan: { // { x, y: a, ...zs = {} } = {} - start: { line: 2, offset: 7 }, - end: { line: 2, offset: 35 } }, + textSpan: { // whole line + start: { line: 2, offset: 1 }, + end: { line: 2, offset: 36 } }, parent: { - textSpan: { // whole line - start: { line: 2, offset: 1 }, - end: { line: 2, offset: 36 } }, - parent: { - textSpan: { - start: { line: 1, offset: 1 }, - end: { line: 2, offset: 36 } } } } } } } } }, - }); + textSpan: { + start: { line: 1, offset: 1 }, + end: { line: 2, offset: 36 } } } } } } } } }); }); it("consumes all whitespace in a multi-line function parameter list", () => { @@ -644,5 +639,18 @@ function square(x) { start: { line: 1, offset: 1 }, end: { line: 7, offset: 2 } } } } } }]); }); + + it("skips lone VariableDeclarations in a declaration list", () => { + const getSelectionRange = setup("/file.ts", `const x = 3;`); + const locations = getSelectionRange([{ line: 1, offset: 7 }]); // x + assert.deepEqual(locations, [{ + textSpan: { + start: { line: 1, offset: 7 }, + end: { line: 1, offset: 8 } }, + parent: { + textSpan: { + start: { line: 1, offset: 1 }, + end: { line: 1, offset: 13 } } } }]); + }); }); } From f0f7d82d7ac4f8091ca1ffdb3425a30017f12808 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 18 Apr 2019 16:04:47 -0700 Subject: [PATCH 016/384] Remove debug info --- src/services/selectionRange.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/services/selectionRange.ts b/src/services/selectionRange.ts index 63a65d42e3b..0ec0641a8a2 100644 --- a/src/services/selectionRange.ts +++ b/src/services/selectionRange.ts @@ -39,7 +39,7 @@ namespace ts.SelectionRange { if (isTemplateSpan(parentNode) && nextNode && isTemplateMiddleOrTemplateTail(nextNode)) { const start = node.getFullStart() - "${".length; const end = nextNode.getStart() + "}".length; - pushSelectionRange(start, end, node.kind); + pushSelectionRange(start, end); } // Blocks with braces, brackets, parens, or JSX tags on separate lines should be @@ -54,7 +54,7 @@ namespace ts.SelectionRange { if (isNumber(jsDocCommentStart)) { pushSelectionRange(jsDocCommentStart, end); } - pushSelectionRange(start, end, node.kind); + pushSelectionRange(start, end); // String literals should have a stop both inside and outside their quotes. if (isStringLiteral(node) || isTemplateLiteral(node)) { @@ -69,14 +69,11 @@ namespace ts.SelectionRange { return selectionRange; - function pushSelectionRange(start: number, end: number, syntaxKind?: SyntaxKind): void { + function pushSelectionRange(start: number, end: number): void { // Skip ranges that are identical to the parent const textSpan = createTextSpanFromBounds(start, end); if (!selectionRange || !textSpansEqual(textSpan, selectionRange.textSpan)) { selectionRange = { textSpan, ...selectionRange && { parent: selectionRange } }; - if (syntaxKind) { - Object.defineProperty(selectionRange, "__debugKind", { value: formatSyntaxKind(syntaxKind) }); - } } } } From d8936fd2906c66c294420e35f1dce654eeac6a13 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 18 Apr 2019 16:23:06 -0700 Subject: [PATCH 017/384] Rename to be smarter --- src/harness/client.ts | 2 +- src/harness/harnessLanguageService.ts | 4 +- src/server/session.ts | 8 +-- src/services/services.ts | 6 +-- src/services/shims.ts | 8 +-- .../{selectionRange.ts => smartSelection.ts} | 4 +- src/services/tsconfig.json | 2 +- src/services/types.ts | 2 +- .../unittests/tsserver/selectionRange.ts | 54 +++++++++---------- .../reference/api/tsserverlibrary.d.ts | 24 ++++++++- tests/baselines/reference/api/typescript.d.ts | 5 ++ .../TypeScript-Node-Starter | 2 +- .../user/create-react-app/create-react-app | 2 +- tests/cases/user/prettier/prettier | 2 +- 14 files changed, 76 insertions(+), 49 deletions(-) rename src/services/{selectionRange.ts => smartSelection.ts} (97%) diff --git a/src/harness/client.ts b/src/harness/client.ts index bb9e674bbc6..d223f9f5fe3 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -424,7 +424,7 @@ namespace ts.server { return renameInfo; } - getSelectionRange() { + getSmartSelectionRange() { return notImplemented(); } diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index fff02e5b94a..03ccbb5d6de 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -472,8 +472,8 @@ namespace Harness.LanguageService { getRenameInfo(fileName: string, position: number, options?: ts.RenameInfoOptions): ts.RenameInfo { return unwrapJSONCallResult(this.shim.getRenameInfo(fileName, position, options)); } - getSelectionRange(fileName: string, position: number): ts.SelectionRange { - return unwrapJSONCallResult(this.shim.getSelectionRange(fileName, position)); + getSmartSelectionRange(fileName: string, position: number): ts.SelectionRange { + return unwrapJSONCallResult(this.shim.getSmartSelectionRange(fileName, position)); } findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): ts.RenameLocation[] { return unwrapJSONCallResult(this.shim.findRenameLocations(fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename)); diff --git a/src/server/session.ts b/src/server/session.ts index 261356f2cd0..2e9d6948b1a 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -2059,14 +2059,14 @@ namespace ts.server { this.projectService.configurePlugin(args); } - private getSelectionRange(args: protocol.SelectionRangeRequestArgs, simplifiedResult: boolean) { + private getSmartSelectionRange(args: protocol.SelectionRangeRequestArgs, simplifiedResult: boolean) { const { locations } = args; const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args); const scriptInfo = Debug.assertDefined(this.projectService.getScriptInfo(file)); return map(locations, location => { const pos = this.getPosition(location, scriptInfo); - const selectionRange = languageService.getSelectionRange(file, pos); + const selectionRange = languageService.getSmartSelectionRange(file, pos); return simplifiedResult ? this.mapSelectionRange(selectionRange, scriptInfo) : selectionRange; }); } @@ -2438,10 +2438,10 @@ namespace ts.server { return this.notRequired(); }, [CommandNames.SelectionRange]: (request: protocol.SelectionRangeRequest) => { - return this.requiredResponse(this.getSelectionRange(request.arguments, /*simplifiedResult*/ true)); + return this.requiredResponse(this.getSmartSelectionRange(request.arguments, /*simplifiedResult*/ true)); }, [CommandNames.SelectionRangeFull]: (request: protocol.SelectionRangeRequest) => { - return this.requiredResponse(this.getSelectionRange(request.arguments, /*simplifiedResult*/ false)); + return this.requiredResponse(this.getSmartSelectionRange(request.arguments, /*simplifiedResult*/ false)); }, }); diff --git a/src/services/services.ts b/src/services/services.ts index 721777c2bad..64fe3bca664 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2087,8 +2087,8 @@ namespace ts { }; } - function getSelectionRange(fileName: string, position: number): SelectionRange { - return SelectionRange.getSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName)); + function getSmartSelectionRange(fileName: string, position: number): SelectionRange { + return SmartSelectionRange.getSmartSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName)); } function getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences = emptyOptions): ApplicableRefactorInfo[] { @@ -2138,7 +2138,7 @@ namespace ts { getBreakpointStatementAtPosition, getNavigateToItems, getRenameInfo, - getSelectionRange, + getSmartSelectionRange, findRenameLocations, getNavigationBarItems, getNavigationTree, diff --git a/src/services/shims.ts b/src/services/shims.ts index 3f3b3c2bef6..e914a4acd42 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -165,7 +165,7 @@ namespace ts { * { canRename: boolean, localizedErrorMessage: string, displayName: string, fullDisplayName: string, kind: string, kindModifiers: string, triggerSpan: { start; length } } */ getRenameInfo(fileName: string, position: number, options?: RenameInfoOptions): string; - getSelectionRange(fileName: string, position: number): string; + getSmartSelectionRange(fileName: string, position: number): string; /** * Returns a JSON-encoded value of the type: @@ -839,10 +839,10 @@ namespace ts { ); } - public getSelectionRange(fileName: string, position: number): string { + public getSmartSelectionRange(fileName: string, position: number): string { return this.forwardJSONCall( - `getSelectionRange('${fileName}', ${position})`, - () => this.languageService.getSelectionRange(fileName, position) + `getSmartSelectionRange('${fileName}', ${position})`, + () => this.languageService.getSmartSelectionRange(fileName, position) ); } diff --git a/src/services/selectionRange.ts b/src/services/smartSelection.ts similarity index 97% rename from src/services/selectionRange.ts rename to src/services/smartSelection.ts index 0ec0641a8a2..ba2ec60e9c5 100644 --- a/src/services/selectionRange.ts +++ b/src/services/smartSelection.ts @@ -1,6 +1,6 @@ /* @internal */ -namespace ts.SelectionRange { - export function getSelectionRange(pos: number, sourceFile: SourceFile): SelectionRange { +namespace ts.SmartSelectionRange { + export function getSmartSelectionRange(pos: number, sourceFile: SourceFile): SelectionRange { let selectionRange: SelectionRange = { textSpan: createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd()) }; diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index a456fbb957f..d5977ee46bf 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -28,7 +28,7 @@ "patternMatcher.ts", "preProcess.ts", "rename.ts", - "selectionRange.ts", + "smartSelection.ts", "signatureHelp.ts", "sourcemaps.ts", "suggestionDiagnostics.ts", diff --git a/src/services/types.ts b/src/services/types.ts index d3c9de0f332..4e784e8160b 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -297,7 +297,7 @@ namespace ts { getRenameInfo(fileName: string, position: number, options?: RenameInfoOptions): RenameInfo; findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): ReadonlyArray | undefined; - getSelectionRange(fileName: string, position: number): SelectionRange; + getSmartSelectionRange(fileName: string, position: number): SelectionRange; getDefinitionAtPosition(fileName: string, position: number): ReadonlyArray | undefined; getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan | undefined; diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/selectionRange.ts index 7940edcdebb..5d4113d3f97 100644 --- a/src/testRunner/unittests/tsserver/selectionRange.ts +++ b/src/testRunner/unittests/tsserver/selectionRange.ts @@ -4,7 +4,7 @@ namespace ts.projectSystem { const host = createServerHost([file, libFile]); const session = createSession(host); openFilesForSession([file], session); - return function getSelectionRange(locations: protocol.SelectionRangeRequestArgs["locations"]) { + return function getSmartSelectionRange(locations: protocol.SelectionRangeRequestArgs["locations"]) { return executeSessionRequest( session, CommandNames.SelectionRange, @@ -14,7 +14,7 @@ namespace ts.projectSystem { describe("unittests:: tsserver:: selectionRange", () => { it("works for simple JavaScript", () => { - const getSelectionRange = setup("/file.js", ` + const getSmartSelectionRange = setup("/file.js", ` class Foo { bar(a, b) { if (a === b) { @@ -24,7 +24,7 @@ class Foo { } }`); - const locations = getSelectionRange([ + const locations = getSmartSelectionRange([ { line: 4, offset: 13, @@ -87,14 +87,14 @@ class Foo { }); it("works for simple TypeScript", () => { - const getSelectionRange = setup("/file.ts", ` + const getSmartSelectionRange = setup("/file.ts", ` export interface IService { _serviceBrand: any; open(host: number, data: any): Promise; bar(): void }`); - const locations = getSelectionRange([ + const locations = getSmartSelectionRange([ { line: 5, offset: 12 }, // ho/**/st { line: 6, offset: 16 }, // void/**/ ]); @@ -136,10 +136,10 @@ export interface IService { }); it("works for complex TypeScript", () => { - const getSelectionRange = setup("/file.ts", ` + const getSmartSelectionRange = setup("/file.ts", ` type X = IsExactlyAny

extends true ? T : ({ [K in keyof P]: IsExactlyAny extends true ? K extends keyof T ? T[K] : P[K] : P[K]; } & Pick>) `); - const locations = getSelectionRange([ + const locations = getSmartSelectionRange([ { line: 2, offset: 133, @@ -195,13 +195,13 @@ type X = IsExactlyAny

extends true ? T : ({ [K in keyof P]: IsExactlyAn }); it("works for object types", () => { - const getSelectionRange = setup("/file.js", ` + const getSmartSelectionRange = setup("/file.js", ` type X = { foo?: string; readonly bar: { x: number }; meh }`); - const locations = getSelectionRange([ + const locations = getSmartSelectionRange([ { line: 3, offset: 5 }, { line: 4, offset: 5 }, { line: 4, offset: 14 }, @@ -285,8 +285,8 @@ type X = { it("works for string literals and template strings", () => { // tslint:disable-next-line:no-invalid-template-strings - const getSelectionRange = setup("/file.ts", "`a b ${\n 'c'\n} d`"); - const locations = getSelectionRange([ + const getSmartSelectionRange = setup("/file.ts", "`a b ${\n 'c'\n} d`"); + const locations = getSmartSelectionRange([ { line: 2, offset: 4 }, { line: 1, offset: 4 }, ]); @@ -327,13 +327,13 @@ type X = { }); it("works for ES2015 import lists", () => { - const getSelectionRange = setup("/file.ts", ` + const getSmartSelectionRange = setup("/file.ts", ` import { x as y, z } from './z'; import { b } from './'; console.log(1);`); - const locations = getSelectionRange([{ line: 2, offset: 10 }]); + const locations = getSmartSelectionRange([{ line: 2, offset: 10 }]); assert.deepEqual(locations, [ { textSpan: { // x @@ -367,10 +367,10 @@ console.log(1);`); }); it("works for complex mapped types", () => { - const getSelectionRange = setup("/file.ts", ` + const getSmartSelectionRange = setup("/file.ts", ` type M = { -readonly [K in keyof any]-?: any };`); - const locations = getSelectionRange([ + const locations = getSmartSelectionRange([ { line: 2, offset: 12 }, // -readonly { line: 2, offset: 14 }, // eadonly { line: 2, offset: 22 }, // [ @@ -476,10 +476,10 @@ type M = { -readonly [K in keyof any]-?: any };`); }); it("works for parameters", () => { - const getSelectionRange = setup("/file.ts", ` + const getSmartSelectionRange = setup("/file.ts", ` function f(p, q?, ...r: any[] = []) {}`); - const locations = getSelectionRange([ + const locations = getSmartSelectionRange([ { line: 2, offset: 12 }, // p { line: 2, offset: 15 }, // q { line: 2, offset: 19 }, // ... @@ -537,9 +537,9 @@ function f(p, q?, ...r: any[] = []) {}`); }); it("works for binding elements", () => { - const getSelectionRange = setup("/file.ts", ` + const getSmartSelectionRange = setup("/file.ts", ` const { x, y: a, ...zs = {} } = {};`); - const locations = getSelectionRange([ + const locations = getSmartSelectionRange([ { line: 2, offset: 9 }, // x { line: 2, offset: 15 }, // a { line: 2, offset: 21 }, // zs @@ -578,12 +578,12 @@ const { x, y: a, ...zs = {} } = {};`); }); it("consumes all whitespace in a multi-line function parameter list", () => { - const getSelectionRange = setup("/file.ts", ` + const getSmartSelectionRange = setup("/file.ts", ` function f( a, b ) {}`); - const locations = getSelectionRange([{ line: 4, offset: 5 }]); // b + const locations = getSmartSelectionRange([{ line: 4, offset: 5 }]); // b assert.deepEqual(locations, [{ textSpan: { // b start: { line: 4, offset: 5 }, @@ -604,8 +604,8 @@ function f( }); it("snaps to nodes directly behind the cursor instead of trivia ahead of the cursor", () => { - const getSelectionRange = setup("/file.ts", `let x: string`); - const locations = getSelectionRange([{ line: 1, offset: 4 }]); + const getSmartSelectionRange = setup("/file.ts", `let x: string`); + const locations = getSmartSelectionRange([{ line: 1, offset: 4 }]); assert.deepEqual(locations![0].textSpan, { start: { line: 1, offset: 1 }, end: { line: 1, offset: 4 }, @@ -613,7 +613,7 @@ function f( }); it("creates a stop for JSDoc ranges", () => { - const getSelectionRange = setup("/file.js", "" + + const getSmartSelectionRange = setup("/file.js", "" + `// Not a JSDoc comment /** * @param {number} x The number to square @@ -621,7 +621,7 @@ function f( function square(x) { return x * x; }`); - const locations = getSelectionRange([{ line: 5, offset: 10 }]); // square(x) + const locations = getSmartSelectionRange([{ line: 5, offset: 10 }]); // square(x) assert.deepEqual(locations, [{ textSpan: { // square start: { line: 5 , offset: 10 }, @@ -641,8 +641,8 @@ function square(x) { }); it("skips lone VariableDeclarations in a declaration list", () => { - const getSelectionRange = setup("/file.ts", `const x = 3;`); - const locations = getSelectionRange([{ line: 1, offset: 7 }]); // x + const getSmartSelectionRange = setup("/file.ts", `const x = 3;`); + const locations = getSmartSelectionRange([{ line: 1, offset: 7 }]); // x assert.deepEqual(locations, [{ textSpan: { start: { line: 1, offset: 7 }, diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 1b4acd88ebf..0cf9780593d 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4788,6 +4788,7 @@ declare namespace ts { getSignatureHelpItems(fileName: string, position: number, options: SignatureHelpItemsOptions | undefined): SignatureHelpItems | undefined; getRenameInfo(fileName: string, position: number, options?: RenameInfoOptions): RenameInfo; findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): ReadonlyArray | undefined; + getSmartSelectionRange(fileName: string, position: number): SelectionRange; getDefinitionAtPosition(fileName: string, position: number): ReadonlyArray | undefined; getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan | undefined; getTypeDefinitionAtPosition(fileName: string, position: number): ReadonlyArray | undefined; @@ -5239,6 +5240,10 @@ declare namespace ts { displayParts: SymbolDisplayPart[]; isOptional: boolean; } + interface SelectionRange { + textSpan: TextSpan; + parent?: SelectionRange; + } /** * Represents a single signature to show in signature help. * The id is used for subsequent calls into the language service to ask questions about the @@ -5790,7 +5795,8 @@ declare namespace ts.server.protocol { GetEditsForRefactor = "getEditsForRefactor", OrganizeImports = "organizeImports", GetEditsForFileRename = "getEditsForFileRename", - ConfigurePlugin = "configurePlugin" + ConfigurePlugin = "configurePlugin", + SelectionRange = "selectionRange", } /** * A TypeScript Server message @@ -6753,6 +6759,20 @@ declare namespace ts.server.protocol { } interface ConfigurePluginResponse extends Response { } + interface SelectionRangeRequest extends FileRequest { + command: CommandTypes.SelectionRange; + arguments: SelectionRangeRequestArgs; + } + interface SelectionRangeRequestArgs extends FileRequestArgs { + locations: Location[]; + } + interface SelectionRangeResponse extends Response { + body?: SelectionRange[]; + } + interface SelectionRange { + textSpan: TextSpan; + parent?: SelectionRange; + } /** * Information found in an "open" request. */ @@ -9026,6 +9046,8 @@ declare namespace ts.server { private getBraceMatching; private getDiagnosticsForProject; private configurePlugin; + private getSmartSelectionRange; + private mapSelectionRange; getCanonicalFileName(fileName: string): string; exit(): void; private notRequired; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index c25e1d733c0..db24e19b3d8 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4788,6 +4788,7 @@ declare namespace ts { getSignatureHelpItems(fileName: string, position: number, options: SignatureHelpItemsOptions | undefined): SignatureHelpItems | undefined; getRenameInfo(fileName: string, position: number, options?: RenameInfoOptions): RenameInfo; findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): ReadonlyArray | undefined; + getSmartSelectionRange(fileName: string, position: number): SelectionRange; getDefinitionAtPosition(fileName: string, position: number): ReadonlyArray | undefined; getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan | undefined; getTypeDefinitionAtPosition(fileName: string, position: number): ReadonlyArray | undefined; @@ -5239,6 +5240,10 @@ declare namespace ts { displayParts: SymbolDisplayPart[]; isOptional: boolean; } + interface SelectionRange { + textSpan: TextSpan; + parent?: SelectionRange; + } /** * Represents a single signature to show in signature help. * The id is used for subsequent calls into the language service to ask questions about the diff --git a/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter b/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter index 40bdb4eadab..46971a84547 160000 --- a/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter +++ b/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter @@ -1 +1 @@ -Subproject commit 40bdb4eadabc9fbed7d83e3f26817a931c0763b6 +Subproject commit 46971a8454761f1a11d8fde4d96ff8d29bc4e754 diff --git a/tests/cases/user/create-react-app/create-react-app b/tests/cases/user/create-react-app/create-react-app index 1a61db58d43..9514cb88ab9 160000 --- a/tests/cases/user/create-react-app/create-react-app +++ b/tests/cases/user/create-react-app/create-react-app @@ -1 +1 @@ -Subproject commit 1a61db58d434d33603f20e73ca643ec83c561b73 +Subproject commit 9514cb88ab92fec7f5df2914702ef23a62c0a249 diff --git a/tests/cases/user/prettier/prettier b/tests/cases/user/prettier/prettier index 1e471a00796..0b07e108333 160000 --- a/tests/cases/user/prettier/prettier +++ b/tests/cases/user/prettier/prettier @@ -1 +1 @@ -Subproject commit 1e471a007968b7490563b91ed6909ae6046f3fe8 +Subproject commit 0b07e1083339e28a8239df3f5245f530cc4fd7f8 From 12492a369e7d973cf89fd9301d0c452c12e218d7 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 18 Apr 2019 16:28:12 -0700 Subject: [PATCH 018/384] Rename test to match --- src/testRunner/tsconfig.json | 2 +- .../unittests/tsserver/{selectionRange.ts => smartSelection.ts} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/testRunner/unittests/tsserver/{selectionRange.ts => smartSelection.ts} (100%) diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index 5ae94c80c23..c4fa16ba715 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -141,7 +141,7 @@ "unittests/tsserver/reload.ts", "unittests/tsserver/rename.ts", "unittests/tsserver/resolutionCache.ts", - "unittests/tsserver/selectionRange.ts", + "unittests/tsserver/smartSelection.ts", "unittests/tsserver/session.ts", "unittests/tsserver/skipLibCheck.ts", "unittests/tsserver/symLinks.ts", diff --git a/src/testRunner/unittests/tsserver/selectionRange.ts b/src/testRunner/unittests/tsserver/smartSelection.ts similarity index 100% rename from src/testRunner/unittests/tsserver/selectionRange.ts rename to src/testRunner/unittests/tsserver/smartSelection.ts From 511cc79642bed5e0a612a227e9458d8b55ff8b45 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 18 Apr 2019 17:21:52 -0700 Subject: [PATCH 019/384] Revert accidental line break added --- src/compiler/utilities.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 91f6e3b4218..2e6c3ae4f86 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -7624,7 +7624,6 @@ namespace ts { return root + pathComponents.slice(1).join(directorySeparator); } - } /* @internal */ From 99ace033bfdcf3155357e420f19281e0e7721abc Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 18 Apr 2019 17:23:54 -0700 Subject: [PATCH 020/384] Revert accidental line ending change --- src/server/tsconfig.json | 54 ++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json index 1410440512b..3cf28ab40ee 100644 --- a/src/server/tsconfig.json +++ b/src/server/tsconfig.json @@ -1,27 +1,27 @@ -{ - "extends": "../tsconfig-base", - "compilerOptions": { - "removeComments": false, - "outFile": "../../built/local/server.js", - "preserveConstEnums": true, - "types": [ - "node" - ] - }, - "references": [ - { "path": "../compiler" }, - { "path": "../jsTyping" }, - { "path": "../services" } - ], - "files": [ - "types.ts", - "utilities.ts", - "protocol.ts", - "scriptInfo.ts", - "typingsCache.ts", - "project.ts", - "editorServices.ts", - "session.ts", - "scriptVersionCache.ts" - ] -} +{ + "extends": "../tsconfig-base", + "compilerOptions": { + "removeComments": false, + "outFile": "../../built/local/server.js", + "preserveConstEnums": true, + "types": [ + "node" + ] + }, + "references": [ + { "path": "../compiler" }, + { "path": "../jsTyping" }, + { "path": "../services" } + ], + "files": [ + "types.ts", + "utilities.ts", + "protocol.ts", + "scriptInfo.ts", + "typingsCache.ts", + "project.ts", + "editorServices.ts", + "session.ts", + "scriptVersionCache.ts" + ] +} From 6177596c270274d18949106cf668254cdb5e0c90 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 18 Apr 2019 17:52:09 -0700 Subject: [PATCH 021/384] Revert accidental submodule change I guess --- .../cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter | 2 +- tests/cases/user/create-react-app/create-react-app | 2 +- tests/cases/user/prettier/prettier | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter b/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter index 46971a84547..40bdb4eadab 160000 --- a/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter +++ b/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter @@ -1 +1 @@ -Subproject commit 46971a8454761f1a11d8fde4d96ff8d29bc4e754 +Subproject commit 40bdb4eadabc9fbed7d83e3f26817a931c0763b6 diff --git a/tests/cases/user/create-react-app/create-react-app b/tests/cases/user/create-react-app/create-react-app index 9514cb88ab9..1a61db58d43 160000 --- a/tests/cases/user/create-react-app/create-react-app +++ b/tests/cases/user/create-react-app/create-react-app @@ -1 +1 @@ -Subproject commit 9514cb88ab92fec7f5df2914702ef23a62c0a249 +Subproject commit 1a61db58d434d33603f20e73ca643ec83c561b73 diff --git a/tests/cases/user/prettier/prettier b/tests/cases/user/prettier/prettier index 0b07e108333..1e471a00796 160000 --- a/tests/cases/user/prettier/prettier +++ b/tests/cases/user/prettier/prettier @@ -1 +1 @@ -Subproject commit 0b07e1083339e28a8239df3f5245f530cc4fd7f8 +Subproject commit 1e471a007968b7490563b91ed6909ae6046f3fe8 From f0a3d2bf92cd59d3c068246109c5832f83d3d150 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Fri, 19 Apr 2019 09:44:42 -0700 Subject: [PATCH 022/384] Filter out zero-width selections --- src/services/smartSelection.ts | 11 ++++--- .../unittests/tsserver/smartSelection.ts | 33 ++++++++++++++++++- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/services/smartSelection.ts b/src/services/smartSelection.ts index ba2ec60e9c5..ddd3c75c2c7 100644 --- a/src/services/smartSelection.ts +++ b/src/services/smartSelection.ts @@ -70,10 +70,13 @@ namespace ts.SmartSelectionRange { return selectionRange; function pushSelectionRange(start: number, end: number): void { - // Skip ranges that are identical to the parent - const textSpan = createTextSpanFromBounds(start, end); - if (!selectionRange || !textSpansEqual(textSpan, selectionRange.textSpan)) { - selectionRange = { textSpan, ...selectionRange && { parent: selectionRange } }; + // Skip empty ranges + if (start !== end) { + // Skip ranges that are identical to the parent + const textSpan = createTextSpanFromBounds(start, end); + if (!selectionRange || !textSpansEqual(textSpan, selectionRange.textSpan)) { + selectionRange = { textSpan, ...selectionRange && { parent: selectionRange } }; + } } } } diff --git a/src/testRunner/unittests/tsserver/smartSelection.ts b/src/testRunner/unittests/tsserver/smartSelection.ts index 5d4113d3f97..fca96ab848e 100644 --- a/src/testRunner/unittests/tsserver/smartSelection.ts +++ b/src/testRunner/unittests/tsserver/smartSelection.ts @@ -12,7 +12,7 @@ namespace ts.projectSystem { }; } - describe("unittests:: tsserver:: selectionRange", () => { + describe("unittests:: tsserver:: smartSelection", () => { it("works for simple JavaScript", () => { const getSmartSelectionRange = setup("/file.js", ` class Foo { @@ -652,5 +652,36 @@ function square(x) { start: { line: 1, offset: 1 }, end: { line: 1, offset: 13 } } } }]); }); + + it("never returns empty ranges", () => { + const getSmartSelectionRange = setup("/file.ts", ` +class HomePage { + componentDidMount() { + if (this.props.username) { + return ''; + } + } +}`); + const locations = getSmartSelectionRange([ + { line: 3, offset: 23 }, // componentDidMount(/**/) + { line: 4, offset: 32 }, // username/**/) + { line: 5, offset: 21 }, // return '/**/' + ]); + + assert.deepEqual(locations![0].textSpan, { // this.props.username + start: { line: 3, offset: 23 }, + end: { line: 3, offset: 24 }, + }); + + assert.deepEqual(locations![1].textSpan, { // this.props.username + start: { line: 4, offset: 32 }, + end: { line: 4, offset: 33 }, + }); + + assert.deepEqual(locations![2].textSpan, { // '' + start: { line: 5, offset: 20 }, + end: { line: 5, offset: 22 }, + }); + }); }); } From 6fc2e4a32e9da29bdf4e4b0fbc1616836d31db6a Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 23 Apr 2019 15:34:01 -0700 Subject: [PATCH 023/384] Add custom baseline format for smart selection --- src/harness/fourslash.ts | 52 +++++++++++++++++++++++++----- tests/cases/fourslash/fourslash.ts | 3 +- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 9e117cdfd8f..b562f908a6c 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1417,12 +1417,7 @@ Actual: ${stringify(fullActual)}`); } public baselineCurrentFileBreakpointLocations() { - let baselineFile = this.testData.globalOptions[MetadataOptionNames.baselineFile]; - if (!baselineFile) { - baselineFile = this.activeFile.fileName.replace(this.basePath + "/breakpointValidation", "bpSpan"); - baselineFile = baselineFile.replace(ts.Extension.Ts, ".baseline"); - - } + const baselineFile = this.getBaselineFileName().replace(this.basePath + "/breakpointValidation", "bpSpan"); Harness.Baseline.runBaseline(baselineFile, this.baselineCurrentFileLocations(pos => this.getBreakpointStatementLocation(pos)!)); } @@ -1497,8 +1492,7 @@ Actual: ${stringify(fullActual)}`); } public baselineQuickInfo() { - const baselineFile = this.testData.globalOptions[MetadataOptionNames.baselineFile] || - ts.getBaseFileName(this.activeFile.fileName).replace(ts.Extension.Ts, ".baseline"); + const baselineFile = this.getBaselineFileName(); Harness.Baseline.runBaseline( baselineFile, stringify( @@ -1508,6 +1502,39 @@ Actual: ${stringify(fullActual)}`); })))); } + public baselineSmartSelection() { + const n = ts.sys.newLine; + const baselineFile = this.getBaselineFileName(); + const markers = this.getMarkers(); + const fileContent = this.activeFile.content; + const text = markers.map(marker => { + const baselineContent = [fileContent.slice(0, marker.position) + "/**/" + fileContent.slice(marker.position) + n]; + let selectionRange: ts.SelectionRange | undefined = this.languageService.getSmartSelectionRange(this.activeFile.fileName, marker.position); + while (selectionRange) { + const { textSpan } = selectionRange; + let masked = Array.from(fileContent).map((char, index) => { + const charCode = char.charCodeAt(0); + if (index >= textSpan.start && index < ts.textSpanEnd(textSpan)) { + return char === " " ? "•" : ts.isLineBreak(charCode) ? `↲${n}` : char; + } + return ts.isLineBreak(charCode) ? char : " "; + }).join(""); + masked = masked.replace(/^\s*$\r?\n?/gm, ""); // Remove blank lines + const isRealCharacter = (char: string) => char !== "•" && char !== "↲" && !ts.isWhiteSpaceLike(char.charCodeAt(0)); + const leadingWidth = Array.from(masked).findIndex(isRealCharacter); + const trailingWidth = ts.findLastIndex(Array.from(masked), isRealCharacter); + masked = masked.slice(0, leadingWidth) + + masked.slice(leadingWidth, trailingWidth).replace(/•/g, " ").replace(/↲/g, "") + + masked.slice(trailingWidth); + baselineContent.push(masked); + selectionRange = selectionRange.parent; + } + return baselineContent.join(n); + }).join(n.repeat(2) + "=".repeat(80) + n.repeat(2)); + + Harness.Baseline.runBaseline(baselineFile, text); + } + public printBreakpointLocation(pos: number) { Harness.IO.log("\n**Pos: " + pos + " " + this.spanInfoToString(this.getBreakpointStatementLocation(pos)!, " ")); } @@ -1562,6 +1589,11 @@ Actual: ${stringify(fullActual)}`); Harness.IO.log(stringify(help.items[help.selectedItemIndex])); } + private getBaselineFileName() { + return this.testData.globalOptions[MetadataOptionNames.baselineFile] || + ts.getBaseFileName(this.activeFile.fileName).replace(ts.Extension.Ts, ".baseline"); + } + private getSignatureHelp({ triggerReason }: FourSlashInterface.VerifySignatureHelpOptions): ts.SignatureHelpItems | undefined { return this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition, { triggerReason @@ -3973,6 +4005,10 @@ namespace FourSlashInterface { this.state.baselineQuickInfo(); } + public baselineSmartSelection() { + this.state.baselineSmartSelection(); + } + public nameOrDottedNameSpanTextIs(text: string) { this.state.verifyCurrentNameOrDottedNameSpanText(text); } diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 6488748b728..4252296d5da 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -244,6 +244,7 @@ declare namespace FourSlashInterface { baselineGetEmitOutput(insertResultsIntoVfs?: boolean): void; getEmitOutput(expectedOutputFiles: ReadonlyArray): void; baselineQuickInfo(): void; + baselineSmartSelection(): void; nameOrDottedNameSpanTextIs(text: string): void; outliningSpansInCurrentFile(spans: Range[]): void; todoCommentsInCurrentFile(descriptors: string[]): void; @@ -508,7 +509,7 @@ declare namespace FourSlashInterface { readonly importModuleSpecifierEnding?: "minimal" | "index" | "js"; } interface CompletionsOptions { - readonly marker?: ArrayOrSingle, + readonly marker?: ArrayOrSingle; readonly isNewIdentifierLocation?: boolean; readonly isGlobalCompletion?: boolean; readonly exact?: ArrayOrSingle; From e28b9b2ba2f9b4857006293db5b9d567a2618754 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 23 Apr 2019 16:41:59 -0700 Subject: [PATCH 024/384] Copy smartSelect tests to fourslash --- src/harness/fourslash.ts | 2 +- .../reference/smartSelection_JSDoc.baseline | 30 +++ .../smartSelection_behindCaret.baseline | 4 + .../smartSelection_bindingPatterns.baseline | 27 +++ .../reference/smartSelection_complex.baseline | 12 ++ .../smartSelection_emptyRanges.baseline | 140 ++++++++++++++ .../smartSelection_functionParams1.baseline | 25 +++ .../smartSelection_functionParams2.baseline | 18 ++ .../reference/smartSelection_imports.baseline | 29 +++ ...Selection_loneVariableDeclaration.baseline | 4 + .../smartSelection_mappedTypes.baseline | 65 +++++++ .../smartSelection_objectTypes.baseline | 174 ++++++++++++++++++ .../reference/smartSelection_simple1.baseline | 116 ++++++++++++ .../reference/smartSelection_simple2.baseline | 63 +++++++ .../smartSelection_templateStrings.baseline | 37 ++++ tests/cases/fourslash/smartSelection_JSDoc.ts | 11 ++ .../fourslash/smartSelection_behindCaret.ts | 6 + .../smartSelection_bindingPatterns.ts | 5 + .../cases/fourslash/smartSelection_complex.ts | 5 + .../fourslash/smartSelection_emptyRanges.ts | 11 ++ .../smartSelection_functionParams1.ts | 5 + .../smartSelection_functionParams2.ts | 8 + .../cases/fourslash/smartSelection_imports.ts | 8 + .../smartSelection_loneVariableDeclaration.ts | 5 + .../fourslash/smartSelection_mappedTypes.ts | 5 + .../fourslash/smartSelection_objectTypes.ts | 9 + .../cases/fourslash/smartSelection_simple1.ts | 12 ++ .../cases/fourslash/smartSelection_simple2.ts | 10 + .../smartSelection_templateStrings.ts | 7 + 29 files changed, 852 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/smartSelection_JSDoc.baseline create mode 100644 tests/baselines/reference/smartSelection_behindCaret.baseline create mode 100644 tests/baselines/reference/smartSelection_bindingPatterns.baseline create mode 100644 tests/baselines/reference/smartSelection_complex.baseline create mode 100644 tests/baselines/reference/smartSelection_emptyRanges.baseline create mode 100644 tests/baselines/reference/smartSelection_functionParams1.baseline create mode 100644 tests/baselines/reference/smartSelection_functionParams2.baseline create mode 100644 tests/baselines/reference/smartSelection_imports.baseline create mode 100644 tests/baselines/reference/smartSelection_loneVariableDeclaration.baseline create mode 100644 tests/baselines/reference/smartSelection_mappedTypes.baseline create mode 100644 tests/baselines/reference/smartSelection_objectTypes.baseline create mode 100644 tests/baselines/reference/smartSelection_simple1.baseline create mode 100644 tests/baselines/reference/smartSelection_simple2.baseline create mode 100644 tests/baselines/reference/smartSelection_templateStrings.baseline create mode 100644 tests/cases/fourslash/smartSelection_JSDoc.ts create mode 100644 tests/cases/fourslash/smartSelection_behindCaret.ts create mode 100644 tests/cases/fourslash/smartSelection_bindingPatterns.ts create mode 100644 tests/cases/fourslash/smartSelection_complex.ts create mode 100644 tests/cases/fourslash/smartSelection_emptyRanges.ts create mode 100644 tests/cases/fourslash/smartSelection_functionParams1.ts create mode 100644 tests/cases/fourslash/smartSelection_functionParams2.ts create mode 100644 tests/cases/fourslash/smartSelection_imports.ts create mode 100644 tests/cases/fourslash/smartSelection_loneVariableDeclaration.ts create mode 100644 tests/cases/fourslash/smartSelection_mappedTypes.ts create mode 100644 tests/cases/fourslash/smartSelection_objectTypes.ts create mode 100644 tests/cases/fourslash/smartSelection_simple1.ts create mode 100644 tests/cases/fourslash/smartSelection_simple2.ts create mode 100644 tests/cases/fourslash/smartSelection_templateStrings.ts diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index b562f908a6c..66ea1ba38c4 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1529,7 +1529,7 @@ Actual: ${stringify(fullActual)}`); baselineContent.push(masked); selectionRange = selectionRange.parent; } - return baselineContent.join(n); + return baselineContent.join(fileContent.includes("\n") ? n + n : n); }).join(n.repeat(2) + "=".repeat(80) + n.repeat(2)); Harness.Baseline.runBaseline(baselineFile, text); diff --git a/tests/baselines/reference/smartSelection_JSDoc.baseline b/tests/baselines/reference/smartSelection_JSDoc.baseline new file mode 100644 index 00000000000..6f223644e43 --- /dev/null +++ b/tests/baselines/reference/smartSelection_JSDoc.baseline @@ -0,0 +1,30 @@ +// Not a JSDoc comment +/** + * @param {number} x The number to square + */ +function /**/square(x) { + return x * x; +} + + + square + + +function square(x) { + return x * x; +} + +/** + * @param {number} x The number to square + */ +function square(x) { + return x * x; +} + +// Not a JSDoc comment +/** + * @param {number} x The number to square + */ +function square(x) { + return x * x; +} \ No newline at end of file diff --git a/tests/baselines/reference/smartSelection_behindCaret.baseline b/tests/baselines/reference/smartSelection_behindCaret.baseline new file mode 100644 index 00000000000..6b7b393f7ea --- /dev/null +++ b/tests/baselines/reference/smartSelection_behindCaret.baseline @@ -0,0 +1,4 @@ +let/**/ x: string + +let +let x: string \ No newline at end of file diff --git a/tests/baselines/reference/smartSelection_bindingPatterns.baseline b/tests/baselines/reference/smartSelection_bindingPatterns.baseline new file mode 100644 index 00000000000..78f3e4a10b7 --- /dev/null +++ b/tests/baselines/reference/smartSelection_bindingPatterns.baseline @@ -0,0 +1,27 @@ +const { /**/x, y: a, ...zs = {} } = {}; + + x + x, y: a, ...zs = {} + { x, y: a, ...zs = {} } +const { x, y: a, ...zs = {} } = {}; + +================================================================================ + +const { x, y: /**/a, ...zs = {} } = {}; + + a + y: a + x, y: a, ...zs = {} + { x, y: a, ...zs = {} } +const { x, y: a, ...zs = {} } = {}; + +================================================================================ + +const { x, y: a, .../**/zs = {} } = {}; + + zs + ...zs + ...zs = {} + x, y: a, ...zs = {} + { x, y: a, ...zs = {} } +const { x, y: a, ...zs = {} } = {}; \ No newline at end of file diff --git a/tests/baselines/reference/smartSelection_complex.baseline b/tests/baselines/reference/smartSelection_complex.baseline new file mode 100644 index 00000000000..c16b1912ae7 --- /dev/null +++ b/tests/baselines/reference/smartSelection_complex.baseline @@ -0,0 +1,12 @@ +type X = IsExactlyAny

extends true ? T : ({ [K in keyof P]: IsExactlyAny extends true ? K extends keyof T ? T[K] : P[/**/K] : P[K]; } & Pick>) + + K + P[K] + K extends keyof T ? T[K] : P[K] + IsExactlyAny extends true ? K extends keyof T ? T[K] : P[K] : P[K] + [K in keyof P]: IsExactlyAny extends true ? K extends keyof T ? T[K] : P[K] : P[K]; + { [K in keyof P]: IsExactlyAny extends true ? K extends keyof T ? T[K] : P[K] : P[K]; } + { [K in keyof P]: IsExactlyAny extends true ? K extends keyof T ? T[K] : P[K] : P[K]; } & Pick> + ({ [K in keyof P]: IsExactlyAny extends true ? K extends keyof T ? T[K] : P[K] : P[K]; } & Pick>) + IsExactlyAny

extends true ? T : ({ [K in keyof P]: IsExactlyAny extends true ? K extends keyof T ? T[K] : P[K] : P[K]; } & Pick>) +type X = IsExactlyAny

extends true ? T : ({ [K in keyof P]: IsExactlyAny extends true ? K extends keyof T ? T[K] : P[K] : P[K]; } & Pick>) \ No newline at end of file diff --git a/tests/baselines/reference/smartSelection_emptyRanges.baseline b/tests/baselines/reference/smartSelection_emptyRanges.baseline new file mode 100644 index 00000000000..8ec58d839ab --- /dev/null +++ b/tests/baselines/reference/smartSelection_emptyRanges.baseline @@ -0,0 +1,140 @@ +class HomePage { + componentDidMount(/**/) { + if (this.props.username) { + return ''; + } + } +} + + + ) + + + componentDidMount() { + if (this.props.username) { + return ''; + } + } + + + ↲ +••componentDidMount() { + if (this.props.username) { + return ''; + } + }↲ + + +class HomePage { + componentDidMount() { + if (this.props.username) { + return ''; + } + } +} + +================================================================================ + +class HomePage { + componentDidMount() { + if (this.props.username/**/) { + return ''; + } + } +} + + + ) + + + if (this.props.username) { + return ''; + } + + + ↲ +••••if (this.props.username) { + return ''; + }↲ +•• + + + componentDidMount() { + if (this.props.username) { + return ''; + } + } + + + ↲ +••componentDidMount() { + if (this.props.username) { + return ''; + } + }↲ + + +class HomePage { + componentDidMount() { + if (this.props.username) { + return ''; + } + } +} + +================================================================================ + +class HomePage { + componentDidMount() { + if (this.props.username) { + return '/**/'; + } + } +} + + + '' + + + return ''; + + + ↲ +••••••return '';↲ +•••• + + + if (this.props.username) { + return ''; + } + + + ↲ +••••if (this.props.username) { + return ''; + }↲ +•• + + + componentDidMount() { + if (this.props.username) { + return ''; + } + } + + + ↲ +••componentDidMount() { + if (this.props.username) { + return ''; + } + }↲ + + +class HomePage { + componentDidMount() { + if (this.props.username) { + return ''; + } + } +} \ No newline at end of file diff --git a/tests/baselines/reference/smartSelection_functionParams1.baseline b/tests/baselines/reference/smartSelection_functionParams1.baseline new file mode 100644 index 00000000000..1162ceb917a --- /dev/null +++ b/tests/baselines/reference/smartSelection_functionParams1.baseline @@ -0,0 +1,25 @@ +function f(/**/p, q?, ...r: any[] = []) {} + + p + p, q?, ...r: any[] = [] +function f(p, q?, ...r: any[] = []) {} + +================================================================================ + +function f(p, /**/q?, ...r: any[] = []) {} + + q + q? + p, q?, ...r: any[] = [] +function f(p, q?, ...r: any[] = []) {} + +================================================================================ + +function f(p, q?, /**/...r: any[] = []) {} + + ... + ...r + ...r: any[] + ...r: any[] = [] + p, q?, ...r: any[] = [] +function f(p, q?, ...r: any[] = []) {} \ No newline at end of file diff --git a/tests/baselines/reference/smartSelection_functionParams2.baseline b/tests/baselines/reference/smartSelection_functionParams2.baseline new file mode 100644 index 00000000000..5f355ff0f0e --- /dev/null +++ b/tests/baselines/reference/smartSelection_functionParams2.baseline @@ -0,0 +1,18 @@ +function f( + a, + /**/b +) {} + + + b + + + ↲ +••a, + b↲ + + +function f( + a, + b +) {} \ No newline at end of file diff --git a/tests/baselines/reference/smartSelection_imports.baseline b/tests/baselines/reference/smartSelection_imports.baseline new file mode 100644 index 00000000000..f3a449ee13e --- /dev/null +++ b/tests/baselines/reference/smartSelection_imports.baseline @@ -0,0 +1,29 @@ +import { /**/x as y, z } from './z'; +import { b } from './'; + +console.log(1); + + + x + + + x as y + + + x as y, z + + + { x as y, z } + + +import { x as y, z } from './z'; + + +import { x as y, z } from './z'; +import { b } from './'; + + +import { x as y, z } from './z'; +import { b } from './'; + +console.log(1); \ No newline at end of file diff --git a/tests/baselines/reference/smartSelection_loneVariableDeclaration.baseline b/tests/baselines/reference/smartSelection_loneVariableDeclaration.baseline new file mode 100644 index 00000000000..df2345bd20f --- /dev/null +++ b/tests/baselines/reference/smartSelection_loneVariableDeclaration.baseline @@ -0,0 +1,4 @@ +const /**/x = 3; + + x +const x = 3; \ No newline at end of file diff --git a/tests/baselines/reference/smartSelection_mappedTypes.baseline b/tests/baselines/reference/smartSelection_mappedTypes.baseline new file mode 100644 index 00000000000..5dd6b37d7fe --- /dev/null +++ b/tests/baselines/reference/smartSelection_mappedTypes.baseline @@ -0,0 +1,65 @@ +type M = { /**/-readonly [K in keyof any]-?: any }; + + - + -readonly + -readonly [K in keyof any]-? + -readonly [K in keyof any]-?: any + { -readonly [K in keyof any]-?: any } +type M = { -readonly [K in keyof any]-?: any }; + +================================================================================ + +type M = { -re/**/adonly [K in keyof any]-?: any }; + + readonly + -readonly + -readonly [K in keyof any]-? + -readonly [K in keyof any]-?: any + { -readonly [K in keyof any]-?: any } +type M = { -readonly [K in keyof any]-?: any }; + +================================================================================ + +type M = { -readonly /**/[K in keyof any]-?: any }; + + [ + [K in keyof any] + -readonly [K in keyof any]-? + -readonly [K in keyof any]-?: any + { -readonly [K in keyof any]-?: any } +type M = { -readonly [K in keyof any]-?: any }; + +================================================================================ + +type M = { -readonly [K in ke/**/yof any]-?: any }; + + keyof + keyof any + K in keyof any + [K in keyof any] + -readonly [K in keyof any]-? + -readonly [K in keyof any]-?: any + { -readonly [K in keyof any]-?: any } +type M = { -readonly [K in keyof any]-?: any }; + +================================================================================ + +type M = { -readonly [K in keyof any]/**/-?: any }; + + - + -? + -readonly [K in keyof any]-? + -readonly [K in keyof any]-?: any + { -readonly [K in keyof any]-?: any } +type M = { -readonly [K in keyof any]-?: any }; + +================================================================================ + +type M = { -readonly [K in keyof any]-/**/?: any }; + + ? + -? + -readonly [K in keyof any]-? + -readonly [K in keyof any]-?: any + { -readonly [K in keyof any]-?: any } +type M = { -readonly [K in keyof any]-?: any }; \ No newline at end of file diff --git a/tests/baselines/reference/smartSelection_objectTypes.baseline b/tests/baselines/reference/smartSelection_objectTypes.baseline new file mode 100644 index 00000000000..612d5df2faa --- /dev/null +++ b/tests/baselines/reference/smartSelection_objectTypes.baseline @@ -0,0 +1,174 @@ +type X = { + /**/foo?: string; + readonly bar: { x: number }; + meh +} + + + foo + + + foo? + + + foo?: string; + + + ↲ +••foo?: string; + readonly bar: { x: number }; + meh↲ + + + { + foo?: string; + readonly bar: { x: number }; + meh +} + +type X = { + foo?: string; + readonly bar: { x: number }; + meh +} + +================================================================================ + +type X = { + foo?: string; + /**/readonly bar: { x: number }; + meh +} + + + readonly + + + readonly bar + + + readonly bar: { x: number }; + + + ↲ +••foo?: string; + readonly bar: { x: number }; + meh↲ + + + { + foo?: string; + readonly bar: { x: number }; + meh +} + +type X = { + foo?: string; + readonly bar: { x: number }; + meh +} + +================================================================================ + +type X = { + foo?: string; + readonly /**/bar: { x: number }; + meh +} + + + bar + + + readonly bar + + + readonly bar: { x: number }; + + + ↲ +••foo?: string; + readonly bar: { x: number }; + meh↲ + + + { + foo?: string; + readonly bar: { x: number }; + meh +} + +type X = { + foo?: string; + readonly bar: { x: number }; + meh +} + +================================================================================ + +type X = { + foo?: string; + readonly bar: { x: num/**/ber }; + meh +} + + + number + + + x: number + + + { x: number } + + + readonly bar: { x: number }; + + + ↲ +••foo?: string; + readonly bar: { x: number }; + meh↲ + + + { + foo?: string; + readonly bar: { x: number }; + meh +} + +type X = { + foo?: string; + readonly bar: { x: number }; + meh +} + +================================================================================ + +type X = { + foo?: string; + readonly bar: { x: number }; + /**/meh +} + + + meh + + + ↲ +••foo?: string; + readonly bar: { x: number }; + meh↲ + + + { + foo?: string; + readonly bar: { x: number }; + meh +} + +type X = { + foo?: string; + readonly bar: { x: number }; + meh +} \ No newline at end of file diff --git a/tests/baselines/reference/smartSelection_simple1.baseline b/tests/baselines/reference/smartSelection_simple1.baseline new file mode 100644 index 00000000000..f28c607c524 --- /dev/null +++ b/tests/baselines/reference/smartSelection_simple1.baseline @@ -0,0 +1,116 @@ +class Foo { + bar(a, b) { + if (/**/a === b) { + return true; + } + return false; + } +} + + + a + + + a === b + + + if (a === b) { + return true; + } + + + ↲ +••••••if (a === b) { + return true; + } + return false;↲ +•• + + + bar(a, b) { + if (a === b) { + return true; + } + return false; + } + + + ↲ +••bar(a, b) { + if (a === b) { + return true; + } + return false; + }↲ + + +class Foo { + bar(a, b) { + if (a === b) { + return true; + } + return false; + } +} + +================================================================================ + +class Foo { + bar(a, b) { + if (a === b) { + return tr/**/ue; + } + return false; + } +} + + + true + + + return true; + + + ↲ +••••••••••return true;↲ +•••••• + + + if (a === b) { + return true; + } + + + ↲ +••••••if (a === b) { + return true; + } + return false;↲ +•• + + + bar(a, b) { + if (a === b) { + return true; + } + return false; + } + + + ↲ +••bar(a, b) { + if (a === b) { + return true; + } + return false; + }↲ + + +class Foo { + bar(a, b) { + if (a === b) { + return true; + } + return false; + } +} \ No newline at end of file diff --git a/tests/baselines/reference/smartSelection_simple2.baseline b/tests/baselines/reference/smartSelection_simple2.baseline new file mode 100644 index 00000000000..2c4b520d449 --- /dev/null +++ b/tests/baselines/reference/smartSelection_simple2.baseline @@ -0,0 +1,63 @@ +export interface IService { + _serviceBrand: any; + + open(ho/**/st: number, data: any): Promise; + bar(): void +} + + + host + + + host: number + + + host: number, data: any + + + open(host: number, data: any): Promise; + + + ↲ +••_serviceBrand: any; + + open(host: number, data: any): Promise; + bar(): void↲ + + +export interface IService { + _serviceBrand: any; + + open(host: number, data: any): Promise; + bar(): void +} + +================================================================================ + +export interface IService { + _serviceBrand: any; + + open(host: number, data: any): Promise; + bar(): void/**/ +} + + + void + + + bar(): void + + + ↲ +••_serviceBrand: any; + + open(host: number, data: any): Promise; + bar(): void↲ + + +export interface IService { + _serviceBrand: any; + + open(host: number, data: any): Promise; + bar(): void +} \ No newline at end of file diff --git a/tests/baselines/reference/smartSelection_templateStrings.baseline b/tests/baselines/reference/smartSelection_templateStrings.baseline new file mode 100644 index 00000000000..91fec157842 --- /dev/null +++ b/tests/baselines/reference/smartSelection_templateStrings.baseline @@ -0,0 +1,37 @@ +`a /**/b ${ + 'c' +} d` + + + a b ${ + 'c' +} d + +`a b ${ + 'c' +} d` + +================================================================================ + +`a b ${ + '/**/c' +} d` + + + c + + + 'c' + + + ${ + 'c' +} + + a b ${ + 'c' +} d + +`a b ${ + 'c' +} d` \ No newline at end of file diff --git a/tests/cases/fourslash/smartSelection_JSDoc.ts b/tests/cases/fourslash/smartSelection_JSDoc.ts new file mode 100644 index 00000000000..2d50810a11e --- /dev/null +++ b/tests/cases/fourslash/smartSelection_JSDoc.ts @@ -0,0 +1,11 @@ +/// + +////// Not a JSDoc comment +/////** +//// * @param {number} x The number to square +//// */ +////function /**/square(x) { +//// return x * x; +////} + +verify.baselineSmartSelection(); \ No newline at end of file diff --git a/tests/cases/fourslash/smartSelection_behindCaret.ts b/tests/cases/fourslash/smartSelection_behindCaret.ts new file mode 100644 index 00000000000..f7bb0ec169d --- /dev/null +++ b/tests/cases/fourslash/smartSelection_behindCaret.ts @@ -0,0 +1,6 @@ +/// + +////let/**/ x: string + +// Verifies that the selection goes to 'let' first even though it’s behind the caret +verify.baselineSmartSelection(); \ No newline at end of file diff --git a/tests/cases/fourslash/smartSelection_bindingPatterns.ts b/tests/cases/fourslash/smartSelection_bindingPatterns.ts new file mode 100644 index 00000000000..350f72bac25 --- /dev/null +++ b/tests/cases/fourslash/smartSelection_bindingPatterns.ts @@ -0,0 +1,5 @@ +/// + +////const { /*1*/x, y: /*2*/a, .../*3*/zs = {} } = {}; + +verify.baselineSmartSelection(); \ No newline at end of file diff --git a/tests/cases/fourslash/smartSelection_complex.ts b/tests/cases/fourslash/smartSelection_complex.ts new file mode 100644 index 00000000000..28797e4833e --- /dev/null +++ b/tests/cases/fourslash/smartSelection_complex.ts @@ -0,0 +1,5 @@ +/// + +////type X = IsExactlyAny

extends true ? T : ({ [K in keyof P]: IsExactlyAny extends true ? K extends keyof T ? T[K] : P[/**/K] : P[K]; } & Pick>) + +verify.baselineSmartSelection(); \ No newline at end of file diff --git a/tests/cases/fourslash/smartSelection_emptyRanges.ts b/tests/cases/fourslash/smartSelection_emptyRanges.ts new file mode 100644 index 00000000000..6f2bfe7a2c0 --- /dev/null +++ b/tests/cases/fourslash/smartSelection_emptyRanges.ts @@ -0,0 +1,11 @@ +/// + +////class HomePage { +//// componentDidMount(/*1*/) { +//// if (this.props.username/*2*/) { +//// return '/*3*/'; +//// } +//// } +////} + +verify.baselineSmartSelection(); \ No newline at end of file diff --git a/tests/cases/fourslash/smartSelection_functionParams1.ts b/tests/cases/fourslash/smartSelection_functionParams1.ts new file mode 100644 index 00000000000..d2e0350d73a --- /dev/null +++ b/tests/cases/fourslash/smartSelection_functionParams1.ts @@ -0,0 +1,5 @@ +/// + +////function f(/*1*/p, /*2*/q?, /*3*/...r: any[] = []) {} + +verify.baselineSmartSelection(); \ No newline at end of file diff --git a/tests/cases/fourslash/smartSelection_functionParams2.ts b/tests/cases/fourslash/smartSelection_functionParams2.ts new file mode 100644 index 00000000000..0172763a70e --- /dev/null +++ b/tests/cases/fourslash/smartSelection_functionParams2.ts @@ -0,0 +1,8 @@ +/// + +////function f( +//// a, +//// /**/b +////) {} + +verify.baselineSmartSelection(); \ No newline at end of file diff --git a/tests/cases/fourslash/smartSelection_imports.ts b/tests/cases/fourslash/smartSelection_imports.ts new file mode 100644 index 00000000000..4e800f6973b --- /dev/null +++ b/tests/cases/fourslash/smartSelection_imports.ts @@ -0,0 +1,8 @@ +/// + +////import { /**/x as y, z } from './z'; +////import { b } from './'; +//// +////console.log(1); + +verify.baselineSmartSelection(); \ No newline at end of file diff --git a/tests/cases/fourslash/smartSelection_loneVariableDeclaration.ts b/tests/cases/fourslash/smartSelection_loneVariableDeclaration.ts new file mode 100644 index 00000000000..ae50d094ee7 --- /dev/null +++ b/tests/cases/fourslash/smartSelection_loneVariableDeclaration.ts @@ -0,0 +1,5 @@ +/// + +////const /**/x = 3; + +verify.baselineSmartSelection(); \ No newline at end of file diff --git a/tests/cases/fourslash/smartSelection_mappedTypes.ts b/tests/cases/fourslash/smartSelection_mappedTypes.ts new file mode 100644 index 00000000000..0f76491a592 --- /dev/null +++ b/tests/cases/fourslash/smartSelection_mappedTypes.ts @@ -0,0 +1,5 @@ +/// + +////type M = { /*1*/-re/*2*/adonly /*3*/[K in ke/*4*/yof any]/*5*/-/*6*/?: any }; + +verify.baselineSmartSelection(); \ No newline at end of file diff --git a/tests/cases/fourslash/smartSelection_objectTypes.ts b/tests/cases/fourslash/smartSelection_objectTypes.ts new file mode 100644 index 00000000000..3d458c43b4c --- /dev/null +++ b/tests/cases/fourslash/smartSelection_objectTypes.ts @@ -0,0 +1,9 @@ +/// + +////type X = { +//// /*1*/foo?: string; +//// /*2*/readonly /*3*/bar: { x: num/*4*/ber }; +//// /*5*/meh +////} + +verify.baselineSmartSelection(); \ No newline at end of file diff --git a/tests/cases/fourslash/smartSelection_simple1.ts b/tests/cases/fourslash/smartSelection_simple1.ts new file mode 100644 index 00000000000..97d7249138b --- /dev/null +++ b/tests/cases/fourslash/smartSelection_simple1.ts @@ -0,0 +1,12 @@ +/// + +////class Foo { +//// bar(a, b) { +//// if (/*1*/a === b) { +//// return tr/*2*/ue; +//// } +//// return false; +//// } +////} + +verify.baselineSmartSelection(); diff --git a/tests/cases/fourslash/smartSelection_simple2.ts b/tests/cases/fourslash/smartSelection_simple2.ts new file mode 100644 index 00000000000..85d3252bca0 --- /dev/null +++ b/tests/cases/fourslash/smartSelection_simple2.ts @@ -0,0 +1,10 @@ +/// + +////export interface IService { +//// _serviceBrand: any; +//// +//// open(ho/*1*/st: number, data: any): Promise; +//// bar(): void/*2*/ +////} + +verify.baselineSmartSelection(); \ No newline at end of file diff --git a/tests/cases/fourslash/smartSelection_templateStrings.ts b/tests/cases/fourslash/smartSelection_templateStrings.ts new file mode 100644 index 00000000000..e3b311d20d9 --- /dev/null +++ b/tests/cases/fourslash/smartSelection_templateStrings.ts @@ -0,0 +1,7 @@ +/// + +////`a /*1*/b ${ +//// '/*2*/c' +////} d` + +verify.baselineSmartSelection(); \ No newline at end of file From 3e30a7c2ad44293111afbb0f86a4008d0848444e Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 23 Apr 2019 16:45:08 -0700 Subject: [PATCH 025/384] Remove all but one server unit test --- .../unittests/tsserver/smartSelection.ts | 669 +----------------- 1 file changed, 24 insertions(+), 645 deletions(-) diff --git a/src/testRunner/unittests/tsserver/smartSelection.ts b/src/testRunner/unittests/tsserver/smartSelection.ts index fca96ab848e..3c903d7da67 100644 --- a/src/testRunner/unittests/tsserver/smartSelection.ts +++ b/src/testRunner/unittests/tsserver/smartSelection.ts @@ -12,6 +12,7 @@ namespace ts.projectSystem { }; } + // More tests in fourslash/smartSelection_* describe("unittests:: tsserver:: smartSelection", () => { it("works for simple JavaScript", () => { const getSmartSelectionRange = setup("/file.js", ` @@ -25,663 +26,41 @@ class Foo { }`); const locations = getSmartSelectionRange([ - { - line: 4, - offset: 13, - }, { - line: 5, - offset: 22, - }, + { line: 4, offset: 13 }, // a === b ]); - // Common to results for both locations - const ifStatementUp: protocol.SelectionRange = { - textSpan: { // IfStatement - start: { line: 4, offset: 9 }, - end: { line: 6, offset: 10 } }, + assert.deepEqual(locations, [{ + textSpan: { // a + start: { line: 4, offset: 13 }, + end: { line: 4, offset: 14 } }, parent: { - textSpan: { // SyntaxList + whitespace (body of method) - start: { line: 3, offset: 16 }, - end: { line: 8, offset: 5 } }, - parent: { - textSpan: { // MethodDeclaration - start: { line: 3, offset: 5 }, - end: { line: 8, offset: 6 } }, - parent: { - textSpan: { // SyntaxList + whitespace (body of class) - start: { line: 2, offset: 12 }, - end: { line: 9, offset: 1 } }, - parent: { - textSpan: { // ClassDeclaration - start: { line: 2, offset: 1 }, - end: { line: 9, offset: 2 } }, - parent: { - textSpan: { // SourceFile (all text) - start: { line: 1, offset: 1 }, - end: { line: 9, offset: 2 }, } } } } } } }; - - assert.deepEqual(locations, [ - { - textSpan: { // a + textSpan: { // a === b start: { line: 4, offset: 13 }, - end: { line: 4, offset: 14 } }, + end: { line: 4, offset: 20 } }, parent: { - textSpan: { // a === b - start: { line: 4, offset: 13 }, - end: { line: 4, offset: 20 } }, - parent: ifStatementUp } }, - { - textSpan: { // true - start: { line: 5, offset: 20 }, - end: { line: 5, offset: 24 } }, - parent: { - textSpan: { // return true; - start: { line: 5, offset: 13 }, - end: { line: 5, offset: 25 } }, + textSpan: { // IfStatement + start: { line: 4, offset: 9 }, + end: { line: 6, offset: 10 } }, parent: { - textSpan: { // SyntaxList + whitespace (body of IfStatement) - start: { line: 4, offset: 23 }, - end: { line: 6, offset: 9 } }, - parent: ifStatementUp } } } - ]); - }); - - it("works for simple TypeScript", () => { - const getSmartSelectionRange = setup("/file.ts", ` -export interface IService { - _serviceBrand: any; - - open(host: number, data: any): Promise; - bar(): void -}`); - const locations = getSmartSelectionRange([ - { line: 5, offset: 12 }, // ho/**/st - { line: 6, offset: 16 }, // void/**/ - ]); - - assert.deepEqual(locations![0], { - textSpan: { // host - start: { line: 5, offset: 10 }, - end: { line: 5, offset: 14 } }, - parent: { - textSpan: { // host: number - start: { line: 5, offset: 10 }, - end: { line: 5, offset: 22 } }, - parent: { - textSpan: { // host: number, data: any - start: { line: 5, offset: 10 }, - end: { line: 5, offset: 33 } }, - parent: { - textSpan: { // open(host: number, data: any): Promise; - start: { line: 5, offset: 5 }, - end: { line: 5, offset: 49 } }, + textSpan: { // SyntaxList + whitespace (body of method) + start: { line: 3, offset: 16 }, + end: { line: 8, offset: 5 } }, parent: { - textSpan: { // SyntaxList + whitespace (body of interface) - start: { line: 2, offset: 28 }, - end: { line: 7, offset: 1 } }, + textSpan: { // MethodDeclaration + start: { line: 3, offset: 5 }, + end: { line: 8, offset: 6 } }, parent: { - textSpan: { // InterfaceDeclaration - start: { line: 2, offset: 1 }, - end: { line: 7, offset: 2 } }, + textSpan: { // SyntaxList + whitespace (body of class) + start: { line: 2, offset: 12 }, + end: { line: 9, offset: 1 } }, parent: { - textSpan: { // SourceFile - start: { line: 1, offset: 1 }, - end: { line: 7, offset: 2 } } } } } } } } }); - - // Ensures positions after a zero-width node work, because ts.positionBelongsToNode - // treats them strangely. - assert.deepEqual(locations![1].textSpan, { // void - start: { line: 6, offset: 12 }, - end: { line: 6, offset: 16 }}); - }); - - it("works for complex TypeScript", () => { - const getSmartSelectionRange = setup("/file.ts", ` -type X = IsExactlyAny

extends true ? T : ({ [K in keyof P]: IsExactlyAny extends true ? K extends keyof T ? T[K] : P[K] : P[K]; } & Pick>) -`); - const locations = getSmartSelectionRange([ - { - line: 2, - offset: 133, - }, - ]); - - assert.deepEqual(locations, [ - { - textSpan: { // K - start: { line: 2, offset: 133 }, - end: { line: 2, offset: 134 } }, - parent: { - textSpan: { // P[K] - start: { line: 2, offset: 131 }, - end: { line: 2, offset: 135 } }, - parent: { - textSpan: { // K extends keyof T ? T[K] : P[K] - start: { line: 2, offset: 104 }, - end: { line: 2, offset: 135 } }, - parent: { - textSpan: { // IsExactlyAny extends true ? K extends keyof T ? T[K] : P[K] : P[K] - start: { line: 2, offset: 70 }, - end: { line: 2, offset: 142 } }, - parent: { - textSpan: { // [K in keyof P]: IsExactlyAny extends true ? K extends keyof T ? T[K] : P[K] : P[K]; - start: { line: 2, offset: 54 }, - end: { line: 2, offset: 143 } }, - parent: { - textSpan: { // MappedType: same as above + braces - start: { line: 2, offset: 52 }, - end: { line: 2, offset: 145 } }, - parent: { - textSpan: { // IntersectionType: { [K in keyof P]: ... } & Pick> - start: { line: 2, offset: 52 }, - end: { line: 2, offset: 182 } }, - parent: { - textSpan: { // same as above + parens - start: { line: 2, offset: 51 }, - end: { line: 2, offset: 183 } }, - parent: { - textSpan: { // Whole TypeNode of TypeAliasDeclaration - start: { line: 2, offset: 16 }, - end: { line: 2, offset: 183 } }, - parent: { - textSpan: { // Whole TypeAliasDeclaration - start: { line: 2, offset: 1 }, - end: { line: 2, offset: 183 } }, - parent: { - textSpan: { // SourceFile - start: { line: 1, offset: 1 }, - end: { line: 2, offset: 184 } } } } } } } } } } } } }, - ]); - }); - - it("works for object types", () => { - const getSmartSelectionRange = setup("/file.js", ` -type X = { - foo?: string; - readonly bar: { x: number }; - meh -}`); - const locations = getSmartSelectionRange([ - { line: 3, offset: 5 }, - { line: 4, offset: 5 }, - { line: 4, offset: 14 }, - { line: 4, offset: 27 }, - { line: 5, offset: 5 }, - ]); - - const allMembersUp: protocol.SelectionRange = { - textSpan: { // all members + whitespace (just inside braces) - start: { line: 2, offset: 11 }, - end: { line: 6, offset: 1 } }, - parent: { - textSpan: { // add braces - start: { line: 2, offset: 10 }, - end: { line: 6, offset: 2 } }, - parent: { - textSpan: { // whole TypeAliasDeclaration - start: { line: 2, offset: 1 }, - end: { line: 6, offset: 2 } }, - parent: { - textSpan: { // SourceFile - start: { line: 1, offset: 1 }, - end: { line: 6, offset: 2 } } } } } }; - - const readonlyBarUp: protocol.SelectionRange = { - textSpan: { // readonly bar - start: { line: 4, offset: 5 }, - end: { line: 4, offset: 17 } }, - parent: { - textSpan: { // readonly bar: { x: number }; - start: { line: 4, offset: 5 }, - end: { line: 4, offset: 33 } }, - parent: allMembersUp } }; - - assert.deepEqual(locations![0], { - textSpan: { // foo - start: { line: 3, offset: 5 }, - end: { line: 3, offset: 8 } }, - parent: { - textSpan: { // foo? - start: { line: 3, offset: 5 }, - end: { line: 3, offset: 9 } }, - parent: { - textSpan: { // foo?: string; - start: { line: 3, offset: 5 }, - end: { line: 3, offset: 18 } }, - parent: allMembersUp } } }); - - assert.deepEqual(locations![1], { - textSpan: { // readonly - start: { line: 4, offset: 5 }, - end: { line: 4, offset: 13 } }, - parent: readonlyBarUp }); - - assert.deepEqual(locations![2], { - textSpan: { // bar - start: { line: 4, offset: 14 }, - end: { line: 4, offset: 17 } }, - parent: readonlyBarUp }); - - assert.deepEqual(locations![3], { - textSpan: { // number - start: { line: 4, offset: 24 }, - end: { line: 4, offset: 30 } }, - parent: { - textSpan: { // x: number - start: { line: 4, offset: 21 }, - end: { line: 4, offset: 30 } }, - parent: { - textSpan: { // { x: number } - start: { line: 4, offset: 19 }, - end: { line: 4, offset: 32 } }, - parent: readonlyBarUp.parent } } }); - - assert.deepEqual(locations![4], { - textSpan: { // meh - start: { line: 5, offset: 5 }, - end: { line: 5, offset: 8 } }, - parent: allMembersUp }); - }); - - it("works for string literals and template strings", () => { - // tslint:disable-next-line:no-invalid-template-strings - const getSmartSelectionRange = setup("/file.ts", "`a b ${\n 'c'\n} d`"); - const locations = getSmartSelectionRange([ - { line: 2, offset: 4 }, - { line: 1, offset: 4 }, - ]); - assert.deepEqual(locations, [ - { - textSpan: { // c - start: { line: 2, offset: 4 }, - end: { line: 2, offset: 5 } }, - parent: { - textSpan: { // 'c' - start: { line: 2, offset: 3 }, - end: { line: 2, offset: 6 } }, - // parent: { - // textSpan: { // just inside braces - // start: { line: 1, offset: 8 }, - // end: { line: 3, offset: 1 } }, - parent: { - textSpan: { // whole TemplateSpan: ${ ... } - start: { line: 1, offset: 6 }, - end: { line: 3, offset: 2 } }, - parent: { - textSpan: { // whole template string without backticks - start: { line: 1, offset: 2 }, - end: { line: 3, offset: 4 } }, - parent: { - textSpan: { // whole template string - start: { line: 1, offset: 1 }, - end: { line: 3, offset: 5 } } } } } } }, - { - textSpan: { // whole template string without backticks - start: { line: 1, offset: 2 }, - end: { line: 3, offset: 4 } }, - parent: { - textSpan: { // whole template string - start: { line: 1, offset: 1 }, - end: { line: 3, offset: 5 } } } }, - ]); - }); - - it("works for ES2015 import lists", () => { - const getSmartSelectionRange = setup("/file.ts", ` -import { x as y, z } from './z'; -import { b } from './'; - -console.log(1);`); - - const locations = getSmartSelectionRange([{ line: 2, offset: 10 }]); - assert.deepEqual(locations, [ - { - textSpan: { // x - start: { line: 2, offset: 10 }, - end: { line: 2, offset: 11 } }, - parent: { - textSpan: { // x as y - start: { line: 2, offset: 10 }, - end: { line: 2, offset: 16 } }, - parent: { - textSpan: { // x as y, z - start: { line: 2, offset: 10 }, - end: { line: 2, offset: 19 } }, - parent: { - textSpan: { // { x as y, z } - start: { line: 2, offset: 8 }, - end: { line: 2, offset: 21 } }, - parent: { - textSpan: { // import { x as y, z } from './z'; - start: { line: 2, offset: 1 }, - end: { line: 2, offset: 33 } }, - parent: { - textSpan: { // all imports + textSpan: { // ClassDeclaration start: { line: 2, offset: 1 }, - end: { line: 3, offset: 24 } }, + end: { line: 9, offset: 2 } }, parent: { - textSpan: { // SourceFile + textSpan: { // SourceFile (all text) start: { line: 1, offset: 1 }, - end: { line: 5, offset: 16 } } } } } } } } } - ]); - }); - - it("works for complex mapped types", () => { - const getSmartSelectionRange = setup("/file.ts", ` -type M = { -readonly [K in keyof any]-?: any };`); - - const locations = getSmartSelectionRange([ - { line: 2, offset: 12 }, // -readonly - { line: 2, offset: 14 }, // eadonly - { line: 2, offset: 22 }, // [ - { line: 2, offset: 30 }, // yof any - { line: 2, offset: 38 }, // -? - { line: 2, offset: 39 }, // ? - ]); - - const leftOfColonUp: protocol.SelectionRange = { - textSpan: { // -readonly [K in keyof any]-? - start: { line: 2, offset: 12 }, - end: { line: 2, offset: 40 } }, - parent: { - textSpan: { // -readonly [K in keyof any]-?: any - start: { line: 2, offset: 12 }, - end: { line: 2, offset: 45 } }, - parent: { - textSpan: { // { -readonly [K in keyof any]-?: any } - start: { line: 2, offset: 10 }, - end: { line: 2, offset: 47 } }, - parent: { - textSpan: { // whole line - start: { line: 2, offset: 1 }, - end: { line: 2, offset: 48 } }, - parent: { - textSpan: { // SourceFile - start: { line: 1, offset: 1 }, - end: { line: 2, offset: 48 } } } } } } }; - - assert.deepEqual(locations![0], { - textSpan: { // - (in -readonly) - start: { line: 2, offset: 12 }, - end: { line: 2, offset: 13 } }, - parent: { - textSpan: { // -readonly - start: { line: 2, offset: 12 }, - end: { line: 2, offset: 21 } }, - parent: leftOfColonUp }, - }); - - assert.deepEqual(locations![1], { - textSpan: { // readonly - start: { line: 2, offset: 13 }, - end: { line: 2, offset: 21 } }, - parent: { - textSpan: { // -readonly - start: { line: 2, offset: 12 }, - end: { line: 2, offset: 21 } }, - parent: leftOfColonUp }, - }); - - assert.deepEqual(locations![2], { - textSpan: { // [ - start: { line: 2, offset: 22 }, - end: { line: 2, offset: 23 } }, - parent: { - textSpan: { // [K in keyof any] - start: { line: 2, offset: 22 }, - end: { line: 2, offset: 38 } }, - parent: leftOfColonUp } - }); - - assert.deepEqual(locations![3], { - textSpan: { // keyof - start: { line: 2, offset: 28 }, - end: { line: 2, offset: 33 } }, - parent: { - textSpan: { // keyof any - start: { line: 2, offset: 28 }, - end: { line: 2, offset: 37 } }, - parent: { - textSpan: { // K in keyof any - start: { line: 2, offset: 23 }, - end: { line: 2, offset: 37 } }, - parent: { - textSpan: { // [K in keyof any] - start: { line: 2, offset: 22 }, - end: { line: 2, offset: 38 } }, - parent: leftOfColonUp } } }, - }); - - assert.deepEqual(locations![4], { - textSpan: { // - (in -?) - start: { line: 2, offset: 38 }, - end: { line: 2, offset: 39 } }, - parent: { - textSpan: { // -? - start: { line: 2, offset: 38 }, - end: { line: 2, offset: 40 } }, - parent: leftOfColonUp }, - }); - - assert.deepEqual(locations![5], { - textSpan: { // ? - start: { line: 2, offset: 39 }, - end: { line: 2, offset: 40 } }, - parent: { - textSpan: { // -? - start: { line: 2, offset: 38 }, - end: { line: 2, offset: 40 } }, - parent: leftOfColonUp }, - }); - }); - - it("works for parameters", () => { - const getSmartSelectionRange = setup("/file.ts", ` -function f(p, q?, ...r: any[] = []) {}`); - - const locations = getSmartSelectionRange([ - { line: 2, offset: 12 }, // p - { line: 2, offset: 15 }, // q - { line: 2, offset: 19 }, // ... - ]); - - const allParamsUp: protocol.SelectionRange = { - textSpan: { // just inside parens - start: { line: 2, offset: 12 }, - end: { line: 2, offset: 35 } }, - parent: { - textSpan: { - start: { line: 2, offset: 1 }, - end: { line: 2, offset: 39 } }, - parent: { - textSpan: { - start: { line: 1, offset: 1 }, - end: { line: 2, offset: 39 } } } } }; - - assert.deepEqual(locations![0], { - textSpan: { // p - start: { line: 2, offset: 12 }, - end: { line: 2, offset: 13 } }, - parent: allParamsUp, - }); - - assert.deepEqual(locations![1], { - textSpan: { // q - start: { line: 2, offset: 15 }, - end: { line: 2, offset: 16 } }, - parent: { - textSpan: { // q? - start: { line: 2, offset: 15 }, - end: { line: 2, offset: 17 } }, - parent: allParamsUp }, - }); - - assert.deepEqual(locations![2], { - textSpan: { // ... - start: { line: 2, offset: 19 }, - end: { line: 2, offset: 22 } }, - parent: { - textSpan: { // ...r - start: { line: 2, offset: 19 }, - end: { line: 2, offset: 23 } }, - parent: { - textSpan: { // ...r: any[] - start: { line: 2, offset: 19 }, - end: { line: 2, offset: 30 } }, - parent: { - textSpan: { // ...r: any[] = [] - start: { line: 2, offset: 19 }, - end: { line: 2, offset: 35 } }, - parent: allParamsUp } } }, - }); - }); - - it("works for binding elements", () => { - const getSmartSelectionRange = setup("/file.ts", ` -const { x, y: a, ...zs = {} } = {};`); - const locations = getSmartSelectionRange([ - { line: 2, offset: 9 }, // x - { line: 2, offset: 15 }, // a - { line: 2, offset: 21 }, // zs - ]); - - // Don’t care about checking first two locations, because - // they’re pretty boring, just want to make sure they don’t cause a crash - assert.deepEqual(locations![2], { - textSpan: { // zs - start: { line: 2, offset: 21 }, - end: { line: 2, offset: 23 } }, - parent: { - textSpan: { // ...zs - start: { line: 2, offset: 18 }, - end: { line: 2, offset: 23 } }, - parent: { - textSpan: { // ...zs = {} - start: { line: 2, offset: 18 }, - end: { line: 2, offset: 28 } }, - parent: { - textSpan: { // x, y: a, ...zs = {} - start: { line: 2, offset: 9 }, - end: { line: 2, offset: 28 } }, - parent: { - textSpan: { // { x, y: a, ...zs = {} } - start: { line: 2, offset: 7 }, - end: { line: 2, offset: 30 } }, - parent: { - textSpan: { // whole line - start: { line: 2, offset: 1 }, - end: { line: 2, offset: 36 } }, - parent: { - textSpan: { - start: { line: 1, offset: 1 }, - end: { line: 2, offset: 36 } } } } } } } } }); - }); - - it("consumes all whitespace in a multi-line function parameter list", () => { - const getSmartSelectionRange = setup("/file.ts", ` -function f( - a, - b -) {}`); - const locations = getSmartSelectionRange([{ line: 4, offset: 5 }]); // b - assert.deepEqual(locations, [{ - textSpan: { // b - start: { line: 4, offset: 5 }, - end: { line: 4, offset: 6 } }, - parent: { // all params and whitespace inside parens - textSpan: { - start: { line: 2, offset: 12 }, - end: { line: 5, offset: 1 } }, - parent: { - textSpan: { // whole function declaration - start: { line: 2, offset: 1 }, - end: { line: 5, offset: 5 } }, - parent: { - textSpan: { // SourceFile - start: { line: 1, offset: 1 }, - end: { line: 5, offset: 5 } } } } } - }]); - }); - - it("snaps to nodes directly behind the cursor instead of trivia ahead of the cursor", () => { - const getSmartSelectionRange = setup("/file.ts", `let x: string`); - const locations = getSmartSelectionRange([{ line: 1, offset: 4 }]); - assert.deepEqual(locations![0].textSpan, { - start: { line: 1, offset: 1 }, - end: { line: 1, offset: 4 }, - }); - }); - - it("creates a stop for JSDoc ranges", () => { - const getSmartSelectionRange = setup("/file.js", "" + -`// Not a JSDoc comment -/** - * @param {number} x The number to square - */ -function square(x) { - return x * x; -}`); - const locations = getSmartSelectionRange([{ line: 5, offset: 10 }]); // square(x) - assert.deepEqual(locations, [{ - textSpan: { // square - start: { line: 5 , offset: 10 }, - end: { line: 5, offset: 16 } }, - parent: { // whole function declaration - textSpan: { - start: { line: 5, offset: 1 }, - end: { line: 7, offset: 2 } }, - parent: { - textSpan: { // add JSDoc - start: { line: 2, offset: 1 }, - end: { line: 7, offset: 2 } }, - parent: { - textSpan: { // SourceFile - start: { line: 1, offset: 1 }, - end: { line: 7, offset: 2 } } } } } }]); - }); - - it("skips lone VariableDeclarations in a declaration list", () => { - const getSmartSelectionRange = setup("/file.ts", `const x = 3;`); - const locations = getSmartSelectionRange([{ line: 1, offset: 7 }]); // x - assert.deepEqual(locations, [{ - textSpan: { - start: { line: 1, offset: 7 }, - end: { line: 1, offset: 8 } }, - parent: { - textSpan: { - start: { line: 1, offset: 1 }, - end: { line: 1, offset: 13 } } } }]); - }); - - it("never returns empty ranges", () => { - const getSmartSelectionRange = setup("/file.ts", ` -class HomePage { - componentDidMount() { - if (this.props.username) { - return ''; - } - } -}`); - const locations = getSmartSelectionRange([ - { line: 3, offset: 23 }, // componentDidMount(/**/) - { line: 4, offset: 32 }, // username/**/) - { line: 5, offset: 21 }, // return '/**/' - ]); - - assert.deepEqual(locations![0].textSpan, { // this.props.username - start: { line: 3, offset: 23 }, - end: { line: 3, offset: 24 }, - }); - - assert.deepEqual(locations![1].textSpan, { // this.props.username - start: { line: 4, offset: 32 }, - end: { line: 4, offset: 33 }, - }); - - assert.deepEqual(locations![2].textSpan, { // '' - start: { line: 5, offset: 20 }, - end: { line: 5, offset: 22 }, - }); + end: { line: 9, offset: 2 }, } } } } } } } } }]); }); }); } From eff39600207df4817b3dceb7848bf858c86f4ca3 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 24 Apr 2019 08:52:07 -0700 Subject: [PATCH 026/384] Fix baseline file name changes --- src/harness/fourslash.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 66ea1ba38c4..0dea2b1e7b0 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1417,7 +1417,7 @@ Actual: ${stringify(fullActual)}`); } public baselineCurrentFileBreakpointLocations() { - const baselineFile = this.getBaselineFileName().replace(this.basePath + "/breakpointValidation", "bpSpan"); + const baselineFile = this.getBaselineFileName().replace("breakpointValidation", "bpSpan"); Harness.Baseline.runBaseline(baselineFile, this.baselineCurrentFileLocations(pos => this.getBreakpointStatementLocation(pos)!)); } From 5443447eb2efa1dd48b2fc52824ceeb0ff5164a5 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 14:42:59 -0700 Subject: [PATCH 027/384] Instead of maintaining queue for invalidated projects, use the pendingSet and graph queue --- src/compiler/tsbuild.ts | 70 ++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 8bc66e95edc..41031d34fc7 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -411,8 +411,6 @@ namespace ts { const diagnostics = createFileMap>(toPath); const projectPendingBuild = createFileMap(toPath); const projectErrorsReported = createFileMap(toPath); - const invalidatedProjectQueue = [] as ResolvedConfigFileName[]; - let nextProjectToBuild = 0; let timerToBuildInvalidatedProject: any; let reportFileChangeDetected = false; const { watchFile, watchFilePath, watchDirectory, writeLog } = createWatchFactory(host, options); @@ -456,8 +454,6 @@ namespace ts { diagnostics.clear(); projectPendingBuild.clear(); projectErrorsReported.clear(); - invalidatedProjectQueue.length = 0; - nextProjectToBuild = 0; if (timerToBuildInvalidatedProject) { clearTimeout(timerToBuildInvalidatedProject); timerToBuildInvalidatedProject = undefined; @@ -498,8 +494,8 @@ namespace ts { } function startWatching() { - const graph = getGlobalDependencyGraph(); - for (const resolved of graph.buildQueue) { + const { buildQueue } = getGlobalDependencyGraph(); + for (const resolved of buildQueue) { // Watch this file watchConfigFile(resolved); @@ -855,10 +851,10 @@ namespace ts { } function invalidateProject(configFileName: string, reloadLevel?: ConfigFileProgramReloadLevel) { - invalidateResolvedProject(resolveProjectName(configFileName), reloadLevel); + invalidateResolvedProject(resolveProjectName(configFileName), reloadLevel || ConfigFileProgramReloadLevel.None); } - function invalidateResolvedProject(resolved: ResolvedConfigFileName, reloadLevel?: ConfigFileProgramReloadLevel) { + function invalidateResolvedProject(resolved: ResolvedConfigFileName, reloadLevel: ConfigFileProgramReloadLevel) { if (reloadLevel === ConfigFileProgramReloadLevel.Full) { configFileCache.removeKey(resolved); globalDependencyGraph = undefined; @@ -872,28 +868,24 @@ namespace ts { /** * return true if new addition */ - function addProjToQueue(proj: ResolvedConfigFileName, reloadLevel?: ConfigFileProgramReloadLevel) { + function addProjToQueue(proj: ResolvedConfigFileName, reloadLevel: ConfigFileProgramReloadLevel) { const value = projectPendingBuild.getValue(proj); if (value === undefined) { - projectPendingBuild.setValue(proj, reloadLevel || ConfigFileProgramReloadLevel.None); - invalidatedProjectQueue.push(proj); + projectPendingBuild.setValue(proj, reloadLevel); } - else if (value < (reloadLevel || ConfigFileProgramReloadLevel.None)) { - projectPendingBuild.setValue(proj, reloadLevel || ConfigFileProgramReloadLevel.None); + else if (value < reloadLevel) { + projectPendingBuild.setValue(proj, reloadLevel); } } function getNextInvalidatedProject() { - if (nextProjectToBuild < invalidatedProjectQueue.length) { - const project = invalidatedProjectQueue[nextProjectToBuild]; - nextProjectToBuild++; - const reloadLevel = projectPendingBuild.getValue(project)!; - projectPendingBuild.removeKey(project); - if (!projectPendingBuild.getSize()) { - invalidatedProjectQueue.length = 0; - nextProjectToBuild = 0; + const { buildQueue } = getGlobalDependencyGraph(); + for (const project of buildQueue) { + const reloadLevel = projectPendingBuild.getValue(project); + if (reloadLevel !== undefined) { + projectPendingBuild.removeKey(project); + return { project, reloadLevel }; } - return { project, reloadLevel }; } } @@ -990,15 +982,20 @@ namespace ts { updateBundle(resolved); // Fake that files have been built by manipulating prepend and existing output if (buildResult & BuildResultFlags.AnyErrors) return; - const { referencingProjectsMap, buildQueue } = getGlobalDependencyGraph(); - const referencingProjects = referencingProjectsMap.getValue(resolved); - if (!referencingProjects) return; + // Only composite projects can be referenced by other projects + if (!proj.options.composite) return; + const { buildQueue } = getGlobalDependencyGraph(); // Always use build order to queue projects for (let index = buildQueue.indexOf(resolved) + 1; index < buildQueue.length; index++) { const project = buildQueue[index]; - const prepend = referencingProjects.getValue(project); - if (prepend !== undefined) { + if (projectPendingBuild.hasKey(project)) continue; + + const config = parseConfigFile(project); + if (!config || !config.projectReferences) continue; + for (const ref of config.projectReferences) { + const resolvedRefPath = resolveProjectName(ref.path); + if (resolvedRefPath !== resolved) continue; // If the project is referenced with prepend, always build downstream projects, // If declaration output is changed, build the project // otherwise mark the project UpToDateWithUpstreamTypes so it updates output time stamps @@ -1013,7 +1010,7 @@ namespace ts { } } else if (status && status.type === UpToDateStatusType.UpToDate) { - if (prepend) { + if (ref.prepend) { projectStatus.setValue(project, { type: UpToDateStatusType.OutOfDateWithPrepend, outOfDateOutputFileName: status.oldestOutputFileName, @@ -1024,7 +1021,8 @@ namespace ts { status.type = UpToDateStatusType.UpToDateWithUpstreamTypes; } } - addProjToQueue(project); + addProjToQueue(project, ConfigFileProgramReloadLevel.None); + break; } } } @@ -1341,9 +1339,9 @@ namespace ts { function getFilesToClean(): string[] { // Get the same graph for cleaning we'd use for building - const graph = getGlobalDependencyGraph(); + const { buildQueue } = getGlobalDependencyGraph(); const filesToDelete: string[] = []; - for (const proj of graph.buildQueue) { + for (const proj of buildQueue) { const parsed = parseConfigFile(proj); if (parsed === undefined) { // File has gone missing; fine to ignore here @@ -1403,10 +1401,10 @@ namespace ts { loadWithLocalCache(Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader); } - const graph = getGlobalDependencyGraph(); - reportBuildQueue(graph); + const { buildQueue } = getGlobalDependencyGraph(); + reportBuildQueue(buildQueue); let anyFailed = false; - for (const next of graph.buildQueue) { + for (const next of buildQueue) { const proj = parseConfigFile(next); if (proj === undefined) { reportParseConfigFileDiagnostic(next); @@ -1494,9 +1492,9 @@ namespace ts { /** * Report the build ordering inferred from the current project graph if we're in verbose mode */ - function reportBuildQueue(graph: DependencyGraph) { + function reportBuildQueue(buildQueue: readonly ResolvedConfigFileName[]) { if (options.verbose) { - reportStatus(Diagnostics.Projects_in_this_build_Colon_0, graph.buildQueue.map(s => "\r\n * " + relName(s)).join("")); + reportStatus(Diagnostics.Projects_in_this_build_Colon_0, buildQueue.map(s => "\r\n * " + relName(s)).join("")); } } From 1de70de09917f18248eafa920405ed4d196e712b Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 15:31:09 -0700 Subject: [PATCH 028/384] No need to calculate and store project references graph --- src/compiler/tsbuild.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 41031d34fc7..81d382a4c6d 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -13,8 +13,6 @@ namespace ts { interface DependencyGraph { buildQueue: ResolvedConfigFileName[]; - /** value in config File map is true if project is referenced using prepend */ - referencingProjectsMap: ConfigFileMap>; } export interface BuildOptions extends OptionsBase { @@ -1032,14 +1030,12 @@ namespace ts { const permanentMarks = createFileMap(toPath); const circularityReportStack: string[] = []; const buildOrder: ResolvedConfigFileName[] = []; - const referencingProjectsMap = createFileMap>(toPath); for (const root of roots) { visit(root); } return { buildQueue: buildOrder, - referencingProjectsMap }; function visit(projPath: ResolvedConfigFileName, inCircularContext?: boolean) { @@ -1061,9 +1057,6 @@ namespace ts { for (const ref of parsed.projectReferences) { const resolvedRefPath = resolveProjectName(ref.path); visit(resolvedRefPath, inCircularContext || ref.circular); - // Get projects referencing resolvedRefPath and add projPath to it - const referencingProjects = getOrCreateValueFromConfigFileMap(referencingProjectsMap, resolvedRefPath, () => createFileMap(toPath)); - referencingProjects.setValue(projPath, !!ref.prepend); } } From b9eeaab050f9b491b2446cf08cc3a91638592554 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 15:32:22 -0700 Subject: [PATCH 029/384] Remove unused variable --- src/compiler/tsbuild.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 81d382a4c6d..12a1436ec63 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -390,7 +390,6 @@ namespace ts { const unchangedOutputs = createFileMap(toPath as ToPath); /** Map from config file name to up-to-date status */ const projectStatus = createFileMap(toPath); - const missingRoots = createMap(); let globalDependencyGraph: DependencyGraph | undefined; const writeFileName = host.trace ? (s: string) => host.trace!(s) : undefined; let readFileWithCache = (f: string) => host.readFile(f); @@ -445,7 +444,6 @@ namespace ts { configFileCache.clear(); unchangedOutputs.clear(); projectStatus.clear(); - missingRoots.clear(); globalDependencyGraph = undefined; buildInfoChecked.clear(); From 3e77b96824b5a11b6f4b216f3016d5f2213129f3 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 15:45:45 -0700 Subject: [PATCH 030/384] Fix the graph ordering test case to check actual order and not just members as set --- src/testRunner/unittests/tsbuild/graphOrdering.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/testRunner/unittests/tsbuild/graphOrdering.ts b/src/testRunner/unittests/tsbuild/graphOrdering.ts index bc1af3f71da..bb29892bc61 100644 --- a/src/testRunner/unittests/tsbuild/graphOrdering.ts +++ b/src/testRunner/unittests/tsbuild/graphOrdering.ts @@ -22,19 +22,19 @@ namespace ts { }); it("orders the graph correctly - specify two roots", () => { - checkGraphOrdering(["A", "G"], ["A", "B", "C", "D", "E", "G"]); + checkGraphOrdering(["A", "G"], ["D", "E", "C", "B", "A", "G"]); }); it("orders the graph correctly - multiple parts of the same graph in various orders", () => { - checkGraphOrdering(["A"], ["A", "B", "C", "D", "E"]); - checkGraphOrdering(["A", "C", "D"], ["A", "B", "C", "D", "E"]); - checkGraphOrdering(["D", "C", "A"], ["A", "B", "C", "D", "E"]); + checkGraphOrdering(["A"], ["D", "E", "C", "B", "A"]); + checkGraphOrdering(["A", "C", "D"], ["D", "E", "C", "B", "A"]); + checkGraphOrdering(["D", "C", "A"], ["D", "E", "C", "B", "A"]); }); it("orders the graph correctly - other orderings", () => { - checkGraphOrdering(["F"], ["F", "E"]); + checkGraphOrdering(["F"], ["E", "F"]); checkGraphOrdering(["E"], ["E"]); - checkGraphOrdering(["F", "C", "A"], ["A", "B", "C", "D", "E", "F"]); + checkGraphOrdering(["F", "C", "A"], ["E", "F", "D", "C", "B", "A"]); }); function checkGraphOrdering(rootNames: string[], expectedBuildSet: string[]) { @@ -43,7 +43,7 @@ namespace ts { const projFileNames = rootNames.map(getProjectFileName); const graph = builder.getBuildGraph(projFileNames); - assert.sameMembers(graph.buildQueue, expectedBuildSet.map(getProjectFileName)); + assert.deepEqual(graph.buildQueue, expectedBuildSet.map(getProjectFileName)); for (const dep of deps) { const child = getProjectFileName(dep[0]); From 845f67a39413e2baea7b065086c9b59e47575ed5 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 15:39:25 -0700 Subject: [PATCH 031/384] Make api to return build order --- src/compiler/tsbuild.ts | 55 +++++++------------ .../unittests/tsbuild/graphOrdering.ts | 12 ++-- 2 files changed, 26 insertions(+), 41 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 12a1436ec63..f995b8d1b4d 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -11,10 +11,6 @@ namespace ts { message(diag: DiagnosticMessage, ...args: string[]): void; } - interface DependencyGraph { - buildQueue: ResolvedConfigFileName[]; - } - export interface BuildOptions extends OptionsBase { dry?: boolean; force?: boolean; @@ -313,7 +309,7 @@ namespace ts { // TODO:: All the below ones should technically only be in watch mode. but thats for later time /*@internal*/ resolveProjectName(name: string): ResolvedConfigFileName; /*@internal*/ getUpToDateStatusOfFile(configFileName: ResolvedConfigFileName): UpToDateStatus; - /*@internal*/ getBuildGraph(configFileNames: ReadonlyArray): DependencyGraph; + /*@internal*/ getBuildOrder(): ReadonlyArray; /*@internal*/ invalidateProject(configFileName: string, reloadLevel?: ConfigFileProgramReloadLevel): void; /*@internal*/ buildInvalidatedProject(): void; @@ -390,7 +386,7 @@ namespace ts { const unchangedOutputs = createFileMap(toPath as ToPath); /** Map from config file name to up-to-date status */ const projectStatus = createFileMap(toPath); - let globalDependencyGraph: DependencyGraph | undefined; + let buildOrder: readonly ResolvedConfigFileName[] | undefined; const writeFileName = host.trace ? (s: string) => host.trace!(s) : undefined; let readFileWithCache = (f: string) => host.readFile(f); let projectCompilerOptions = baseCompilerOptions; @@ -422,7 +418,7 @@ namespace ts { getUpToDateStatusOfFile, cleanAllProjects, resetBuildContext, - getBuildGraph, + getBuildOrder, invalidateProject, buildInvalidatedProject, @@ -444,7 +440,7 @@ namespace ts { configFileCache.clear(); unchangedOutputs.clear(); projectStatus.clear(); - globalDependencyGraph = undefined; + buildOrder = undefined; buildInfoChecked.clear(); diagnostics.clear(); @@ -490,8 +486,7 @@ namespace ts { } function startWatching() { - const { buildQueue } = getGlobalDependencyGraph(); - for (const resolved of buildQueue) { + for (const resolved of getBuildOrder()) { // Watch this file watchConfigFile(resolved); @@ -615,12 +610,8 @@ namespace ts { return getUpToDateStatus(parseConfigFile(configFileName)); } - function getBuildGraph(configFileNames: ReadonlyArray) { - return createDependencyGraph(resolveProjectNames(configFileNames)); - } - - function getGlobalDependencyGraph() { - return globalDependencyGraph || (globalDependencyGraph = getBuildGraph(rootNames)); + function getBuildOrder() { + return buildOrder || (buildOrder = createBuildOrder(resolveProjectNames(rootNames))); } function getUpToDateStatus(project: ParsedCommandLine | undefined): UpToDateStatus { @@ -853,7 +844,7 @@ namespace ts { function invalidateResolvedProject(resolved: ResolvedConfigFileName, reloadLevel: ConfigFileProgramReloadLevel) { if (reloadLevel === ConfigFileProgramReloadLevel.Full) { configFileCache.removeKey(resolved); - globalDependencyGraph = undefined; + buildOrder = undefined; } projectStatus.removeKey(resolved); diagnostics.removeKey(resolved); @@ -875,8 +866,7 @@ namespace ts { } function getNextInvalidatedProject() { - const { buildQueue } = getGlobalDependencyGraph(); - for (const project of buildQueue) { + for (const project of getBuildOrder()) { const reloadLevel = projectPendingBuild.getValue(project); if (reloadLevel !== undefined) { projectPendingBuild.removeKey(project); @@ -923,7 +913,7 @@ namespace ts { function reportErrorSummary() { if (options.watch || (host as SolutionBuilderHost).reportErrorSummary) { // Report errors from the other projects - getGlobalDependencyGraph().buildQueue.forEach(project => { + getBuildOrder().forEach(project => { if (!projectErrorsReported.hasKey(project)) { reportErrors(diagnostics.getValue(project) || emptyArray); } @@ -980,11 +970,11 @@ namespace ts { // Only composite projects can be referenced by other projects if (!proj.options.composite) return; - const { buildQueue } = getGlobalDependencyGraph(); + const buildOrder = getBuildOrder(); // Always use build order to queue projects - for (let index = buildQueue.indexOf(resolved) + 1; index < buildQueue.length; index++) { - const project = buildQueue[index]; + for (let index = buildOrder.indexOf(resolved) + 1; index < buildOrder.length; index++) { + const project = buildOrder[index]; if (projectPendingBuild.hasKey(project)) continue; const config = parseConfigFile(project); @@ -1023,18 +1013,16 @@ namespace ts { } } - function createDependencyGraph(roots: ResolvedConfigFileName[]): DependencyGraph { + function createBuildOrder(roots: ResolvedConfigFileName[]): readonly ResolvedConfigFileName[] { const temporaryMarks = createFileMap(toPath); const permanentMarks = createFileMap(toPath); const circularityReportStack: string[] = []; - const buildOrder: ResolvedConfigFileName[] = []; + let buildOrder: ResolvedConfigFileName[] | undefined; for (const root of roots) { visit(root); } - return { - buildQueue: buildOrder, - }; + return buildOrder || emptyArray; function visit(projPath: ResolvedConfigFileName, inCircularContext?: boolean) { // Already visited @@ -1060,7 +1048,7 @@ namespace ts { circularityReportStack.pop(); permanentMarks.setValue(projPath, true); - buildOrder.push(projPath); + (buildOrder || (buildOrder = [])).push(projPath); } } @@ -1330,9 +1318,8 @@ namespace ts { function getFilesToClean(): string[] { // Get the same graph for cleaning we'd use for building - const { buildQueue } = getGlobalDependencyGraph(); const filesToDelete: string[] = []; - for (const proj of buildQueue) { + for (const proj of getBuildOrder()) { const parsed = parseConfigFile(proj); if (parsed === undefined) { // File has gone missing; fine to ignore here @@ -1392,10 +1379,10 @@ namespace ts { loadWithLocalCache(Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader); } - const { buildQueue } = getGlobalDependencyGraph(); - reportBuildQueue(buildQueue); + const buildOrder = getBuildOrder(); + reportBuildQueue(buildOrder); let anyFailed = false; - for (const next of buildQueue) { + for (const next of buildOrder) { const proj = parseConfigFile(next); if (proj === undefined) { reportParseConfigFileDiagnostic(next); diff --git a/src/testRunner/unittests/tsbuild/graphOrdering.ts b/src/testRunner/unittests/tsbuild/graphOrdering.ts index bb29892bc61..a8f4c3a57a9 100644 --- a/src/testRunner/unittests/tsbuild/graphOrdering.ts +++ b/src/testRunner/unittests/tsbuild/graphOrdering.ts @@ -38,18 +38,16 @@ namespace ts { }); function checkGraphOrdering(rootNames: string[], expectedBuildSet: string[]) { - const builder = createSolutionBuilder(host!, rootNames, { dry: true, force: false, verbose: false }); + const builder = createSolutionBuilder(host!, rootNames.map(getProjectFileName), { dry: true, force: false, verbose: false }); + const buildQueue = builder.getBuildOrder(); - const projFileNames = rootNames.map(getProjectFileName); - const graph = builder.getBuildGraph(projFileNames); - - assert.deepEqual(graph.buildQueue, expectedBuildSet.map(getProjectFileName)); + assert.deepEqual(buildQueue, expectedBuildSet.map(getProjectFileName)); for (const dep of deps) { const child = getProjectFileName(dep[0]); - if (graph.buildQueue.indexOf(child) < 0) continue; + if (buildQueue.indexOf(child) < 0) continue; const parent = getProjectFileName(dep[1]); - assert.isAbove(graph.buildQueue.indexOf(child), graph.buildQueue.indexOf(parent), `Expecting child ${child} to be built after parent ${parent}`); + assert.isAbove(buildQueue.indexOf(child), buildQueue.indexOf(parent), `Expecting child ${child} to be built after parent ${parent}`); } } From e9d4e0b104307f8055f5e7023de821f1daaca9c1 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 16:04:43 -0700 Subject: [PATCH 032/384] Unchanged output time is no more required --- src/compiler/tsbuild.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index f995b8d1b4d..ede9354165d 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -382,8 +382,6 @@ namespace ts { let baseCompilerOptions = getCompilerOptionsOfBuildOptions(options); type ConfigFileCacheEntry = ParsedCommandLine | Diagnostic; const configFileCache = createFileMap(toPath); - /** Map from output file name to its pre-build timestamp */ - const unchangedOutputs = createFileMap(toPath as ToPath); /** Map from config file name to up-to-date status */ const projectStatus = createFileMap(toPath); let buildOrder: readonly ResolvedConfigFileName[] | undefined; @@ -438,7 +436,6 @@ namespace ts { options = opts; baseCompilerOptions = getCompilerOptionsOfBuildOptions(options); configFileCache.clear(); - unchangedOutputs.clear(); projectStatus.clear(); buildOrder = undefined; buildInfoChecked.clear(); @@ -697,14 +694,8 @@ namespace ts { // had its file touched but not had its contents changed - this allows us // to skip a downstream typecheck if (isDeclarationFile(output)) { - const unchangedTime = unchangedOutputs.getValue(output); - if (unchangedTime !== undefined) { - newestDeclarationFileContentChangedTime = newer(unchangedTime, newestDeclarationFileContentChangedTime); - } - else { - const outputModifiedTime = host.getModifiedTime(output) || missingFileModifiedTime; - newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime); - } + const outputModifiedTime = host.getModifiedTime(output) || missingFileModifiedTime; + newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime); } } @@ -1161,7 +1152,6 @@ namespace ts { writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); if (priorChangeTime !== undefined) { newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime); - unchangedOutputs.setValue(name, priorChangeTime); } }); From 92365027a1804c767b63b220b84c1dd350678c1e Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 16:22:13 -0700 Subject: [PATCH 033/384] Remove `getUpToDateStatusOfFile` from solution builder since that test anyways is tested with the --watch mode --- src/compiler/tsbuild.ts | 20 +++----- src/testRunner/unittests/tsbuild/sample.ts | 55 ---------------------- 2 files changed, 7 insertions(+), 68 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index ede9354165d..18eaeed188d 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -306,10 +306,13 @@ namespace ts { buildAllProjects(): ExitStatus; cleanAllProjects(): ExitStatus; + // Currently used for testing but can be made public if needed: + /*@internal*/ getBuildOrder(): ReadonlyArray; + + // Testing only + // TODO:: All the below ones should technically only be in watch mode. but thats for later time /*@internal*/ resolveProjectName(name: string): ResolvedConfigFileName; - /*@internal*/ getUpToDateStatusOfFile(configFileName: ResolvedConfigFileName): UpToDateStatus; - /*@internal*/ getBuildOrder(): ReadonlyArray; /*@internal*/ invalidateProject(configFileName: string, reloadLevel?: ConfigFileProgramReloadLevel): void; /*@internal*/ buildInvalidatedProject(): void; @@ -413,7 +416,6 @@ namespace ts { return { buildAllProjects, - getUpToDateStatusOfFile, cleanAllProjects, resetBuildContext, getBuildOrder, @@ -603,12 +605,8 @@ namespace ts { scheduleBuildInvalidatedProject(); } - function getUpToDateStatusOfFile(configFileName: ResolvedConfigFileName): UpToDateStatus { - return getUpToDateStatus(parseConfigFile(configFileName)); - } - function getBuildOrder() { - return buildOrder || (buildOrder = createBuildOrder(resolveProjectNames(rootNames))); + return buildOrder || (buildOrder = createBuildOrder(rootNames.map(resolveProjectName))); } function getUpToDateStatus(project: ParsedCommandLine | undefined): UpToDateStatus { @@ -1004,7 +1002,7 @@ namespace ts { } } - function createBuildOrder(roots: ResolvedConfigFileName[]): readonly ResolvedConfigFileName[] { + function createBuildOrder(roots: readonly ResolvedConfigFileName[]): readonly ResolvedConfigFileName[] { const temporaryMarks = createFileMap(toPath); const permanentMarks = createFileMap(toPath); const circularityReportStack: string[] = []; @@ -1344,10 +1342,6 @@ namespace ts { return resolveConfigFileProjectName(resolvePath(host.getCurrentDirectory(), name)); } - function resolveProjectNames(configFileNames: ReadonlyArray): ResolvedConfigFileName[] { - return configFileNames.map(resolveProjectName); - } - function buildAllProjects(): ExitStatus { if (options.watch) { reportWatchStatus(Diagnostics.Starting_compilation_in_watch_mode); } // TODO:: In watch mode as well to use caches for incremental build once we can invalidate caches correctly and have right api diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 6e31ada9ee5..2621bd303ea 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -337,61 +337,6 @@ namespace ts { }); }); - describe("project invalidation", () => { - it("invalidates projects correctly", () => { - const fs = projFs.shadow(); - const host = new fakes.SolutionBuilderHost(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); - - builder.buildAllProjects(); - host.assertDiagnosticMessages(/*empty*/); - - // Update a timestamp in the middle project - tick(); - appendText(fs, "/src/logic/index.ts", "function foo() {}"); - const originalWriteFile = fs.writeFileSync; - const writtenFiles = createMap(); - fs.writeFileSync = (path, data, encoding) => { - writtenFiles.set(path, true); - originalWriteFile.call(fs, path, data, encoding); - }; - // Because we haven't reset the build context, the builder should assume there's nothing to do right now - const status = builder.getUpToDateStatusOfFile(builder.resolveProjectName("/src/logic")); - assert.equal(status.type, UpToDateStatusType.UpToDate, "Project should be assumed to be up-to-date"); - verifyInvalidation(/*expectedToWriteTests*/ false); - - // Rebuild this project - fs.writeFileSync("/src/logic/index.ts", `${fs.readFileSync("/src/logic/index.ts")} -export class cNew {}`); - verifyInvalidation(/*expectedToWriteTests*/ true); - - function verifyInvalidation(expectedToWriteTests: boolean) { - // Rebuild this project - tick(); - builder.invalidateProject("/src/logic"); - builder.buildInvalidatedProject(); - // The file should be updated - assert.isTrue(writtenFiles.has("/src/logic/index.js"), "JS file should have been rebuilt"); - assert.equal(fs.statSync("/src/logic/index.js").mtimeMs, time(), "JS file should have been rebuilt"); - assert.isFalse(writtenFiles.has("/src/tests/index.js"), "Downstream JS file should *not* have been rebuilt"); - assert.isBelow(fs.statSync("/src/tests/index.js").mtimeMs, time(), "Downstream JS file should *not* have been rebuilt"); - writtenFiles.clear(); - - // Build downstream projects should update 'tests', but not 'core' - tick(); - builder.buildInvalidatedProject(); - if (expectedToWriteTests) { - assert.isTrue(writtenFiles.has("/src/tests/index.js"), "Downstream JS file should have been rebuilt"); - } - else { - assert.equal(writtenFiles.size, 0, "Should not write any new files"); - } - assert.equal(fs.statSync("/src/tests/index.js").mtimeMs, time(), "Downstream JS file should have new timestamp"); - assert.isBelow(fs.statSync("/src/core/index.js").mtimeMs, time(), "Upstream JS file should not have been rebuilt"); - } - }); - }); - describe("lists files", () => { it("listFiles", () => { const fs = projFs.shadow(); From b42e76b1e5e1712856190b5d2f5ae6022b344d5f Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 16:35:08 -0700 Subject: [PATCH 034/384] Remove usage of fileMap for output unchanged timestamp modification and simplify to use configFileMap --- src/compiler/tsbuild.ts | 43 ++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 18eaeed188d..f119481ac08 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -194,27 +194,22 @@ namespace ts { } } - interface FileMap { - setValue(fileName: U, value: T): void; - getValue(fileName: U): T | undefined; - hasKey(fileName: U): boolean; - removeKey(fileName: U): void; - forEach(action: (value: T, key: V) => void): void; + interface ConfigFileMap { + setValue(fileName: ResolvedConfigFileName, value: T): void; + getValue(fileName: ResolvedConfigFileName): T | undefined; + hasKey(fileName: ResolvedConfigFileName): boolean; + removeKey(fileName: ResolvedConfigFileName): void; + forEach(action: (value: T, key: ResolvedConfigFilePath) => void): void; getSize(): number; clear(): void; } type ResolvedConfigFilePath = ResolvedConfigFileName & Path; - type ConfigFileMap = FileMap; - type ToResolvedConfigFilePath = (fileName: ResolvedConfigFileName) => ResolvedConfigFilePath; - type ToPath = (fileName: string) => Path; /** * A FileMap maintains a normalized-key to value relationship */ - function createFileMap(toPath: ToResolvedConfigFilePath): ConfigFileMap; - function createFileMap(toPath: ToPath): FileMap; - function createFileMap(toPath: (fileName: U) => V): FileMap { + function createFileMap(toPath: (fileName: ResolvedConfigFileName) => ResolvedConfigFilePath): ConfigFileMap { // tslint:disable-next-line:no-null-keyword const lookup = createMap(); @@ -228,23 +223,23 @@ namespace ts { clear }; - function forEach(action: (value: T, key: V) => void) { + function forEach(action: (value: T, key: ResolvedConfigFilePath) => void) { lookup.forEach(action); } - function hasKey(fileName: U) { + function hasKey(fileName: ResolvedConfigFileName) { return lookup.has(toPath(fileName)); } - function removeKey(fileName: U) { + function removeKey(fileName: ResolvedConfigFileName) { lookup.delete(toPath(fileName)); } - function setValue(fileName: U, value: T) { + function setValue(fileName: ResolvedConfigFileName, value: T) { lookup.set(toPath(fileName), value); } - function getValue(fileName: U): T | undefined { + function getValue(fileName: ResolvedConfigFileName): T | undefined { return lookup.get(toPath(fileName)); } @@ -1132,7 +1127,7 @@ namespace ts { // Actual Emit const emitterDiagnostics = createDiagnosticCollection(); - const emittedOutputs = createFileMap(toPath as ToPath); + const emittedOutputs = createMap(); outputFiles.forEach(({ name, text, writeByteOrderMark }) => { let priorChangeTime: Date | undefined; if (!anyDtsChanged && isDeclarationFile(name)) { @@ -1146,7 +1141,7 @@ namespace ts { } } - emittedOutputs.setValue(name, name); + emittedOutputs.set(toPath(name), name); writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); if (priorChangeTime !== undefined) { newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime); @@ -1235,9 +1230,9 @@ namespace ts { // Actual Emit Debug.assert(!!outputFiles.length); const emitterDiagnostics = createDiagnosticCollection(); - const emittedOutputs = createFileMap(toPath as ToPath); + const emittedOutputs = createMap(); outputFiles.forEach(({ name, text, writeByteOrderMark }) => { - emittedOutputs.setValue(name, name); + emittedOutputs.set(toPath(name), name); writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); }); const emitDiagnostics = emitterDiagnostics.getDiagnostics(); @@ -1280,15 +1275,15 @@ namespace ts { projectStatus.setValue(proj.options.configFilePath as ResolvedConfigFilePath, status); } - function updateOutputTimestampsWorker(proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: FileMap) { + function updateOutputTimestampsWorker(proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: Map) { const outputs = getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames()); - if (!skipOutputs || outputs.length !== skipOutputs.getSize()) { + if (!skipOutputs || outputs.length !== skipOutputs.size) { if (options.verbose) { reportStatus(verboseMessage, proj.options.configFilePath!); } const now = host.now ? host.now() : new Date(); for (const file of outputs) { - if (skipOutputs && skipOutputs.hasKey(file)) { + if (skipOutputs && skipOutputs.has(toPath(file))) { continue; } From d4474a5dfca8ee80cd343696e6c3e42cef94fae5 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 16:42:56 -0700 Subject: [PATCH 035/384] More refactoring to move file map creation inside solution builder --- src/compiler/tsbuild.ts | 126 +++++++++++++++++++++------------------- 1 file changed, 67 insertions(+), 59 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index f119481ac08..76a93afc478 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -206,51 +206,6 @@ namespace ts { type ResolvedConfigFilePath = ResolvedConfigFileName & Path; - /** - * A FileMap maintains a normalized-key to value relationship - */ - function createFileMap(toPath: (fileName: ResolvedConfigFileName) => ResolvedConfigFilePath): ConfigFileMap { - // tslint:disable-next-line:no-null-keyword - const lookup = createMap(); - - return { - setValue, - getValue, - removeKey, - forEach, - hasKey, - getSize, - clear - }; - - function forEach(action: (value: T, key: ResolvedConfigFilePath) => void) { - lookup.forEach(action); - } - - function hasKey(fileName: ResolvedConfigFileName) { - return lookup.has(toPath(fileName)); - } - - function removeKey(fileName: ResolvedConfigFileName) { - lookup.delete(toPath(fileName)); - } - - function setValue(fileName: ResolvedConfigFileName, value: T) { - lookup.set(toPath(fileName), value); - } - - function getValue(fileName: ResolvedConfigFileName): T | undefined { - return lookup.get(toPath(fileName)); - } - - function getSize() { - return lookup.size; - } - - function clear() { - lookup.clear(); - } - } function getOrCreateValueFromConfigFileMap(configFileMap: ConfigFileMap, resolved: ResolvedConfigFileName, createT: () => T): T { const existingValue = configFileMap.getValue(resolved); @@ -378,10 +333,11 @@ namespace ts { // State of the solution let options = defaultOptions; let baseCompilerOptions = getCompilerOptionsOfBuildOptions(options); + const resolvedConfigFilePaths = createMap(); type ConfigFileCacheEntry = ParsedCommandLine | Diagnostic; - const configFileCache = createFileMap(toPath); + const configFileCache = createFileMap(); /** Map from config file name to up-to-date status */ - const projectStatus = createFileMap(toPath); + const projectStatus = createFileMap(); let buildOrder: readonly ResolvedConfigFileName[] | undefined; const writeFileName = host.trace ? (s: string) => host.trace!(s) : undefined; let readFileWithCache = (f: string) => host.readFile(f); @@ -393,21 +349,21 @@ namespace ts { compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives); let moduleResolutionCache = !compilerHost.resolveModuleNames ? createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined; - const buildInfoChecked = createFileMap(toPath); + const buildInfoChecked = createFileMap(); // Watch state - const builderPrograms = createFileMap(toPath); - const diagnostics = createFileMap>(toPath); - const projectPendingBuild = createFileMap(toPath); - const projectErrorsReported = createFileMap(toPath); + const builderPrograms = createFileMap(); + const diagnostics = createFileMap>(); + const projectPendingBuild = createFileMap(); + const projectErrorsReported = createFileMap(); let timerToBuildInvalidatedProject: any; let reportFileChangeDetected = false; const { watchFile, watchFilePath, watchDirectory, writeLog } = createWatchFactory(host, options); // Watches for the solution - const allWatchedWildcardDirectories = createFileMap>(toPath); - const allWatchedInputFiles = createFileMap>(toPath); - const allWatchedConfigFiles = createFileMap(toPath); + const allWatchedWildcardDirectories = createFileMap>(); + const allWatchedInputFiles = createFileMap>(); + const allWatchedConfigFiles = createFileMap(); return { buildAllProjects, @@ -423,15 +379,67 @@ namespace ts { startWatching }; - function toPath(fileName: ResolvedConfigFileName): ResolvedConfigFilePath; - function toPath(fileName: string): Path; function toPath(fileName: string) { return ts.toPath(fileName, currentDirectory, getCanonicalFileName); } + function toResolvedConfigFilePath(fileName: ResolvedConfigFileName): ResolvedConfigFilePath { + const path = resolvedConfigFilePaths.get(fileName); + if (path !== undefined) return path; + + const resolvedPath = toPath(fileName) as ResolvedConfigFilePath; + resolvedConfigFilePaths.set(fileName, resolvedPath); + return resolvedPath; + } + + + // TODO remove this and use normal map so we arent transforming paths constantly + function createFileMap(): ConfigFileMap { + const lookup = createMap(); + return { + setValue, + getValue, + removeKey, + forEach, + hasKey, + getSize, + clear + }; + + function forEach(action: (value: T, key: ResolvedConfigFilePath) => void) { + lookup.forEach(action); + } + + function hasKey(fileName: ResolvedConfigFileName) { + return lookup.has(toResolvedConfigFilePath(fileName)); + } + + function removeKey(fileName: ResolvedConfigFileName) { + lookup.delete(toResolvedConfigFilePath(fileName)); + } + + function setValue(fileName: ResolvedConfigFileName, value: T) { + lookup.set(toResolvedConfigFilePath(fileName), value); + } + + function getValue(fileName: ResolvedConfigFileName): T | undefined { + return lookup.get(toResolvedConfigFilePath(fileName)); + } + + function getSize() { + return lookup.size; + } + + function clear() { + lookup.clear(); + } + } + + function resetBuildContext(opts = defaultOptions) { options = opts; baseCompilerOptions = getCompilerOptionsOfBuildOptions(options); + resolvedConfigFilePaths.clear(); configFileCache.clear(); projectStatus.clear(); buildOrder = undefined; @@ -998,8 +1006,8 @@ namespace ts { } function createBuildOrder(roots: readonly ResolvedConfigFileName[]): readonly ResolvedConfigFileName[] { - const temporaryMarks = createFileMap(toPath); - const permanentMarks = createFileMap(toPath); + const temporaryMarks = createFileMap(); + const permanentMarks = createFileMap(); const circularityReportStack: string[] = []; let buildOrder: ResolvedConfigFileName[] | undefined; for (const root of roots) { From c615d48727433d09912568285326956bba8d8748 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 16:49:06 -0700 Subject: [PATCH 036/384] Make use of maps in build order calculation --- src/compiler/tsbuild.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 76a93afc478..69da4bed77f 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -1006,8 +1006,8 @@ namespace ts { } function createBuildOrder(roots: readonly ResolvedConfigFileName[]): readonly ResolvedConfigFileName[] { - const temporaryMarks = createFileMap(); - const permanentMarks = createFileMap(); + const temporaryMarks = createMap(); + const permanentMarks = createMap(); const circularityReportStack: string[] = []; let buildOrder: ResolvedConfigFileName[] | undefined; for (const root of roots) { @@ -1016,11 +1016,12 @@ namespace ts { return buildOrder || emptyArray; - function visit(projPath: ResolvedConfigFileName, inCircularContext?: boolean) { + function visit(configFileName: ResolvedConfigFileName, inCircularContext?: boolean) { + const projPath = toResolvedConfigFilePath(configFileName); // Already visited - if (permanentMarks.hasKey(projPath)) return; + if (permanentMarks.has(projPath)) return; // Circular - if (temporaryMarks.hasKey(projPath)) { + if (temporaryMarks.has(projPath)) { if (!inCircularContext) { // TODO:: Do we report this as error? reportStatus(Diagnostics.Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0, circularityReportStack.join("\r\n")); @@ -1028,9 +1029,9 @@ namespace ts { return; } - temporaryMarks.setValue(projPath, true); - circularityReportStack.push(projPath); - const parsed = parseConfigFile(projPath); + temporaryMarks.set(projPath, true); + circularityReportStack.push(configFileName); + const parsed = parseConfigFile(configFileName); if (parsed && parsed.projectReferences) { for (const ref of parsed.projectReferences) { const resolvedRefPath = resolveProjectName(ref.path); @@ -1039,8 +1040,8 @@ namespace ts { } circularityReportStack.pop(); - permanentMarks.setValue(projPath, true); - (buildOrder || (buildOrder = [])).push(projPath); + permanentMarks.set(projPath, true); + (buildOrder || (buildOrder = [])).push(configFileName); } } From 50741e647be6cea5406b8fb900167d1ab016c66d Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 16:59:07 -0700 Subject: [PATCH 037/384] Use maps for all the watch data structures --- src/compiler/tsbuild.ts | 58 +++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 69da4bed77f..cc6899163fc 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -207,17 +207,17 @@ namespace ts { type ResolvedConfigFilePath = ResolvedConfigFileName & Path; - function getOrCreateValueFromConfigFileMap(configFileMap: ConfigFileMap, resolved: ResolvedConfigFileName, createT: () => T): T { - const existingValue = configFileMap.getValue(resolved); + function getOrCreateValueFromConfigFileMap(configFileMap: Map, resolved: ResolvedConfigFilePath, createT: () => T): T { + const existingValue = configFileMap.get(resolved); let newValue: T | undefined; if (!existingValue) { newValue = createT(); - configFileMap.setValue(resolved, newValue); + configFileMap.set(resolved, newValue); } return existingValue || newValue!; } - function getOrCreateValueMapFromConfigFileMap(configFileMap: ConfigFileMap>, resolved: ResolvedConfigFileName): Map { + function getOrCreateValueMapFromConfigFileMap(configFileMap: Map>, resolved: ResolvedConfigFilePath): Map { return getOrCreateValueFromConfigFileMap>(configFileMap, resolved, createMap); } @@ -361,9 +361,9 @@ namespace ts { const { watchFile, watchFilePath, watchDirectory, writeLog } = createWatchFactory(host, options); // Watches for the solution - const allWatchedWildcardDirectories = createFileMap>(); - const allWatchedInputFiles = createFileMap>(); - const allWatchedConfigFiles = createFileMap(); + const allWatchedWildcardDirectories = createMap>(); + const allWatchedInputFiles = createMap>(); + const allWatchedConfigFiles = createMap(); return { buildAllProjects, @@ -489,28 +489,29 @@ namespace ts { function startWatching() { for (const resolved of getBuildOrder()) { + const resolvedPath = toResolvedConfigFilePath(resolved); // Watch this file - watchConfigFile(resolved); + watchConfigFile(resolved, resolvedPath); const cfg = parseConfigFile(resolved); if (cfg) { // Update watchers for wildcard directories - watchWildCardDirectories(resolved, cfg); + watchWildCardDirectories(resolved, resolvedPath, cfg); // Watch input files - watchInputFiles(resolved, cfg); + watchInputFiles(resolved, resolvedPath, cfg); } } } - function watchConfigFile(resolved: ResolvedConfigFileName) { - if (options.watch && !allWatchedConfigFiles.hasKey(resolved)) { - allWatchedConfigFiles.setValue(resolved, watchFile( + function watchConfigFile(resolved: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath) { + if (options.watch && !allWatchedConfigFiles.has(resolvedPath)) { + allWatchedConfigFiles.set(resolvedPath, watchFile( hostWithWatch, resolved, () => { - invalidateProjectAndScheduleBuilds(resolved, ConfigFileProgramReloadLevel.Full); + invalidateProjectAndScheduleBuilds(resolvedPath, ConfigFileProgramReloadLevel.Full); }, PollingInterval.High, WatchType.ConfigFile, @@ -519,10 +520,10 @@ namespace ts { } } - function watchWildCardDirectories(resolved: ResolvedConfigFileName, parsed: ParsedCommandLine) { + function watchWildCardDirectories(resolved: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, parsed: ParsedCommandLine) { if (!options.watch) return; updateWatchingWildcardDirectories( - getOrCreateValueMapFromConfigFileMap(allWatchedWildcardDirectories, resolved), + getOrCreateValueMapFromConfigFileMap(allWatchedWildcardDirectories, resolvedPath), createMapFromTemplate(parsed.configFileSpecs!.wildcardDirectories), (dir, flags) => { return watchDirectory( @@ -540,7 +541,7 @@ namespace ts { return; } - invalidateProjectAndScheduleBuilds(resolved, ConfigFileProgramReloadLevel.Partial); + invalidateProjectAndScheduleBuilds(resolvedPath, ConfigFileProgramReloadLevel.Partial); }, flags, WatchType.WildcardDirectory, @@ -550,16 +551,16 @@ namespace ts { ); } - function watchInputFiles(resolved: ResolvedConfigFileName, parsed: ParsedCommandLine) { + function watchInputFiles(resolved: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, parsed: ParsedCommandLine) { if (!options.watch) return; mutateMap( - getOrCreateValueMapFromConfigFileMap(allWatchedInputFiles, resolved), + getOrCreateValueMapFromConfigFileMap(allWatchedInputFiles, resolvedPath), arrayToMap(parsed.fileNames, toPath), { createNewValue: (path, input) => watchFilePath( hostWithWatch, input, - () => invalidateProjectAndScheduleBuilds(resolved, ConfigFileProgramReloadLevel.None), + () => invalidateProjectAndScheduleBuilds(resolvedPath, ConfigFileProgramReloadLevel.None), PollingInterval.Low, path as Path, WatchType.SourceFile, @@ -602,9 +603,9 @@ namespace ts { return comparePaths(file1, file2, currentDirectory, !host.useCaseSensitiveFileNames()) === Comparison.EqualTo; } - function invalidateProjectAndScheduleBuilds(resolved: ResolvedConfigFileName, reloadLevel: ConfigFileProgramReloadLevel) { + function invalidateProjectAndScheduleBuilds(resolvedPath: ResolvedConfigFilePath, reloadLevel: ConfigFileProgramReloadLevel) { reportFileChangeDetected = true; - invalidateResolvedProject(resolved, reloadLevel); + invalidateResolvedProject(resolvedPath, reloadLevel); scheduleBuildInvalidatedProject(); } @@ -830,10 +831,10 @@ namespace ts { } function invalidateProject(configFileName: string, reloadLevel?: ConfigFileProgramReloadLevel) { - invalidateResolvedProject(resolveProjectName(configFileName), reloadLevel || ConfigFileProgramReloadLevel.None); + invalidateResolvedProject(toResolvedConfigFilePath(resolveProjectName(configFileName)), reloadLevel || ConfigFileProgramReloadLevel.None); } - function invalidateResolvedProject(resolved: ResolvedConfigFileName, reloadLevel: ConfigFileProgramReloadLevel) { + function invalidateResolvedProject(resolved: ResolvedConfigFilePath, reloadLevel: ConfigFileProgramReloadLevel) { if (reloadLevel === ConfigFileProgramReloadLevel.Full) { configFileCache.removeKey(resolved); buildOrder = undefined; @@ -928,17 +929,18 @@ namespace ts { return; } + const resolvedPath = toResolvedConfigFilePath(resolved); if (reloadLevel === ConfigFileProgramReloadLevel.Full) { - watchConfigFile(resolved); - watchWildCardDirectories(resolved, proj); - watchInputFiles(resolved, proj); + watchConfigFile(resolved, resolvedPath); + watchWildCardDirectories(resolved, resolvedPath, proj); + watchInputFiles(resolved, resolvedPath, proj); } else if (reloadLevel === ConfigFileProgramReloadLevel.Partial) { // Update file names const result = getFileNamesFromConfigSpecs(proj.configFileSpecs!, getDirectoryPath(resolved), proj.options, parseConfigFileHost); updateErrorForNoInputFiles(result, resolved, proj.configFileSpecs!, proj.errors, canJsonReportNoInutFiles(proj.raw)); proj.fileNames = result.fileNames; - watchInputFiles(resolved, proj); + watchInputFiles(resolved, resolvedPath, proj); } const status = getUpToDateStatus(proj); From 579d2bfe1f550f4bd88ca7590f52ee0fe0012682 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 17:16:36 -0700 Subject: [PATCH 038/384] Make FileMap Apis to match map but just ensure that keys are always paths Turn projectPendingBuild to config file map --- src/compiler/tsbuild.ts | 75 ++++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index cc6899163fc..f1e32051310 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -194,20 +194,24 @@ namespace ts { } } - interface ConfigFileMap { - setValue(fileName: ResolvedConfigFileName, value: T): void; - getValue(fileName: ResolvedConfigFileName): T | undefined; - hasKey(fileName: ResolvedConfigFileName): boolean; - removeKey(fileName: ResolvedConfigFileName): void; - forEach(action: (value: T, key: ResolvedConfigFilePath) => void): void; - getSize(): number; + type ResolvedConfigFilePath = ResolvedConfigFileName & Path; + + interface FileMap extends Map { + get(key: U): T | undefined; + has(key: U): boolean; + forEach(action: (value: T, key: U) => void): void; + readonly size: number; + keys(): Iterator; + values(): Iterator; + entries(): Iterator<[U, T]>; + set(key: U, value: T): this; + delete(key: U): boolean; clear(): void; } - type ResolvedConfigFilePath = ResolvedConfigFileName & Path; + type ConfigFileMap = FileMap; - - function getOrCreateValueFromConfigFileMap(configFileMap: Map, resolved: ResolvedConfigFilePath, createT: () => T): T { + function getOrCreateValueFromConfigFileMap(configFileMap: ConfigFileMap, resolved: ResolvedConfigFilePath, createT: () => T): T { const existingValue = configFileMap.get(resolved); let newValue: T | undefined; if (!existingValue) { @@ -217,7 +221,7 @@ namespace ts { return existingValue || newValue!; } - function getOrCreateValueMapFromConfigFileMap(configFileMap: Map>, resolved: ResolvedConfigFilePath): Map { + function getOrCreateValueMapFromConfigFileMap(configFileMap: ConfigFileMap>, resolved: ResolvedConfigFilePath): Map { return getOrCreateValueFromConfigFileMap>(configFileMap, resolved, createMap); } @@ -354,16 +358,16 @@ namespace ts { // Watch state const builderPrograms = createFileMap(); const diagnostics = createFileMap>(); - const projectPendingBuild = createFileMap(); + const projectPendingBuild = createMap() as ConfigFileMap; const projectErrorsReported = createFileMap(); let timerToBuildInvalidatedProject: any; let reportFileChangeDetected = false; const { watchFile, watchFilePath, watchDirectory, writeLog } = createWatchFactory(host, options); // Watches for the solution - const allWatchedWildcardDirectories = createMap>(); - const allWatchedInputFiles = createMap>(); - const allWatchedConfigFiles = createMap(); + const allWatchedWildcardDirectories = createMap() as ConfigFileMap>; + const allWatchedInputFiles = createMap() as ConfigFileMap>; + const allWatchedConfigFiles = createMap() as ConfigFileMap; return { buildAllProjects, @@ -394,7 +398,15 @@ namespace ts { // TODO remove this and use normal map so we arent transforming paths constantly - function createFileMap(): ConfigFileMap { + function createFileMap(): { + setValue(fileName: ResolvedConfigFileName, value: T): void; + getValue(fileName: ResolvedConfigFileName): T | undefined; + hasKey(fileName: ResolvedConfigFileName): boolean; + removeKey(fileName: ResolvedConfigFileName): void; + forEach(action: (value: T, key: ResolvedConfigFilePath) => void): void; + getSize(): number; + clear(): void; + } { const lookup = createMap(); return { setValue, @@ -435,7 +447,6 @@ namespace ts { } } - function resetBuildContext(opts = defaultOptions) { options = opts; baseCompilerOptions = getCompilerOptionsOfBuildOptions(options); @@ -848,28 +859,29 @@ namespace ts { /** * return true if new addition */ - function addProjToQueue(proj: ResolvedConfigFileName, reloadLevel: ConfigFileProgramReloadLevel) { - const value = projectPendingBuild.getValue(proj); + function addProjToQueue(proj: ResolvedConfigFilePath, reloadLevel: ConfigFileProgramReloadLevel) { + const value = projectPendingBuild.get(proj); if (value === undefined) { - projectPendingBuild.setValue(proj, reloadLevel); + projectPendingBuild.set(proj, reloadLevel); } else if (value < reloadLevel) { - projectPendingBuild.setValue(proj, reloadLevel); + projectPendingBuild.set(proj, reloadLevel); } } function getNextInvalidatedProject() { for (const project of getBuildOrder()) { - const reloadLevel = projectPendingBuild.getValue(project); + const projectPath = toResolvedConfigFilePath(project); + const reloadLevel = projectPendingBuild.get(projectPath); if (reloadLevel !== undefined) { - projectPendingBuild.removeKey(project); + projectPendingBuild.delete(projectPath); return { project, reloadLevel }; } } } function hasPendingInvalidatedProjects() { - return !!projectPendingBuild.getSize(); + return !!projectPendingBuild.size; } function scheduleBuildInvalidatedProject() { @@ -969,7 +981,8 @@ namespace ts { // Always use build order to queue projects for (let index = buildOrder.indexOf(resolved) + 1; index < buildOrder.length; index++) { const project = buildOrder[index]; - if (projectPendingBuild.hasKey(project)) continue; + const projectPath = toResolvedConfigFilePath(project); + if (projectPendingBuild.has(projectPath)) continue; const config = parseConfigFile(project); if (!config || !config.projectReferences) continue; @@ -1001,15 +1014,15 @@ namespace ts { status.type = UpToDateStatusType.UpToDateWithUpstreamTypes; } } - addProjToQueue(project, ConfigFileProgramReloadLevel.None); + addProjToQueue(projectPath, ConfigFileProgramReloadLevel.None); break; } } } function createBuildOrder(roots: readonly ResolvedConfigFileName[]): readonly ResolvedConfigFileName[] { - const temporaryMarks = createMap(); - const permanentMarks = createMap(); + const temporaryMarks = createMap() as ConfigFileMap; + const permanentMarks = createMap() as ConfigFileMap; const circularityReportStack: string[] = []; let buildOrder: ResolvedConfigFileName[] | undefined; for (const root of roots) { @@ -1138,7 +1151,7 @@ namespace ts { // Actual Emit const emitterDiagnostics = createDiagnosticCollection(); - const emittedOutputs = createMap(); + const emittedOutputs = createMap() as FileMap; outputFiles.forEach(({ name, text, writeByteOrderMark }) => { let priorChangeTime: Date | undefined; if (!anyDtsChanged && isDeclarationFile(name)) { @@ -1241,7 +1254,7 @@ namespace ts { // Actual Emit Debug.assert(!!outputFiles.length); const emitterDiagnostics = createDiagnosticCollection(); - const emittedOutputs = createMap(); + const emittedOutputs = createMap() as FileMap; outputFiles.forEach(({ name, text, writeByteOrderMark }) => { emittedOutputs.set(toPath(name), name); writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); @@ -1286,7 +1299,7 @@ namespace ts { projectStatus.setValue(proj.options.configFilePath as ResolvedConfigFilePath, status); } - function updateOutputTimestampsWorker(proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: Map) { + function updateOutputTimestampsWorker(proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: FileMap) { const outputs = getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames()); if (!skipOutputs || outputs.length !== skipOutputs.size) { if (options.verbose) { From 05257e8696d4adc2e620c1e85e7d799190df0d98 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 17:31:20 -0700 Subject: [PATCH 039/384] configFileCache, projectStatus, buildInfoChecked is now ConfigFileMap --- src/compiler/tsbuild.ts | 149 ++++++++++++++++++++-------------------- 1 file changed, 76 insertions(+), 73 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index f1e32051310..17c6d893764 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -339,9 +339,9 @@ namespace ts { let baseCompilerOptions = getCompilerOptionsOfBuildOptions(options); const resolvedConfigFilePaths = createMap(); type ConfigFileCacheEntry = ParsedCommandLine | Diagnostic; - const configFileCache = createFileMap(); + const configFileCache = createMap() as ConfigFileMap; /** Map from config file name to up-to-date status */ - const projectStatus = createFileMap(); + const projectStatus = createMap() as ConfigFileMap; let buildOrder: readonly ResolvedConfigFileName[] | undefined; const writeFileName = host.trace ? (s: string) => host.trace!(s) : undefined; let readFileWithCache = (f: string) => host.readFile(f); @@ -353,7 +353,7 @@ namespace ts { compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives); let moduleResolutionCache = !compilerHost.resolveModuleNames ? createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined; - const buildInfoChecked = createFileMap(); + const buildInfoChecked = createMap() as ConfigFileMap; // Watch state const builderPrograms = createFileMap(); @@ -474,17 +474,17 @@ namespace ts { return !!(entry as ParsedCommandLine).options; } - function parseConfigFile(configFilePath: ResolvedConfigFileName): ParsedCommandLine | undefined { - const value = configFileCache.getValue(configFilePath); + function parseConfigFile(configFileName: ResolvedConfigFileName, configFilePath: ResolvedConfigFilePath): ParsedCommandLine | undefined { + const value = configFileCache.get(configFilePath); if (value) { return isParsedCommandLine(value) ? value : undefined; } let diagnostic: Diagnostic | undefined; parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = d => diagnostic = d; - const parsed = getParsedCommandLineOfConfigFile(configFilePath, baseCompilerOptions, parseConfigFileHost); + const parsed = getParsedCommandLineOfConfigFile(configFileName, baseCompilerOptions, parseConfigFileHost); parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = noop; - configFileCache.setValue(configFilePath, parsed || diagnostic!); + configFileCache.set(configFilePath, parsed || diagnostic!); return parsed; } @@ -504,7 +504,7 @@ namespace ts { // Watch this file watchConfigFile(resolved, resolvedPath); - const cfg = parseConfigFile(resolved); + const cfg = parseConfigFile(resolved, resolvedPath); if (cfg) { // Update watchers for wildcard directories watchWildCardDirectories(resolved, resolvedPath, cfg); @@ -624,22 +624,22 @@ namespace ts { return buildOrder || (buildOrder = createBuildOrder(rootNames.map(resolveProjectName))); } - function getUpToDateStatus(project: ParsedCommandLine | undefined): UpToDateStatus { + function getUpToDateStatus(project: ParsedCommandLine | undefined, resolvedPath: ResolvedConfigFilePath): UpToDateStatus { if (project === undefined) { return { type: UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" }; } - const prior = projectStatus.getValue(project.options.configFilePath as ResolvedConfigFilePath); + const prior = projectStatus.get(resolvedPath); if (prior !== undefined) { return prior; } - const actual = getUpToDateStatusWorker(project); - projectStatus.setValue(project.options.configFilePath as ResolvedConfigFilePath, actual); + const actual = getUpToDateStatusWorker(project, resolvedPath); + projectStatus.set(resolvedPath, actual); return actual; } - function getUpToDateStatusWorker(project: ParsedCommandLine): UpToDateStatus { + function getUpToDateStatusWorker(project: ParsedCommandLine, resolvedPath: ResolvedConfigFilePath): UpToDateStatus { let newestInputFileName: string = undefined!; let newestInputFileTime = minimumDate; // Get timestamps of input files @@ -716,11 +716,12 @@ namespace ts { let usesPrepend = false; let upstreamChangedProject: string | undefined; if (project.projectReferences) { - projectStatus.setValue(project.options.configFilePath as ResolvedConfigFileName, { type: UpToDateStatusType.ComputingUpstream }); + projectStatus.set(resolvedPath, { type: UpToDateStatusType.ComputingUpstream }); for (const ref of project.projectReferences) { usesPrepend = usesPrepend || !!(ref.prepend); const resolvedRef = resolveProjectReferencePath(ref); - const refStatus = getUpToDateStatus(parseConfigFile(resolvedRef)); + const resolvedRefPath = toResolvedConfigFilePath(resolvedRef); + const refStatus = getUpToDateStatus(parseConfigFile(resolvedRef, resolvedRefPath), resolvedRefPath); // Its a circular reference ignore the status of this project if (refStatus.type === UpToDateStatusType.ComputingUpstream) { @@ -794,8 +795,8 @@ namespace ts { if (extendedConfigStatus) return extendedConfigStatus; } - if (!buildInfoChecked.hasKey(project.options.configFilePath as ResolvedConfigFileName)) { - buildInfoChecked.setValue(project.options.configFilePath as ResolvedConfigFileName, true); + if (!buildInfoChecked.has(resolvedPath)) { + buildInfoChecked.set(resolvedPath, true); const buildInfoPath = getOutputPathForBuildInfo(project.options); if (buildInfoPath) { const value = readFileWithCache(buildInfoPath); @@ -847,10 +848,10 @@ namespace ts { function invalidateResolvedProject(resolved: ResolvedConfigFilePath, reloadLevel: ConfigFileProgramReloadLevel) { if (reloadLevel === ConfigFileProgramReloadLevel.Full) { - configFileCache.removeKey(resolved); + configFileCache.delete(resolved); buildOrder = undefined; } - projectStatus.removeKey(resolved); + projectStatus.delete(resolved); diagnostics.removeKey(resolved); addProjToQueue(resolved, reloadLevel); @@ -935,13 +936,13 @@ namespace ts { } function buildSingleInvalidatedProject(resolved: ResolvedConfigFileName, reloadLevel: ConfigFileProgramReloadLevel) { - const proj = parseConfigFile(resolved); + const resolvedPath = toResolvedConfigFilePath(resolved); + const proj = parseConfigFile(resolved, resolvedPath); if (!proj) { - reportParseConfigFileDiagnostic(resolved); + reportParseConfigFileDiagnostic(resolvedPath); return; } - const resolvedPath = toResolvedConfigFilePath(resolved); if (reloadLevel === ConfigFileProgramReloadLevel.Full) { watchConfigFile(resolved, resolvedPath); watchWildCardDirectories(resolved, resolvedPath, proj); @@ -955,7 +956,7 @@ namespace ts { watchInputFiles(resolved, resolvedPath, proj); } - const status = getUpToDateStatus(proj); + const status = getUpToDateStatus(proj, resolvedPath); verboseReportProjectStatus(resolved, status); if (status.type === UpToDateStatusType.UpstreamBlocked) { @@ -965,13 +966,13 @@ namespace ts { if (status.type === UpToDateStatusType.UpToDateWithUpstreamTypes) { // Fake that files have been built by updating output file stamps - updateOutputTimestamps(proj); + updateOutputTimestamps(proj, resolvedPath); return; } - const buildResult = needsBuild(status, resolved) ? - buildSingleProject(resolved) : // Actual build - updateBundle(resolved); // Fake that files have been built by manipulating prepend and existing output + const buildResult = needsBuild(status, proj) ? + buildSingleProject(resolved, resolvedPath) : // Actual build + updateBundle(resolved, resolvedPath); // Fake that files have been built by manipulating prepend and existing output if (buildResult & BuildResultFlags.AnyErrors) return; // Only composite projects can be referenced by other projects @@ -984,18 +985,18 @@ namespace ts { const projectPath = toResolvedConfigFilePath(project); if (projectPendingBuild.has(projectPath)) continue; - const config = parseConfigFile(project); + const config = parseConfigFile(project, projectPath); if (!config || !config.projectReferences) continue; for (const ref of config.projectReferences) { const resolvedRefPath = resolveProjectName(ref.path); - if (resolvedRefPath !== resolved) continue; + if (toResolvedConfigFilePath(resolvedRefPath) !== resolvedPath) continue; // If the project is referenced with prepend, always build downstream projects, // If declaration output is changed, build the project // otherwise mark the project UpToDateWithUpstreamTypes so it updates output time stamps - const status = projectStatus.getValue(project); + const status = projectStatus.get(projectPath); if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) { if (status && (status.type === UpToDateStatusType.UpToDate || status.type === UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === UpToDateStatusType.OutOfDateWithPrepend)) { - projectStatus.setValue(project, { + projectStatus.set(projectPath, { type: UpToDateStatusType.OutOfDateWithUpstream, outOfDateOutputFileName: status.type === UpToDateStatusType.OutOfDateWithPrepend ? status.outOfDateOutputFileName : status.oldestOutputFileName, newerProjectName: resolved @@ -1004,7 +1005,7 @@ namespace ts { } else if (status && status.type === UpToDateStatusType.UpToDate) { if (ref.prepend) { - projectStatus.setValue(project, { + projectStatus.set(projectPath, { type: UpToDateStatusType.OutOfDateWithPrepend, outOfDateOutputFileName: status.oldestOutputFileName, newerProjectName: resolved @@ -1046,7 +1047,7 @@ namespace ts { temporaryMarks.set(projPath, true); circularityReportStack.push(configFileName); - const parsed = parseConfigFile(configFileName); + const parsed = parseConfigFile(configFileName, projPath); if (parsed && parsed.projectReferences) { for (const ref of parsed.projectReferences) { const resolvedRefPath = resolveProjectName(ref.path); @@ -1060,7 +1061,7 @@ namespace ts { } } - function buildSingleProject(proj: ResolvedConfigFileName): BuildResultFlags { + function buildSingleProject(proj: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath): BuildResultFlags { if (options.dry) { reportStatus(Diagnostics.A_non_dry_build_would_build_project_0, proj); return BuildResultFlags.Success; @@ -1070,16 +1071,16 @@ namespace ts { let resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - const configFile = parseConfigFile(proj); + const configFile = parseConfigFile(proj, resolvedPath); if (!configFile) { // Failed to read the config file resultFlags |= BuildResultFlags.ConfigFileErrors; - reportParseConfigFileDiagnostic(proj); - projectStatus.setValue(proj, { type: UpToDateStatusType.Unbuildable, reason: "Config file errors" }); + reportParseConfigFileDiagnostic(resolvedPath); + projectStatus.set(resolvedPath, { type: UpToDateStatusType.Unbuildable, reason: "Config file errors" }); return resultFlags; } if (configFile.fileNames.length === 0) { - reportAndStoreErrors(proj, configFile.errors); + reportAndStoreErrors(resolvedPath, configFile.errors); // Nothing to build - must be a solution file, basically return BuildResultFlags.None; } @@ -1191,17 +1192,17 @@ namespace ts { oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(configFile, !host.useCaseSensitiveFileNames()) }; diagnostics.removeKey(proj); - projectStatus.setValue(proj, status); + projectStatus.set(resolvedPath, status); afterProgramCreate(proj, program); projectCompilerOptions = baseCompilerOptions; return resultFlags; function buildErrors(diagnostics: ReadonlyArray, errorFlags: BuildResultFlags, errorType: string) { resultFlags |= errorFlags; - reportAndStoreErrors(proj, diagnostics); + reportAndStoreErrors(resolvedPath, diagnostics); // List files if any other build error using program (emit errors already report files) if (writeFileName) listFiles(program, writeFileName); - projectStatus.setValue(proj, { type: UpToDateStatusType.Unbuildable, reason: `${errorType} errors` }); + projectStatus.set(resolvedPath, { type: UpToDateStatusType.Unbuildable, reason: `${errorType} errors` }); afterProgramCreate(proj, program); projectCompilerOptions = baseCompilerOptions; return resultFlags; @@ -1231,7 +1232,7 @@ namespace ts { return readBuilderProgram(parsed.options, readFileWithCache) as any as T; } - function updateBundle(proj: ResolvedConfigFileName): BuildResultFlags { + function updateBundle(proj: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath): BuildResultFlags { if (options.dry) { reportStatus(Diagnostics.A_non_dry_build_would_update_output_of_project_0, proj); return BuildResultFlags.Success; @@ -1240,15 +1241,18 @@ namespace ts { if (options.verbose) reportStatus(Diagnostics.Updating_output_of_project_0, proj); // Update js, and source map - const config = Debug.assertDefined(parseConfigFile(proj)); + const config = Debug.assertDefined(parseConfigFile(proj, resolvedPath)); projectCompilerOptions = config.options; const outputFiles = emitUsingBuildInfo( config, compilerHost, - ref => parseConfigFile(resolveProjectName(ref.path))); + ref => { + const refName = resolveProjectName(ref.path); + return parseConfigFile(refName, toResolvedConfigFilePath(refName)); + }); if (isString(outputFiles)) { reportStatus(Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, proj, relName(outputFiles)); - return buildSingleProject(proj); + return buildSingleProject(proj, resolvedPath); } // Actual Emit @@ -1261,8 +1265,8 @@ namespace ts { }); const emitDiagnostics = emitterDiagnostics.getDiagnostics(); if (emitDiagnostics.length) { - reportAndStoreErrors(proj, emitDiagnostics); - projectStatus.setValue(proj, { type: UpToDateStatusType.Unbuildable, reason: "Emit errors" }); + reportAndStoreErrors(resolvedPath, emitDiagnostics); + projectStatus.set(resolvedPath, { type: UpToDateStatusType.Unbuildable, reason: "Emit errors" }); projectCompilerOptions = baseCompilerOptions; return BuildResultFlags.DeclarationOutputUnchanged | BuildResultFlags.EmitErrors; } @@ -1281,12 +1285,12 @@ namespace ts { }; diagnostics.removeKey(proj); - projectStatus.setValue(proj, status); + projectStatus.set(resolvedPath, status); projectCompilerOptions = baseCompilerOptions; return BuildResultFlags.DeclarationOutputUnchanged; } - function updateOutputTimestamps(proj: ParsedCommandLine) { + function updateOutputTimestamps(proj: ParsedCommandLine, resolvedPath: ResolvedConfigFilePath) { if (options.dry) { return reportStatus(Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath!); } @@ -1296,7 +1300,7 @@ namespace ts { newestDeclarationFileContentChangedTime: priorNewestUpdateTime, oldestOutputFileName: getFirstProjectOutput(proj, !host.useCaseSensitiveFileNames()) }; - projectStatus.setValue(proj.options.configFilePath as ResolvedConfigFilePath, status); + projectStatus.set(resolvedPath, status); } function updateOutputTimestampsWorker(proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: FileMap) { @@ -1327,10 +1331,11 @@ namespace ts { // Get the same graph for cleaning we'd use for building const filesToDelete: string[] = []; for (const proj of getBuildOrder()) { - const parsed = parseConfigFile(proj); + const resolvedPath = toResolvedConfigFilePath(proj); + const parsed = parseConfigFile(proj, resolvedPath); if (parsed === undefined) { // File has gone missing; fine to ignore here - reportParseConfigFileDiagnostic(proj); + reportParseConfigFileDiagnostic(resolvedPath); continue; } const outputs = getAllProjectOutputs(parsed, !host.useCaseSensitiveFileNames()); @@ -1386,51 +1391,51 @@ namespace ts { reportBuildQueue(buildOrder); let anyFailed = false; for (const next of buildOrder) { - const proj = parseConfigFile(next); + const resolvedPath = toResolvedConfigFilePath(next); + const proj = parseConfigFile(next, resolvedPath); if (proj === undefined) { - reportParseConfigFileDiagnostic(next); + reportParseConfigFileDiagnostic(resolvedPath); anyFailed = true; break; } // report errors early when using continue or break statements const errors = proj.errors; - const status = getUpToDateStatus(proj); + const status = getUpToDateStatus(proj, resolvedPath); verboseReportProjectStatus(next, status); - const projName = proj.options.configFilePath!; if (status.type === UpToDateStatusType.UpToDate && !options.force) { - reportAndStoreErrors(next, errors); + reportAndStoreErrors(resolvedPath, errors); // Up to date, skip if (defaultOptions.dry) { // In a dry build, inform the user of this fact - reportStatus(Diagnostics.Project_0_is_up_to_date, projName); + reportStatus(Diagnostics.Project_0_is_up_to_date, next); } continue; } if (status.type === UpToDateStatusType.UpToDateWithUpstreamTypes && !options.force) { - reportAndStoreErrors(next, errors); + reportAndStoreErrors(resolvedPath, errors); // Fake build - updateOutputTimestamps(proj); + updateOutputTimestamps(proj, resolvedPath); continue; } if (status.type === UpToDateStatusType.UpstreamBlocked) { - reportAndStoreErrors(next, errors); - if (options.verbose) reportStatus(Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, projName, status.upstreamProjectName); + reportAndStoreErrors(resolvedPath, errors); + if (options.verbose) reportStatus(Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, next, status.upstreamProjectName); continue; } if (status.type === UpToDateStatusType.ContainerOnly) { - reportAndStoreErrors(next, errors); + reportAndStoreErrors(resolvedPath, errors); // Do nothing continue; } - const buildResult = needsBuild(status, next) ? - buildSingleProject(next) : // Actual build - updateBundle(next); // Fake that files have been built by manipulating prepend and existing output + const buildResult = needsBuild(status, proj) ? + buildSingleProject(next, resolvedPath) : // Actual build + updateBundle(next, resolvedPath); // Fake that files have been built by manipulating prepend and existing output anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors); } @@ -1447,20 +1452,18 @@ namespace ts { return anyFailed ? ExitStatus.DiagnosticsPresent_OutputsSkipped : ExitStatus.Success; } - function needsBuild(status: UpToDateStatus, configFile: ResolvedConfigFileName) { + function needsBuild(status: UpToDateStatus, config: ParsedCommandLine) { if (status.type !== UpToDateStatusType.OutOfDateWithPrepend || options.force) return true; - const config = parseConfigFile(configFile); - return !config || - config.fileNames.length === 0 || + return config.fileNames.length === 0 || !!config.errors.length || !isIncrementalCompilation(config.options); } - function reportParseConfigFileDiagnostic(proj: ResolvedConfigFileName) { - reportAndStoreErrors(proj, [configFileCache.getValue(proj) as Diagnostic]); + function reportParseConfigFileDiagnostic(proj: ResolvedConfigFilePath) { + reportAndStoreErrors(proj, [configFileCache.get(proj) as Diagnostic]); } - function reportAndStoreErrors(proj: ResolvedConfigFileName, errors: ReadonlyArray) { + function reportAndStoreErrors(proj: ResolvedConfigFilePath, errors: ReadonlyArray) { reportErrors(errors); projectErrorsReported.setValue(proj, true); diagnostics.setValue(proj, errors); From fd6773f94416008149b9c92b1db22179f5b9d747 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 17:55:15 -0700 Subject: [PATCH 040/384] Diagnostics as ConfigFileMap --- src/compiler/tsbuild.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 17c6d893764..d8d55c346f9 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -357,9 +357,9 @@ namespace ts { // Watch state const builderPrograms = createFileMap(); - const diagnostics = createFileMap>(); + const diagnostics = createMap() as ConfigFileMap>; const projectPendingBuild = createMap() as ConfigFileMap; - const projectErrorsReported = createFileMap(); + const projectErrorsReported = createMap() as ConfigFileMap; let timerToBuildInvalidatedProject: any; let reportFileChangeDetected = false; const { watchFile, watchFilePath, watchDirectory, writeLog } = createWatchFactory(host, options); @@ -852,7 +852,7 @@ namespace ts { buildOrder = undefined; } projectStatus.delete(resolved); - diagnostics.removeKey(resolved); + diagnostics.delete(resolved); addProjToQueue(resolved, reloadLevel); } @@ -920,8 +920,9 @@ namespace ts { if (options.watch || (host as SolutionBuilderHost).reportErrorSummary) { // Report errors from the other projects getBuildOrder().forEach(project => { - if (!projectErrorsReported.hasKey(project)) { - reportErrors(diagnostics.getValue(project) || emptyArray); + const projectPath = toResolvedConfigFilePath(project); + if (!projectErrorsReported.has(projectPath)) { + reportErrors(diagnostics.get(projectPath) || emptyArray); } }); let totalErrors = 0; @@ -1191,7 +1192,7 @@ namespace ts { newestDeclarationFileContentChangedTime: anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime, oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(configFile, !host.useCaseSensitiveFileNames()) }; - diagnostics.removeKey(proj); + diagnostics.delete(resolvedPath); projectStatus.set(resolvedPath, status); afterProgramCreate(proj, program); projectCompilerOptions = baseCompilerOptions; @@ -1284,7 +1285,7 @@ namespace ts { oldestOutputFileName: outputFiles[0].name }; - diagnostics.removeKey(proj); + diagnostics.delete(resolvedPath); projectStatus.set(resolvedPath, status); projectCompilerOptions = baseCompilerOptions; return BuildResultFlags.DeclarationOutputUnchanged; @@ -1465,8 +1466,8 @@ namespace ts { function reportAndStoreErrors(proj: ResolvedConfigFilePath, errors: ReadonlyArray) { reportErrors(errors); - projectErrorsReported.setValue(proj, true); - diagnostics.setValue(proj, errors); + projectErrorsReported.set(proj, true); + diagnostics.set(proj, errors); } function reportErrors(errors: ReadonlyArray) { From 11b21fbba6aa383c04917c0379b0f7c04756a899 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 17:56:50 -0700 Subject: [PATCH 041/384] builderPrograms as ConfigFileMap --- src/compiler/tsbuild.ts | 67 +++++------------------------------------ 1 file changed, 8 insertions(+), 59 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index d8d55c346f9..54094fb62de 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -356,7 +356,7 @@ namespace ts { const buildInfoChecked = createMap() as ConfigFileMap; // Watch state - const builderPrograms = createFileMap(); + const builderPrograms = createMap() as ConfigFileMap; const diagnostics = createMap() as ConfigFileMap>; const projectPendingBuild = createMap() as ConfigFileMap; const projectErrorsReported = createMap() as ConfigFileMap; @@ -396,57 +396,6 @@ namespace ts { return resolvedPath; } - - // TODO remove this and use normal map so we arent transforming paths constantly - function createFileMap(): { - setValue(fileName: ResolvedConfigFileName, value: T): void; - getValue(fileName: ResolvedConfigFileName): T | undefined; - hasKey(fileName: ResolvedConfigFileName): boolean; - removeKey(fileName: ResolvedConfigFileName): void; - forEach(action: (value: T, key: ResolvedConfigFilePath) => void): void; - getSize(): number; - clear(): void; - } { - const lookup = createMap(); - return { - setValue, - getValue, - removeKey, - forEach, - hasKey, - getSize, - clear - }; - - function forEach(action: (value: T, key: ResolvedConfigFilePath) => void) { - lookup.forEach(action); - } - - function hasKey(fileName: ResolvedConfigFileName) { - return lookup.has(toResolvedConfigFilePath(fileName)); - } - - function removeKey(fileName: ResolvedConfigFileName) { - lookup.delete(toResolvedConfigFilePath(fileName)); - } - - function setValue(fileName: ResolvedConfigFileName, value: T) { - lookup.set(toResolvedConfigFilePath(fileName), value); - } - - function getValue(fileName: ResolvedConfigFileName): T | undefined { - return lookup.get(toResolvedConfigFilePath(fileName)); - } - - function getSize() { - return lookup.size; - } - - function clear() { - lookup.clear(); - } - } - function resetBuildContext(opts = defaultOptions) { options = opts; baseCompilerOptions = getCompilerOptionsOfBuildOptions(options); @@ -1116,7 +1065,7 @@ namespace ts { configFile.fileNames, configFile.options, compilerHost, - getOldProgram(proj, configFile), + getOldProgram(resolvedPath, configFile), configFile.errors, configFile.projectReferences ); @@ -1194,7 +1143,7 @@ namespace ts { }; diagnostics.delete(resolvedPath); projectStatus.set(resolvedPath, status); - afterProgramCreate(proj, program); + afterProgramCreate(resolvedPath, program); projectCompilerOptions = baseCompilerOptions; return resultFlags; @@ -1204,7 +1153,7 @@ namespace ts { // List files if any other build error using program (emit errors already report files) if (writeFileName) listFiles(program, writeFileName); projectStatus.set(resolvedPath, { type: UpToDateStatusType.Unbuildable, reason: `${errorType} errors` }); - afterProgramCreate(proj, program); + afterProgramCreate(resolvedPath, program); projectCompilerOptions = baseCompilerOptions; return resultFlags; } @@ -1216,19 +1165,19 @@ namespace ts { } } - function afterProgramCreate(proj: ResolvedConfigFileName, program: T) { + function afterProgramCreate(proj: ResolvedConfigFilePath, program: T) { if (host.afterProgramEmitAndDiagnostics) { host.afterProgramEmitAndDiagnostics(program); } if (options.watch) { program.releaseProgram(); - builderPrograms.setValue(proj, program); + builderPrograms.set(proj, program); } } - function getOldProgram(proj: ResolvedConfigFileName, parsed: ParsedCommandLine) { + function getOldProgram(proj: ResolvedConfigFilePath, parsed: ParsedCommandLine) { if (options.force) return undefined; - const value = builderPrograms.getValue(proj); + const value = builderPrograms.get(proj); if (value) return value; return readBuilderProgram(parsed.options, readFileWithCache) as any as T; } From 65ed413d8ddf80d418bb9df059f2e2201adccbfb Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 18 Apr 2019 18:01:03 -0700 Subject: [PATCH 042/384] Remove resolveProjectName as api --- src/compiler/tsbuild.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 54094fb62de..0042abfcb9f 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -266,8 +266,6 @@ namespace ts { // Testing only // TODO:: All the below ones should technically only be in watch mode. but thats for later time - /*@internal*/ resolveProjectName(name: string): ResolvedConfigFileName; - /*@internal*/ invalidateProject(configFileName: string, reloadLevel?: ConfigFileProgramReloadLevel): void; /*@internal*/ buildInvalidatedProject(): void; @@ -378,8 +376,6 @@ namespace ts { invalidateProject, buildInvalidatedProject, - resolveProjectName, - startWatching }; From ddee617e845c33cbb45fddb914c8914b54a131d7 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 19 Apr 2019 10:11:44 -0700 Subject: [PATCH 043/384] Make SolutionBuilder and SolutionBuilderWithWatch separate --- src/compiler/tsbuild.ts | 95 ++++++++++++-------- src/testRunner/unittests/tsbuild/sample.ts | 55 ++++++++++++ src/testRunner/unittests/tsbuildWatchMode.ts | 13 ++- src/tsc/tsc.ts | 32 ++++--- 4 files changed, 133 insertions(+), 62 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 0042abfcb9f..9ec1b3f99c4 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -236,7 +236,6 @@ namespace ts { export interface SolutionBuilderHostBase extends ProgramHost { getModifiedTime(fileName: string): Date | undefined; setModifiedTime(fileName: string, date: Date): void; - deleteFile(fileName: string): void; reportDiagnostic: DiagnosticReporter; // Technically we want to move it out and allow steps of actions on Solution, but for now just merge stuff in build host here reportSolutionBuilderStatus: DiagnosticReporter; @@ -246,10 +245,11 @@ namespace ts { afterProgramEmitAndDiagnostics?(program: T): void; // For testing - now?(): Date; + /*@internal*/ now?(): Date; } export interface SolutionBuilderHost extends SolutionBuilderHostBase { + deleteFile(fileName: string): void; reportErrorSummary?: ReportEmitErrorSummary; } @@ -262,17 +262,16 @@ namespace ts { // Currently used for testing but can be made public if needed: /*@internal*/ getBuildOrder(): ReadonlyArray; + /*@internal*/ resetBuildContext(opts?: BuildOptions): void; // Testing only - - // TODO:: All the below ones should technically only be in watch mode. but thats for later time + /*@internal*/ getUpToDateStatusOfProject(project: string): UpToDateStatus; /*@internal*/ invalidateProject(configFileName: string, reloadLevel?: ConfigFileProgramReloadLevel): void; /*@internal*/ buildInvalidatedProject(): void; - - /*@internal*/ resetBuildContext(opts?: BuildOptions): void; } - export interface SolutionBuilderWithWatch extends SolutionBuilder { + export interface SolutionBuilderWithWatch { + buildAllProjects(): ExitStatus; /*@internal*/ startWatching(): void; } @@ -291,7 +290,6 @@ namespace ts { const host = createProgramHost(system, createProgram) as SolutionBuilderHostBase; host.getModifiedTime = system.getModifiedTime ? path => system.getModifiedTime!(path) : returnUndefined; host.setModifiedTime = system.setModifiedTime ? (path, date) => system.setModifiedTime!(path, date) : noop; - host.deleteFile = system.deleteFile ? path => system.deleteFile!(path) : noop; host.reportDiagnostic = reportDiagnostic || createDiagnosticReporter(system); host.reportSolutionBuilderStatus = reportSolutionBuilderStatus || createBuilderStatusReporter(system); return host; @@ -299,6 +297,7 @@ namespace ts { export function createSolutionBuilderHost(system = sys, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportErrorSummary?: ReportEmitErrorSummary) { const host = createSolutionBuilderHostBase(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus) as SolutionBuilderHost; + host.deleteFile = system.deleteFile ? path => system.deleteFile!(path) : noop; host.reportErrorSummary = reportErrorSummary; return host; } @@ -318,16 +317,23 @@ namespace ts { return result; } + export function createSolutionBuilder(host: SolutionBuilderHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder { + return createSolutionBuilderWorker(/*watch*/ false, host, rootNames, defaultOptions); + } + + export function createSolutionBuilderWithWatch(host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilderWithWatch { + return createSolutionBuilderWorker(/*watch*/ true, host, rootNames, defaultOptions); + } + /** * A SolutionBuilder has an immutable set of rootNames that are the "entry point" projects, but * can dynamically add/remove other projects based on changes on the rootNames' references - * TODO: use SolutionBuilderWithWatchHost => watchedSolution - * use SolutionBuilderHost => Solution */ - export function createSolutionBuilder(host: SolutionBuilderHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; - export function createSolutionBuilder(host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilderWithWatch; - export function createSolutionBuilder(host: SolutionBuilderHost | SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilderWithWatch { - const hostWithWatch = host as SolutionBuilderWithWatchHost; + function createSolutionBuilderWorker(watch: false, host: SolutionBuilderHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; + function createSolutionBuilderWorker(watch: true, host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilderWithWatch; + function createSolutionBuilderWorker(watch: boolean, hostOrHostWithWatch: SolutionBuilderHost | SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder | SolutionBuilderWithWatch { + const host = hostOrHostWithWatch as SolutionBuilderHost; + const hostWithWatch = hostOrHostWithWatch as SolutionBuilderWithWatchHost; const currentDirectory = host.getCurrentDirectory(); const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames()); const parseConfigFileHost = parseConfigHostFromCompilerHostLike(host); @@ -360,24 +366,27 @@ namespace ts { const projectErrorsReported = createMap() as ConfigFileMap; let timerToBuildInvalidatedProject: any; let reportFileChangeDetected = false; - const { watchFile, watchFilePath, watchDirectory, writeLog } = createWatchFactory(host, options); + const { watchFile, watchFilePath, watchDirectory, writeLog } = createWatchFactory(hostWithWatch, options); // Watches for the solution const allWatchedWildcardDirectories = createMap() as ConfigFileMap>; const allWatchedInputFiles = createMap() as ConfigFileMap>; const allWatchedConfigFiles = createMap() as ConfigFileMap; - return { - buildAllProjects, - cleanAllProjects, - resetBuildContext, - getBuildOrder, - - invalidateProject, - buildInvalidatedProject, - - startWatching - }; + return watch ? + { + buildAllProjects, + startWatching + } : + { + buildAllProjects, + cleanAllProjects, + getBuildOrder, + resetBuildContext, + getUpToDateStatusOfProject, + invalidateProject, + buildInvalidatedProject, + }; function toPath(fileName: string) { return ts.toPath(fileName, currentDirectory, getCanonicalFileName); @@ -392,8 +401,8 @@ namespace ts { return resolvedPath; } - function resetBuildContext(opts = defaultOptions) { - options = opts; + function resetBuildContext(opts?: BuildOptions) { + options = opts || defaultOptions; baseCompilerOptions = getCompilerOptionsOfBuildOptions(options); resolvedConfigFilePaths.clear(); configFileCache.clear(); @@ -462,7 +471,7 @@ namespace ts { } function watchConfigFile(resolved: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath) { - if (options.watch && !allWatchedConfigFiles.has(resolvedPath)) { + if (watch && !allWatchedConfigFiles.has(resolvedPath)) { allWatchedConfigFiles.set(resolvedPath, watchFile( hostWithWatch, resolved, @@ -477,7 +486,7 @@ namespace ts { } function watchWildCardDirectories(resolved: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, parsed: ParsedCommandLine) { - if (!options.watch) return; + if (!watch) return; updateWatchingWildcardDirectories( getOrCreateValueMapFromConfigFileMap(allWatchedWildcardDirectories, resolvedPath), createMapFromTemplate(parsed.configFileSpecs!.wildcardDirectories), @@ -508,7 +517,7 @@ namespace ts { } function watchInputFiles(resolved: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, parsed: ParsedCommandLine) { - if (!options.watch) return; + if (!watch) return; mutateMap( getOrCreateValueMapFromConfigFileMap(allWatchedInputFiles, resolvedPath), arrayToMap(parsed.fileNames, toPath), @@ -565,8 +574,14 @@ namespace ts { scheduleBuildInvalidatedProject(); } + function getUpToDateStatusOfProject(project: string): UpToDateStatus { + const configFileName = resolveProjectName(project); + const configFilePath = toResolvedConfigFilePath(configFileName); + return getUpToDateStatus(parseConfigFile(configFileName, configFilePath), configFilePath); + } + function getBuildOrder() { - return buildOrder || (buildOrder = createBuildOrder(rootNames.map(resolveProjectName))); + return buildOrder || (buildOrder = createBuildOrder(resolveProjectNames(rootNames))); } function getUpToDateStatus(project: ParsedCommandLine | undefined, resolvedPath: ResolvedConfigFilePath): UpToDateStatus { @@ -851,7 +866,7 @@ namespace ts { if (buildProject) { buildSingleInvalidatedProject(buildProject.project, buildProject.reloadLevel); if (hasPendingInvalidatedProjects()) { - if (options.watch && !timerToBuildInvalidatedProject) { + if (watch && !timerToBuildInvalidatedProject) { scheduleBuildInvalidatedProject(); } } @@ -862,7 +877,7 @@ namespace ts { } function reportErrorSummary() { - if (options.watch || (host as SolutionBuilderHost).reportErrorSummary) { + if (watch || host.reportErrorSummary) { // Report errors from the other projects getBuildOrder().forEach(project => { const projectPath = toResolvedConfigFilePath(project); @@ -872,11 +887,11 @@ namespace ts { }); let totalErrors = 0; diagnostics.forEach(singleProjectErrors => totalErrors += getErrorCountForSummary(singleProjectErrors)); - if (options.watch) { + if (watch) { reportWatchStatus(getWatchErrorSummaryDiagnosticMessage(totalErrors), totalErrors); } else { - (host as SolutionBuilderHost).reportErrorSummary!(totalErrors); + host.reportErrorSummary!(totalErrors); } } } @@ -1165,7 +1180,7 @@ namespace ts { if (host.afterProgramEmitAndDiagnostics) { host.afterProgramEmitAndDiagnostics(program); } - if (options.watch) { + if (watch) { program.releaseProgram(); builderPrograms.set(proj, program); } @@ -1312,8 +1327,12 @@ namespace ts { return resolveConfigFileProjectName(resolvePath(host.getCurrentDirectory(), name)); } + function resolveProjectNames(configFileNames: ReadonlyArray): ResolvedConfigFileName[] { + return configFileNames.map(resolveProjectName); + } + function buildAllProjects(): ExitStatus { - if (options.watch) { reportWatchStatus(Diagnostics.Starting_compilation_in_watch_mode); } + if (watch) { reportWatchStatus(Diagnostics.Starting_compilation_in_watch_mode); } // TODO:: In watch mode as well to use caches for incremental build once we can invalidate caches correctly and have right api // Override readFile for json files and output .d.ts to cache the text const savedReadFileWithCache = readFileWithCache; diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 2621bd303ea..c004f53d38e 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -337,6 +337,61 @@ namespace ts { }); }); + describe("project invalidation", () => { + it("invalidates projects correctly", () => { + const fs = projFs.shadow(); + const host = new fakes.SolutionBuilderHost(fs); + const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); + + builder.buildAllProjects(); + host.assertDiagnosticMessages(/*empty*/); + + // Update a timestamp in the middle project + tick(); + appendText(fs, "/src/logic/index.ts", "function foo() {}"); + const originalWriteFile = fs.writeFileSync; + const writtenFiles = createMap(); + fs.writeFileSync = (path, data, encoding) => { + writtenFiles.set(path, true); + originalWriteFile.call(fs, path, data, encoding); + }; + // Because we haven't reset the build context, the builder should assume there's nothing to do right now + const status = builder.getUpToDateStatusOfProject("/src/logic"); + assert.equal(status.type, UpToDateStatusType.UpToDate, "Project should be assumed to be up-to-date"); + verifyInvalidation(/*expectedToWriteTests*/ false); + + // Rebuild this project + fs.writeFileSync("/src/logic/index.ts", `${fs.readFileSync("/src/logic/index.ts")} +export class cNew {}`); + verifyInvalidation(/*expectedToWriteTests*/ true); + + function verifyInvalidation(expectedToWriteTests: boolean) { + // Rebuild this project + tick(); + builder.invalidateProject("/src/logic"); + builder.buildInvalidatedProject(); + // The file should be updated + assert.isTrue(writtenFiles.has("/src/logic/index.js"), "JS file should have been rebuilt"); + assert.equal(fs.statSync("/src/logic/index.js").mtimeMs, time(), "JS file should have been rebuilt"); + assert.isFalse(writtenFiles.has("/src/tests/index.js"), "Downstream JS file should *not* have been rebuilt"); + assert.isBelow(fs.statSync("/src/tests/index.js").mtimeMs, time(), "Downstream JS file should *not* have been rebuilt"); + writtenFiles.clear(); + + // Build downstream projects should update 'tests', but not 'core' + tick(); + builder.buildInvalidatedProject(); + if (expectedToWriteTests) { + assert.isTrue(writtenFiles.has("/src/tests/index.js"), "Downstream JS file should have been rebuilt"); + } + else { + assert.equal(writtenFiles.size, 0, "Should not write any new files"); + } + assert.equal(fs.statSync("/src/tests/index.js").mtimeMs, time(), "Downstream JS file should have new timestamp"); + assert.isBelow(fs.statSync("/src/core/index.js").mtimeMs, time(), "Upstream JS file should not have been rebuilt"); + } + }); + }); + describe("lists files", () => { it("listFiles", () => { const fs = projFs.shadow(); diff --git a/src/testRunner/unittests/tsbuildWatchMode.ts b/src/testRunner/unittests/tsbuildWatchMode.ts index 005956a98ad..ef87aa1f9cb 100644 --- a/src/testRunner/unittests/tsbuildWatchMode.ts +++ b/src/testRunner/unittests/tsbuildWatchMode.ts @@ -17,12 +17,13 @@ namespace ts.tscWatch { } export function createSolutionBuilder(system: WatchedSystem, rootNames: ReadonlyArray, defaultOptions?: BuildOptions) { - const host = createSolutionBuilderWithWatchHost(system); - return ts.createSolutionBuilder(host, rootNames, defaultOptions || { watch: true }); + const host = createSolutionBuilderHost(system); + return ts.createSolutionBuilder(host, rootNames, defaultOptions || {}); } - function createSolutionBuilderWithWatch(host: TsBuildWatchSystem, rootNames: ReadonlyArray, defaultOptions?: BuildOptions) { - const solutionBuilder = createSolutionBuilder(host, rootNames, defaultOptions); + function createSolutionBuilderWithWatch(system: TsBuildWatchSystem, rootNames: ReadonlyArray, defaultOptions?: BuildOptions) { + const host = createSolutionBuilderWithWatchHost(system); + const solutionBuilder = ts.createSolutionBuilderWithWatch(host, rootNames, defaultOptions || { watch: true }); solutionBuilder.buildAllProjects(); solutionBuilder.startWatching(); return solutionBuilder; @@ -1140,9 +1141,7 @@ export function gfoo() { it("incremental updates in verbose mode", () => { const host = createTsBuildWatchSystem(allFiles, { currentDirectory: projectsLocation }); - const solutionBuilder = createSolutionBuilder(host, [`${project}/${SubProject.tests}`], { verbose: true, watch: true }); - solutionBuilder.buildAllProjects(); - solutionBuilder.startWatching(); + createSolutionBuilderWithWatch(host, [`${project}/${SubProject.tests}`], { verbose: true, watch: true }); checkOutputErrorsInitial(host, emptyArray, /*disableConsoleClears*/ undefined, [ `Projects in this build: \r\n * sample1/core/tsconfig.json\r\n * sample1/logic/tsconfig.json\r\n * sample1/tests/tsconfig.json\n\n`, `Project 'sample1/core/tsconfig.json' is out of date because output file 'sample1/core/anotherModule.js' does not exist\n\n`, diff --git a/src/tsc/tsc.ts b/src/tsc/tsc.ts index 500480463bd..35bd29ea774 100644 --- a/src/tsc/tsc.ts +++ b/src/tsc/tsc.ts @@ -183,6 +183,9 @@ namespace ts { function performBuild(args: string[]) { const { buildOptions, projects, errors } = parseBuildCommand(args); + // Update to pretty if host supports it + updateReportDiagnostic(buildOptions); + if (errors.length > 0) { errors.forEach(reportDiagnostic); return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); @@ -194,8 +197,6 @@ namespace ts { return sys.exit(ExitStatus.Success); } - // Update to pretty if host supports it - updateReportDiagnostic(buildOptions); if (projects.length === 0) { printVersion(); printHelp(buildOpts, "--build "); @@ -210,24 +211,21 @@ namespace ts { reportWatchModeWithoutSysSupport(); } - // Use default createProgram - const buildHost = buildOptions.watch ? - createSolutionBuilderWithWatchHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty(buildOptions)), createWatchStatusReporter(buildOptions)) : - createSolutionBuilderHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty(buildOptions)), createReportErrorSummary(buildOptions)); - updateCreateProgram(buildHost); - buildHost.afterProgramEmitAndDiagnostics = (program: BuilderProgram) => reportStatistics(program.getProgram()); - - const builder = createSolutionBuilder(buildHost, projects, buildOptions); - if (buildOptions.clean) { - return sys.exit(builder.cleanAllProjects()); - } - if (buildOptions.watch) { + const buildHost = createSolutionBuilderWithWatchHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty(buildOptions)), createWatchStatusReporter(buildOptions)); + updateCreateProgram(buildHost); + buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(program.getProgram()); + const builder = createSolutionBuilderWithWatch(buildHost, projects, buildOptions); builder.buildAllProjects(); - return (builder as SolutionBuilderWithWatch).startWatching(); + return builder.startWatching(); + } + else { + const buildHost = createSolutionBuilderHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty(buildOptions)), createReportErrorSummary(buildOptions)); + updateCreateProgram(buildHost); + buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(program.getProgram()); + const builder = createSolutionBuilder(buildHost, projects, buildOptions); + return sys.exit(buildOptions.clean ? builder.cleanAllProjects() : builder.buildAllProjects()); } - - return sys.exit(builder.buildAllProjects()); } function createReportErrorSummary(options: CompilerOptions | BuildOptions): ReportEmitErrorSummary | undefined { From 4b572bea3703cc12b9086a6f4bbfcda4fca58897 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 19 Apr 2019 14:16:29 -0700 Subject: [PATCH 044/384] Instead of having two separate paths for building projects, (build all or invalidated use single path) --- src/compiler/tsbuild.ts | 210 +++++++++++++++++++--------------------- 1 file changed, 102 insertions(+), 108 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 9ec1b3f99c4..5690851e0b8 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -195,7 +195,6 @@ namespace ts { } type ResolvedConfigFilePath = ResolvedConfigFileName & Path; - interface FileMap extends Map { get(key: U): T | undefined; has(key: U): boolean; @@ -208,7 +207,6 @@ namespace ts { delete(key: U): boolean; clear(): void; } - type ConfigFileMap = FileMap; function getOrCreateValueFromConfigFileMap(configFileMap: ConfigFileMap, resolved: ResolvedConfigFilePath, createT: () => T): T { @@ -811,10 +809,13 @@ namespace ts { configFileCache.delete(resolved); buildOrder = undefined; } + clearProjectStatus(resolved); + addProjToQueue(resolved, reloadLevel); + } + + function clearProjectStatus(resolved: ResolvedConfigFilePath) { projectStatus.delete(resolved); diagnostics.delete(resolved); - - addProjToQueue(resolved, reloadLevel); } /** @@ -896,87 +897,121 @@ namespace ts { } } - function buildSingleInvalidatedProject(resolved: ResolvedConfigFileName, reloadLevel: ConfigFileProgramReloadLevel) { - const resolvedPath = toResolvedConfigFilePath(resolved); - const proj = parseConfigFile(resolved, resolvedPath); - if (!proj) { - reportParseConfigFileDiagnostic(resolvedPath); + function buildSingleInvalidatedProject(project: ResolvedConfigFileName, reloadLevel: ConfigFileProgramReloadLevel) { + const projectPath = toResolvedConfigFilePath(project); + const config = parseConfigFile(project, projectPath); + if (!config) { + reportParseConfigFileDiagnostic(projectPath); return; } if (reloadLevel === ConfigFileProgramReloadLevel.Full) { - watchConfigFile(resolved, resolvedPath); - watchWildCardDirectories(resolved, resolvedPath, proj); - watchInputFiles(resolved, resolvedPath, proj); + watchConfigFile(project, projectPath); + watchWildCardDirectories(project, projectPath, config); + watchInputFiles(project, projectPath, config); } else if (reloadLevel === ConfigFileProgramReloadLevel.Partial) { // Update file names - const result = getFileNamesFromConfigSpecs(proj.configFileSpecs!, getDirectoryPath(resolved), proj.options, parseConfigFileHost); - updateErrorForNoInputFiles(result, resolved, proj.configFileSpecs!, proj.errors, canJsonReportNoInutFiles(proj.raw)); - proj.fileNames = result.fileNames; - watchInputFiles(resolved, resolvedPath, proj); + const result = getFileNamesFromConfigSpecs(config.configFileSpecs!, getDirectoryPath(project), config.options, parseConfigFileHost); + updateErrorForNoInputFiles(result, project, config.configFileSpecs!, config.errors, canJsonReportNoInutFiles(config.raw)); + config.fileNames = result.fileNames; + watchInputFiles(project, projectPath, config); } - const status = getUpToDateStatus(proj, resolvedPath); - verboseReportProjectStatus(resolved, status); + const status = getUpToDateStatus(config, projectPath); + verboseReportProjectStatus(project, status); + if (status.type === UpToDateStatusType.UpToDate && !options.force) { + reportAndStoreErrors(projectPath, config.errors); + // Up to date, skip + if (options.dry) { + // In a dry build, inform the user of this fact + reportStatus(Diagnostics.Project_0_is_up_to_date, project); + } + return; + } + + if (status.type === UpToDateStatusType.UpToDateWithUpstreamTypes && !options.force) { + reportAndStoreErrors(projectPath, config.errors); + // Fake that files have been built by updating output file stamps + updateOutputTimestamps(config, projectPath); + return; + } if (status.type === UpToDateStatusType.UpstreamBlocked) { - if (options.verbose) reportStatus(Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, resolved, status.upstreamProjectName); + reportAndStoreErrors(projectPath, config.errors); + if (options.verbose) reportStatus(Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, project, status.upstreamProjectName); return; } - if (status.type === UpToDateStatusType.UpToDateWithUpstreamTypes) { - // Fake that files have been built by updating output file stamps - updateOutputTimestamps(proj, resolvedPath); + if (status.type === UpToDateStatusType.ContainerOnly) { + reportAndStoreErrors(projectPath, config.errors); + // Do nothing return; } - const buildResult = needsBuild(status, proj) ? - buildSingleProject(resolved, resolvedPath) : // Actual build - updateBundle(resolved, resolvedPath); // Fake that files have been built by manipulating prepend and existing output - if (buildResult & BuildResultFlags.AnyErrors) return; - + const buildResult = needsBuild(status, config) ? + buildSingleProject(project, projectPath) : // Actual build + updateBundle(project, projectPath); // Fake that files have been built by manipulating prepend and existing output // Only composite projects can be referenced by other projects - if (!proj.options.composite) return; - const buildOrder = getBuildOrder(); + if (!(buildResult & BuildResultFlags.AnyErrors) && config.options.composite) { + queueReferencingProjects(project, projectPath, !(buildResult & BuildResultFlags.DeclarationOutputUnchanged)); + } + } + function queueReferencingProjects(project: ResolvedConfigFileName, projectPath: ResolvedConfigFilePath, declarationOutputChanged: boolean) { // Always use build order to queue projects - for (let index = buildOrder.indexOf(resolved) + 1; index < buildOrder.length; index++) { - const project = buildOrder[index]; - const projectPath = toResolvedConfigFilePath(project); - if (projectPendingBuild.has(projectPath)) continue; + const buildOrder = getBuildOrder(); + for (let index = buildOrder.indexOf(project) + 1; index < buildOrder.length; index++) { + const nextProject = buildOrder[index]; + const nextProjectPath = toResolvedConfigFilePath(nextProject); + if (projectPendingBuild.has(nextProjectPath)) continue; - const config = parseConfigFile(project, projectPath); - if (!config || !config.projectReferences) continue; - for (const ref of config.projectReferences) { + const nextProjectConfig = parseConfigFile(nextProject, nextProjectPath); + if (!nextProjectConfig || !nextProjectConfig.projectReferences) continue; + for (const ref of nextProjectConfig.projectReferences) { const resolvedRefPath = resolveProjectName(ref.path); - if (toResolvedConfigFilePath(resolvedRefPath) !== resolvedPath) continue; + if (toResolvedConfigFilePath(resolvedRefPath) !== projectPath) continue; // If the project is referenced with prepend, always build downstream projects, // If declaration output is changed, build the project // otherwise mark the project UpToDateWithUpstreamTypes so it updates output time stamps - const status = projectStatus.get(projectPath); - if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) { - if (status && (status.type === UpToDateStatusType.UpToDate || status.type === UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === UpToDateStatusType.OutOfDateWithPrepend)) { - projectStatus.set(projectPath, { - type: UpToDateStatusType.OutOfDateWithUpstream, - outOfDateOutputFileName: status.type === UpToDateStatusType.OutOfDateWithPrepend ? status.outOfDateOutputFileName : status.oldestOutputFileName, - newerProjectName: resolved - }); + const status = projectStatus.get(nextProjectPath); + if (status) { + switch (status.type) { + case UpToDateStatusType.UpToDate: + if (!declarationOutputChanged) { + if (ref.prepend) { + projectStatus.set(nextProjectPath, { + type: UpToDateStatusType.OutOfDateWithPrepend, + outOfDateOutputFileName: status.oldestOutputFileName, + newerProjectName: project + }); + } + else { + status.type = UpToDateStatusType.UpToDateWithUpstreamTypes; + } + break; + } + + // falls through + case UpToDateStatusType.UpToDateWithUpstreamTypes: + case UpToDateStatusType.OutOfDateWithPrepend: + if (declarationOutputChanged) { + projectStatus.set(nextProjectPath, { + type: UpToDateStatusType.OutOfDateWithUpstream, + outOfDateOutputFileName: status.type === UpToDateStatusType.OutOfDateWithPrepend ? status.outOfDateOutputFileName : status.oldestOutputFileName, + newerProjectName: project + }); + } + break; + + case UpToDateStatusType.UpstreamBlocked: + if (toResolvedConfigFilePath(resolveProjectName(status.upstreamProjectName)) === projectPath) { + clearProjectStatus(nextProjectPath); + } + break; } } - else if (status && status.type === UpToDateStatusType.UpToDate) { - if (ref.prepend) { - projectStatus.set(projectPath, { - type: UpToDateStatusType.OutOfDateWithPrepend, - outOfDateOutputFileName: status.oldestOutputFileName, - newerProjectName: resolved - }); - } - else { - status.type = UpToDateStatusType.UpToDateWithUpstreamTypes; - } - } - addProjToQueue(projectPath, ConfigFileProgramReloadLevel.None); + addProjToQueue(nextProjectPath, ConfigFileProgramReloadLevel.None); break; } } @@ -1354,55 +1389,12 @@ namespace ts { const buildOrder = getBuildOrder(); reportBuildQueue(buildOrder); - let anyFailed = false; - for (const next of buildOrder) { - const resolvedPath = toResolvedConfigFilePath(next); - const proj = parseConfigFile(next, resolvedPath); - if (proj === undefined) { - reportParseConfigFileDiagnostic(resolvedPath); - anyFailed = true; - break; - } + buildOrder.forEach(configFileName => + projectPendingBuild.set(toResolvedConfigFilePath(configFileName), ConfigFileProgramReloadLevel.None)); - // report errors early when using continue or break statements - const errors = proj.errors; - const status = getUpToDateStatus(proj, resolvedPath); - verboseReportProjectStatus(next, status); - - if (status.type === UpToDateStatusType.UpToDate && !options.force) { - reportAndStoreErrors(resolvedPath, errors); - // Up to date, skip - if (defaultOptions.dry) { - // In a dry build, inform the user of this fact - reportStatus(Diagnostics.Project_0_is_up_to_date, next); - } - continue; - } - - if (status.type === UpToDateStatusType.UpToDateWithUpstreamTypes && !options.force) { - reportAndStoreErrors(resolvedPath, errors); - // Fake build - updateOutputTimestamps(proj, resolvedPath); - continue; - } - - if (status.type === UpToDateStatusType.UpstreamBlocked) { - reportAndStoreErrors(resolvedPath, errors); - if (options.verbose) reportStatus(Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, next, status.upstreamProjectName); - continue; - } - - if (status.type === UpToDateStatusType.ContainerOnly) { - reportAndStoreErrors(resolvedPath, errors); - // Do nothing - continue; - } - - const buildResult = needsBuild(status, proj) ? - buildSingleProject(next, resolvedPath) : // Actual build - updateBundle(next, resolvedPath); // Fake that files have been built by manipulating prepend and existing output - - anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors); + while (hasPendingInvalidatedProjects()) { + const buildProject = getNextInvalidatedProject()!; + buildSingleInvalidatedProject(buildProject.project, buildProject.reloadLevel); } reportErrorSummary(); host.readFile = originalReadFile; @@ -1414,7 +1406,7 @@ namespace ts { readFileWithCache = savedReadFileWithCache; compilerHost.resolveModuleNames = originalResolveModuleNames; moduleResolutionCache = undefined; - return anyFailed ? ExitStatus.DiagnosticsPresent_OutputsSkipped : ExitStatus.Success; + return diagnostics.size ? ExitStatus.DiagnosticsPresent_OutputsSkipped : ExitStatus.Success; } function needsBuild(status: UpToDateStatus, config: ParsedCommandLine) { @@ -1431,7 +1423,9 @@ namespace ts { function reportAndStoreErrors(proj: ResolvedConfigFilePath, errors: ReadonlyArray) { reportErrors(errors); projectErrorsReported.set(proj, true); - diagnostics.set(proj, errors); + if (errors.length) { + diagnostics.set(proj, errors); + } } function reportErrors(errors: ReadonlyArray) { From 04a972b9f384738769e90e133e88340d64cbc043 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 19 Apr 2019 15:13:55 -0700 Subject: [PATCH 045/384] More refactoring --- src/compiler/tsbuild.ts | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 5690851e0b8..1b298f248f2 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -832,14 +832,15 @@ namespace ts { } function getNextInvalidatedProject() { - for (const project of getBuildOrder()) { + Debug.assert(hasPendingInvalidatedProjects()); + return forEach(getBuildOrder(), (project, projectIndex) => { const projectPath = toResolvedConfigFilePath(project); const reloadLevel = projectPendingBuild.get(projectPath); if (reloadLevel !== undefined) { projectPendingBuild.delete(projectPath); - return { project, reloadLevel }; + return { project, projectPath, reloadLevel, projectIndex }; } - } + }); } function hasPendingInvalidatedProjects() { @@ -863,9 +864,8 @@ namespace ts { projectErrorsReported.clear(); reportWatchStatus(Diagnostics.File_change_detected_Starting_incremental_compilation); } - const buildProject = getNextInvalidatedProject(); - if (buildProject) { - buildSingleInvalidatedProject(buildProject.project, buildProject.reloadLevel); + if (hasPendingInvalidatedProjects()) { + buildNextInvalidatedProject(); if (hasPendingInvalidatedProjects()) { if (watch && !timerToBuildInvalidatedProject) { scheduleBuildInvalidatedProject(); @@ -897,8 +897,8 @@ namespace ts { } } - function buildSingleInvalidatedProject(project: ResolvedConfigFileName, reloadLevel: ConfigFileProgramReloadLevel) { - const projectPath = toResolvedConfigFilePath(project); + function buildNextInvalidatedProject() { + const { project, projectPath, reloadLevel, projectIndex } = getNextInvalidatedProject()!; const config = parseConfigFile(project, projectPath); if (!config) { reportParseConfigFileDiagnostic(projectPath); @@ -954,14 +954,14 @@ namespace ts { updateBundle(project, projectPath); // Fake that files have been built by manipulating prepend and existing output // Only composite projects can be referenced by other projects if (!(buildResult & BuildResultFlags.AnyErrors) && config.options.composite) { - queueReferencingProjects(project, projectPath, !(buildResult & BuildResultFlags.DeclarationOutputUnchanged)); + queueReferencingProjects(project, projectPath, projectIndex, !(buildResult & BuildResultFlags.DeclarationOutputUnchanged)); } } - function queueReferencingProjects(project: ResolvedConfigFileName, projectPath: ResolvedConfigFilePath, declarationOutputChanged: boolean) { + function queueReferencingProjects(project: ResolvedConfigFileName, projectPath: ResolvedConfigFilePath, projectIndex: number, declarationOutputChanged: boolean) { // Always use build order to queue projects const buildOrder = getBuildOrder(); - for (let index = buildOrder.indexOf(project) + 1; index < buildOrder.length; index++) { + for (let index = projectIndex + 1; index < buildOrder.length; index++) { const nextProject = buildOrder[index]; const nextProjectPath = toResolvedConfigFilePath(nextProject); if (projectPendingBuild.has(nextProjectPath)) continue; @@ -1393,8 +1393,7 @@ namespace ts { projectPendingBuild.set(toResolvedConfigFilePath(configFileName), ConfigFileProgramReloadLevel.None)); while (hasPendingInvalidatedProjects()) { - const buildProject = getNextInvalidatedProject()!; - buildSingleInvalidatedProject(buildProject.project, buildProject.reloadLevel); + buildNextInvalidatedProject(); } reportErrorSummary(); host.readFile = originalReadFile; From 1a75c62ceb077454b3d2e5bd652690da136f54e6 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 19 Apr 2019 15:37:23 -0700 Subject: [PATCH 046/384] Remove resetBuildContext --- src/compiler/tsbuild.ts | 29 ++----------------- src/testRunner/unittests/tsbuild/outFile.ts | 14 ++++----- .../unittests/tsbuild/resolveJsonModule.ts | 12 ++++---- src/testRunner/unittests/tsbuild/sample.ts | 9 +++--- 4 files changed, 19 insertions(+), 45 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 1b298f248f2..5d36be72314 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -260,7 +260,6 @@ namespace ts { // Currently used for testing but can be made public if needed: /*@internal*/ getBuildOrder(): ReadonlyArray; - /*@internal*/ resetBuildContext(opts?: BuildOptions): void; // Testing only /*@internal*/ getUpToDateStatusOfProject(project: string): UpToDateStatus; @@ -337,8 +336,8 @@ namespace ts { const parseConfigFileHost = parseConfigHostFromCompilerHostLike(host); // State of the solution - let options = defaultOptions; - let baseCompilerOptions = getCompilerOptionsOfBuildOptions(options); + const options = defaultOptions; + const baseCompilerOptions = getCompilerOptionsOfBuildOptions(options); const resolvedConfigFilePaths = createMap(); type ConfigFileCacheEntry = ParsedCommandLine | Diagnostic; const configFileCache = createMap() as ConfigFileMap; @@ -380,7 +379,6 @@ namespace ts { buildAllProjects, cleanAllProjects, getBuildOrder, - resetBuildContext, getUpToDateStatusOfProject, invalidateProject, buildInvalidatedProject, @@ -399,29 +397,6 @@ namespace ts { return resolvedPath; } - function resetBuildContext(opts?: BuildOptions) { - options = opts || defaultOptions; - baseCompilerOptions = getCompilerOptionsOfBuildOptions(options); - resolvedConfigFilePaths.clear(); - configFileCache.clear(); - projectStatus.clear(); - buildOrder = undefined; - buildInfoChecked.clear(); - - diagnostics.clear(); - projectPendingBuild.clear(); - projectErrorsReported.clear(); - if (timerToBuildInvalidatedProject) { - clearTimeout(timerToBuildInvalidatedProject); - timerToBuildInvalidatedProject = undefined; - } - reportFileChangeDetected = false; - clearMap(allWatchedWildcardDirectories, wildCardWatches => clearMap(wildCardWatches, closeFileWatcherOf)); - clearMap(allWatchedInputFiles, inputFileWatches => clearMap(inputFileWatches, closeFileWatcher)); - clearMap(allWatchedConfigFiles, closeFileWatcher); - builderPrograms.clear(); - } - function isParsedCommandLine(entry: ConfigFileCacheEntry): entry is ParsedCommandLine { return !!(entry as ParsedCommandLine).options; } diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index 48beeef4f61..20061c86a7b 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -388,7 +388,7 @@ namespace ts { ...outputFiles[project.third] ]; const host = new fakes.SolutionBuilderHost(fs); - const builder = createSolutionBuilder(host); + let builder = createSolutionBuilder(host); builder.buildAllProjects(); host.assertDiagnosticMessages(...initialExpectedDiagnostics); // Verify they exist @@ -398,7 +398,7 @@ namespace ts { // Delete bundle info host.clearDiagnostics(); host.deleteFile(outputFiles[project.first][ext.buildinfo]); - builder.resetBuildContext(); + builder = createSolutionBuilder(host); builder.buildAllProjects(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), @@ -428,11 +428,11 @@ namespace ts { it("rebuilds completely when version in tsbuildinfo doesnt match ts version", () => { const fs = outFileFs.shadow(); const host = new fakes.SolutionBuilderHost(fs); - const builder = createSolutionBuilder(host); + let builder = createSolutionBuilder(host); builder.buildAllProjects(); host.assertDiagnosticMessages(...initialExpectedDiagnostics); host.clearDiagnostics(); - builder.resetBuildContext(); + builder = createSolutionBuilder(host); changeCompilerVersion(host); builder.buildAllProjects(); host.assertDiagnosticMessages( @@ -453,7 +453,7 @@ namespace ts { // Build with command line incremental const host = new fakes.SolutionBuilderHost(fs); - const builder = createSolutionBuilder(host, { incremental: true }); + let builder = createSolutionBuilder(host, { incremental: true }); builder.buildAllProjects(); host.assertDiagnosticMessages(...initialExpectedDiagnostics); host.clearDiagnostics(); @@ -461,7 +461,7 @@ namespace ts { // Make non incremental build with change in file that doesnt affect dts appendText(fs, relSources[project.first][source.ts][part.one], "console.log(s);"); - builder.resetBuildContext({ verbose: true }); + builder = createSolutionBuilder(host, { verbose: true }); builder.buildAllProjects(); host.assertDiagnosticMessages(getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relSources[project.first][source.config], relOutputFiles[project.first][ext.js], relSources[project.first][source.ts][part.one]], @@ -475,7 +475,7 @@ namespace ts { // Make incremental build with change in file that doesnt affect dts appendText(fs, relSources[project.first][source.ts][part.one], "console.log(s);"); - builder.resetBuildContext({ verbose: true, incremental: true }); + builder = createSolutionBuilder(host, { verbose: true, incremental: true }); builder.buildAllProjects(); // Builds completely because tsbuildinfo is old. host.assertDiagnosticMessages( diff --git a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts index 3fc50d72ea5..d2555a730a2 100644 --- a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts +++ b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts @@ -64,7 +64,7 @@ export default hello.hello`); const configFile = "src/tsconfig_withFiles.json"; replaceText(fs, configFile, `"composite": true,`, `"composite": true, "sourceMap": true,`); const host = new fakes.SolutionBuilderHost(fs); - const builder = createSolutionBuilder(host, [configFile], { verbose: true }); + let builder = createSolutionBuilder(host, [configFile], { verbose: true }); builder.buildAllProjects(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild(configFile), @@ -75,7 +75,7 @@ export default hello.hello`); assert(fs.existsSync(output), `Expect file ${output} to exist`); } host.clearDiagnostics(); - builder.resetBuildContext(); + builder = createSolutionBuilder(host, [configFile], { verbose: true }); tick(); builder.buildAllProjects(); host.assertDiagnosticMessages( @@ -89,7 +89,7 @@ export default hello.hello`); const configFile = "src/tsconfig_withFiles.json"; replaceText(fs, configFile, `"outDir": "dist",`, ""); const host = new fakes.SolutionBuilderHost(fs); - const builder = createSolutionBuilder(host, [configFile], { verbose: true }); + let builder = createSolutionBuilder(host, [configFile], { verbose: true }); builder.buildAllProjects(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild(configFile), @@ -100,7 +100,7 @@ export default hello.hello`); assert(fs.existsSync(output), `Expect file ${output} to exist`); } host.clearDiagnostics(); - builder.resetBuildContext(); + builder = createSolutionBuilder(host, [configFile], { verbose: true }); tick(); builder.buildAllProjects(); host.assertDiagnosticMessages( @@ -128,7 +128,7 @@ export default hello.hello`); const stringsConfigFile = "src/strings/tsconfig.json"; const mainConfigFile = "src/main/tsconfig.json"; const host = new fakes.SolutionBuilderHost(fs); - const builder = createSolutionBuilder(host, [configFile], { verbose: true }); + let builder = createSolutionBuilder(host, [configFile], { verbose: true }); builder.buildAllProjects(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild(stringsConfigFile, mainConfigFile, configFile), @@ -139,7 +139,7 @@ export default hello.hello`); ); assert(fs.existsSync(expectedOutput), `Expect file ${expectedOutput} to exist`); host.clearDiagnostics(); - builder.resetBuildContext(); + builder = createSolutionBuilder(host, [configFile], { verbose: true }); tick(); builder.buildAllProjects(); host.assertDiagnosticMessages( diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index c004f53d38e..0682284e1d7 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -171,11 +171,11 @@ namespace ts { function initializeWithBuild(opts?: BuildOptions) { const fs = projFs.shadow(); const host = new fakes.SolutionBuilderHost(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); + let builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); builder.buildAllProjects(); host.clearDiagnostics(); tick(); - builder.resetBuildContext(opts ? { ...opts, verbose: true } : undefined); + builder = createSolutionBuilder(host, ["/src/tests"], { ...(opts || {}), verbose: true }); return { fs, host, builder }; } @@ -183,7 +183,6 @@ namespace ts { const fs = projFs.shadow(); const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); - builder.resetBuildContext(); builder.buildAllProjects(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), @@ -288,7 +287,7 @@ namespace ts { fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: { target: "es3" } })); replaceText(fs, "/src/tests/tsconfig.json", `"references": [`, `"extends": "./tsconfig.base.json", "references": [`); const host = new fakes.SolutionBuilderHost(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); + let builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); builder.buildAllProjects(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), @@ -301,7 +300,7 @@ namespace ts { ); host.clearDiagnostics(); tick(); - builder.resetBuildContext(); + builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: {} })); builder.buildAllProjects(); host.assertDiagnosticMessages( From 60962a8709f0ef3587f489e15071b07ef3cec9a9 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 1 May 2019 13:57:47 -0700 Subject: [PATCH 047/384] Added test. --- .../compiler/omitTypeHelperModifiers01.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/cases/compiler/omitTypeHelperModifiers01.ts diff --git a/tests/cases/compiler/omitTypeHelperModifiers01.ts b/tests/cases/compiler/omitTypeHelperModifiers01.ts new file mode 100644 index 00000000000..da76173d365 --- /dev/null +++ b/tests/cases/compiler/omitTypeHelperModifiers01.ts @@ -0,0 +1,22 @@ +// @strict: true + +type A = { + a: number; + b?: string; + readonly c: boolean; + d: unknown; +}; + +type B = Omit; + +function f(x: B) { + const b = x.b; + x.b = "hello"; + x.b = undefined; + + const c = x.c; + x.c = true; + + const d = x.d; + x.d = d; +} From d22cb0c56bbacee5fa07af60b02284806937527b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 1 May 2019 13:57:53 -0700 Subject: [PATCH 048/384] Accepted baselines. --- .../reference/omitTypeHelperModifiers01.js | 34 +++++++++ .../omitTypeHelperModifiers01.symbols | 69 ++++++++++++++++++ .../reference/omitTypeHelperModifiers01.types | 72 +++++++++++++++++++ 3 files changed, 175 insertions(+) create mode 100644 tests/baselines/reference/omitTypeHelperModifiers01.js create mode 100644 tests/baselines/reference/omitTypeHelperModifiers01.symbols create mode 100644 tests/baselines/reference/omitTypeHelperModifiers01.types diff --git a/tests/baselines/reference/omitTypeHelperModifiers01.js b/tests/baselines/reference/omitTypeHelperModifiers01.js new file mode 100644 index 00000000000..4ddfbf0c682 --- /dev/null +++ b/tests/baselines/reference/omitTypeHelperModifiers01.js @@ -0,0 +1,34 @@ +//// [omitTypeHelperModifiers01.ts] +type A = { + a: number; + b?: string; + readonly c: boolean; + d: unknown; +}; + +type B = Omit; + +function f(x: B) { + const b = x.b; + x.b = "hello"; + x.b = undefined; + + const c = x.c; + x.c = true; + + const d = x.d; + x.d = d; +} + + +//// [omitTypeHelperModifiers01.js] +"use strict"; +function f(x) { + var b = x.b; + x.b = "hello"; + x.b = undefined; + var c = x.c; + x.c = true; + var d = x.d; + x.d = d; +} diff --git a/tests/baselines/reference/omitTypeHelperModifiers01.symbols b/tests/baselines/reference/omitTypeHelperModifiers01.symbols new file mode 100644 index 00000000000..a5cc8be34f3 --- /dev/null +++ b/tests/baselines/reference/omitTypeHelperModifiers01.symbols @@ -0,0 +1,69 @@ +=== tests/cases/compiler/omitTypeHelperModifiers01.ts === +type A = { +>A : Symbol(A, Decl(omitTypeHelperModifiers01.ts, 0, 0)) + + a: number; +>a : Symbol(a, Decl(omitTypeHelperModifiers01.ts, 0, 10)) + + b?: string; +>b : Symbol(b, Decl(omitTypeHelperModifiers01.ts, 1, 14)) + + readonly c: boolean; +>c : Symbol(c, Decl(omitTypeHelperModifiers01.ts, 2, 15)) + + d: unknown; +>d : Symbol(d, Decl(omitTypeHelperModifiers01.ts, 3, 24)) + +}; + +type B = Omit; +>B : Symbol(B, Decl(omitTypeHelperModifiers01.ts, 5, 2)) +>Omit : Symbol(Omit, Decl(lib.es5.d.ts, --, --)) +>A : Symbol(A, Decl(omitTypeHelperModifiers01.ts, 0, 0)) + +function f(x: B) { +>f : Symbol(f, Decl(omitTypeHelperModifiers01.ts, 7, 22)) +>x : Symbol(x, Decl(omitTypeHelperModifiers01.ts, 9, 11)) +>B : Symbol(B, Decl(omitTypeHelperModifiers01.ts, 5, 2)) + + const b = x.b; +>b : Symbol(b, Decl(omitTypeHelperModifiers01.ts, 10, 9)) +>x.b : Symbol(b) +>x : Symbol(x, Decl(omitTypeHelperModifiers01.ts, 9, 11)) +>b : Symbol(b) + + x.b = "hello"; +>x.b : Symbol(b) +>x : Symbol(x, Decl(omitTypeHelperModifiers01.ts, 9, 11)) +>b : Symbol(b) + + x.b = undefined; +>x.b : Symbol(b) +>x : Symbol(x, Decl(omitTypeHelperModifiers01.ts, 9, 11)) +>b : Symbol(b) +>undefined : Symbol(undefined) + + const c = x.c; +>c : Symbol(c, Decl(omitTypeHelperModifiers01.ts, 14, 9)) +>x.c : Symbol(c) +>x : Symbol(x, Decl(omitTypeHelperModifiers01.ts, 9, 11)) +>c : Symbol(c) + + x.c = true; +>x.c : Symbol(c) +>x : Symbol(x, Decl(omitTypeHelperModifiers01.ts, 9, 11)) +>c : Symbol(c) + + const d = x.d; +>d : Symbol(d, Decl(omitTypeHelperModifiers01.ts, 17, 9)) +>x.d : Symbol(d) +>x : Symbol(x, Decl(omitTypeHelperModifiers01.ts, 9, 11)) +>d : Symbol(d) + + x.d = d; +>x.d : Symbol(d) +>x : Symbol(x, Decl(omitTypeHelperModifiers01.ts, 9, 11)) +>d : Symbol(d) +>d : Symbol(d, Decl(omitTypeHelperModifiers01.ts, 17, 9)) +} + diff --git a/tests/baselines/reference/omitTypeHelperModifiers01.types b/tests/baselines/reference/omitTypeHelperModifiers01.types new file mode 100644 index 00000000000..1053648d6da --- /dev/null +++ b/tests/baselines/reference/omitTypeHelperModifiers01.types @@ -0,0 +1,72 @@ +=== tests/cases/compiler/omitTypeHelperModifiers01.ts === +type A = { +>A : A + + a: number; +>a : number + + b?: string; +>b : string | undefined + + readonly c: boolean; +>c : boolean + + d: unknown; +>d : unknown + +}; + +type B = Omit; +>B : Omit + +function f(x: B) { +>f : (x: Omit) => void +>x : Omit + + const b = x.b; +>b : string | undefined +>x.b : string | undefined +>x : Omit +>b : string | undefined + + x.b = "hello"; +>x.b = "hello" : "hello" +>x.b : string | undefined +>x : Omit +>b : string | undefined +>"hello" : "hello" + + x.b = undefined; +>x.b = undefined : undefined +>x.b : string | undefined +>x : Omit +>b : string | undefined +>undefined : undefined + + const c = x.c; +>c : boolean +>x.c : boolean +>x : Omit +>c : boolean + + x.c = true; +>x.c = true : true +>x.c : boolean +>x : Omit +>c : boolean +>true : true + + const d = x.d; +>d : unknown +>x.d : unknown +>x : Omit +>d : unknown + + x.d = d; +>x.d = d : unknown +>x.d : unknown +>x : Omit +>d : unknown +>d : unknown +} + From d9e82466e28412a22268f54897a50e9caef13594 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 1 May 2019 14:00:11 -0700 Subject: [PATCH 049/384] Change `Omit` back to using `Pick>` in order to maintain modifiers. --- src/lib/es5.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 827c2aaddd5..f2be6716c72 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1446,9 +1446,7 @@ type Extract = T extends U ? T : never; /** * Construct a type with the properties of T except for those in type K. */ -type Omit = { - [P in Exclude]: T[P] -}; +type Omit = Pick>; /** * Exclude null and undefined from T From d7434a01b248641907c1aed4ed97cf539adcd242 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 1 May 2019 16:07:29 -0700 Subject: [PATCH 050/384] Accepted baselines. --- .../reference/genericIsNeverEmptyObject.types | 12 ++++---- .../reference/genericObjectRest.types | 16 +++++------ .../reference/literalTypeWidening.types | 6 ++-- .../reference/mappedTypeConstraints.symbols | 4 +-- .../reference/mappedTypeConstraints.types | 4 +-- .../reference/objectRestNegative.types | 6 ++-- .../omitTypeHelperModifiers01.errors.txt | 27 ++++++++++++++++++ .../omitTypeHelperModifiers01.symbols | 28 +++++++++---------- .../reference/omitTypeHelperModifiers01.types | 24 ++++++++-------- .../reference/omitTypeTestErrors01.errors.txt | 8 +++--- .../reference/omitTypeTestErrors01.types | 16 +++++------ .../reference/omitTypeTests01.symbols | 8 +++--- .../baselines/reference/omitTypeTests01.types | 16 +++++------ 13 files changed, 101 insertions(+), 74 deletions(-) create mode 100644 tests/baselines/reference/omitTypeHelperModifiers01.errors.txt diff --git a/tests/baselines/reference/genericIsNeverEmptyObject.types b/tests/baselines/reference/genericIsNeverEmptyObject.types index 3a49e723e76..5d2b4d9d57f 100644 --- a/tests/baselines/reference/genericIsNeverEmptyObject.types +++ b/tests/baselines/reference/genericIsNeverEmptyObject.types @@ -2,18 +2,18 @@ // Repro from #29067 function test(obj: T) { ->test : (obj: T) => Omit & { b: string; } +>test : (obj: T) => Pick> & { b: string; } >a : string >obj : T let { a, ...rest } = obj; >a : string ->rest : Omit +>rest : Pick> >obj : T return { ...rest, b: a }; ->{ ...rest, b: a } : Omit & { b: string; } ->rest : Omit +>{ ...rest, b: a } : Pick> & { b: string; } +>rest : Pick> >b : string >a : string } @@ -30,7 +30,7 @@ let o2: { b: string, x: number } = test(o1); >o2 : { b: string; x: number; } >b : string >x : number ->test(o1) : Omit<{ a: string; x: number; }, "a"> & { b: string; } ->test : (obj: T) => Omit & { b: string; } +>test(o1) : Pick<{ a: string; x: number; }, "x"> & { b: string; } +>test : (obj: T) => Pick> & { b: string; } >o1 : { a: string; x: number; } diff --git a/tests/baselines/reference/genericObjectRest.types b/tests/baselines/reference/genericObjectRest.types index ba5145dccba..c2fcaad7cb8 100644 --- a/tests/baselines/reference/genericObjectRest.types +++ b/tests/baselines/reference/genericObjectRest.types @@ -16,7 +16,7 @@ function f1(obj: T) { let { a: a1, ...r1 } = obj; >a : any >a1 : string ->r1 : Omit +>r1 : Pick> >obj : T let { a: a2, b: b2, ...r2 } = obj; @@ -24,24 +24,24 @@ function f1(obj: T) { >a2 : string >b : any >b2 : number ->r2 : Omit +>r2 : Pick> >obj : T let { 'a': a3, ...r3 } = obj; >a3 : string ->r3 : Omit +>r3 : Pick> >obj : T let { ['a']: a4, ...r4 } = obj; >'a' : "a" >a4 : string ->r4 : Omit +>r4 : Pick> >obj : T let { [a]: a5, ...r5 } = obj; >a : "a" >a5 : string ->r5 : Omit +>r5 : Pick> >obj : T } @@ -68,7 +68,7 @@ function f2(obj: T) { >a1 : string >sb : unique symbol >b1 : number ->r1 : Omit +>r1 : Pick> >obj : T } @@ -83,7 +83,7 @@ function f3(obj: T, k1: K1, k2: K2) { >a1 : T[K1] >k2 : K2 >a2 : T[K2] ->r1 : Omit +>r1 : Pick> >obj : T } @@ -104,7 +104,7 @@ function f4(obj: Item, k1: K1, k2: >a1 : Item[K1] >k2 : K2 >a2 : Item[K2] ->r1 : Omit +>r1 : Pick | Exclude<"b", K1 | K2> | Exclude<"c", K1 | K2>> >obj : Item } diff --git a/tests/baselines/reference/literalTypeWidening.types b/tests/baselines/reference/literalTypeWidening.types index 81db0bfc36f..95bde9a08ac 100644 --- a/tests/baselines/reference/literalTypeWidening.types +++ b/tests/baselines/reference/literalTypeWidening.types @@ -443,14 +443,14 @@ function test(obj: T): T { let { a, ...rest } = obj; >a : string ->rest : Omit +>rest : Pick> >obj : T return { a: 'hello', ...rest } as T; >{ a: 'hello', ...rest } as T : T ->{ a: 'hello', ...rest } : { a: string; } & Omit +>{ a: 'hello', ...rest } : { a: string; } & Pick> >a : string >'hello' : "hello" ->rest : Omit +>rest : Pick> } diff --git a/tests/baselines/reference/mappedTypeConstraints.symbols b/tests/baselines/reference/mappedTypeConstraints.symbols index 4a793fd0dc3..3601ffc3de8 100644 --- a/tests/baselines/reference/mappedTypeConstraints.symbols +++ b/tests/baselines/reference/mappedTypeConstraints.symbols @@ -132,9 +132,9 @@ const modifier = (targetProps: T) => { >targetProps : Symbol(targetProps, Decl(mappedTypeConstraints.ts, 30, 41)) rest.foo; ->rest.foo : Symbol(foo) +>rest.foo : Symbol(foo, Decl(mappedTypeConstraints.ts, 25, 20)) >rest : Symbol(rest, Decl(mappedTypeConstraints.ts, 31, 13)) ->foo : Symbol(foo) +>foo : Symbol(foo, Decl(mappedTypeConstraints.ts, 25, 20)) }; diff --git a/tests/baselines/reference/mappedTypeConstraints.types b/tests/baselines/reference/mappedTypeConstraints.types index 98ae325e6be..3e42e2a2e98 100644 --- a/tests/baselines/reference/mappedTypeConstraints.types +++ b/tests/baselines/reference/mappedTypeConstraints.types @@ -98,12 +98,12 @@ const modifier = (targetProps: T) => { let {bar, ...rest} = targetProps; >bar : string ->rest : Omit +>rest : Pick> >targetProps : T rest.foo; >rest.foo : T["foo"] ->rest : Omit +>rest : Pick> >foo : T["foo"] }; diff --git a/tests/baselines/reference/objectRestNegative.types b/tests/baselines/reference/objectRestNegative.types index 7cc174299e4..58ed1902f6d 100644 --- a/tests/baselines/reference/objectRestNegative.types +++ b/tests/baselines/reference/objectRestNegative.types @@ -36,18 +36,18 @@ function stillMustBeLast({ ...mustBeLast, a }: { a: number, b: string }): void { >b : string } function generic(t: T) { ->generic : (t: T) => Omit +>generic : (t: T) => Pick> >x : any >y : any >t : T let { x, ...rest } = t; >x : any ->rest : Omit +>rest : Pick> >t : T return rest; ->rest : Omit +>rest : Pick> } let rest: { b: string } diff --git a/tests/baselines/reference/omitTypeHelperModifiers01.errors.txt b/tests/baselines/reference/omitTypeHelperModifiers01.errors.txt new file mode 100644 index 00000000000..e175a537032 --- /dev/null +++ b/tests/baselines/reference/omitTypeHelperModifiers01.errors.txt @@ -0,0 +1,27 @@ +tests/cases/compiler/omitTypeHelperModifiers01.ts(16,7): error TS2540: Cannot assign to 'c' because it is a read-only property. + + +==== tests/cases/compiler/omitTypeHelperModifiers01.ts (1 errors) ==== + type A = { + a: number; + b?: string; + readonly c: boolean; + d: unknown; + }; + + type B = Omit; + + function f(x: B) { + const b = x.b; + x.b = "hello"; + x.b = undefined; + + const c = x.c; + x.c = true; + ~ +!!! error TS2540: Cannot assign to 'c' because it is a read-only property. + + const d = x.d; + x.d = d; + } + \ No newline at end of file diff --git a/tests/baselines/reference/omitTypeHelperModifiers01.symbols b/tests/baselines/reference/omitTypeHelperModifiers01.symbols index a5cc8be34f3..39a33606781 100644 --- a/tests/baselines/reference/omitTypeHelperModifiers01.symbols +++ b/tests/baselines/reference/omitTypeHelperModifiers01.symbols @@ -28,42 +28,42 @@ function f(x: B) { const b = x.b; >b : Symbol(b, Decl(omitTypeHelperModifiers01.ts, 10, 9)) ->x.b : Symbol(b) +>x.b : Symbol(b, Decl(omitTypeHelperModifiers01.ts, 1, 14)) >x : Symbol(x, Decl(omitTypeHelperModifiers01.ts, 9, 11)) ->b : Symbol(b) +>b : Symbol(b, Decl(omitTypeHelperModifiers01.ts, 1, 14)) x.b = "hello"; ->x.b : Symbol(b) +>x.b : Symbol(b, Decl(omitTypeHelperModifiers01.ts, 1, 14)) >x : Symbol(x, Decl(omitTypeHelperModifiers01.ts, 9, 11)) ->b : Symbol(b) +>b : Symbol(b, Decl(omitTypeHelperModifiers01.ts, 1, 14)) x.b = undefined; ->x.b : Symbol(b) +>x.b : Symbol(b, Decl(omitTypeHelperModifiers01.ts, 1, 14)) >x : Symbol(x, Decl(omitTypeHelperModifiers01.ts, 9, 11)) ->b : Symbol(b) +>b : Symbol(b, Decl(omitTypeHelperModifiers01.ts, 1, 14)) >undefined : Symbol(undefined) const c = x.c; >c : Symbol(c, Decl(omitTypeHelperModifiers01.ts, 14, 9)) ->x.c : Symbol(c) +>x.c : Symbol(c, Decl(omitTypeHelperModifiers01.ts, 2, 15)) >x : Symbol(x, Decl(omitTypeHelperModifiers01.ts, 9, 11)) ->c : Symbol(c) +>c : Symbol(c, Decl(omitTypeHelperModifiers01.ts, 2, 15)) x.c = true; ->x.c : Symbol(c) +>x.c : Symbol(c, Decl(omitTypeHelperModifiers01.ts, 2, 15)) >x : Symbol(x, Decl(omitTypeHelperModifiers01.ts, 9, 11)) ->c : Symbol(c) +>c : Symbol(c, Decl(omitTypeHelperModifiers01.ts, 2, 15)) const d = x.d; >d : Symbol(d, Decl(omitTypeHelperModifiers01.ts, 17, 9)) ->x.d : Symbol(d) +>x.d : Symbol(d, Decl(omitTypeHelperModifiers01.ts, 3, 24)) >x : Symbol(x, Decl(omitTypeHelperModifiers01.ts, 9, 11)) ->d : Symbol(d) +>d : Symbol(d, Decl(omitTypeHelperModifiers01.ts, 3, 24)) x.d = d; ->x.d : Symbol(d) +>x.d : Symbol(d, Decl(omitTypeHelperModifiers01.ts, 3, 24)) >x : Symbol(x, Decl(omitTypeHelperModifiers01.ts, 9, 11)) ->d : Symbol(d) +>d : Symbol(d, Decl(omitTypeHelperModifiers01.ts, 3, 24)) >d : Symbol(d, Decl(omitTypeHelperModifiers01.ts, 17, 9)) } diff --git a/tests/baselines/reference/omitTypeHelperModifiers01.types b/tests/baselines/reference/omitTypeHelperModifiers01.types index 1053648d6da..da5f61b6986 100644 --- a/tests/baselines/reference/omitTypeHelperModifiers01.types +++ b/tests/baselines/reference/omitTypeHelperModifiers01.types @@ -17,55 +17,55 @@ type A = { }; type B = Omit; ->B : Omit +>B : Pick function f(x: B) { ->f : (x: Omit) => void ->x : Omit +>f : (x: Pick) => void +>x : Pick const b = x.b; >b : string | undefined >x.b : string | undefined ->x : Omit +>x : Pick >b : string | undefined x.b = "hello"; >x.b = "hello" : "hello" >x.b : string | undefined ->x : Omit +>x : Pick >b : string | undefined >"hello" : "hello" x.b = undefined; >x.b = undefined : undefined >x.b : string | undefined ->x : Omit +>x : Pick >b : string | undefined >undefined : undefined const c = x.c; >c : boolean >x.c : boolean ->x : Omit +>x : Pick >c : boolean x.c = true; >x.c = true : true ->x.c : boolean ->x : Omit ->c : boolean +>x.c : any +>x : Pick +>c : any >true : true const d = x.d; >d : unknown >x.d : unknown ->x : Omit +>x : Pick >d : unknown x.d = d; >x.d = d : unknown >x.d : unknown ->x : Omit +>x : Pick >d : unknown >d : unknown } diff --git a/tests/baselines/reference/omitTypeTestErrors01.errors.txt b/tests/baselines/reference/omitTypeTestErrors01.errors.txt index 6b65e292b55..a66ab384b89 100644 --- a/tests/baselines/reference/omitTypeTestErrors01.errors.txt +++ b/tests/baselines/reference/omitTypeTestErrors01.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/omitTypeTestErrors01.ts(11,16): error TS2339: Property 'c' does not exist on type 'Omit'. -tests/cases/compiler/omitTypeTestErrors01.ts(15,16): error TS2339: Property 'b' does not exist on type 'Omit'. +tests/cases/compiler/omitTypeTestErrors01.ts(11,16): error TS2339: Property 'c' does not exist on type 'Pick'. +tests/cases/compiler/omitTypeTestErrors01.ts(15,16): error TS2339: Property 'b' does not exist on type 'Pick'. ==== tests/cases/compiler/omitTypeTestErrors01.ts (2 errors) ==== @@ -15,13 +15,13 @@ tests/cases/compiler/omitTypeTestErrors01.ts(15,16): error TS2339: Property 'b' export function getBarC(bar: Bar) { return bar.c; ~ -!!! error TS2339: Property 'c' does not exist on type 'Omit'. +!!! error TS2339: Property 'c' does not exist on type 'Pick'. } export function getBazB(baz: Baz) { return baz.b; ~ -!!! error TS2339: Property 'b' does not exist on type 'Omit'. +!!! error TS2339: Property 'b' does not exist on type 'Pick'. } \ No newline at end of file diff --git a/tests/baselines/reference/omitTypeTestErrors01.types b/tests/baselines/reference/omitTypeTestErrors01.types index 4b286c2c89c..e7282016868 100644 --- a/tests/baselines/reference/omitTypeTestErrors01.types +++ b/tests/baselines/reference/omitTypeTestErrors01.types @@ -11,28 +11,28 @@ interface Foo { } export type Bar = Omit; ->Bar : Omit +>Bar : Pick export type Baz = Omit; ->Baz : Omit +>Baz : Pick export function getBarC(bar: Bar) { ->getBarC : (bar: Omit) => any ->bar : Omit +>getBarC : (bar: Pick) => any +>bar : Pick return bar.c; >bar.c : any ->bar : Omit +>bar : Pick >c : any } export function getBazB(baz: Baz) { ->getBazB : (baz: Omit) => any ->baz : Omit +>getBazB : (baz: Pick) => any +>baz : Pick return baz.b; >baz.b : any ->baz : Omit +>baz : Pick >b : any } diff --git a/tests/baselines/reference/omitTypeTests01.symbols b/tests/baselines/reference/omitTypeTests01.symbols index 93b49291785..d614f65daff 100644 --- a/tests/baselines/reference/omitTypeTests01.symbols +++ b/tests/baselines/reference/omitTypeTests01.symbols @@ -28,9 +28,9 @@ export function getBarA(bar: Bar) { >Bar : Symbol(Bar, Decl(omitTypeTests01.ts, 4, 1)) return bar.a; ->bar.a : Symbol(a) +>bar.a : Symbol(a, Decl(omitTypeTests01.ts, 0, 15)) >bar : Symbol(bar, Decl(omitTypeTests01.ts, 9, 24)) ->a : Symbol(a) +>a : Symbol(a, Decl(omitTypeTests01.ts, 0, 15)) } export function getBazA(baz: Baz) { @@ -39,9 +39,9 @@ export function getBazA(baz: Baz) { >Baz : Symbol(Baz, Decl(omitTypeTests01.ts, 6, 33)) return baz.a; ->baz.a : Symbol(a) +>baz.a : Symbol(a, Decl(omitTypeTests01.ts, 0, 15)) >baz : Symbol(baz, Decl(omitTypeTests01.ts, 13, 24)) ->a : Symbol(a) +>a : Symbol(a, Decl(omitTypeTests01.ts, 0, 15)) } diff --git a/tests/baselines/reference/omitTypeTests01.types b/tests/baselines/reference/omitTypeTests01.types index 549fcccc0f2..c07894ee2dc 100644 --- a/tests/baselines/reference/omitTypeTests01.types +++ b/tests/baselines/reference/omitTypeTests01.types @@ -11,28 +11,28 @@ interface Foo { } export type Bar = Omit; ->Bar : Omit +>Bar : Pick export type Baz = Omit; ->Baz : Omit +>Baz : Pick export function getBarA(bar: Bar) { ->getBarA : (bar: Omit) => string ->bar : Omit +>getBarA : (bar: Pick) => string +>bar : Pick return bar.a; >bar.a : string ->bar : Omit +>bar : Pick >a : string } export function getBazA(baz: Baz) { ->getBazA : (baz: Omit) => string ->baz : Omit +>getBazA : (baz: Pick) => string +>baz : Pick return baz.a; >baz.a : string ->baz : Omit +>baz : Pick >a : string } From 5b361c8497d2cc25d0e25f97c11e5c2394429a2a Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 2 May 2019 13:27:36 -0700 Subject: [PATCH 051/384] Make API to build project and wire cancellation token --- src/compiler/tsbuild.ts | 153 ++++++++++++------ src/compiler/types.ts | 3 + src/compiler/watch.ts | 29 ++-- .../unittests/tsbuild/emptyFiles.ts | 4 +- src/testRunner/unittests/tsbuild/helpers.ts | 2 +- .../unittests/tsbuild/missingExtendedFile.ts | 2 +- src/testRunner/unittests/tsbuild/outFile.ts | 37 +++-- .../tsbuild/referencesWithRootDirInParent.ts | 8 +- .../unittests/tsbuild/resolveJsonModule.ts | 14 +- src/testRunner/unittests/tsbuild/sample.ts | 80 +++++---- .../unittests/tsbuild/transitiveReferences.ts | 2 +- src/testRunner/unittests/tsbuildWatchMode.ts | 12 +- .../unittests/tsserver/projectReferences.ts | 2 +- src/tsc/tsc.ts | 4 +- 14 files changed, 234 insertions(+), 118 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index dd9b62edd7a..4fb2edf6801 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -255,7 +255,7 @@ namespace ts { } export interface SolutionBuilder { - buildAllProjects(): ExitStatus; + build(project?: string, cancellationToken?: CancellationToken): ExitStatus; cleanAllProjects(): ExitStatus; // Currently used for testing but can be made public if needed: @@ -264,14 +264,21 @@ namespace ts { // Testing only /*@internal*/ getUpToDateStatusOfProject(project: string): UpToDateStatus; /*@internal*/ invalidateProject(configFileName: string, reloadLevel?: ConfigFileProgramReloadLevel): void; - /*@internal*/ buildInvalidatedProject(): void; + /*@internal*/ buildNextInvalidatedProject(): void; } export interface SolutionBuilderWithWatch { - buildAllProjects(): ExitStatus; + build(project?: string, cancellationToken?: CancellationToken): ExitStatus; /*@internal*/ startWatching(): void; } + interface InvalidatedProject { + project: ResolvedConfigFileName; + projectPath: ResolvedConfigFilePath; + reloadLevel: ConfigFileProgramReloadLevel; + projectIndex: number; + } + /** * Create a function that reports watch status by writing to the system and handles the formating of the diagnostic */ @@ -386,18 +393,22 @@ namespace ts { const allWatchedInputFiles = createMap() as ConfigFileMap>; const allWatchedConfigFiles = createMap() as ConfigFileMap; + let allProjectBuildPending = true; + let needsSummary = true; + // let watchAllProjectsPending = watch; + return watch ? { - buildAllProjects, + build, startWatching } : { - buildAllProjects, + build, cleanAllProjects, getBuildOrder, getUpToDateStatusOfProject, invalidateProject, - buildInvalidatedProject, + buildNextInvalidatedProject, }; function toPath(fileName: string) { @@ -800,6 +811,7 @@ namespace ts { configFileCache.delete(resolved); buildOrder = undefined; } + needsSummary = true; clearProjectStatus(resolved); addProjToQueue(resolved, reloadLevel); enableCache(); @@ -823,16 +835,16 @@ namespace ts { } } - function getNextInvalidatedProject() { - Debug.assert(hasPendingInvalidatedProjects()); - return forEach(getBuildOrder(), (project, projectIndex) => { - const projectPath = toResolvedConfigFilePath(project); - const reloadLevel = projectPendingBuild.get(projectPath); - if (reloadLevel !== undefined) { - projectPendingBuild.delete(projectPath); - return { project, projectPath, reloadLevel, projectIndex }; - } - }); + function getNextInvalidatedProject(buildOrder: readonly ResolvedConfigFileName[]): InvalidatedProject | undefined { + return hasPendingInvalidatedProjects() ? + forEach(buildOrder, (project, projectIndex) => { + const projectPath = toResolvedConfigFilePath(project); + const reloadLevel = projectPendingBuild.get(projectPath); + if (reloadLevel !== undefined) { + return { project, projectPath, reloadLevel, projectIndex }; + } + }) : + undefined; } function hasPendingInvalidatedProjects() { @@ -846,18 +858,19 @@ namespace ts { if (timerToBuildInvalidatedProject) { hostWithWatch.clearTimeout(timerToBuildInvalidatedProject); } - timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildInvalidatedProject, 250); + timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, 250); } - function buildInvalidatedProject() { + function buildNextInvalidatedProject() { timerToBuildInvalidatedProject = undefined; if (reportFileChangeDetected) { reportFileChangeDetected = false; projectErrorsReported.clear(); reportWatchStatus(Diagnostics.File_change_detected_Starting_incremental_compilation); } - if (hasPendingInvalidatedProjects()) { - buildNextInvalidatedProject(); + const invalidatedProject = getNextInvalidatedProject(getBuildOrder()); + if (invalidatedProject) { + buildInvalidatedProject(invalidatedProject); if (hasPendingInvalidatedProjects()) { if (watch && !timerToBuildInvalidatedProject) { scheduleBuildInvalidatedProject(); @@ -872,6 +885,7 @@ namespace ts { function reportErrorSummary() { if (watch || host.reportErrorSummary) { + needsSummary = false; // Report errors from the other projects getBuildOrder().forEach(project => { const projectPath = toResolvedConfigFilePath(project); @@ -890,11 +904,11 @@ namespace ts { } } - function buildNextInvalidatedProject() { - const { project, projectPath, reloadLevel, projectIndex } = getNextInvalidatedProject()!; + function buildInvalidatedProject({ project, projectPath, reloadLevel, projectIndex }: InvalidatedProject, cancellationToken?: CancellationToken) { const config = parseConfigFile(project, projectPath); if (!config) { reportParseConfigFileDiagnostic(projectPath); + projectPendingBuild.delete(projectPath); return; } @@ -920,6 +934,7 @@ namespace ts { // In a dry build, inform the user of this fact reportStatus(Diagnostics.Project_0_is_up_to_date, project); } + projectPendingBuild.delete(projectPath); return; } @@ -927,24 +942,28 @@ namespace ts { reportAndStoreErrors(projectPath, config.errors); // Fake that files have been built by updating output file stamps updateOutputTimestamps(config, projectPath); + projectPendingBuild.delete(projectPath); return; } if (status.type === UpToDateStatusType.UpstreamBlocked) { reportAndStoreErrors(projectPath, config.errors); if (options.verbose) reportStatus(Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, project, status.upstreamProjectName); + projectPendingBuild.delete(projectPath); return; } if (status.type === UpToDateStatusType.ContainerOnly) { reportAndStoreErrors(projectPath, config.errors); // Do nothing + projectPendingBuild.delete(projectPath); return; } const buildResult = needsBuild(status, config) ? - buildSingleProject(project, projectPath) : // Actual build - updateBundle(project, projectPath); // Fake that files have been built by manipulating prepend and existing output + buildSingleProject(project, projectPath, cancellationToken) : // Actual build + updateBundle(project, projectPath, cancellationToken); // Fake that files have been built by manipulating prepend and existing output + projectPendingBuild.delete(projectPath); // Only composite projects can be referenced by other projects if (!(buildResult & BuildResultFlags.AnyErrors) && config.options.composite) { queueReferencingProjects(project, projectPath, projectIndex, !(buildResult & BuildResultFlags.DeclarationOutputUnchanged)); @@ -1050,7 +1069,7 @@ namespace ts { } } - function buildSingleProject(proj: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath): BuildResultFlags { + function buildSingleProject(proj: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, cancellationToken: CancellationToken | undefined): BuildResultFlags { if (options.dry) { reportStatus(Diagnostics.A_non_dry_build_would_build_project_0, proj); return BuildResultFlags.Success; @@ -1112,15 +1131,15 @@ namespace ts { // Don't emit anything in the presence of syntactic errors or options diagnostics const syntaxDiagnostics = [ ...program.getConfigFileParsingDiagnostics(), - ...program.getOptionsDiagnostics(), - ...program.getGlobalDiagnostics(), - ...program.getSyntacticDiagnostics()]; + ...program.getOptionsDiagnostics(cancellationToken), + ...program.getGlobalDiagnostics(cancellationToken), + ...program.getSyntacticDiagnostics(/*sourceFile*/ undefined, cancellationToken)]; if (syntaxDiagnostics.length) { return buildErrors(syntaxDiagnostics, BuildResultFlags.SyntaxErrors, "Syntactic"); } // Same as above but now for semantic diagnostics - const semanticDiagnostics = program.getSemanticDiagnostics(); + const semanticDiagnostics = program.getSemanticDiagnostics(/*sourceFile*/ undefined, cancellationToken); if (semanticDiagnostics.length) { return buildErrors(semanticDiagnostics, BuildResultFlags.TypeErrors, "Semantic"); } @@ -1132,7 +1151,14 @@ namespace ts { let declDiagnostics: Diagnostic[] | undefined; const reportDeclarationDiagnostics = (d: Diagnostic) => (declDiagnostics || (declDiagnostics = [])).push(d); const outputFiles: OutputFile[] = []; - emitFilesAndReportErrors(program, reportDeclarationDiagnostics, /*writeFileName*/ undefined, /*reportSummary*/ undefined, (name, text, writeByteOrderMark) => outputFiles.push({ name, text, writeByteOrderMark })); + emitFilesAndReportErrors( + program, + reportDeclarationDiagnostics, + /*writeFileName*/ undefined, + /*reportSummary*/ undefined, + (name, text, writeByteOrderMark) => outputFiles.push({ name, text, writeByteOrderMark }), + cancellationToken + ); // Don't emit .d.ts if there are decl file errors if (declDiagnostics) { program.restoreState(); @@ -1221,7 +1247,7 @@ namespace ts { return readBuilderProgram(parsed.options, readFileWithCache) as any as T; } - function updateBundle(proj: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath): BuildResultFlags { + function updateBundle(proj: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, cancellationToken: CancellationToken | undefined): BuildResultFlags { if (options.dry) { reportStatus(Diagnostics.A_non_dry_build_would_update_output_of_project_0, proj); return BuildResultFlags.Success; @@ -1241,7 +1267,7 @@ namespace ts { }); if (isString(outputFiles)) { reportStatus(Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, proj, relName(outputFiles)); - return buildSingleProject(proj, resolvedPath); + return buildSingleProject(proj, resolvedPath, cancellationToken); } // Actual Emit @@ -1403,21 +1429,58 @@ namespace ts { cacheState = undefined; } - function buildAllProjects(): ExitStatus { - if (options.watch) { reportWatchStatus(Diagnostics.Starting_compilation_in_watch_mode); } - enableCache(); + function build(project?: string, cancellationToken?: CancellationToken): ExitStatus { + // Set initial build if not already built + if (allProjectBuildPending) { + allProjectBuildPending = false; + if (options.watch) { reportWatchStatus(Diagnostics.Starting_compilation_in_watch_mode); } + enableCache(); + const buildOrder = getBuildOrder(); + reportBuildQueue(buildOrder); + buildOrder.forEach(configFileName => + projectPendingBuild.set(toResolvedConfigFilePath(configFileName), ConfigFileProgramReloadLevel.None)); - const buildOrder = getBuildOrder(); - reportBuildQueue(buildOrder); - buildOrder.forEach(configFileName => - projectPendingBuild.set(toResolvedConfigFilePath(configFileName), ConfigFileProgramReloadLevel.None)); - - while (hasPendingInvalidatedProjects()) { - buildNextInvalidatedProject(); + if (cancellationToken) { + cancellationToken.throwIfCancellationRequested(); + } } - reportErrorSummary(); - disableCache(); - return diagnostics.size ? ExitStatus.DiagnosticsPresent_OutputsSkipped : ExitStatus.Success; + + let successfulProjects = 0; + let errorProjects = 0; + const resolvedProject = project && resolveProjectName(project); + if (resolvedProject) { + const projectPath = toResolvedConfigFilePath(resolvedProject); + const projectIndex = findIndex( + getBuildOrder(), + configFileName => toResolvedConfigFilePath(configFileName) === projectPath + ); + if (projectIndex === -1) return ExitStatus.InvalidProject_OutputsSkipped; + } + const buildOrder = resolvedProject ? createBuildOrder([resolvedProject]) : getBuildOrder(); + while (true) { + const invalidatedProject = getNextInvalidatedProject(buildOrder); + if (!invalidatedProject) { + if (needsSummary) { + disableCache(); + reportErrorSummary(); + } + break; + } + + buildInvalidatedProject(invalidatedProject, cancellationToken); + if (diagnostics.has(invalidatedProject.projectPath)) { + errorProjects++; + } + else { + successfulProjects++; + } + } + + return errorProjects ? + successfulProjects ? + ExitStatus.DiagnosticsPresent_OutputsGenerated : + ExitStatus.DiagnosticsPresent_OutputsSkipped : + ExitStatus.Success; } function needsBuild(status: UpToDateStatus, config: ParsedCommandLine) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5e2d6aba474..791b26ab572 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3053,6 +3053,9 @@ namespace ts { // Diagnostics were produced and outputs were generated in spite of them. DiagnosticsPresent_OutputsGenerated = 2, + + // When build skipped because passed in project is invalid + InvalidProject_OutputsSkipped = 3, } export interface EmitResult { diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index f9bf2a8468d..d6a856cfe9f 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -113,12 +113,12 @@ namespace ts { getCurrentDirectory(): string; getCompilerOptions(): CompilerOptions; getSourceFiles(): ReadonlyArray; - getSyntacticDiagnostics(): ReadonlyArray; - getOptionsDiagnostics(): ReadonlyArray; - getGlobalDiagnostics(): ReadonlyArray; - getSemanticDiagnostics(): ReadonlyArray; + getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + getOptionsDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; + getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; + getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; getConfigFileParsingDiagnostics(): ReadonlyArray; - emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult; } export function listFiles(program: ProgramToEmitFilesAndReportErrors, writeFileName: (s: string) => void) { @@ -132,25 +132,32 @@ namespace ts { /** * Helper that emit files, report diagnostics and lists emitted and/or source files depending on compiler options */ - export function emitFilesAndReportErrors(program: ProgramToEmitFilesAndReportErrors, reportDiagnostic: DiagnosticReporter, writeFileName?: (s: string) => void, reportSummary?: ReportEmitErrorSummary, writeFile?: WriteFileCallback) { + export function emitFilesAndReportErrors( + program: ProgramToEmitFilesAndReportErrors, + reportDiagnostic: DiagnosticReporter, + writeFileName?: (s: string) => void, + reportSummary?: ReportEmitErrorSummary, + writeFile?: WriteFileCallback, + cancellationToken?: CancellationToken + ) { // First get and report any syntactic errors. const diagnostics = program.getConfigFileParsingDiagnostics().slice(); const configFileParsingDiagnosticsLength = diagnostics.length; - addRange(diagnostics, program.getSyntacticDiagnostics()); + addRange(diagnostics, program.getSyntacticDiagnostics(/*sourceFile*/ undefined, cancellationToken)); // If we didn't have any syntactic errors, then also try getting the global and // semantic errors. if (diagnostics.length === configFileParsingDiagnosticsLength) { - addRange(diagnostics, program.getOptionsDiagnostics()); - addRange(diagnostics, program.getGlobalDiagnostics()); + addRange(diagnostics, program.getOptionsDiagnostics(cancellationToken)); + addRange(diagnostics, program.getGlobalDiagnostics(cancellationToken)); if (diagnostics.length === configFileParsingDiagnosticsLength) { - addRange(diagnostics, program.getSemanticDiagnostics()); + addRange(diagnostics, program.getSemanticDiagnostics(/*sourceFile*/ undefined, cancellationToken)); } } // Emit and report any errors we ran into. - const { emittedFiles, emitSkipped, diagnostics: emitDiagnostics } = program.emit(/*targetSourceFile*/ undefined, writeFile); + const { emittedFiles, emitSkipped, diagnostics: emitDiagnostics } = program.emit(/*targetSourceFile*/ undefined, writeFile, cancellationToken); addRange(diagnostics, emitDiagnostics); sortAndDeduplicateDiagnostics(diagnostics).forEach(reportDiagnostic); diff --git a/src/testRunner/unittests/tsbuild/emptyFiles.ts b/src/testRunner/unittests/tsbuild/emptyFiles.ts index 17c6644ccc6..badad8f3377 100644 --- a/src/testRunner/unittests/tsbuild/emptyFiles.ts +++ b/src/testRunner/unittests/tsbuild/emptyFiles.ts @@ -14,7 +14,7 @@ namespace ts { const builder = createSolutionBuilder(host, ["/src/no-references"], { dry: false, force: false, verbose: false }); host.clearDiagnostics(); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages([Diagnostics.The_files_list_in_config_file_0_is_empty, "/src/no-references/tsconfig.json"]); // Check for outputs to not be written. @@ -29,7 +29,7 @@ namespace ts { const builder = createSolutionBuilder(host, ["/src/with-references"], { dry: false, force: false, verbose: false }); host.clearDiagnostics(); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages(/*empty*/); // Check for outputs to be written. diff --git a/src/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index 579573a876e..33a7afb181a 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -172,7 +172,7 @@ declare const console: { log(msg: any): void; };`; } return originalReadFile.call(host, path); }; - builder.buildAllProjects(); + builder.build(); generateSourceMapBaselineFiles(fs, expectedMapFileNames); generateBuildInfoSectionBaselineFiles(fs, expectedBuildInfoFilesForSectionBaselines || emptyArray); fs.makeReadonly(); diff --git a/src/testRunner/unittests/tsbuild/missingExtendedFile.ts b/src/testRunner/unittests/tsbuild/missingExtendedFile.ts index 00e8bfec1e3..881f3fbc030 100644 --- a/src/testRunner/unittests/tsbuild/missingExtendedFile.ts +++ b/src/testRunner/unittests/tsbuild/missingExtendedFile.ts @@ -5,7 +5,7 @@ namespace ts { const fs = projFs.shadow(); const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/tsconfig.json"], {}); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( [Diagnostics.The_specified_path_does_not_exist_Colon_0, "/src/foobar.json"], [Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, "/src/tsconfig.first.json", "[\"**/*\"]", "[]"], diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index 20061c86a7b..ea56c7f511d 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -363,7 +363,7 @@ namespace ts { ]; const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages(...initialExpectedDiagnostics); // Verify they exist for (const output of expectedOutputs) { @@ -389,7 +389,7 @@ namespace ts { ]; const host = new fakes.SolutionBuilderHost(fs); let builder = createSolutionBuilder(host); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages(...initialExpectedDiagnostics); // Verify they exist for (const output of expectedOutputs) { @@ -399,7 +399,7 @@ namespace ts { host.clearDiagnostics(); host.deleteFile(outputFiles[project.first][ext.buildinfo]); builder = createSolutionBuilder(host); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relSources[project.first][source.config], relOutputFiles[project.first][ext.buildinfo]], @@ -416,7 +416,7 @@ namespace ts { const host = new fakes.SolutionBuilderHost(fs); replaceText(fs, sources[project.third][source.config], `"composite": true,`, ""); const builder = createSolutionBuilder(host); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages(...initialExpectedDiagnostics); // Verify they exist - without tsbuildinfo for third project for (const output of expectedOutputFiles.slice(0, expectedOutputFiles.length - 2)) { @@ -429,12 +429,12 @@ namespace ts { const fs = outFileFs.shadow(); const host = new fakes.SolutionBuilderHost(fs); let builder = createSolutionBuilder(host); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages(...initialExpectedDiagnostics); host.clearDiagnostics(); builder = createSolutionBuilder(host); changeCompilerVersion(host); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), [Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2, relSources[project.first][source.config], fakes.version, version], @@ -454,7 +454,7 @@ namespace ts { // Build with command line incremental const host = new fakes.SolutionBuilderHost(fs); let builder = createSolutionBuilder(host, { incremental: true }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages(...initialExpectedDiagnostics); host.clearDiagnostics(); tick(); @@ -462,7 +462,7 @@ namespace ts { // Make non incremental build with change in file that doesnt affect dts appendText(fs, relSources[project.first][source.ts][part.one], "console.log(s);"); builder = createSolutionBuilder(host, { verbose: true }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages(getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relSources[project.first][source.config], relOutputFiles[project.first][ext.js], relSources[project.first][source.ts][part.one]], [Diagnostics.Building_project_0, sources[project.first][source.config]], @@ -476,7 +476,7 @@ namespace ts { // Make incremental build with change in file that doesnt affect dts appendText(fs, relSources[project.first][source.ts][part.one], "console.log(s);"); builder = createSolutionBuilder(host, { verbose: true, incremental: true }); - builder.buildAllProjects(); + builder.build(); // Builds completely because tsbuildinfo is old. host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), @@ -489,6 +489,23 @@ namespace ts { host.clearDiagnostics(); }); + it("builds till project specified", () => { + const fs = outFileFs.shadow(); + const host = new fakes.SolutionBuilderHost(fs); + const builder = createSolutionBuilder(host, { verbose: false }); + const result = builder.build(sources[project.second][source.config]); + host.assertDiagnosticMessages(/*empty*/); + // First and Third is not built + for (const output of [...outputFiles[project.first], ...outputFiles[project.third]]) { + assert.isFalse(fs.existsSync(output), `Expect file ${output} to not exist`); + } + // second is built + for (const output of outputFiles[project.second]) { + assert(fs.existsSync(output), `Expect file ${output} to exist`); + } + assert.equal(result, ExitStatus.Success); + }); + describe("Prepend output with .tsbuildinfo", () => { // Prologues describe("Prologues", () => { @@ -904,7 +921,7 @@ ${internal} enum internalEnum { a, b, c }`); const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relSources[project.first][source.config], "src/first/first_PART1.js"], diff --git a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts index 630cd8575ec..c965eb73067 100644 --- a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts +++ b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts @@ -19,7 +19,7 @@ namespace ts { const fs = projFs.shadow(); const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/src/main", "/src/src/other"], {}); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages(/*empty*/); for (const output of allExpectedOutputs) { assert(fs.existsSync(output), `Expect file ${output} to exist`); @@ -39,7 +39,7 @@ namespace ts { replaceText(fs, "/src/tsconfig.base.json", `"rootDir": "./src/",`, ""); const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/src/main"], { verbose: true }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/src/other/tsconfig.json", "src/src/main/tsconfig.json"), [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/other/tsconfig.json", "src/dist/other.js"], @@ -75,7 +75,7 @@ namespace ts { })); const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/src/main"], { verbose: true }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/src/other/tsconfig.json", "src/src/main/tsconfig.json"), [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/other/tsconfig.json", "src/dist/other.js"], @@ -112,7 +112,7 @@ namespace ts { })); const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/src/main/tsconfig.main.json"], { verbose: true }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/src/other/tsconfig.other.json", "src/src/main/tsconfig.main.json"), [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/other/tsconfig.other.json", "src/dist/other.js"], diff --git a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts index d2555a730a2..f1a40c050f9 100644 --- a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts +++ b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts @@ -19,7 +19,7 @@ namespace ts { function verifyProjectWithResolveJsonModuleWithFs(fs: vfs.FileSystem, configFile: string, allExpectedOutputs: ReadonlyArray, ...expectedDiagnosticMessages: fakes.ExpectedDiagnostic[]) { const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, [configFile], { dry: false, force: false, verbose: false }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages(...expectedDiagnosticMessages); if (!expectedDiagnosticMessages.length) { // Check for outputs. Not an exhaustive list @@ -65,7 +65,7 @@ export default hello.hello`); replaceText(fs, configFile, `"composite": true,`, `"composite": true, "sourceMap": true,`); const host = new fakes.SolutionBuilderHost(fs); let builder = createSolutionBuilder(host, [configFile], { verbose: true }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild(configFile), [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, configFile, "src/dist/src/index.js"], @@ -77,7 +77,7 @@ export default hello.hello`); host.clearDiagnostics(); builder = createSolutionBuilder(host, [configFile], { verbose: true }); tick(); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild(configFile), [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, configFile, "src/src/index.ts", "src/dist/src/index.js"] @@ -90,7 +90,7 @@ export default hello.hello`); replaceText(fs, configFile, `"outDir": "dist",`, ""); const host = new fakes.SolutionBuilderHost(fs); let builder = createSolutionBuilder(host, [configFile], { verbose: true }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild(configFile), [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, configFile, "src/src/index.js"], @@ -102,7 +102,7 @@ export default hello.hello`); host.clearDiagnostics(); builder = createSolutionBuilder(host, [configFile], { verbose: true }); tick(); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild(configFile), [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, configFile, "src/src/index.ts", "src/src/index.js"] @@ -129,7 +129,7 @@ export default hello.hello`); const mainConfigFile = "src/main/tsconfig.json"; const host = new fakes.SolutionBuilderHost(fs); let builder = createSolutionBuilder(host, [configFile], { verbose: true }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild(stringsConfigFile, mainConfigFile, configFile), [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, stringsConfigFile, "src/strings/tsconfig.tsbuildinfo"], @@ -141,7 +141,7 @@ export default hello.hello`); host.clearDiagnostics(); builder = createSolutionBuilder(host, [configFile], { verbose: true }); tick(); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild(stringsConfigFile, mainConfigFile, configFile), [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, stringsConfigFile, "src/strings/foo.json", "src/strings/tsconfig.tsbuildinfo"], diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 9119fd2fb96..3ad2b2e3eec 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -21,7 +21,7 @@ namespace ts { const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); host.clearDiagnostics(); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages(/*empty*/); // Check for outputs. Not an exhaustive list @@ -39,7 +39,7 @@ namespace ts { const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/tests"], {}); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages(/*empty*/); const expectedOutputs = allExpectedOutputs.map(f => f.replace("/logic/", "/logic/outDir/")); // Check for outputs. Not an exhaustive list @@ -57,7 +57,7 @@ namespace ts { const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/tests"], {}); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages(/*empty*/); const expectedOutputs = allExpectedOutputs.map(f => f.replace("/logic/index.d.ts", "/logic/out/decls/index.d.ts")); // Check for outputs. Not an exhaustive list @@ -71,7 +71,7 @@ namespace ts { replaceText(fs, "/src/core/tsconfig.json", `"composite": true,`, ""); const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/core"], { verbose: true }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json"), [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], @@ -88,7 +88,7 @@ namespace ts { const fs = projFs.shadow(); const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { dry: true, force: false, verbose: false }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( [Diagnostics.A_non_dry_build_would_build_project_0, "/src/core/tsconfig.json"], [Diagnostics.A_non_dry_build_would_build_project_0, "/src/logic/tsconfig.json"], @@ -106,12 +106,12 @@ namespace ts { const host = new fakes.SolutionBuilderHost(fs); let builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); - builder.buildAllProjects(); + builder.build(); tick(); host.clearDiagnostics(); builder = createSolutionBuilder(host, ["/src/tests"], { dry: true, force: false, verbose: false }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( [Diagnostics.Project_0_is_up_to_date, "/src/core/tsconfig.json"], [Diagnostics.Project_0_is_up_to_date, "/src/logic/tsconfig.json"], @@ -126,7 +126,7 @@ namespace ts { const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); - builder.buildAllProjects(); + builder.build(); // Verify they exist for (const output of allExpectedOutputs) { assert(fs.existsSync(output), `Expect file ${output} to exist`); @@ -146,15 +146,16 @@ namespace ts { const fs = projFs.shadow(); const host = new fakes.SolutionBuilderHost(fs); - const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: true, verbose: false }); - builder.buildAllProjects(); + let builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: true, verbose: false }); + builder.build(); let currentTime = time(); checkOutputTimestamps(currentTime); tick(); Debug.assert(time() !== currentTime, "Time moves on"); currentTime = time(); - builder.buildAllProjects(); + builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: true, verbose: false }); + builder.build(); checkOutputTimestamps(currentTime); function checkOutputTimestamps(expected: number) { @@ -172,7 +173,7 @@ namespace ts { const fs = projFs.shadow(); const host = new fakes.SolutionBuilderHost(fs); let builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); - builder.buildAllProjects(); + builder.build(); host.clearDiagnostics(); tick(); builder = createSolutionBuilder(host, ["/src/tests"], { ...(opts || {}), verbose: true }); @@ -183,7 +184,7 @@ namespace ts { const fs = projFs.shadow(); const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], @@ -198,7 +199,7 @@ namespace ts { // All three projects are up to date it("Detects that all projects are up to date", () => { const { host, builder } = initializeWithBuild(); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"], @@ -211,7 +212,7 @@ namespace ts { it("Only builds the leaf node project", () => { const { fs, host, builder } = initializeWithBuild(); fs.writeFileSync("/src/tests/index.ts", "const m = 10;"); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"], @@ -225,7 +226,7 @@ namespace ts { it("Detects type-only changes in upstream projects", () => { const { fs, host, builder } = initializeWithBuild(); replaceText(fs, "/src/core/index.ts", "HELLO WORLD", "WELCOME PLANET"); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), @@ -242,7 +243,7 @@ namespace ts { it("rebuilds completely when version in tsbuildinfo doesnt match ts version", () => { const { host, builder } = initializeWithBuild(); changeCompilerVersion(host); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), [Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2, "src/core/tsconfig.json", fakes.version, version], @@ -256,7 +257,7 @@ namespace ts { it("rebuilds from start if --f is passed", () => { const { host, builder } = initializeWithBuild({ force: true }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"], @@ -271,7 +272,7 @@ namespace ts { it("rebuilds when tsconfig changes", () => { const { fs, host, builder } = initializeWithBuild(); replaceText(fs, "/src/tests/tsconfig.json", `"composite": true`, `"composite": true, "target": "es3"`); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"], @@ -287,7 +288,7 @@ namespace ts { replaceText(fs, "/src/tests/tsconfig.json", `"references": [`, `"extends": "./tsconfig.base.json", "references": [`); const host = new fakes.SolutionBuilderHost(fs); let builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], @@ -301,7 +302,7 @@ namespace ts { tick(); builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: {} })); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"], @@ -310,6 +311,31 @@ namespace ts { [Diagnostics.Building_project_0, "/src/tests/tsconfig.json"] ); }); + + it("builds till project specified", () => { + const fs = projFs.shadow(); + const host = new fakes.SolutionBuilderHost(fs); + const builder = createSolutionBuilder(host, ["/src/tests"], {}); + const result = builder.build("/src/logic"); + host.assertDiagnosticMessages(/*empty*/); + assert.isFalse(fs.existsSync(allExpectedOutputs[0]), `Expect file ${allExpectedOutputs[0]} to not exist`); + for (const output of allExpectedOutputs.slice(1)) { + assert(fs.existsSync(output), `Expect file ${output} to exist`); + } + assert.equal(result, ExitStatus.Success); + }); + + it("building project in not build order doesnt throw error", () => { + const fs = projFs.shadow(); + const host = new fakes.SolutionBuilderHost(fs); + const builder = createSolutionBuilder(host, ["/src/tests"], {}); + const result = builder.build("/src/logic2"); + host.assertDiagnosticMessages(/*empty*/); + for (const output of allExpectedOutputs) { + assert.isFalse(fs.existsSync(output), `Expect file ${output} to not exist`); + } + assert.equal(result, ExitStatus.InvalidProject_OutputsSkipped); + }); }); describe("downstream-blocked compilations", () => { @@ -320,7 +346,7 @@ namespace ts { // Induce an error in the middle project replaceText(fs, "/src/logic/index.ts", "c.multiply(10, 15)", `c.muitply()`); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages( getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], @@ -340,7 +366,7 @@ namespace ts { const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages(/*empty*/); // Update a timestamp in the middle project @@ -366,7 +392,7 @@ export class cNew {}`); // Rebuild this project tick(); builder.invalidateProject("/src/logic"); - builder.buildInvalidatedProject(); + builder.buildNextInvalidatedProject(); // The file should be updated assert.isTrue(writtenFiles.has("/src/logic/index.js"), "JS file should have been rebuilt"); assert.equal(fs.statSync("/src/logic/index.js").mtimeMs, time(), "JS file should have been rebuilt"); @@ -376,7 +402,7 @@ export class cNew {}`); // Build downstream projects should update 'tests', but not 'core' tick(); - builder.buildInvalidatedProject(); + builder.buildNextInvalidatedProject(); if (expectedToWriteTests) { assert.isTrue(writtenFiles.has("/src/tests/index.js"), "Downstream JS file should have been rebuilt"); } @@ -394,7 +420,7 @@ export class cNew {}`); const fs = projFs.shadow(); const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { listFiles: true }); - builder.buildAllProjects(); + builder.build(); assert.deepEqual(host.traces, [ "/lib/lib.d.ts", "/src/core/anotherModule.ts", @@ -421,7 +447,7 @@ export class cNew {}`); const fs = projFs.shadow(); const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/tests"], { listEmittedFiles: true }); - builder.buildAllProjects(); + builder.build(); assert.deepEqual(host.traces, [ "TSFILE: /src/core/anotherModule.js", "TSFILE: /src/core/anotherModule.d.ts.map", diff --git a/src/testRunner/unittests/tsbuild/transitiveReferences.ts b/src/testRunner/unittests/tsbuild/transitiveReferences.ts index 30e28de8cde..94f364ddec0 100644 --- a/src/testRunner/unittests/tsbuild/transitiveReferences.ts +++ b/src/testRunner/unittests/tsbuild/transitiveReferences.ts @@ -30,7 +30,7 @@ namespace ts { const host = new fakes.SolutionBuilderHost(fs); modifyDiskLayout(fs); const builder = createSolutionBuilder(host, ["/src/tsconfig.c.json"], { listFiles: true }); - builder.buildAllProjects(); + builder.build(); host.assertDiagnosticMessages(...expectedDiagnostics); for (const output of allExpectedOutputs) { assert(fs.existsSync(output), `Expect file ${output} to exist`); diff --git a/src/testRunner/unittests/tsbuildWatchMode.ts b/src/testRunner/unittests/tsbuildWatchMode.ts index ef87aa1f9cb..ad00145db52 100644 --- a/src/testRunner/unittests/tsbuildWatchMode.ts +++ b/src/testRunner/unittests/tsbuildWatchMode.ts @@ -24,7 +24,7 @@ namespace ts.tscWatch { function createSolutionBuilderWithWatch(system: TsBuildWatchSystem, rootNames: ReadonlyArray, defaultOptions?: BuildOptions) { const host = createSolutionBuilderWithWatchHost(system); const solutionBuilder = ts.createSolutionBuilderWithWatch(host, rootNames, defaultOptions || { watch: true }); - solutionBuilder.buildAllProjects(); + solutionBuilder.build(); solutionBuilder.startWatching(); return solutionBuilder; } @@ -608,7 +608,7 @@ let x: string = 10;`); // Build the composite project const host = createTsBuildWatchSystem(allFiles, { currentDirectory }); const solutionBuilder = createSolutionBuilder(host, [solutionBuilderconfig], {}); - solutionBuilder.buildAllProjects(); + solutionBuilder.build(); const outputFileStamps = getOutputFileStamps(host); for (const stamp of outputFileStamps) { assert.isDefined(stamp[1], `${stamp[0]} expected to be present`); @@ -723,7 +723,7 @@ let x: string = 10;`); function foo() { }`); solutionBuilder.invalidateProject(`${project}/${SubProject.logic}`); - solutionBuilder.buildInvalidatedProject(); + solutionBuilder.buildNextInvalidatedProject(); // not ideal, but currently because of d.ts but no new file is written // There will be timeout queued even though file contents are same @@ -736,7 +736,7 @@ function foo() { export function gfoo() { }`); solutionBuilder.invalidateProject(logic[0].path); - solutionBuilder.buildInvalidatedProject(); + solutionBuilder.buildNextInvalidatedProject(); }, expectedProgramFiles); }); @@ -747,7 +747,7 @@ export function gfoo() { references: [{ path: "../core" }] })); solutionBuilder.invalidateProject(logic[0].path, ConfigFileProgramReloadLevel.Full); - solutionBuilder.buildInvalidatedProject(); + solutionBuilder.buildNextInvalidatedProject(); }, [tests[1].path, libFile.path, coreIndexDts, coreAnotherModuleDts, projectFilePath(SubProject.logic, "decls/index.d.ts")]); }); }); @@ -967,7 +967,7 @@ export function gfoo() { export function gfoo() { }`); solutionBuilder.invalidateProject(bTsconfig.path); - solutionBuilder.buildInvalidatedProject(); + solutionBuilder.buildNextInvalidatedProject(); }, emptyArray, expectedProgramFiles, diff --git a/src/testRunner/unittests/tsserver/projectReferences.ts b/src/testRunner/unittests/tsserver/projectReferences.ts index e39c510216d..f07774cd43c 100644 --- a/src/testRunner/unittests/tsserver/projectReferences.ts +++ b/src/testRunner/unittests/tsserver/projectReferences.ts @@ -5,7 +5,7 @@ namespace ts.projectSystem { // ts build should succeed const solutionBuilder = tscWatch.createSolutionBuilder(host, rootNames, {}); - solutionBuilder.buildAllProjects(); + solutionBuilder.build(); assert.equal(host.getOutput().length, 0); return host; diff --git a/src/tsc/tsc.ts b/src/tsc/tsc.ts index 35bd29ea774..fc5559be023 100644 --- a/src/tsc/tsc.ts +++ b/src/tsc/tsc.ts @@ -216,7 +216,7 @@ namespace ts { updateCreateProgram(buildHost); buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(program.getProgram()); const builder = createSolutionBuilderWithWatch(buildHost, projects, buildOptions); - builder.buildAllProjects(); + builder.build(); return builder.startWatching(); } else { @@ -224,7 +224,7 @@ namespace ts { updateCreateProgram(buildHost); buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(program.getProgram()); const builder = createSolutionBuilder(buildHost, projects, buildOptions); - return sys.exit(buildOptions.clean ? builder.cleanAllProjects() : builder.buildAllProjects()); + return sys.exit(buildOptions.clean ? builder.cleanAllProjects() : builder.build()); } } From e8074f7fdc3aac4fd8b6e23f0067800685420d1f Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 2 May 2019 14:30:59 -0700 Subject: [PATCH 052/384] Rename cleanAll to clean and take optional project as input --- src/compiler/tsbuild.ts | 59 ++++++++------- .../unittests/tsbuild/emptyFiles.ts | 8 +-- src/testRunner/unittests/tsbuild/helpers.ts | 12 ++++ src/testRunner/unittests/tsbuild/outFile.ts | 48 ++++++------- .../tsbuild/referencesWithRootDirInParent.ts | 24 ++----- .../unittests/tsbuild/resolveJsonModule.ts | 14 ++-- src/testRunner/unittests/tsbuild/sample.ts | 72 +++++++++++-------- .../unittests/tsbuild/transitiveReferences.ts | 4 +- src/tsc/tsc.ts | 2 +- 9 files changed, 124 insertions(+), 119 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 4fb2edf6801..c075e1f799c 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -256,7 +256,7 @@ namespace ts { export interface SolutionBuilder { build(project?: string, cancellationToken?: CancellationToken): ExitStatus; - cleanAllProjects(): ExitStatus; + clean(project?: string): ExitStatus; // Currently used for testing but can be made public if needed: /*@internal*/ getBuildOrder(): ReadonlyArray; @@ -404,7 +404,7 @@ namespace ts { } : { build, - cleanAllProjects, + clean, getBuildOrder, getUpToDateStatusOfProject, invalidateProject, @@ -1342,10 +1342,12 @@ namespace ts { return priorNewestUpdateTime; } - function getFilesToClean(): string[] { - // Get the same graph for cleaning we'd use for building - const filesToDelete: string[] = []; - for (const proj of getBuildOrder()) { + function clean(project?: string) { + const buildOrder = getBuildOrderFor(project); + if (!buildOrder) return ExitStatus.InvalidProject_OutputsSkipped; + + const filesToDelete = options.dry ? [] as string[] : undefined; + for (const proj of buildOrder) { const resolvedPath = toResolvedConfigFilePath(proj); const parsed = parseConfigFile(proj, resolvedPath); if (parsed === undefined) { @@ -1356,22 +1358,19 @@ namespace ts { const outputs = getAllProjectOutputs(parsed, !host.useCaseSensitiveFileNames()); for (const output of outputs) { if (host.fileExists(output)) { - filesToDelete.push(output); + if (filesToDelete) { + filesToDelete.push(output); + } + else { + host.deleteFile(output); + invalidateResolvedProject(resolvedPath, ConfigFileProgramReloadLevel.None); + } } } } - return filesToDelete; - } - function cleanAllProjects() { - const filesToDelete = getFilesToClean(); - if (options.dry) { + if (filesToDelete) { reportStatus(Diagnostics.A_non_dry_build_would_delete_the_following_files_Colon_0, filesToDelete.map(f => `\r\n * ${f}`).join("")); - return ExitStatus.Success; - } - - for (const output of filesToDelete) { - host.deleteFile(output); } return ExitStatus.Success; @@ -1429,7 +1428,23 @@ namespace ts { cacheState = undefined; } + function getBuildOrderFor(project: string | undefined) { + const resolvedProject = project && resolveProjectName(project); + if (resolvedProject) { + const projectPath = toResolvedConfigFilePath(resolvedProject); + const projectIndex = findIndex( + getBuildOrder(), + configFileName => toResolvedConfigFilePath(configFileName) === projectPath + ); + if (projectIndex === -1) return undefined; + } + return resolvedProject ? createBuildOrder([resolvedProject]) : getBuildOrder(); + } + function build(project?: string, cancellationToken?: CancellationToken): ExitStatus { + const buildOrder = getBuildOrderFor(project); + if (!buildOrder) return ExitStatus.InvalidProject_OutputsSkipped; + // Set initial build if not already built if (allProjectBuildPending) { allProjectBuildPending = false; @@ -1447,16 +1462,6 @@ namespace ts { let successfulProjects = 0; let errorProjects = 0; - const resolvedProject = project && resolveProjectName(project); - if (resolvedProject) { - const projectPath = toResolvedConfigFilePath(resolvedProject); - const projectIndex = findIndex( - getBuildOrder(), - configFileName => toResolvedConfigFilePath(configFileName) === projectPath - ); - if (projectIndex === -1) return ExitStatus.InvalidProject_OutputsSkipped; - } - const buildOrder = resolvedProject ? createBuildOrder([resolvedProject]) : getBuildOrder(); while (true) { const invalidatedProject = getNextInvalidatedProject(buildOrder); if (!invalidatedProject) { diff --git a/src/testRunner/unittests/tsbuild/emptyFiles.ts b/src/testRunner/unittests/tsbuild/emptyFiles.ts index badad8f3377..38b8b4b5379 100644 --- a/src/testRunner/unittests/tsbuild/emptyFiles.ts +++ b/src/testRunner/unittests/tsbuild/emptyFiles.ts @@ -18,9 +18,7 @@ namespace ts { host.assertDiagnosticMessages([Diagnostics.The_files_list_in_config_file_0_is_empty, "/src/no-references/tsconfig.json"]); // Check for outputs to not be written. - for (const output of allExpectedOutputs) { - assert(!fs.existsSync(output), `Expect file ${output} to not exist`); - } + verifyOutputsAbsent(fs, allExpectedOutputs); }); it("does not have empty files diagnostic when files is empty and references are provided", () => { @@ -33,9 +31,7 @@ namespace ts { host.assertDiagnosticMessages(/*empty*/); // Check for outputs to be written. - for (const output of allExpectedOutputs) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsPresent(fs, allExpectedOutputs); }); }); } diff --git a/src/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index 33a7afb181a..7aeaba36199 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -82,6 +82,18 @@ declare const console: { log(msg: any): void; };`; return fs; } + export function verifyOutputsPresent(fs: vfs.FileSystem, outputs: readonly string[]) { + for (const output of outputs) { + assert(fs.existsSync(output), `Expect file ${output} to exist`); + } + } + + export function verifyOutputsAbsent(fs: vfs.FileSystem, outputs: readonly string[]) { + for (const output of outputs) { + assert.isFalse(fs.existsSync(output), `Expect file ${output} to not exist`); + } + } + function generateSourceMapBaselineFiles(fs: vfs.FileSystem, mapFileNames: ReadonlyArray) { for (const mapFile of mapFileNames) { if (!fs.existsSync(mapFile)) continue; diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index ea56c7f511d..f562d4dc26b 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -366,18 +366,14 @@ namespace ts { builder.build(); host.assertDiagnosticMessages(...initialExpectedDiagnostics); // Verify they exist - for (const output of expectedOutputs) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsPresent(fs, expectedOutputs); host.clearDiagnostics(); - builder.cleanAllProjects(); + builder.clean(); host.assertDiagnosticMessages(/*none*/); // Verify they are gone - for (const output of expectedOutputs) { - assert(!fs.existsSync(output), `Expect file ${output} to not exist`); - } + verifyOutputsAbsent(fs, expectedOutputs); // Subsequent clean shouldn't throw / etc - builder.cleanAllProjects(); + builder.clean(); }); it("verify buildInfo absence results in new build", () => { @@ -392,9 +388,7 @@ namespace ts { builder.build(); host.assertDiagnosticMessages(...initialExpectedDiagnostics); // Verify they exist - for (const output of expectedOutputs) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsPresent(fs, expectedOutputs); // Delete bundle info host.clearDiagnostics(); host.deleteFile(outputFiles[project.first][ext.buildinfo]); @@ -419,10 +413,8 @@ namespace ts { builder.build(); host.assertDiagnosticMessages(...initialExpectedDiagnostics); // Verify they exist - without tsbuildinfo for third project - for (const output of expectedOutputFiles.slice(0, expectedOutputFiles.length - 2)) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } - assert.isFalse(fs.existsSync(outputFiles[project.third][ext.buildinfo]), `Expect file ${outputFiles[project.third][ext.buildinfo]} to not exist`); + verifyOutputsPresent(fs, expectedOutputFiles.slice(0, expectedOutputFiles.length - 2)); + verifyOutputsAbsent(fs, [outputFiles[project.third][ext.buildinfo]]); }); it("rebuilds completely when version in tsbuildinfo doesnt match ts version", () => { @@ -496,13 +488,23 @@ namespace ts { const result = builder.build(sources[project.second][source.config]); host.assertDiagnosticMessages(/*empty*/); // First and Third is not built - for (const output of [...outputFiles[project.first], ...outputFiles[project.third]]) { - assert.isFalse(fs.existsSync(output), `Expect file ${output} to not exist`); - } + verifyOutputsAbsent(fs, [...outputFiles[project.first], ...outputFiles[project.third]]); // second is built - for (const output of outputFiles[project.second]) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsPresent(fs, outputFiles[project.second]); + assert.equal(result, ExitStatus.Success); + }); + + it("cleans till project specified", () => { + const fs = outFileFs.shadow(); + const host = new fakes.SolutionBuilderHost(fs); + const builder = createSolutionBuilder(host, { verbose: false }); + builder.build(); + const result = builder.clean(sources[project.second][source.config]); + host.assertDiagnosticMessages(/*empty*/); + // First and Third output for present + verifyOutputsPresent(fs, [...outputFiles[project.first], ...outputFiles[project.third]]); + // second is cleaned + verifyOutputsAbsent(fs, outputFiles[project.second]); assert.equal(result, ExitStatus.Success); }); @@ -940,9 +942,7 @@ ${internal} enum internalEnum { a, b, c }`); removeFileExtension(f) + Extension.Dts + ".map", ]) ]); - for (const output of expectedOutputFiles) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsPresent(fs, expectedOutputFiles); }); }); } diff --git a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts index c965eb73067..186a43b3c3e 100644 --- a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts +++ b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts @@ -21,9 +21,7 @@ namespace ts { const builder = createSolutionBuilder(host, ["/src/src/main", "/src/src/other"], {}); builder.build(); host.assertDiagnosticMessages(/*empty*/); - for (const output of allExpectedOutputs) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsPresent(fs, allExpectedOutputs); }); it("verify that it reports error for same .tsbuildinfo file because no rootDir in the base", () => { @@ -48,12 +46,8 @@ namespace ts { [Diagnostics.Building_project_0, "/src/src/main/tsconfig.json"], [Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, "/src/dist/tsconfig.tsbuildinfo", "/src/src/other"] ); - for (const output of allExpectedOutputs) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } - for (const output of missingOutputs) { - assert.isFalse(fs.existsSync(output), `Expect file ${output} to not exist`); - } + verifyOutputsPresent(fs, allExpectedOutputs); + verifyOutputsAbsent(fs, missingOutputs); }); it("verify that it reports error for same .tsbuildinfo file", () => { @@ -84,12 +78,8 @@ namespace ts { [Diagnostics.Building_project_0, "/src/src/main/tsconfig.json"], [Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, "/src/dist/tsconfig.tsbuildinfo", "/src/src/other"] ); - for (const output of allExpectedOutputs) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } - for (const output of missingOutputs) { - assert.isFalse(fs.existsSync(output), `Expect file ${output} to not exist`); - } + verifyOutputsPresent(fs, allExpectedOutputs); + verifyOutputsAbsent(fs, missingOutputs); }); it("verify that it reports no error when .tsbuildinfo differ", () => { @@ -120,9 +110,7 @@ namespace ts { [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/main/tsconfig.main.json", "src/dist/a.js"], [Diagnostics.Building_project_0, "/src/src/main/tsconfig.main.json"] ); - for (const output of allExpectedOutputs) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsPresent(fs, allExpectedOutputs); }); }); } diff --git a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts index f1a40c050f9..66bb0dc6e95 100644 --- a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts +++ b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts @@ -23,9 +23,7 @@ namespace ts { host.assertDiagnosticMessages(...expectedDiagnosticMessages); if (!expectedDiagnosticMessages.length) { // Check for outputs. Not an exhaustive list - for (const output of allExpectedOutputs) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsPresent(fs, allExpectedOutputs); } } @@ -71,9 +69,7 @@ export default hello.hello`); [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, configFile, "src/dist/src/index.js"], [Diagnostics.Building_project_0, `/${configFile}`] ); - for (const output of [...allExpectedOutputs, "/src/dist/src/index.js.map"]) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsPresent(fs, [...allExpectedOutputs, "/src/dist/src/index.js.map"]); host.clearDiagnostics(); builder = createSolutionBuilder(host, [configFile], { verbose: true }); tick(); @@ -96,9 +92,7 @@ export default hello.hello`); [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, configFile, "src/src/index.js"], [Diagnostics.Building_project_0, `/${configFile}`] ); - for (const output of ["/src/src/index.js", "/src/src/index.d.ts"]) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsPresent(fs, ["/src/src/index.js", "/src/src/index.d.ts"]); host.clearDiagnostics(); builder = createSolutionBuilder(host, [configFile], { verbose: true }); tick(); @@ -137,7 +131,7 @@ export default hello.hello`); [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, mainConfigFile, "src/main/index.js"], [Diagnostics.Building_project_0, `/${mainConfigFile}`], ); - assert(fs.existsSync(expectedOutput), `Expect file ${expectedOutput} to exist`); + verifyOutputsPresent(fs, [expectedOutput]); host.clearDiagnostics(); builder = createSolutionBuilder(host, [configFile], { verbose: true }); tick(); diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 3ad2b2e3eec..65530e59705 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -25,9 +25,7 @@ namespace ts { host.assertDiagnosticMessages(/*empty*/); // Check for outputs. Not an exhaustive list - for (const output of allExpectedOutputs) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsPresent(fs, allExpectedOutputs); }); it("builds correctly when outDir is specified", () => { @@ -43,9 +41,7 @@ namespace ts { host.assertDiagnosticMessages(/*empty*/); const expectedOutputs = allExpectedOutputs.map(f => f.replace("/logic/", "/logic/outDir/")); // Check for outputs. Not an exhaustive list - for (const output of expectedOutputs) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsPresent(fs, expectedOutputs); }); it("builds correctly when declarationDir is specified", () => { @@ -61,9 +57,7 @@ namespace ts { host.assertDiagnosticMessages(/*empty*/); const expectedOutputs = allExpectedOutputs.map(f => f.replace("/logic/index.d.ts", "/logic/out/decls/index.d.ts")); // Check for outputs. Not an exhaustive list - for (const output of expectedOutputs) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsPresent(fs, expectedOutputs); }); it("builds correctly when project is not composite or doesnt have any references", () => { @@ -77,9 +71,7 @@ namespace ts { [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], [Diagnostics.Building_project_0, "/src/core/tsconfig.json"] ); - for (const output of ["/src/core/index.js", "/src/core/index.d.ts", "/src/core/index.d.ts.map"]) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsPresent(fs, ["/src/core/index.js", "/src/core/index.d.ts", "/src/core/index.d.ts.map"]); }); }); @@ -96,9 +88,7 @@ namespace ts { ); // Check for outputs to not be written. Not an exhaustive list - for (const output of allExpectedOutputs) { - assert(!fs.existsSync(output), `Expect file ${output} to not exist`); - } + verifyOutputsAbsent(fs, allExpectedOutputs); }); it("indicates that it would skip builds during a dry build", () => { @@ -128,16 +118,42 @@ namespace ts { const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: false }); builder.build(); // Verify they exist - for (const output of allExpectedOutputs) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } - builder.cleanAllProjects(); + verifyOutputsPresent(fs, allExpectedOutputs); + + builder.clean(); // Verify they are gone - for (const output of allExpectedOutputs) { - assert(!fs.existsSync(output), `Expect file ${output} to not exist`); - } + verifyOutputsAbsent(fs, allExpectedOutputs); + // Subsequent clean shouldn't throw / etc - builder.cleanAllProjects(); + builder.clean(); + verifyOutputsAbsent(fs, allExpectedOutputs); + + builder.build(); + // Verify they exist + verifyOutputsPresent(fs, allExpectedOutputs); + }); + + it("cleans till project specified", () => { + const fs = projFs.shadow(); + const host = new fakes.SolutionBuilderHost(fs); + const builder = createSolutionBuilder(host, ["/src/tests"], {}); + builder.build(); + const result = builder.clean("/src/logic"); + host.assertDiagnosticMessages(/*empty*/); + verifyOutputsPresent(fs, [allExpectedOutputs[0]]); + verifyOutputsAbsent(fs, allExpectedOutputs.slice(1)); + assert.equal(result, ExitStatus.Success); + }); + + it("cleaning project in not build order doesnt throw error", () => { + const fs = projFs.shadow(); + const host = new fakes.SolutionBuilderHost(fs); + const builder = createSolutionBuilder(host, ["/src/tests"], {}); + builder.build(); + const result = builder.clean("/src/logic2"); + host.assertDiagnosticMessages(/*empty*/); + verifyOutputsPresent(fs, allExpectedOutputs); + assert.equal(result, ExitStatus.InvalidProject_OutputsSkipped); }); }); @@ -318,10 +334,8 @@ namespace ts { const builder = createSolutionBuilder(host, ["/src/tests"], {}); const result = builder.build("/src/logic"); host.assertDiagnosticMessages(/*empty*/); - assert.isFalse(fs.existsSync(allExpectedOutputs[0]), `Expect file ${allExpectedOutputs[0]} to not exist`); - for (const output of allExpectedOutputs.slice(1)) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsAbsent(fs, [allExpectedOutputs[0]]); + verifyOutputsPresent(fs, allExpectedOutputs.slice(1)); assert.equal(result, ExitStatus.Success); }); @@ -331,9 +345,7 @@ namespace ts { const builder = createSolutionBuilder(host, ["/src/tests"], {}); const result = builder.build("/src/logic2"); host.assertDiagnosticMessages(/*empty*/); - for (const output of allExpectedOutputs) { - assert.isFalse(fs.existsSync(output), `Expect file ${output} to not exist`); - } + verifyOutputsAbsent(fs, allExpectedOutputs); assert.equal(result, ExitStatus.InvalidProject_OutputsSkipped); }); }); diff --git a/src/testRunner/unittests/tsbuild/transitiveReferences.ts b/src/testRunner/unittests/tsbuild/transitiveReferences.ts index 94f364ddec0..614796b2a85 100644 --- a/src/testRunner/unittests/tsbuild/transitiveReferences.ts +++ b/src/testRunner/unittests/tsbuild/transitiveReferences.ts @@ -32,9 +32,7 @@ namespace ts { const builder = createSolutionBuilder(host, ["/src/tsconfig.c.json"], { listFiles: true }); builder.build(); host.assertDiagnosticMessages(...expectedDiagnostics); - for (const output of allExpectedOutputs) { - assert(fs.existsSync(output), `Expect file ${output} to exist`); - } + verifyOutputsPresent(fs, allExpectedOutputs); assert.deepEqual(host.traces, expectedFileTraces); } diff --git a/src/tsc/tsc.ts b/src/tsc/tsc.ts index fc5559be023..3514236beda 100644 --- a/src/tsc/tsc.ts +++ b/src/tsc/tsc.ts @@ -224,7 +224,7 @@ namespace ts { updateCreateProgram(buildHost); buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(program.getProgram()); const builder = createSolutionBuilder(buildHost, projects, buildOptions); - return sys.exit(buildOptions.clean ? builder.cleanAllProjects() : builder.build()); + return sys.exit(buildOptions.clean ? builder.clean() : builder.build()); } } From 8891d4f375e86ec897f1fad219d4d3804da2c7f6 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 2 May 2019 15:15:03 -0700 Subject: [PATCH 053/384] Permit reverse mapped types to be created from partially inferable types --- src/compiler/checker.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f9c87e94961..61607e9c904 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14887,10 +14887,22 @@ namespace ts { return type; } + // We consider a type to be partially inferable if it isn't marked non-inferable or if it is + // an object literal type with at least one property of an inferable type. For example, an object + // literal { a: 123, b: x => true } is marked non-inferable because it contains a context sensitive + // arrow function, but is considered partially inferable because property 'a' has an inferable type. + function isPartiallyInferableType(type: Type): boolean { + return !(getObjectFlags(type) & ObjectFlags.NonInferrableType) || + isObjectLiteralType(type) && some(getPropertiesOfType(type), prop => isPartiallyInferableType(getTypeOfSymbol(prop))); + } + function createReverseMappedType(source: Type, target: MappedType, constraint: IndexType) { - // If any property contains context sensitive functions that have been skipped, the source type - // is incomplete and we can't infer a meaningful input type. - if (getObjectFlags(source) & ObjectFlags.NonInferrableType || getPropertiesOfType(source).length === 0 && !getIndexInfoOfType(source, IndexKind.String)) { + // We consider a source type reverse mappable if it has a string index signature or if + // it has one or more properties and all properties have inferable types. + const properties = getPropertiesOfType(source); + const isReverseMappable = getIndexInfoOfType(source, IndexKind.String) || + properties.length !== 0 && every(properties, prop => isPartiallyInferableType(getTypeOfSymbol(prop))); + if (!isReverseMappable) { return undefined; } // For arrays and tuples we infer new arrays and tuples where the reverse mapping has been From 3da47963d51d85a1af3c482344d56c947b71c552 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 2 May 2019 15:17:53 -0700 Subject: [PATCH 054/384] Remove startWatching as explicit method from api --- src/compiler/tsbuild.ts | 42 +++++++++----------- src/testRunner/unittests/tsbuildWatchMode.ts | 1 - src/tsc/tsc.ts | 19 ++++----- 3 files changed, 26 insertions(+), 36 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index c075e1f799c..1f7a90cabd6 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -234,6 +234,7 @@ namespace ts { export interface SolutionBuilderHostBase extends ProgramHost { getModifiedTime(fileName: string): Date | undefined; setModifiedTime(fileName: string, date: Date): void; + deleteFile(fileName: string): void; reportDiagnostic: DiagnosticReporter; // Technically we want to move it out and allow steps of actions on Solution, but for now just merge stuff in build host here reportSolutionBuilderStatus: DiagnosticReporter; @@ -247,7 +248,6 @@ namespace ts { } export interface SolutionBuilderHost extends SolutionBuilderHostBase { - deleteFile(fileName: string): void; reportErrorSummary?: ReportEmitErrorSummary; } @@ -267,11 +267,6 @@ namespace ts { /*@internal*/ buildNextInvalidatedProject(): void; } - export interface SolutionBuilderWithWatch { - build(project?: string, cancellationToken?: CancellationToken): ExitStatus; - /*@internal*/ startWatching(): void; - } - interface InvalidatedProject { project: ResolvedConfigFileName; projectPath: ResolvedConfigFilePath; @@ -294,6 +289,7 @@ namespace ts { const host = createProgramHost(system, createProgram) as SolutionBuilderHostBase; host.getModifiedTime = system.getModifiedTime ? path => system.getModifiedTime!(path) : returnUndefined; host.setModifiedTime = system.setModifiedTime ? (path, date) => system.setModifiedTime!(path, date) : noop; + host.deleteFile = system.deleteFile ? path => system.deleteFile!(path) : noop; host.reportDiagnostic = reportDiagnostic || createDiagnosticReporter(system); host.reportSolutionBuilderStatus = reportSolutionBuilderStatus || createBuilderStatusReporter(system); return host; @@ -301,7 +297,6 @@ namespace ts { export function createSolutionBuilderHost(system = sys, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportErrorSummary?: ReportEmitErrorSummary) { const host = createSolutionBuilderHostBase(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus) as SolutionBuilderHost; - host.deleteFile = system.deleteFile ? path => system.deleteFile!(path) : noop; host.reportErrorSummary = reportErrorSummary; return host; } @@ -325,7 +320,7 @@ namespace ts { return createSolutionBuilderWorker(/*watch*/ false, host, rootNames, defaultOptions); } - export function createSolutionBuilderWithWatch(host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilderWithWatch { + export function createSolutionBuilderWithWatch(host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder { return createSolutionBuilderWorker(/*watch*/ true, host, rootNames, defaultOptions); } @@ -334,8 +329,8 @@ namespace ts { * can dynamically add/remove other projects based on changes on the rootNames' references */ function createSolutionBuilderWorker(watch: false, host: SolutionBuilderHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; - function createSolutionBuilderWorker(watch: true, host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilderWithWatch; - function createSolutionBuilderWorker(watch: boolean, hostOrHostWithWatch: SolutionBuilderHost | SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder | SolutionBuilderWithWatch { + function createSolutionBuilderWorker(watch: true, host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; + function createSolutionBuilderWorker(watch: boolean, hostOrHostWithWatch: SolutionBuilderHost | SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder { const host = hostOrHostWithWatch as SolutionBuilderHost; const hostWithWatch = hostOrHostWithWatch as SolutionBuilderWithWatchHost; const currentDirectory = host.getCurrentDirectory(); @@ -395,21 +390,16 @@ namespace ts { let allProjectBuildPending = true; let needsSummary = true; - // let watchAllProjectsPending = watch; + let watchAllProjectsPending = watch; - return watch ? - { - build, - startWatching - } : - { - build, - clean, - getBuildOrder, - getUpToDateStatusOfProject, - invalidateProject, - buildNextInvalidatedProject, - }; + return { + build, + clean, + getBuildOrder, + getUpToDateStatusOfProject, + invalidateProject, + buildNextInvalidatedProject, + }; function toPath(fileName: string) { return ts.toPath(fileName, currentDirectory, getCanonicalFileName); @@ -1469,6 +1459,10 @@ namespace ts { disableCache(); reportErrorSummary(); } + if (watchAllProjectsPending) { + watchAllProjectsPending = false; + startWatching(); + } break; } diff --git a/src/testRunner/unittests/tsbuildWatchMode.ts b/src/testRunner/unittests/tsbuildWatchMode.ts index ad00145db52..70fe602c8a2 100644 --- a/src/testRunner/unittests/tsbuildWatchMode.ts +++ b/src/testRunner/unittests/tsbuildWatchMode.ts @@ -25,7 +25,6 @@ namespace ts.tscWatch { const host = createSolutionBuilderWithWatchHost(system); const solutionBuilder = ts.createSolutionBuilderWithWatch(host, rootNames, defaultOptions || { watch: true }); solutionBuilder.build(); - solutionBuilder.startWatching(); return solutionBuilder; } diff --git a/src/tsc/tsc.ts b/src/tsc/tsc.ts index 3514236beda..47814a1f68b 100644 --- a/src/tsc/tsc.ts +++ b/src/tsc/tsc.ts @@ -207,25 +207,22 @@ namespace ts { reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--build")); return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } - if (buildOptions.watch) { - reportWatchModeWithoutSysSupport(); - } if (buildOptions.watch) { + reportWatchModeWithoutSysSupport(); const buildHost = createSolutionBuilderWithWatchHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty(buildOptions)), createWatchStatusReporter(buildOptions)); updateCreateProgram(buildHost); buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(program.getProgram()); const builder = createSolutionBuilderWithWatch(buildHost, projects, buildOptions); builder.build(); - return builder.startWatching(); - } - else { - const buildHost = createSolutionBuilderHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty(buildOptions)), createReportErrorSummary(buildOptions)); - updateCreateProgram(buildHost); - buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(program.getProgram()); - const builder = createSolutionBuilder(buildHost, projects, buildOptions); - return sys.exit(buildOptions.clean ? builder.clean() : builder.build()); + return; } + + const buildHost = createSolutionBuilderHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty(buildOptions)), createReportErrorSummary(buildOptions)); + updateCreateProgram(buildHost); + buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(program.getProgram()); + const builder = createSolutionBuilder(buildHost, projects, buildOptions); + return sys.exit(buildOptions.clean ? builder.clean() : builder.build()); } function createReportErrorSummary(options: CompilerOptions | BuildOptions): ReportEmitErrorSummary | undefined { From f73308b248d99a30a741314e2a8e5aba9415e311 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 2 May 2019 15:24:56 -0700 Subject: [PATCH 055/384] Add tests --- .../reverseMappedPartiallyInferableTypes.ts | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 tests/cases/compiler/reverseMappedPartiallyInferableTypes.ts diff --git a/tests/cases/compiler/reverseMappedPartiallyInferableTypes.ts b/tests/cases/compiler/reverseMappedPartiallyInferableTypes.ts new file mode 100644 index 00000000000..799ff641c5a --- /dev/null +++ b/tests/cases/compiler/reverseMappedPartiallyInferableTypes.ts @@ -0,0 +1,96 @@ +// @strict: true + +// Repro from #30505 + +export type Prop = { (): T } +export type PropType = Prop; +export type PropDefaultValue = T; + + +export type PropValidatorFunction = (value: T) => boolean; +export type PropValidator = PropOptions; + + +export type PropOptions = { + type: PropType; + + value?: PropDefaultValue, + required?: boolean; + validator?: PropValidatorFunction; +} + +export type RecordPropsDefinition = { + [K in keyof T]: PropValidator +} +export type PropsDefinition = RecordPropsDefinition; + + +declare function extend({ props }: { props: PropsDefinition }): PropsDefinition; + +interface MyType { + valid: boolean; +} + +const r = extend({ + props: { + notResolved: { + type: Object as PropType, + validator: x => { + return x.valid; + } + }, + explicit: { + type: Object as PropType, + validator: (x: MyType) => { + return x.valid; + } + } + } +}) + +r.explicit +r.notResolved +r.explicit.required +r.notResolved.required + +// Modified repro from #30505 + +type Box = { + contents?: T; + contains?(content: T): boolean; +}; + +type Mapped = { + [K in keyof T]: Box; +} + +declare function id(arg: Mapped): Mapped; + +// All properties have inferable types + +const obj1 = id({ + foo: { + contents: "" + } +}); + +// Some properties have inferable types + +const obj2 = id({ + foo: { + contents: "", + contains(k) { + return k.length > 0; + } + } +}); + +// No properties have inferable types + +const obj3 = id({ + foo: { + contains(k) { + return k.length > 0; + } + } +}); From 6aaeb52c9235b23324ff8a5fd46555e991d3897a Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 2 May 2019 15:25:05 -0700 Subject: [PATCH 056/384] Accept new baselines --- ...seMappedPartiallyInferableTypes.errors.txt | 101 +++++++ .../reverseMappedPartiallyInferableTypes.js | 144 ++++++++++ ...verseMappedPartiallyInferableTypes.symbols | 259 ++++++++++++++++++ ...reverseMappedPartiallyInferableTypes.types | 231 ++++++++++++++++ 4 files changed, 735 insertions(+) create mode 100644 tests/baselines/reference/reverseMappedPartiallyInferableTypes.errors.txt create mode 100644 tests/baselines/reference/reverseMappedPartiallyInferableTypes.js create mode 100644 tests/baselines/reference/reverseMappedPartiallyInferableTypes.symbols create mode 100644 tests/baselines/reference/reverseMappedPartiallyInferableTypes.types diff --git a/tests/baselines/reference/reverseMappedPartiallyInferableTypes.errors.txt b/tests/baselines/reference/reverseMappedPartiallyInferableTypes.errors.txt new file mode 100644 index 00000000000..63ea9a9f279 --- /dev/null +++ b/tests/baselines/reference/reverseMappedPartiallyInferableTypes.errors.txt @@ -0,0 +1,101 @@ +tests/cases/compiler/reverseMappedPartiallyInferableTypes.ts(91,20): error TS2571: Object is of type 'unknown'. + + +==== tests/cases/compiler/reverseMappedPartiallyInferableTypes.ts (1 errors) ==== + // Repro from #30505 + + export type Prop = { (): T } + export type PropType = Prop; + export type PropDefaultValue = T; + + + export type PropValidatorFunction = (value: T) => boolean; + export type PropValidator = PropOptions; + + + export type PropOptions = { + type: PropType; + + value?: PropDefaultValue, + required?: boolean; + validator?: PropValidatorFunction; + } + + export type RecordPropsDefinition = { + [K in keyof T]: PropValidator + } + export type PropsDefinition = RecordPropsDefinition; + + + declare function extend({ props }: { props: PropsDefinition }): PropsDefinition; + + interface MyType { + valid: boolean; + } + + const r = extend({ + props: { + notResolved: { + type: Object as PropType, + validator: x => { + return x.valid; + } + }, + explicit: { + type: Object as PropType, + validator: (x: MyType) => { + return x.valid; + } + } + } + }) + + r.explicit + r.notResolved + r.explicit.required + r.notResolved.required + + // Modified repro from #30505 + + type Box = { + contents?: T; + contains?(content: T): boolean; + }; + + type Mapped = { + [K in keyof T]: Box; + } + + declare function id(arg: Mapped): Mapped; + + // All properties have inferable types + + const obj1 = id({ + foo: { + contents: "" + } + }); + + // Some properties have inferable types + + const obj2 = id({ + foo: { + contents: "", + contains(k) { + return k.length > 0; + } + } + }); + + // No properties have inferable types + + const obj3 = id({ + foo: { + contains(k) { + return k.length > 0; + ~ +!!! error TS2571: Object is of type 'unknown'. + } + } + }); + \ No newline at end of file diff --git a/tests/baselines/reference/reverseMappedPartiallyInferableTypes.js b/tests/baselines/reference/reverseMappedPartiallyInferableTypes.js new file mode 100644 index 00000000000..e5a9c2a57ae --- /dev/null +++ b/tests/baselines/reference/reverseMappedPartiallyInferableTypes.js @@ -0,0 +1,144 @@ +//// [reverseMappedPartiallyInferableTypes.ts] +// Repro from #30505 + +export type Prop = { (): T } +export type PropType = Prop; +export type PropDefaultValue = T; + + +export type PropValidatorFunction = (value: T) => boolean; +export type PropValidator = PropOptions; + + +export type PropOptions = { + type: PropType; + + value?: PropDefaultValue, + required?: boolean; + validator?: PropValidatorFunction; +} + +export type RecordPropsDefinition = { + [K in keyof T]: PropValidator +} +export type PropsDefinition = RecordPropsDefinition; + + +declare function extend({ props }: { props: PropsDefinition }): PropsDefinition; + +interface MyType { + valid: boolean; +} + +const r = extend({ + props: { + notResolved: { + type: Object as PropType, + validator: x => { + return x.valid; + } + }, + explicit: { + type: Object as PropType, + validator: (x: MyType) => { + return x.valid; + } + } + } +}) + +r.explicit +r.notResolved +r.explicit.required +r.notResolved.required + +// Modified repro from #30505 + +type Box = { + contents?: T; + contains?(content: T): boolean; +}; + +type Mapped = { + [K in keyof T]: Box; +} + +declare function id(arg: Mapped): Mapped; + +// All properties have inferable types + +const obj1 = id({ + foo: { + contents: "" + } +}); + +// Some properties have inferable types + +const obj2 = id({ + foo: { + contents: "", + contains(k) { + return k.length > 0; + } + } +}); + +// No properties have inferable types + +const obj3 = id({ + foo: { + contains(k) { + return k.length > 0; + } + } +}); + + +//// [reverseMappedPartiallyInferableTypes.js] +"use strict"; +// Repro from #30505 +exports.__esModule = true; +var r = extend({ + props: { + notResolved: { + type: Object, + validator: function (x) { + return x.valid; + } + }, + explicit: { + type: Object, + validator: function (x) { + return x.valid; + } + } + } +}); +r.explicit; +r.notResolved; +r.explicit.required; +r.notResolved.required; +// All properties have inferable types +var obj1 = id({ + foo: { + contents: "" + } +}); +// Some properties have inferable types +var obj2 = id({ + foo: { + contents: "", + contains: function (k) { + return k.length > 0; + } + } +}); +// No properties have inferable types +var obj3 = id({ + foo: { + contains: function (k) { + return k.length > 0; + } + } +}); diff --git a/tests/baselines/reference/reverseMappedPartiallyInferableTypes.symbols b/tests/baselines/reference/reverseMappedPartiallyInferableTypes.symbols new file mode 100644 index 00000000000..ac264a37e9e --- /dev/null +++ b/tests/baselines/reference/reverseMappedPartiallyInferableTypes.symbols @@ -0,0 +1,259 @@ +=== tests/cases/compiler/reverseMappedPartiallyInferableTypes.ts === +// Repro from #30505 + +export type Prop = { (): T } +>Prop : Symbol(Prop, Decl(reverseMappedPartiallyInferableTypes.ts, 0, 0)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 2, 17)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 2, 17)) + +export type PropType = Prop; +>PropType : Symbol(PropType, Decl(reverseMappedPartiallyInferableTypes.ts, 2, 31)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 3, 21)) +>Prop : Symbol(Prop, Decl(reverseMappedPartiallyInferableTypes.ts, 0, 0)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 3, 21)) + +export type PropDefaultValue = T; +>PropDefaultValue : Symbol(PropDefaultValue, Decl(reverseMappedPartiallyInferableTypes.ts, 3, 34)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 4, 29)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 4, 29)) + + +export type PropValidatorFunction = (value: T) => boolean; +>PropValidatorFunction : Symbol(PropValidatorFunction, Decl(reverseMappedPartiallyInferableTypes.ts, 4, 36)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 7, 34)) +>value : Symbol(value, Decl(reverseMappedPartiallyInferableTypes.ts, 7, 40)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 7, 34)) + +export type PropValidator = PropOptions; +>PropValidator : Symbol(PropValidator, Decl(reverseMappedPartiallyInferableTypes.ts, 7, 61)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 8, 26)) +>PropOptions : Symbol(PropOptions, Decl(reverseMappedPartiallyInferableTypes.ts, 8, 46)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 8, 26)) + + +export type PropOptions = { +>PropOptions : Symbol(PropOptions, Decl(reverseMappedPartiallyInferableTypes.ts, 8, 46)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 11, 24)) + + type: PropType; +>type : Symbol(type, Decl(reverseMappedPartiallyInferableTypes.ts, 11, 30)) +>PropType : Symbol(PropType, Decl(reverseMappedPartiallyInferableTypes.ts, 2, 31)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 11, 24)) + + value?: PropDefaultValue, +>value : Symbol(value, Decl(reverseMappedPartiallyInferableTypes.ts, 12, 22)) +>PropDefaultValue : Symbol(PropDefaultValue, Decl(reverseMappedPartiallyInferableTypes.ts, 3, 34)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 11, 24)) + + required?: boolean; +>required : Symbol(required, Decl(reverseMappedPartiallyInferableTypes.ts, 14, 32)) + + validator?: PropValidatorFunction; +>validator : Symbol(validator, Decl(reverseMappedPartiallyInferableTypes.ts, 15, 23)) +>PropValidatorFunction : Symbol(PropValidatorFunction, Decl(reverseMappedPartiallyInferableTypes.ts, 4, 36)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 11, 24)) +} + +export type RecordPropsDefinition = { +>RecordPropsDefinition : Symbol(RecordPropsDefinition, Decl(reverseMappedPartiallyInferableTypes.ts, 17, 1)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 19, 34)) + + [K in keyof T]: PropValidator +>K : Symbol(K, Decl(reverseMappedPartiallyInferableTypes.ts, 20, 5)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 19, 34)) +>PropValidator : Symbol(PropValidator, Decl(reverseMappedPartiallyInferableTypes.ts, 7, 61)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 19, 34)) +>K : Symbol(K, Decl(reverseMappedPartiallyInferableTypes.ts, 20, 5)) +} +export type PropsDefinition = RecordPropsDefinition; +>PropsDefinition : Symbol(PropsDefinition, Decl(reverseMappedPartiallyInferableTypes.ts, 21, 1)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 22, 28)) +>RecordPropsDefinition : Symbol(RecordPropsDefinition, Decl(reverseMappedPartiallyInferableTypes.ts, 17, 1)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 22, 28)) + + +declare function extend({ props }: { props: PropsDefinition }): PropsDefinition; +>extend : Symbol(extend, Decl(reverseMappedPartiallyInferableTypes.ts, 22, 58)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 25, 24)) +>props : Symbol(props, Decl(reverseMappedPartiallyInferableTypes.ts, 25, 28)) +>props : Symbol(props, Decl(reverseMappedPartiallyInferableTypes.ts, 25, 39)) +>PropsDefinition : Symbol(PropsDefinition, Decl(reverseMappedPartiallyInferableTypes.ts, 21, 1)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 25, 24)) +>PropsDefinition : Symbol(PropsDefinition, Decl(reverseMappedPartiallyInferableTypes.ts, 21, 1)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 25, 24)) + +interface MyType { +>MyType : Symbol(MyType, Decl(reverseMappedPartiallyInferableTypes.ts, 25, 90)) + + valid: boolean; +>valid : Symbol(MyType.valid, Decl(reverseMappedPartiallyInferableTypes.ts, 27, 18)) +} + +const r = extend({ +>r : Symbol(r, Decl(reverseMappedPartiallyInferableTypes.ts, 31, 5)) +>extend : Symbol(extend, Decl(reverseMappedPartiallyInferableTypes.ts, 22, 58)) + + props: { +>props : Symbol(props, Decl(reverseMappedPartiallyInferableTypes.ts, 31, 18)) + + notResolved: { +>notResolved : Symbol(notResolved, Decl(reverseMappedPartiallyInferableTypes.ts, 32, 12)) + + type: Object as PropType, +>type : Symbol(type, Decl(reverseMappedPartiallyInferableTypes.ts, 33, 22)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>PropType : Symbol(PropType, Decl(reverseMappedPartiallyInferableTypes.ts, 2, 31)) +>MyType : Symbol(MyType, Decl(reverseMappedPartiallyInferableTypes.ts, 25, 90)) + + validator: x => { +>validator : Symbol(validator, Decl(reverseMappedPartiallyInferableTypes.ts, 34, 45)) +>x : Symbol(x, Decl(reverseMappedPartiallyInferableTypes.ts, 35, 22)) + + return x.valid; +>x.valid : Symbol(MyType.valid, Decl(reverseMappedPartiallyInferableTypes.ts, 27, 18)) +>x : Symbol(x, Decl(reverseMappedPartiallyInferableTypes.ts, 35, 22)) +>valid : Symbol(MyType.valid, Decl(reverseMappedPartiallyInferableTypes.ts, 27, 18)) + } + }, + explicit: { +>explicit : Symbol(explicit, Decl(reverseMappedPartiallyInferableTypes.ts, 38, 10)) + + type: Object as PropType, +>type : Symbol(type, Decl(reverseMappedPartiallyInferableTypes.ts, 39, 19)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>PropType : Symbol(PropType, Decl(reverseMappedPartiallyInferableTypes.ts, 2, 31)) +>MyType : Symbol(MyType, Decl(reverseMappedPartiallyInferableTypes.ts, 25, 90)) + + validator: (x: MyType) => { +>validator : Symbol(validator, Decl(reverseMappedPartiallyInferableTypes.ts, 40, 45)) +>x : Symbol(x, Decl(reverseMappedPartiallyInferableTypes.ts, 41, 24)) +>MyType : Symbol(MyType, Decl(reverseMappedPartiallyInferableTypes.ts, 25, 90)) + + return x.valid; +>x.valid : Symbol(MyType.valid, Decl(reverseMappedPartiallyInferableTypes.ts, 27, 18)) +>x : Symbol(x, Decl(reverseMappedPartiallyInferableTypes.ts, 41, 24)) +>valid : Symbol(MyType.valid, Decl(reverseMappedPartiallyInferableTypes.ts, 27, 18)) + } + } + } +}) + +r.explicit +>r.explicit : Symbol(explicit, Decl(reverseMappedPartiallyInferableTypes.ts, 38, 10)) +>r : Symbol(r, Decl(reverseMappedPartiallyInferableTypes.ts, 31, 5)) +>explicit : Symbol(explicit, Decl(reverseMappedPartiallyInferableTypes.ts, 38, 10)) + +r.notResolved +>r.notResolved : Symbol(notResolved, Decl(reverseMappedPartiallyInferableTypes.ts, 32, 12)) +>r : Symbol(r, Decl(reverseMappedPartiallyInferableTypes.ts, 31, 5)) +>notResolved : Symbol(notResolved, Decl(reverseMappedPartiallyInferableTypes.ts, 32, 12)) + +r.explicit.required +>r.explicit.required : Symbol(required, Decl(reverseMappedPartiallyInferableTypes.ts, 14, 32)) +>r.explicit : Symbol(explicit, Decl(reverseMappedPartiallyInferableTypes.ts, 38, 10)) +>r : Symbol(r, Decl(reverseMappedPartiallyInferableTypes.ts, 31, 5)) +>explicit : Symbol(explicit, Decl(reverseMappedPartiallyInferableTypes.ts, 38, 10)) +>required : Symbol(required, Decl(reverseMappedPartiallyInferableTypes.ts, 14, 32)) + +r.notResolved.required +>r.notResolved.required : Symbol(required, Decl(reverseMappedPartiallyInferableTypes.ts, 14, 32)) +>r.notResolved : Symbol(notResolved, Decl(reverseMappedPartiallyInferableTypes.ts, 32, 12)) +>r : Symbol(r, Decl(reverseMappedPartiallyInferableTypes.ts, 31, 5)) +>notResolved : Symbol(notResolved, Decl(reverseMappedPartiallyInferableTypes.ts, 32, 12)) +>required : Symbol(required, Decl(reverseMappedPartiallyInferableTypes.ts, 14, 32)) + +// Modified repro from #30505 + +type Box = { +>Box : Symbol(Box, Decl(reverseMappedPartiallyInferableTypes.ts, 51, 22)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 55, 9)) + + contents?: T; +>contents : Symbol(contents, Decl(reverseMappedPartiallyInferableTypes.ts, 55, 15)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 55, 9)) + + contains?(content: T): boolean; +>contains : Symbol(contains, Decl(reverseMappedPartiallyInferableTypes.ts, 56, 17)) +>content : Symbol(content, Decl(reverseMappedPartiallyInferableTypes.ts, 57, 14)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 55, 9)) + +}; + +type Mapped = { +>Mapped : Symbol(Mapped, Decl(reverseMappedPartiallyInferableTypes.ts, 58, 2)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 60, 12)) + + [K in keyof T]: Box; +>K : Symbol(K, Decl(reverseMappedPartiallyInferableTypes.ts, 61, 5)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 60, 12)) +>Box : Symbol(Box, Decl(reverseMappedPartiallyInferableTypes.ts, 51, 22)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 60, 12)) +>K : Symbol(K, Decl(reverseMappedPartiallyInferableTypes.ts, 61, 5)) +} + +declare function id(arg: Mapped): Mapped; +>id : Symbol(id, Decl(reverseMappedPartiallyInferableTypes.ts, 62, 1)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 64, 20)) +>arg : Symbol(arg, Decl(reverseMappedPartiallyInferableTypes.ts, 64, 23)) +>Mapped : Symbol(Mapped, Decl(reverseMappedPartiallyInferableTypes.ts, 58, 2)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 64, 20)) +>Mapped : Symbol(Mapped, Decl(reverseMappedPartiallyInferableTypes.ts, 58, 2)) +>T : Symbol(T, Decl(reverseMappedPartiallyInferableTypes.ts, 64, 20)) + +// All properties have inferable types + +const obj1 = id({ +>obj1 : Symbol(obj1, Decl(reverseMappedPartiallyInferableTypes.ts, 68, 5)) +>id : Symbol(id, Decl(reverseMappedPartiallyInferableTypes.ts, 62, 1)) + + foo: { +>foo : Symbol(foo, Decl(reverseMappedPartiallyInferableTypes.ts, 68, 17)) + + contents: "" +>contents : Symbol(contents, Decl(reverseMappedPartiallyInferableTypes.ts, 69, 10)) + } +}); + +// Some properties have inferable types + +const obj2 = id({ +>obj2 : Symbol(obj2, Decl(reverseMappedPartiallyInferableTypes.ts, 76, 5)) +>id : Symbol(id, Decl(reverseMappedPartiallyInferableTypes.ts, 62, 1)) + + foo: { +>foo : Symbol(foo, Decl(reverseMappedPartiallyInferableTypes.ts, 76, 17)) + + contents: "", +>contents : Symbol(contents, Decl(reverseMappedPartiallyInferableTypes.ts, 77, 10)) + + contains(k) { +>contains : Symbol(contains, Decl(reverseMappedPartiallyInferableTypes.ts, 78, 21)) +>k : Symbol(k, Decl(reverseMappedPartiallyInferableTypes.ts, 79, 17)) + + return k.length > 0; +>k.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) +>k : Symbol(k, Decl(reverseMappedPartiallyInferableTypes.ts, 79, 17)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) + } + } +}); + +// No properties have inferable types + +const obj3 = id({ +>obj3 : Symbol(obj3, Decl(reverseMappedPartiallyInferableTypes.ts, 87, 5)) +>id : Symbol(id, Decl(reverseMappedPartiallyInferableTypes.ts, 62, 1)) + + foo: { +>foo : Symbol(foo, Decl(reverseMappedPartiallyInferableTypes.ts, 87, 17)) + + contains(k) { +>contains : Symbol(contains, Decl(reverseMappedPartiallyInferableTypes.ts, 88, 10)) +>k : Symbol(k, Decl(reverseMappedPartiallyInferableTypes.ts, 89, 17)) + + return k.length > 0; +>k : Symbol(k, Decl(reverseMappedPartiallyInferableTypes.ts, 89, 17)) + } + } +}); + diff --git a/tests/baselines/reference/reverseMappedPartiallyInferableTypes.types b/tests/baselines/reference/reverseMappedPartiallyInferableTypes.types new file mode 100644 index 00000000000..49cd5cf8962 --- /dev/null +++ b/tests/baselines/reference/reverseMappedPartiallyInferableTypes.types @@ -0,0 +1,231 @@ +=== tests/cases/compiler/reverseMappedPartiallyInferableTypes.ts === +// Repro from #30505 + +export type Prop = { (): T } +>Prop : Prop + +export type PropType = Prop; +>PropType : Prop + +export type PropDefaultValue = T; +>PropDefaultValue : T + + +export type PropValidatorFunction = (value: T) => boolean; +>PropValidatorFunction : PropValidatorFunction +>value : T + +export type PropValidator = PropOptions; +>PropValidator : PropOptions + + +export type PropOptions = { +>PropOptions : PropOptions + + type: PropType; +>type : Prop + + value?: PropDefaultValue, +>value : T | undefined + + required?: boolean; +>required : boolean | undefined + + validator?: PropValidatorFunction; +>validator : PropValidatorFunction | undefined +} + +export type RecordPropsDefinition = { +>RecordPropsDefinition : RecordPropsDefinition + + [K in keyof T]: PropValidator +} +export type PropsDefinition = RecordPropsDefinition; +>PropsDefinition : RecordPropsDefinition + + +declare function extend({ props }: { props: PropsDefinition }): PropsDefinition; +>extend : ({ props }: { props: RecordPropsDefinition; }) => RecordPropsDefinition +>props : RecordPropsDefinition +>props : RecordPropsDefinition + +interface MyType { + valid: boolean; +>valid : boolean +} + +const r = extend({ +>r : RecordPropsDefinition<{ notResolved: MyType; explicit: MyType; }> +>extend({ props: { notResolved: { type: Object as PropType, validator: x => { return x.valid; } }, explicit: { type: Object as PropType, validator: (x: MyType) => { return x.valid; } } }}) : RecordPropsDefinition<{ notResolved: MyType; explicit: MyType; }> +>extend : ({ props }: { props: RecordPropsDefinition; }) => RecordPropsDefinition +>{ props: { notResolved: { type: Object as PropType, validator: x => { return x.valid; } }, explicit: { type: Object as PropType, validator: (x: MyType) => { return x.valid; } } }} : { props: { notResolved: { type: Prop; validator: (x: MyType) => boolean; }; explicit: { type: Prop; validator: (x: MyType) => boolean; }; }; } + + props: { +>props : { notResolved: { type: Prop; validator: (x: MyType) => boolean; }; explicit: { type: Prop; validator: (x: MyType) => boolean; }; } +>{ notResolved: { type: Object as PropType, validator: x => { return x.valid; } }, explicit: { type: Object as PropType, validator: (x: MyType) => { return x.valid; } } } : { notResolved: { type: Prop; validator: (x: MyType) => boolean; }; explicit: { type: Prop; validator: (x: MyType) => boolean; }; } + + notResolved: { +>notResolved : { type: Prop; validator: (x: MyType) => boolean; } +>{ type: Object as PropType, validator: x => { return x.valid; } } : { type: Prop; validator: (x: MyType) => boolean; } + + type: Object as PropType, +>type : Prop +>Object as PropType : Prop +>Object : ObjectConstructor + + validator: x => { +>validator : (x: MyType) => boolean +>x => { return x.valid; } : (x: MyType) => boolean +>x : MyType + + return x.valid; +>x.valid : boolean +>x : MyType +>valid : boolean + } + }, + explicit: { +>explicit : { type: Prop; validator: (x: MyType) => boolean; } +>{ type: Object as PropType, validator: (x: MyType) => { return x.valid; } } : { type: Prop; validator: (x: MyType) => boolean; } + + type: Object as PropType, +>type : Prop +>Object as PropType : Prop +>Object : ObjectConstructor + + validator: (x: MyType) => { +>validator : (x: MyType) => boolean +>(x: MyType) => { return x.valid; } : (x: MyType) => boolean +>x : MyType + + return x.valid; +>x.valid : boolean +>x : MyType +>valid : boolean + } + } + } +}) + +r.explicit +>r.explicit : PropOptions +>r : RecordPropsDefinition<{ notResolved: MyType; explicit: MyType; }> +>explicit : PropOptions + +r.notResolved +>r.notResolved : PropOptions +>r : RecordPropsDefinition<{ notResolved: MyType; explicit: MyType; }> +>notResolved : PropOptions + +r.explicit.required +>r.explicit.required : boolean | undefined +>r.explicit : PropOptions +>r : RecordPropsDefinition<{ notResolved: MyType; explicit: MyType; }> +>explicit : PropOptions +>required : boolean | undefined + +r.notResolved.required +>r.notResolved.required : boolean | undefined +>r.notResolved : PropOptions +>r : RecordPropsDefinition<{ notResolved: MyType; explicit: MyType; }> +>notResolved : PropOptions +>required : boolean | undefined + +// Modified repro from #30505 + +type Box = { +>Box : Box + + contents?: T; +>contents : T | undefined + + contains?(content: T): boolean; +>contains : ((content: T) => boolean) | undefined +>content : T + +}; + +type Mapped = { +>Mapped : Mapped + + [K in keyof T]: Box; +} + +declare function id(arg: Mapped): Mapped; +>id : (arg: Mapped) => Mapped +>arg : Mapped + +// All properties have inferable types + +const obj1 = id({ +>obj1 : Mapped<{ foo: string; }> +>id({ foo: { contents: "" }}) : Mapped<{ foo: string; }> +>id : (arg: Mapped) => Mapped +>{ foo: { contents: "" }} : { foo: { contents: string; }; } + + foo: { +>foo : { contents: string; } +>{ contents: "" } : { contents: string; } + + contents: "" +>contents : string +>"" : "" + } +}); + +// Some properties have inferable types + +const obj2 = id({ +>obj2 : Mapped<{ foo: string; }> +>id({ foo: { contents: "", contains(k) { return k.length > 0; } }}) : Mapped<{ foo: string; }> +>id : (arg: Mapped) => Mapped +>{ foo: { contents: "", contains(k) { return k.length > 0; } }} : { foo: { contents: string; contains(k: string): boolean; }; } + + foo: { +>foo : { contents: string; contains(k: string): boolean; } +>{ contents: "", contains(k) { return k.length > 0; } } : { contents: string; contains(k: string): boolean; } + + contents: "", +>contents : string +>"" : "" + + contains(k) { +>contains : (k: string) => boolean +>k : string + + return k.length > 0; +>k.length > 0 : boolean +>k.length : number +>k : string +>length : number +>0 : 0 + } + } +}); + +// No properties have inferable types + +const obj3 = id({ +>obj3 : Mapped +>id({ foo: { contains(k) { return k.length > 0; } }}) : Mapped +>id : (arg: Mapped) => Mapped +>{ foo: { contains(k) { return k.length > 0; } }} : { foo: { contains(k: unknown): boolean; }; } + + foo: { +>foo : { contains(k: unknown): boolean; } +>{ contains(k) { return k.length > 0; } } : { contains(k: unknown): boolean; } + + contains(k) { +>contains : (k: unknown) => boolean +>k : unknown + + return k.length > 0; +>k.length > 0 : boolean +>k.length : any +>k : unknown +>length : any +>0 : 0 + } + } +}); + From 5c18513e966dc9718358778cc53261aa2c845cc2 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 2 May 2019 15:34:13 -0700 Subject: [PATCH 057/384] Make SolutionBuilder as Public API --- src/compiler/commandLineParser.ts | 3 +- src/compiler/tsbuild.ts | 122 +++++++++--------- src/compiler/watch.ts | 2 - .../reference/api/tsserverlibrary.d.ts | 43 +++++- tests/baselines/reference/api/typescript.d.ts | 43 +++++- 5 files changed, 145 insertions(+), 68 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 104f3576e3a..b6ae404a295 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1022,8 +1022,7 @@ namespace ts { } } - /* @internal */ - export interface OptionsBase { + interface OptionsBase { [option: string]: CompilerOptionsValue | undefined; } diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 1f7a90cabd6..673f712689e 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -1,58 +1,5 @@ -// Currently we do not want to expose API for build, we should work out the API, and then expose it just like we did for builder/watch /*@internal*/ namespace ts { - const minimumDate = new Date(-8640000000000000); - const maximumDate = new Date(8640000000000000); - - export interface BuildHost { - verbose(diag: DiagnosticMessage, ...args: string[]): void; - error(diag: DiagnosticMessage, ...args: string[]): void; - errorDiagnostic(diag: Diagnostic): void; - message(diag: DiagnosticMessage, ...args: string[]): void; - } - - export interface BuildOptions extends OptionsBase { - dry?: boolean; - force?: boolean; - verbose?: boolean; - - /*@internal*/ clean?: boolean; - /*@internal*/ watch?: boolean; - /*@internal*/ help?: boolean; - - preserveWatchOutput?: boolean; - listEmittedFiles?: boolean; - listFiles?: boolean; - pretty?: boolean; - incremental?: boolean; - - traceResolution?: boolean; - /* @internal */ diagnostics?: boolean; - /* @internal */ extendedDiagnostics?: boolean; - } - - enum BuildResultFlags { - None = 0, - - /** - * No errors of any kind occurred during build - */ - Success = 1 << 0, - /** - * None of the .d.ts files emitted by this build were - * different from the existing files on disk - */ - DeclarationOutputUnchanged = 1 << 1, - - ConfigFileErrors = 1 << 2, - SyntaxErrors = 1 << 3, - TypeErrors = 1 << 4, - DeclarationEmitErrors = 1 << 5, - EmitErrors = 1 << 6, - - AnyErrors = ConfigFileErrors | SyntaxErrors | TypeErrors | DeclarationEmitErrors | EmitErrors - } - export enum UpToDateStatusType { Unbuildable, UpToDate, @@ -194,6 +141,63 @@ namespace ts { } } + export function resolveConfigFileProjectName(project: string): ResolvedConfigFileName { + if (fileExtensionIs(project, Extension.Json)) { + return project as ResolvedConfigFileName; + } + + return combinePaths(project, "tsconfig.json") as ResolvedConfigFileName; + } +} + +namespace ts { + const minimumDate = new Date(-8640000000000000); + const maximumDate = new Date(8640000000000000); + + export interface BuildOptions { + dry?: boolean; + force?: boolean; + verbose?: boolean; + + /*@internal*/ clean?: boolean; + /*@internal*/ watch?: boolean; + /*@internal*/ help?: boolean; + + preserveWatchOutput?: boolean; + listEmittedFiles?: boolean; + listFiles?: boolean; + pretty?: boolean; + incremental?: boolean; + + traceResolution?: boolean; + /* @internal */ diagnostics?: boolean; + /* @internal */ extendedDiagnostics?: boolean; + + [option: string]: CompilerOptionsValue | undefined; + } + + enum BuildResultFlags { + None = 0, + + /** + * No errors of any kind occurred during build + */ + Success = 1 << 0, + /** + * None of the .d.ts files emitted by this build were + * different from the existing files on disk + */ + DeclarationOutputUnchanged = 1 << 1, + + ConfigFileErrors = 1 << 2, + SyntaxErrors = 1 << 3, + TypeErrors = 1 << 4, + DeclarationEmitErrors = 1 << 5, + EmitErrors = 1 << 6, + + AnyErrors = ConfigFileErrors | SyntaxErrors | TypeErrors | DeclarationEmitErrors | EmitErrors + } + type ResolvedConfigFilePath = ResolvedConfigFileName & Path; interface FileMap extends Map { get(key: U): T | undefined; @@ -231,6 +235,8 @@ namespace ts { return fileExtensionIs(fileName, Extension.Dts); } + export type ReportEmitErrorSummary = (errorCount: number) => void; + export interface SolutionBuilderHostBase extends ProgramHost { getModifiedTime(fileName: string): Date | undefined; setModifiedTime(fileName: string, date: Date): void; @@ -1527,15 +1533,7 @@ namespace ts { } } - export function resolveConfigFileProjectName(project: string): ResolvedConfigFileName { - if (fileExtensionIs(project, Extension.Json)) { - return project as ResolvedConfigFileName; - } - - return combinePaths(project, "tsconfig.json") as ResolvedConfigFileName; - } - - export function formatUpToDateStatus(configFileName: string, status: UpToDateStatus, relName: (fileName: string) => string, formatMessage: (message: DiagnosticMessage, ...args: string[]) => T) { + function formatUpToDateStatus(configFileName: string, status: UpToDateStatus, relName: (fileName: string) => string, formatMessage: (message: DiagnosticMessage, ...args: string[]) => T) { switch (status.type) { case UpToDateStatusType.OutOfDateWithSelf: return formatMessage(Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index d6a856cfe9f..50853534bb0 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -88,8 +88,6 @@ namespace ts { return result; } - export type ReportEmitErrorSummary = (errorCount: number) => void; - export function getErrorCountForSummary(diagnostics: ReadonlyArray) { return countWhere(diagnostics, diagnostic => diagnostic.category === DiagnosticCategory.Error); } diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index fb95102e791..08a1309d792 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -1905,7 +1905,8 @@ declare namespace ts { enum ExitStatus { Success = 0, DiagnosticsPresent_OutputsSkipped = 1, - DiagnosticsPresent_OutputsGenerated = 2 + DiagnosticsPresent_OutputsGenerated = 2, + InvalidProject_OutputsSkipped = 3 } interface EmitResult { emitSkipped: boolean; @@ -4555,6 +4556,46 @@ declare namespace ts { */ function createWatchProgram(host: WatchCompilerHostOfConfigFile): WatchOfConfigFile; } +declare namespace ts { + interface BuildOptions { + dry?: boolean; + force?: boolean; + verbose?: boolean; + preserveWatchOutput?: boolean; + listEmittedFiles?: boolean; + listFiles?: boolean; + pretty?: boolean; + incremental?: boolean; + traceResolution?: boolean; + [option: string]: CompilerOptionsValue | undefined; + } + type ReportEmitErrorSummary = (errorCount: number) => void; + interface SolutionBuilderHostBase extends ProgramHost { + getModifiedTime(fileName: string): Date | undefined; + setModifiedTime(fileName: string, date: Date): void; + deleteFile(fileName: string): void; + reportDiagnostic: DiagnosticReporter; + reportSolutionBuilderStatus: DiagnosticReporter; + afterProgramEmitAndDiagnostics?(program: T): void; + } + interface SolutionBuilderHost extends SolutionBuilderHostBase { + reportErrorSummary?: ReportEmitErrorSummary; + } + interface SolutionBuilderWithWatchHost extends SolutionBuilderHostBase, WatchHost { + } + interface SolutionBuilder { + build(project?: string, cancellationToken?: CancellationToken): ExitStatus; + clean(project?: string): ExitStatus; + } + /** + * Create a function that reports watch status by writing to the system and handles the formating of the diagnostic + */ + function createBuilderStatusReporter(system: System, pretty?: boolean): DiagnosticReporter; + function createSolutionBuilderHost(system?: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportErrorSummary?: ReportEmitErrorSummary): SolutionBuilderHost; + function createSolutionBuilderWithWatchHost(system?: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): SolutionBuilderWithWatchHost; + function createSolutionBuilder(host: SolutionBuilderHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; + function createSolutionBuilderWithWatch(host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; +} declare namespace ts.server { type ActionSet = "action::set"; type ActionInvalidate = "action::invalidate"; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 170cb00b9e8..1c8129c20b0 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1905,7 +1905,8 @@ declare namespace ts { enum ExitStatus { Success = 0, DiagnosticsPresent_OutputsSkipped = 1, - DiagnosticsPresent_OutputsGenerated = 2 + DiagnosticsPresent_OutputsGenerated = 2, + InvalidProject_OutputsSkipped = 3 } interface EmitResult { emitSkipped: boolean; @@ -4555,6 +4556,46 @@ declare namespace ts { */ function createWatchProgram(host: WatchCompilerHostOfConfigFile): WatchOfConfigFile; } +declare namespace ts { + interface BuildOptions { + dry?: boolean; + force?: boolean; + verbose?: boolean; + preserveWatchOutput?: boolean; + listEmittedFiles?: boolean; + listFiles?: boolean; + pretty?: boolean; + incremental?: boolean; + traceResolution?: boolean; + [option: string]: CompilerOptionsValue | undefined; + } + type ReportEmitErrorSummary = (errorCount: number) => void; + interface SolutionBuilderHostBase extends ProgramHost { + getModifiedTime(fileName: string): Date | undefined; + setModifiedTime(fileName: string, date: Date): void; + deleteFile(fileName: string): void; + reportDiagnostic: DiagnosticReporter; + reportSolutionBuilderStatus: DiagnosticReporter; + afterProgramEmitAndDiagnostics?(program: T): void; + } + interface SolutionBuilderHost extends SolutionBuilderHostBase { + reportErrorSummary?: ReportEmitErrorSummary; + } + interface SolutionBuilderWithWatchHost extends SolutionBuilderHostBase, WatchHost { + } + interface SolutionBuilder { + build(project?: string, cancellationToken?: CancellationToken): ExitStatus; + clean(project?: string): ExitStatus; + } + /** + * Create a function that reports watch status by writing to the system and handles the formating of the diagnostic + */ + function createBuilderStatusReporter(system: System, pretty?: boolean): DiagnosticReporter; + function createSolutionBuilderHost(system?: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportErrorSummary?: ReportEmitErrorSummary): SolutionBuilderHost; + function createSolutionBuilderWithWatchHost(system?: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): SolutionBuilderWithWatchHost; + function createSolutionBuilder(host: SolutionBuilderHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; + function createSolutionBuilderWithWatch(host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; +} declare namespace ts.server { type ActionSet = "action::set"; type ActionInvalidate = "action::invalidate"; From 0a255249f6bf04c3c15e21fadb393c31fb9a3b15 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 2 May 2019 15:42:08 -0700 Subject: [PATCH 058/384] Enable apis to create incremental program --- src/compiler/watch.ts | 75 ++++++++++--------- .../reference/api/tsserverlibrary.d.ts | 11 +++ tests/baselines/reference/api/typescript.d.ts | 11 +++ 3 files changed, 60 insertions(+), 37 deletions(-) diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 50853534bb0..4f974add57d 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -380,43 +380,6 @@ namespace ts { return host; } - export function readBuilderProgram(compilerOptions: CompilerOptions, readFile: (path: string) => string | undefined) { - if (compilerOptions.out || compilerOptions.outFile) return undefined; - const buildInfoPath = getOutputPathForBuildInfo(compilerOptions); - if (!buildInfoPath) return undefined; - const content = readFile(buildInfoPath); - if (!content) return undefined; - const buildInfo = getBuildInfo(content); - if (buildInfo.version !== version) return undefined; - if (!buildInfo.program) return undefined; - return createBuildProgramUsingProgramBuildInfo(buildInfo.program); - } - - export function createIncrementalCompilerHost(options: CompilerOptions, system = sys): CompilerHost { - const host = createCompilerHostWorker(options, /*setParentNodes*/ undefined, system); - host.createHash = maybeBind(system, system.createHash); - setGetSourceFileAsHashVersioned(host, system); - changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName)); - return host; - } - - interface IncrementalProgramOptions { - rootNames: ReadonlyArray; - options: CompilerOptions; - configFileParsingDiagnostics?: ReadonlyArray; - projectReferences?: ReadonlyArray; - host?: CompilerHost; - createProgram?: CreateProgram; - } - function createIncrementalProgram({ - rootNames, options, configFileParsingDiagnostics, projectReferences, host, createProgram - }: IncrementalProgramOptions): T { - host = host || createIncrementalCompilerHost(options); - createProgram = createProgram || createEmitAndSemanticDiagnosticsBuilderProgram as any as CreateProgram; - const oldProgram = readBuilderProgram(options, path => host!.readFile(path)) as any as T; - return createProgram(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences); - } - export interface IncrementalCompilationOptions { rootNames: ReadonlyArray; options: CompilerOptions; @@ -444,6 +407,44 @@ namespace ts { } namespace ts { + export function readBuilderProgram(compilerOptions: CompilerOptions, readFile: (path: string) => string | undefined) { + if (compilerOptions.out || compilerOptions.outFile) return undefined; + const buildInfoPath = getOutputPathForBuildInfo(compilerOptions); + if (!buildInfoPath) return undefined; + const content = readFile(buildInfoPath); + if (!content) return undefined; + const buildInfo = getBuildInfo(content); + if (buildInfo.version !== version) return undefined; + if (!buildInfo.program) return undefined; + return createBuildProgramUsingProgramBuildInfo(buildInfo.program); + } + + export function createIncrementalCompilerHost(options: CompilerOptions, system = sys): CompilerHost { + const host = createCompilerHostWorker(options, /*setParentNodes*/ undefined, system); + host.createHash = maybeBind(system, system.createHash); + setGetSourceFileAsHashVersioned(host, system); + changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName)); + return host; + } + + export interface IncrementalProgramOptions { + rootNames: ReadonlyArray; + options: CompilerOptions; + configFileParsingDiagnostics?: ReadonlyArray; + projectReferences?: ReadonlyArray; + host?: CompilerHost; + createProgram?: CreateProgram; + } + + export function createIncrementalProgram({ + rootNames, options, configFileParsingDiagnostics, projectReferences, host, createProgram + }: IncrementalProgramOptions): T { + host = host || createIncrementalCompilerHost(options); + createProgram = createProgram || createEmitAndSemanticDiagnosticsBuilderProgram as any as CreateProgram; + const oldProgram = readBuilderProgram(options, path => host!.readFile(path)) as any as T; + return createProgram(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences); + } + export type WatchStatusReporter = (diagnostic: Diagnostic, newLine: string, options: CompilerOptions) => void; /** Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program */ export type CreateProgram = (rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: T, configFileParsingDiagnostics?: ReadonlyArray, projectReferences?: ReadonlyArray | undefined) => T; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 08a1309d792..7b45703dcfd 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4443,6 +4443,17 @@ declare namespace ts { function createAbstractBuilder(rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray, projectReferences?: ReadonlyArray): BuilderProgram; } declare namespace ts { + function readBuilderProgram(compilerOptions: CompilerOptions, readFile: (path: string) => string | undefined): (EmitAndSemanticDiagnosticsBuilderProgram & SemanticDiagnosticsBuilderProgram) | undefined; + function createIncrementalCompilerHost(options: CompilerOptions, system?: System): CompilerHost; + interface IncrementalProgramOptions { + rootNames: ReadonlyArray; + options: CompilerOptions; + configFileParsingDiagnostics?: ReadonlyArray; + projectReferences?: ReadonlyArray; + host?: CompilerHost; + createProgram?: CreateProgram; + } + function createIncrementalProgram({ rootNames, options, configFileParsingDiagnostics, projectReferences, host, createProgram }: IncrementalProgramOptions): T; type WatchStatusReporter = (diagnostic: Diagnostic, newLine: string, options: CompilerOptions) => void; /** Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program */ type CreateProgram = (rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: T, configFileParsingDiagnostics?: ReadonlyArray, projectReferences?: ReadonlyArray | undefined) => T; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 1c8129c20b0..acbe1b1ac0d 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4443,6 +4443,17 @@ declare namespace ts { function createAbstractBuilder(rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray, projectReferences?: ReadonlyArray): BuilderProgram; } declare namespace ts { + function readBuilderProgram(compilerOptions: CompilerOptions, readFile: (path: string) => string | undefined): (EmitAndSemanticDiagnosticsBuilderProgram & SemanticDiagnosticsBuilderProgram) | undefined; + function createIncrementalCompilerHost(options: CompilerOptions, system?: System): CompilerHost; + interface IncrementalProgramOptions { + rootNames: ReadonlyArray; + options: CompilerOptions; + configFileParsingDiagnostics?: ReadonlyArray; + projectReferences?: ReadonlyArray; + host?: CompilerHost; + createProgram?: CreateProgram; + } + function createIncrementalProgram({ rootNames, options, configFileParsingDiagnostics, projectReferences, host, createProgram }: IncrementalProgramOptions): T; type WatchStatusReporter = (diagnostic: Diagnostic, newLine: string, options: CompilerOptions) => void; /** Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program */ type CreateProgram = (rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: T, configFileParsingDiagnostics?: ReadonlyArray, projectReferences?: ReadonlyArray | undefined) => T; From 71b190af61ba2b074c54bb85d2a8c817a7df7bf9 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 2 May 2019 16:12:29 -0700 Subject: [PATCH 059/384] Create api for buildNextProject --- src/compiler/tsbuild.ts | 33 +++++++++++-- src/testRunner/unittests/tsbuild/sample.ts | 48 ++++++++++++++++--- .../reference/api/tsserverlibrary.d.ts | 5 ++ tests/baselines/reference/api/typescript.d.ts | 5 ++ 4 files changed, 80 insertions(+), 11 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 673f712689e..9e625041287 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -260,9 +260,15 @@ namespace ts { export interface SolutionBuilderWithWatchHost extends SolutionBuilderHostBase, WatchHost { } + export interface SolutionBuilderResult { + project: ResolvedConfigFileName; + result: T; + } + export interface SolutionBuilder { build(project?: string, cancellationToken?: CancellationToken): ExitStatus; clean(project?: string): ExitStatus; + buildNextProject(cancellationToken?: CancellationToken): SolutionBuilderResult | undefined; // Currently used for testing but can be made public if needed: /*@internal*/ getBuildOrder(): ReadonlyArray; @@ -401,6 +407,7 @@ namespace ts { return { build, clean, + buildNextProject, getBuildOrder, getUpToDateStatusOfProject, invalidateProject, @@ -1437,10 +1444,7 @@ namespace ts { return resolvedProject ? createBuildOrder([resolvedProject]) : getBuildOrder(); } - function build(project?: string, cancellationToken?: CancellationToken): ExitStatus { - const buildOrder = getBuildOrderFor(project); - if (!buildOrder) return ExitStatus.InvalidProject_OutputsSkipped; - + function setupInitialBuild(cancellationToken: CancellationToken | undefined) { // Set initial build if not already built if (allProjectBuildPending) { allProjectBuildPending = false; @@ -1455,6 +1459,27 @@ namespace ts { cancellationToken.throwIfCancellationRequested(); } } + } + + function buildNextProject(cancellationToken?: CancellationToken): SolutionBuilderResult | undefined { + setupInitialBuild(cancellationToken); + const invalidatedProject = getNextInvalidatedProject(getBuildOrder()); + if (!invalidatedProject) return undefined; + + buildInvalidatedProject(invalidatedProject, cancellationToken); + return { + project: invalidatedProject.project, + result: diagnostics.has(invalidatedProject.projectPath) ? + ExitStatus.DiagnosticsPresent_OutputsSkipped : + ExitStatus.Success + }; + } + + function build(project?: string, cancellationToken?: CancellationToken): ExitStatus { + const buildOrder = getBuildOrderFor(project); + if (!buildOrder) return ExitStatus.InvalidProject_OutputsSkipped; + + setupInitialBuild(cancellationToken); let successfulProjects = 0; let errorProjects = 0; diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 65530e59705..7f9f2260d6d 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -2,9 +2,10 @@ namespace ts { describe("unittests:: tsbuild:: on 'sample1' project", () => { let projFs: vfs.FileSystem; const { time, tick } = getTime(); - const allExpectedOutputs = ["/src/tests/index.js", - "/src/core/index.js", "/src/core/index.d.ts", "/src/core/index.d.ts.map", - "/src/logic/index.js", "/src/logic/index.js.map", "/src/logic/index.d.ts"]; + const testsOutputs = ["/src/tests/index.js"]; + const logicOutputs = ["/src/logic/index.js", "/src/logic/index.js.map", "/src/logic/index.d.ts"]; + const coreOutputs = ["/src/core/index.js", "/src/core/index.d.ts", "/src/core/index.d.ts.map"]; + const allExpectedOutputs = [...testsOutputs, ...logicOutputs, ...coreOutputs]; before(() => { projFs = loadProjectFromDisk("tests/projects/sample1", time); @@ -140,8 +141,8 @@ namespace ts { builder.build(); const result = builder.clean("/src/logic"); host.assertDiagnosticMessages(/*empty*/); - verifyOutputsPresent(fs, [allExpectedOutputs[0]]); - verifyOutputsAbsent(fs, allExpectedOutputs.slice(1)); + verifyOutputsPresent(fs, testsOutputs); + verifyOutputsAbsent(fs, [...logicOutputs, ...coreOutputs]); assert.equal(result, ExitStatus.Success); }); @@ -334,8 +335,8 @@ namespace ts { const builder = createSolutionBuilder(host, ["/src/tests"], {}); const result = builder.build("/src/logic"); host.assertDiagnosticMessages(/*empty*/); - verifyOutputsAbsent(fs, [allExpectedOutputs[0]]); - verifyOutputsPresent(fs, allExpectedOutputs.slice(1)); + verifyOutputsAbsent(fs, testsOutputs); + verifyOutputsPresent(fs, [...logicOutputs, ...coreOutputs]); assert.equal(result, ExitStatus.Success); }); @@ -348,6 +349,39 @@ namespace ts { verifyOutputsAbsent(fs, allExpectedOutputs); assert.equal(result, ExitStatus.InvalidProject_OutputsSkipped); }); + + it("building using buildNextProject", () => { + const fs = projFs.shadow(); + const host = new fakes.SolutionBuilderHost(fs); + const builder = createSolutionBuilder(host, ["/src/tests"], {}); + verifyBuildNextResult({ + project: "/src/core/tsconfig.json" as ResolvedConfigFileName, + result: ExitStatus.Success + }, coreOutputs, [...logicOutputs, ...testsOutputs]); + + verifyBuildNextResult({ + project: "/src/logic/tsconfig.json" as ResolvedConfigFileName, + result: ExitStatus.Success + }, [...coreOutputs, ...logicOutputs], testsOutputs); + + verifyBuildNextResult({ + project: "/src/tests/tsconfig.json" as ResolvedConfigFileName, + result: ExitStatus.Success + }, allExpectedOutputs, emptyArray); + + verifyBuildNextResult(/*expected*/ undefined, allExpectedOutputs, emptyArray); + + function verifyBuildNextResult( + expected: SolutionBuilderResult | undefined, + presentOutputs: readonly string[], + absentOutputs: readonly string[] + ) { + const result = builder.buildNextProject(); + assert.deepEqual(result, expected); + verifyOutputsPresent(fs, presentOutputs); + verifyOutputsAbsent(fs, absentOutputs); + } + }); }); describe("downstream-blocked compilations", () => { diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 7b45703dcfd..f13d0ab3f51 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4594,9 +4594,14 @@ declare namespace ts { } interface SolutionBuilderWithWatchHost extends SolutionBuilderHostBase, WatchHost { } + interface SolutionBuilderResult { + project: ResolvedConfigFileName; + result: T; + } interface SolutionBuilder { build(project?: string, cancellationToken?: CancellationToken): ExitStatus; clean(project?: string): ExitStatus; + buildNextProject(cancellationToken?: CancellationToken): SolutionBuilderResult | undefined; } /** * Create a function that reports watch status by writing to the system and handles the formating of the diagnostic diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index acbe1b1ac0d..e5e5046794a 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4594,9 +4594,14 @@ declare namespace ts { } interface SolutionBuilderWithWatchHost extends SolutionBuilderHostBase, WatchHost { } + interface SolutionBuilderResult { + project: ResolvedConfigFileName; + result: T; + } interface SolutionBuilder { build(project?: string, cancellationToken?: CancellationToken): ExitStatus; clean(project?: string): ExitStatus; + buildNextProject(cancellationToken?: CancellationToken): SolutionBuilderResult | undefined; } /** * Create a function that reports watch status by writing to the system and handles the formating of the diagnostic From 578013b65cbc78930279388a810fbb0d12b67c73 Mon Sep 17 00:00:00 2001 From: rpgeeganage Date: Sun, 5 May 2019 18:59:45 +0200 Subject: [PATCH 060/384] modified the service file --- src/services/services.ts | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index 42d2278bcba..ab5138fb489 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1467,33 +1467,49 @@ namespace ts { } const typeChecker = program.getTypeChecker(); - const symbol = getSymbolAtLocationForQuickInfo(node, typeChecker); + const nodeForQuickInfo = getNodeForQuickInfo(node, typeChecker); + const symbol = getSymbolAtLocationForQuickInfo(nodeForQuickInfo, typeChecker); if (!symbol || typeChecker.isUnknownSymbol(symbol)) { - const type = shouldGetType(sourceFile, node, position) ? typeChecker.getTypeAtLocation(node) : undefined; + const type = shouldGetType(sourceFile, nodeForQuickInfo, position) ? typeChecker.getTypeAtLocation(nodeForQuickInfo) : undefined; return type && { kind: ScriptElementKind.unknown, kindModifiers: ScriptElementKindModifier.none, - textSpan: createTextSpanFromNode(node, sourceFile), - displayParts: typeChecker.runWithCancellationToken(cancellationToken, typeChecker => typeToDisplayParts(typeChecker, type, getContainerNode(node))), + textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile), + displayParts: typeChecker.runWithCancellationToken(cancellationToken, typeChecker => typeToDisplayParts(typeChecker, type, getContainerNode(nodeForQuickInfo))), documentation: type.symbol ? type.symbol.getDocumentationComment(typeChecker) : undefined, tags: type.symbol ? type.symbol.getJsDocTags() : undefined }; } const { symbolKind, displayParts, documentation, tags } = typeChecker.runWithCancellationToken(cancellationToken, typeChecker => - SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, getContainerNode(node), node) + SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, getContainerNode(nodeForQuickInfo), nodeForQuickInfo) ); return { kind: symbolKind, kindModifiers: SymbolDisplay.getSymbolModifiers(symbol), - textSpan: createTextSpanFromNode(node, sourceFile), + textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile), displayParts, documentation, tags, }; } + function getNodeForQuickInfo(node: Node, typeChecker: TypeChecker): Node { + const firstParentNode = node.parent.getFirstToken(); + const firstNodeSyntaxKind = firstParentNode ? firstParentNode.kind : undefined; + + if (node.kind === SyntaxKind.NewKeyword || firstNodeSyntaxKind === SyntaxKind.NewKeyword) { + for (const singleNode of node.parent.getChildren()) { + const symbol = getSymbolAtLocationForQuickInfo(singleNode, typeChecker); + if (symbol) { + return singleNode; + } + } + } + return node; + } + function shouldGetType(sourceFile: SourceFile, node: Node, position: number): boolean { switch (node.kind) { case SyntaxKind.Identifier: From 9959ce449e6ef9dcb047572f7e670811f5447206 Mon Sep 17 00:00:00 2001 From: rpgeeganage Date: Sun, 5 May 2019 19:00:01 +0200 Subject: [PATCH 061/384] added test --- .../fourslash/quickInfoOnNewKeyword01.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/cases/fourslash/quickInfoOnNewKeyword01.ts diff --git a/tests/cases/fourslash/quickInfoOnNewKeyword01.ts b/tests/cases/fourslash/quickInfoOnNewKeyword01.ts new file mode 100644 index 00000000000..21ccb8a6502 --- /dev/null +++ b/tests/cases/fourslash/quickInfoOnNewKeyword01.ts @@ -0,0 +1,21 @@ +/// + +////class Cat { +//// /** +//// * NOTE: this constructor is private! Please use the factory function +//// */ +//// private constructor() { } +//// +//// static makeCat() { new Cat(); } +////} +//// +////ne/*1*/w Ca/*2*/t(/*3*/); + +verify.quickInfoAt('1', 'constructor Cat(): Cat', +'NOTE: this constructor is private! Please use the factory function'); + +verify.quickInfoAt('2', 'constructor Cat(): Cat', +'NOTE: this constructor is private! Please use the factory function'); + +verify.quickInfoAt('3', 'constructor Cat(): Cat', +'NOTE: this constructor is private! Please use the factory function'); From ca749b107cbd4b467904c51d3b6dc78d30a43d6b Mon Sep 17 00:00:00 2001 From: rpgeeganage Date: Sun, 5 May 2019 21:58:31 +0200 Subject: [PATCH 062/384] updated the baseline files --- tests/baselines/reference/jsDocTags.baseline | 70 +++++ ...oDisplayPartsTypeParameterInClass.baseline | 84 +++++- ...playPartsTypeParameterInInterface.baseline | 260 +++++++++++++++++- 3 files changed, 402 insertions(+), 12 deletions(-) diff --git a/tests/baselines/reference/jsDocTags.baseline b/tests/baselines/reference/jsDocTags.baseline index f316a9c4245..2d89c183ab3 100644 --- a/tests/baselines/reference/jsDocTags.baseline +++ b/tests/baselines/reference/jsDocTags.baseline @@ -79,6 +79,76 @@ "marker": { "fileName": "/tests/cases/fourslash/jsDocTags.ts", "position": 981 + }, + "quickInfo": { + "kind": "constructor", + "kindModifiers": "", + "textSpan": { + "start": 977, + "length": 3 + }, + "displayParts": [ + { + "text": "constructor", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + } + ], + "documentation": [ + { + "text": "This is the constructor.", + "kind": "text" + } + ], + "tags": [ + { + "name": "myjsdoctag", + "text": "this is a comment" + } + ] } }, { diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline index 48bd280a1b5..68e48ff9b68 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline @@ -2991,15 +2991,15 @@ "position": 337 }, "quickInfo": { - "kind": "var", + "kind": "constructor", "kindModifiers": "", "textSpan": { - "start": 337, - "length": 9 + "start": 334, + "length": 2 }, "displayParts": [ { - "text": "var", + "text": "constructor", "kind": "keyword" }, { @@ -3007,8 +3007,40 @@ "kind": "space" }, { - "text": "cInstance", - "kind": "localName" + "text": "c2", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" }, { "text": ":", @@ -3030,6 +3062,46 @@ "text": "string", "kind": "keyword" }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "c2", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "c", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, { "text": ">", "kind": "punctuation" diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline index 715811f9918..6830394801c 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline @@ -5568,8 +5568,8 @@ "kind": "var", "kindModifiers": "", "textSpan": { - "start": 415, - "length": 4 + "start": 409, + "length": 5 }, "displayParts": [ { @@ -5581,7 +5581,7 @@ "kind": "space" }, { - "text": "iVal", + "text": "iVal1", "kind": "localName" }, { @@ -5592,6 +5592,130 @@ "text": " ", "kind": "space" }, + { + "text": "I1", + "kind": "interfaceName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "new", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, { "text": "I", "kind": "interfaceName" @@ -5621,8 +5745,8 @@ "kind": "var", "kindModifiers": "", "textSpan": { - "start": 421, - "length": 4 + "start": 409, + "length": 5 }, "displayParts": [ { @@ -5634,7 +5758,7 @@ "kind": "space" }, { - "text": "iVal", + "text": "iVal1", "kind": "localName" }, { @@ -5645,6 +5769,130 @@ "text": " ", "kind": "space" }, + { + "text": "I1", + "kind": "interfaceName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "new", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, { "text": "I", "kind": "interfaceName" From 8f209be149ec626f40031a5b0f904ae5ea74479d Mon Sep 17 00:00:00 2001 From: rpgeeganage Date: Mon, 6 May 2019 21:21:37 +0200 Subject: [PATCH 063/384] fixed the comments --- src/services/services.ts | 16 +- tests/baselines/reference/jsDocTags.baseline | 70 ----- ...oDisplayPartsTypeParameterInClass.baseline | 84 +----- ...playPartsTypeParameterInInterface.baseline | 260 +----------------- .../fourslash/quickInfoOnNewKeyword01.ts | 5 +- 5 files changed, 17 insertions(+), 418 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index ab5138fb489..628ec395437 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1467,7 +1467,7 @@ namespace ts { } const typeChecker = program.getTypeChecker(); - const nodeForQuickInfo = getNodeForQuickInfo(node, typeChecker); + const nodeForQuickInfo = getNodeForQuickInfo(node); const symbol = getSymbolAtLocationForQuickInfo(nodeForQuickInfo, typeChecker); if (!symbol || typeChecker.isUnknownSymbol(symbol)) { @@ -1495,17 +1495,9 @@ namespace ts { }; } - function getNodeForQuickInfo(node: Node, typeChecker: TypeChecker): Node { - const firstParentNode = node.parent.getFirstToken(); - const firstNodeSyntaxKind = firstParentNode ? firstParentNode.kind : undefined; - - if (node.kind === SyntaxKind.NewKeyword || firstNodeSyntaxKind === SyntaxKind.NewKeyword) { - for (const singleNode of node.parent.getChildren()) { - const symbol = getSymbolAtLocationForQuickInfo(singleNode, typeChecker); - if (symbol) { - return singleNode; - } - } + function getNodeForQuickInfo(node: Node): Node { + if (isNewExpression(node.parent) && node.pos === node.parent.pos) { + return node.parent.expression; } return node; } diff --git a/tests/baselines/reference/jsDocTags.baseline b/tests/baselines/reference/jsDocTags.baseline index 2d89c183ab3..f316a9c4245 100644 --- a/tests/baselines/reference/jsDocTags.baseline +++ b/tests/baselines/reference/jsDocTags.baseline @@ -79,76 +79,6 @@ "marker": { "fileName": "/tests/cases/fourslash/jsDocTags.ts", "position": 981 - }, - "quickInfo": { - "kind": "constructor", - "kindModifiers": "", - "textSpan": { - "start": 977, - "length": 3 - }, - "displayParts": [ - { - "text": "constructor", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "Foo", - "kind": "className" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "value", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "Foo", - "kind": "className" - } - ], - "documentation": [ - { - "text": "This is the constructor.", - "kind": "text" - } - ], - "tags": [ - { - "name": "myjsdoctag", - "text": "this is a comment" - } - ] } }, { diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline index 68e48ff9b68..48bd280a1b5 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInClass.baseline @@ -2991,15 +2991,15 @@ "position": 337 }, "quickInfo": { - "kind": "constructor", + "kind": "var", "kindModifiers": "", "textSpan": { - "start": 334, - "length": 2 + "start": 337, + "length": 9 }, "displayParts": [ { - "text": "constructor", + "text": "var", "kind": "keyword" }, { @@ -3007,40 +3007,8 @@ "kind": "space" }, { - "text": "c2", - "kind": "className" - }, - { - "text": "<", - "kind": "punctuation" - }, - { - "text": "c", - "kind": "className" - }, - { - "text": "<", - "kind": "punctuation" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ">", - "kind": "punctuation" - }, - { - "text": ">", - "kind": "punctuation" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" + "text": "cInstance", + "kind": "localName" }, { "text": ":", @@ -3062,46 +3030,6 @@ "text": "string", "kind": "keyword" }, - { - "text": ">", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "c2", - "kind": "className" - }, - { - "text": "<", - "kind": "punctuation" - }, - { - "text": "c", - "kind": "className" - }, - { - "text": "<", - "kind": "punctuation" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ">", - "kind": "punctuation" - }, { "text": ">", "kind": "punctuation" diff --git a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline index 6830394801c..715811f9918 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsTypeParameterInInterface.baseline @@ -5568,8 +5568,8 @@ "kind": "var", "kindModifiers": "", "textSpan": { - "start": 409, - "length": 5 + "start": 415, + "length": 4 }, "displayParts": [ { @@ -5581,7 +5581,7 @@ "kind": "space" }, { - "text": "iVal1", + "text": "iVal", "kind": "localName" }, { @@ -5592,130 +5592,6 @@ "text": " ", "kind": "space" }, - { - "text": "I1", - "kind": "interfaceName" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": "new", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "<", - "kind": "punctuation" - }, - { - "text": "I", - "kind": "interfaceName" - }, - { - "text": "<", - "kind": "punctuation" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ">", - "kind": "punctuation" - }, - { - "text": ">", - "kind": "punctuation" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "I", - "kind": "interfaceName" - }, - { - "text": "<", - "kind": "punctuation" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ">", - "kind": "punctuation" - }, - { - "text": ",", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "b", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "I", - "kind": "interfaceName" - }, - { - "text": "<", - "kind": "punctuation" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ">", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "=>", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, { "text": "I", "kind": "interfaceName" @@ -5745,8 +5621,8 @@ "kind": "var", "kindModifiers": "", "textSpan": { - "start": 409, - "length": 5 + "start": 421, + "length": 4 }, "displayParts": [ { @@ -5758,7 +5634,7 @@ "kind": "space" }, { - "text": "iVal1", + "text": "iVal", "kind": "localName" }, { @@ -5769,130 +5645,6 @@ "text": " ", "kind": "space" }, - { - "text": "I1", - "kind": "interfaceName" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": "new", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "<", - "kind": "punctuation" - }, - { - "text": "I", - "kind": "interfaceName" - }, - { - "text": "<", - "kind": "punctuation" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ">", - "kind": "punctuation" - }, - { - "text": ">", - "kind": "punctuation" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "I", - "kind": "interfaceName" - }, - { - "text": "<", - "kind": "punctuation" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ">", - "kind": "punctuation" - }, - { - "text": ",", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "b", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "I", - "kind": "interfaceName" - }, - { - "text": "<", - "kind": "punctuation" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ">", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "=>", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, { "text": "I", "kind": "interfaceName" diff --git a/tests/cases/fourslash/quickInfoOnNewKeyword01.ts b/tests/cases/fourslash/quickInfoOnNewKeyword01.ts index 21ccb8a6502..f7d1e359b8d 100644 --- a/tests/cases/fourslash/quickInfoOnNewKeyword01.ts +++ b/tests/cases/fourslash/quickInfoOnNewKeyword01.ts @@ -9,13 +9,10 @@ //// static makeCat() { new Cat(); } ////} //// -////ne/*1*/w Ca/*2*/t(/*3*/); +////ne/*1*/w Ca/*2*/t(); verify.quickInfoAt('1', 'constructor Cat(): Cat', 'NOTE: this constructor is private! Please use the factory function'); verify.quickInfoAt('2', 'constructor Cat(): Cat', 'NOTE: this constructor is private! Please use the factory function'); - -verify.quickInfoAt('3', 'constructor Cat(): Cat', -'NOTE: this constructor is private! Please use the factory function'); From f01743385796a2d8a07d1dc5d3feaad526166d7e Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 3 May 2019 13:32:47 -0700 Subject: [PATCH 064/384] Move everything into state so we can pass it around --- src/compiler/tsbuild.ts | 2649 +++++++++--------- src/testRunner/unittests/tsbuild/sample.ts | 2 +- src/testRunner/unittests/tsbuildWatchMode.ts | 8 +- 3 files changed, 1406 insertions(+), 1253 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 9e625041287..22bc8ba8238 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -198,7 +198,8 @@ namespace ts { AnyErrors = ConfigFileErrors | SyntaxErrors | TypeErrors | DeclarationEmitErrors | EmitErrors } - type ResolvedConfigFilePath = ResolvedConfigFileName & Path; + /*@internal*/ + export type ResolvedConfigFilePath = ResolvedConfigFileName & Path; interface FileMap extends Map { get(key: U): T | undefined; has(key: U): boolean; @@ -212,6 +213,9 @@ namespace ts { clear(): void; } type ConfigFileMap = FileMap; + function createConfigFileMap(): ConfigFileMap { + return createMap() as ConfigFileMap; + } function getOrCreateValueFromConfigFileMap(configFileMap: ConfigFileMap, resolved: ResolvedConfigFilePath, createT: () => T): T { const existingValue = configFileMap.get(resolved); @@ -275,15 +279,16 @@ namespace ts { // Testing only /*@internal*/ getUpToDateStatusOfProject(project: string): UpToDateStatus; - /*@internal*/ invalidateProject(configFileName: string, reloadLevel?: ConfigFileProgramReloadLevel): void; + /*@internal*/ invalidateProject(configFilePath: ResolvedConfigFilePath, reloadLevel?: ConfigFileProgramReloadLevel): void; /*@internal*/ buildNextInvalidatedProject(): void; } interface InvalidatedProject { - project: ResolvedConfigFileName; - projectPath: ResolvedConfigFilePath; - reloadLevel: ConfigFileProgramReloadLevel; - projectIndex: number; + readonly project: ResolvedConfigFileName; + readonly projectPath: ResolvedConfigFilePath; + readonly reloadLevel: ConfigFileProgramReloadLevel; + readonly projectIndex: number; + readonly buildOrder: readonly ResolvedConfigFileName[]; } /** @@ -336,1279 +341,1418 @@ namespace ts { return createSolutionBuilderWorker(/*watch*/ true, host, rootNames, defaultOptions); } + type ConfigFileCacheEntry = ParsedCommandLine | Diagnostic; + interface SolutionBuilderStateCache { + originalReadFile: CompilerHost["readFile"]; + originalFileExists: CompilerHost["fileExists"]; + originalDirectoryExists: CompilerHost["directoryExists"]; + originalCreateDirectory: CompilerHost["createDirectory"]; + originalWriteFile: CompilerHost["writeFile"] | undefined; + originalReadFileWithCache: CompilerHost["readFile"]; + originalGetSourceFile: CompilerHost["getSourceFile"]; + } + + interface SolutionBuilderState { + readonly host: SolutionBuilderHost; + readonly hostWithWatch: SolutionBuilderWithWatchHost; + readonly currentDirectory: string; + readonly getCanonicalFileName: GetCanonicalFileName; + readonly parseConfigFileHost: ParseConfigFileHost; + readonly writeFileName: ((s: string) => void) | undefined; + + // State of solution + readonly options: BuildOptions; + readonly baseCompilerOptions: CompilerOptions; + readonly rootNames: ReadonlyArray; + + readonly resolvedConfigFilePaths: Map; + readonly configFileCache: ConfigFileMap; + /** Map from config file name to up-to-date status */ + readonly projectStatus: ConfigFileMap; + readonly buildInfoChecked: ConfigFileMap; + readonly extendedConfigCache: Map; + + readonly builderPrograms: ConfigFileMap; + readonly diagnostics: ConfigFileMap; + readonly projectPendingBuild: ConfigFileMap; + readonly projectErrorsReported: ConfigFileMap; + + readonly compilerHost: CompilerHost; + readonly moduleResolutionCache: ModuleResolutionCache | undefined; + + // Mutable state + buildOrder: readonly ResolvedConfigFileName[] | undefined; + readFileWithCache: (f: string) => string | undefined; + projectCompilerOptions: CompilerOptions; + cache: SolutionBuilderStateCache | undefined; + allProjectBuildPending: boolean; + needsSummary: boolean; + watchAllProjectsPending: boolean; + + // Watch state + readonly watch: boolean; + readonly allWatchedWildcardDirectories: ConfigFileMap>; + readonly allWatchedInputFiles: ConfigFileMap>; + readonly allWatchedConfigFiles: ConfigFileMap; + + timerToBuildInvalidatedProject: any; + reportFileChangeDetected: boolean; + watchFile: WatchFile; + watchFilePath: WatchFilePath; + watchDirectory: WatchDirectory; + writeLog: (s: string) => void; + } + + function createSolutionBuilderState(watch: boolean, hostOrHostWithWatch: SolutionBuilderHost | SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, options: BuildOptions): SolutionBuilderState { + const host = hostOrHostWithWatch as SolutionBuilderHost; + const hostWithWatch = hostOrHostWithWatch as SolutionBuilderWithWatchHost; + const currentDirectory = host.getCurrentDirectory(); + const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames()); + + // State of the solution + const baseCompilerOptions = getCompilerOptionsOfBuildOptions(options); + const compilerHost = createCompilerHostFromProgramHost(host, () => state.projectCompilerOptions); + setGetSourceFileAsHashVersioned(compilerHost, host); + compilerHost.getParsedCommandLine = fileName => parseConfigFile(state, fileName as ResolvedConfigFileName, toResolvedConfigFilePath(state, fileName as ResolvedConfigFileName)); + compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames); + compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives); + const moduleResolutionCache = !compilerHost.resolveModuleNames ? createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined; + if (!compilerHost.resolveModuleNames) { + const loader = (moduleName: string, containingFile: string, redirectedReference: ResolvedProjectReference | undefined) => resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference).resolvedModule!; + compilerHost.resolveModuleNames = (moduleNames, containingFile, _reusedNames, redirectedReference) => + loadWithLocalCache(Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader); + } + + const { watchFile, watchFilePath, watchDirectory, writeLog } = createWatchFactory(hostWithWatch, options); + + const state: SolutionBuilderState = { + host, + hostWithWatch, + currentDirectory, + getCanonicalFileName, + parseConfigFileHost: parseConfigHostFromCompilerHostLike(host), + writeFileName: host.trace ? (s: string) => host.trace!(s) : undefined, + + // State of solution + options, + baseCompilerOptions, + rootNames, + + resolvedConfigFilePaths: createMap(), + configFileCache: createConfigFileMap(), + projectStatus: createConfigFileMap(), + buildInfoChecked: createConfigFileMap(), + extendedConfigCache: createMap(), + + builderPrograms: createConfigFileMap(), + diagnostics: createConfigFileMap(), + projectPendingBuild: createConfigFileMap(), + projectErrorsReported: createConfigFileMap(), + + compilerHost, + moduleResolutionCache, + + // Mutable state + buildOrder: undefined, + readFileWithCache: f => host.readFile(f), + projectCompilerOptions: baseCompilerOptions, + cache: undefined, + allProjectBuildPending: true, + needsSummary: true, + watchAllProjectsPending: watch, + + // Watch state + watch, + allWatchedWildcardDirectories: createConfigFileMap(), + allWatchedInputFiles: createConfigFileMap(), + allWatchedConfigFiles: createConfigFileMap(), + + timerToBuildInvalidatedProject: undefined, + reportFileChangeDetected: false, + watchFile, + watchFilePath, + watchDirectory, + writeLog, + }; + + return state; + } + + function toPath(state: SolutionBuilderState, fileName: string) { + return ts.toPath(fileName, state.currentDirectory, state.getCanonicalFileName); + } + + function toResolvedConfigFilePath(state: SolutionBuilderState, fileName: ResolvedConfigFileName): ResolvedConfigFilePath { + const { resolvedConfigFilePaths } = state; + const path = resolvedConfigFilePaths.get(fileName); + if (path !== undefined) return path; + + const resolvedPath = toPath(state, fileName) as ResolvedConfigFilePath; + resolvedConfigFilePaths.set(fileName, resolvedPath); + return resolvedPath; + } + + function isParsedCommandLine(entry: ConfigFileCacheEntry): entry is ParsedCommandLine { + return !!(entry as ParsedCommandLine).options; + } + + function parseConfigFile(state: SolutionBuilderState, configFileName: ResolvedConfigFileName, configFilePath: ResolvedConfigFilePath): ParsedCommandLine | undefined { + const { configFileCache } = state; + const value = configFileCache.get(configFilePath); + if (value) { + return isParsedCommandLine(value) ? value : undefined; + } + + let diagnostic: Diagnostic | undefined; + const { parseConfigFileHost, baseCompilerOptions, extendedConfigCache } = state; + parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = d => diagnostic = d; + const parsed = getParsedCommandLineOfConfigFile(configFileName, baseCompilerOptions, parseConfigFileHost, extendedConfigCache); + parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = noop; + configFileCache.set(configFilePath, parsed || diagnostic!); + return parsed; + } + + function resolveProjectName(state: SolutionBuilderState, name: string): ResolvedConfigFileName { + return resolveConfigFileProjectName(resolvePath(state.currentDirectory, name)); + } + + function createBuildOrder(state: SolutionBuilderState, roots: readonly ResolvedConfigFileName[]): readonly ResolvedConfigFileName[] { + const temporaryMarks = createMap() as ConfigFileMap; + const permanentMarks = createMap() as ConfigFileMap; + const circularityReportStack: string[] = []; + let buildOrder: ResolvedConfigFileName[] | undefined; + for (const root of roots) { + visit(root); + } + + return buildOrder || emptyArray; + + function visit(configFileName: ResolvedConfigFileName, inCircularContext?: boolean) { + const projPath = toResolvedConfigFilePath(state, configFileName); + // Already visited + if (permanentMarks.has(projPath)) return; + // Circular + if (temporaryMarks.has(projPath)) { + if (!inCircularContext) { + // TODO:: Do we report this as error? + reportStatus(state, Diagnostics.Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0, circularityReportStack.join("\r\n")); + } + return; + } + + temporaryMarks.set(projPath, true); + circularityReportStack.push(configFileName); + const parsed = parseConfigFile(state, configFileName, projPath); + if (parsed && parsed.projectReferences) { + for (const ref of parsed.projectReferences) { + const resolvedRefPath = resolveProjectName(state, ref.path); + visit(resolvedRefPath, inCircularContext || ref.circular); + } + } + + circularityReportStack.pop(); + permanentMarks.set(projPath, true); + (buildOrder || (buildOrder = [])).push(configFileName); + } + } + + function getBuildOrder(state: SolutionBuilderState) { + return state.buildOrder || + (state.buildOrder = createBuildOrder(state, state.rootNames.map(f => resolveProjectName(state, f)))); + } + + function getBuildOrderFor(state: SolutionBuilderState, project: string | undefined) { + const resolvedProject = project && resolveProjectName(state, project); + if (resolvedProject) { + const projectPath = toResolvedConfigFilePath(state, resolvedProject); + const projectIndex = findIndex( + getBuildOrder(state), + configFileName => toResolvedConfigFilePath(state, configFileName) === projectPath + ); + if (projectIndex === -1) return undefined; + } + return resolvedProject ? createBuildOrder(state, [resolvedProject]) : getBuildOrder(state); + } + + function enableCache(state: SolutionBuilderState) { + if (state.cache) { + disableCache(state); + } + + const { compilerHost, host } = state; + + const originalReadFileWithCache = state.readFileWithCache; + const originalGetSourceFile = compilerHost.getSourceFile; + + const { + originalReadFile, originalFileExists, originalDirectoryExists, + originalCreateDirectory, originalWriteFile, + getSourceFileWithCache, readFileWithCache + } = changeCompilerHostLikeToUseCache( + host, + fileName => toPath(state, fileName), + (...args) => originalGetSourceFile.call(compilerHost, ...args) + ); + state.readFileWithCache = readFileWithCache; + compilerHost.getSourceFile = getSourceFileWithCache!; + + state.cache = { + originalReadFile, + originalFileExists, + originalDirectoryExists, + originalCreateDirectory, + originalWriteFile, + originalReadFileWithCache, + originalGetSourceFile, + }; + } + + function disableCache(state: SolutionBuilderState) { + if (!state.cache) return; + + const { cache, host, compilerHost, extendedConfigCache, moduleResolutionCache } = state; + + host.readFile = cache.originalReadFile; + host.fileExists = cache.originalFileExists; + host.directoryExists = cache.originalDirectoryExists; + host.createDirectory = cache.originalCreateDirectory; + host.writeFile = cache.originalWriteFile; + compilerHost.getSourceFile = cache.originalGetSourceFile; + state.readFileWithCache = cache.originalReadFileWithCache; + extendedConfigCache.clear(); + if (moduleResolutionCache) { + moduleResolutionCache.directoryToModuleNameMap.clear(); + moduleResolutionCache.moduleNameToDirectoryMap.clear(); + } + state.cache = undefined; + } + + function clearProjectStatus(state: SolutionBuilderState, resolved: ResolvedConfigFilePath) { + state.projectStatus.delete(resolved); + state.diagnostics.delete(resolved); + } + + function addProjToQueue({ projectPendingBuild }: SolutionBuilderState, proj: ResolvedConfigFilePath, reloadLevel: ConfigFileProgramReloadLevel) { + const value = projectPendingBuild.get(proj); + if (value === undefined) { + projectPendingBuild.set(proj, reloadLevel); + } + else if (value < reloadLevel) { + projectPendingBuild.set(proj, reloadLevel); + } + } + + function setupInitialBuild(state: SolutionBuilderState, cancellationToken: CancellationToken | undefined) { + // Set initial build if not already built + if (!state.allProjectBuildPending) return; + state.allProjectBuildPending = false; + if (state.options.watch) { reportWatchStatus(state, Diagnostics.Starting_compilation_in_watch_mode); } + enableCache(state); + const buildOrder = getBuildOrder(state); + reportBuildQueue(state, buildOrder); + buildOrder.forEach(configFileName => + state.projectPendingBuild.set( + toResolvedConfigFilePath(state, configFileName), + ConfigFileProgramReloadLevel.None + ) + ); + + if (cancellationToken) { + cancellationToken.throwIfCancellationRequested(); + } + } + + function getNextInvalidatedProject(state: SolutionBuilderState, buildOrder: readonly ResolvedConfigFileName[]): InvalidatedProject | undefined { + return state.projectPendingBuild.size ? + forEach(buildOrder, (project, projectIndex) => { + const projectPath = toResolvedConfigFilePath(state, project); + const reloadLevel = state.projectPendingBuild.get(projectPath); + if (reloadLevel !== undefined) { + return { project, projectPath, reloadLevel, projectIndex, buildOrder }; + } + }) : + undefined; + } + + function listEmittedFile({ writeFileName }: SolutionBuilderState, proj: ParsedCommandLine, file: string) { + if (writeFileName && proj.options.listEmittedFiles) { + writeFileName(`TSFILE: ${file}`); + } + } + + function getOldProgram({ options, builderPrograms, readFileWithCache }: SolutionBuilderState, proj: ResolvedConfigFilePath, parsed: ParsedCommandLine) { + if (options.force) return undefined; + const value = builderPrograms.get(proj); + if (value) return value; + return readBuilderProgram(parsed.options, readFileWithCache) as any as T; + } + + function afterProgramCreate({ host, watch, builderPrograms }: SolutionBuilderState, proj: ResolvedConfigFilePath, program: T) { + if (host.afterProgramEmitAndDiagnostics) { + host.afterProgramEmitAndDiagnostics(program); + } + if (watch) { + program.releaseProgram(); + builderPrograms.set(proj, program); + } + } + + function buildErrors( + state: SolutionBuilderState, + resolvedPath: ResolvedConfigFilePath, + program: T | undefined, + diagnostics: ReadonlyArray, + errorFlags: BuildResultFlags, + errorType: string + ) { + reportAndStoreErrors(state, resolvedPath, diagnostics); + // List files if any other build error using program (emit errors already report files) + if (program && state.writeFileName) listFiles(program, state.writeFileName); + state.projectStatus.set(resolvedPath, { type: UpToDateStatusType.Unbuildable, reason: `${errorType} errors` }); + if (program) afterProgramCreate(state, resolvedPath, program); + state.projectCompilerOptions = state.baseCompilerOptions; + return errorFlags; + } + + function buildSingleProject(state: SolutionBuilderState, proj: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, cancellationToken: CancellationToken | undefined): BuildResultFlags { + if (state.options.dry) { + reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, proj); + return BuildResultFlags.Success; + } + + if (state.options.verbose) reportStatus(state, Diagnostics.Building_project_0, proj); + + const { host, projectStatus, diagnostics, compilerHost, moduleResolutionCache, } = state; + const configFile = parseConfigFile(state, proj, resolvedPath); + if (!configFile) { + // Failed to read the config file + reportParseConfigFileDiagnostic(state, resolvedPath); + projectStatus.set(resolvedPath, { type: UpToDateStatusType.Unbuildable, reason: "Config file errors" }); + return BuildResultFlags.ConfigFileErrors; + } + + if (configFile.fileNames.length === 0) { + reportAndStoreErrors(state, resolvedPath, configFile.errors); + // Nothing to build - must be a solution file, basically + return BuildResultFlags.None; + } + + state.projectCompilerOptions = configFile.options; + // Update module resolution cache if needed + if (moduleResolutionCache) { + const projPath = toPath(state, proj); + if (moduleResolutionCache.directoryToModuleNameMap.redirectsMap.size === 0) { + // The own map will be for projectCompilerOptions + Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size === 0); + moduleResolutionCache.directoryToModuleNameMap.redirectsMap.set(projPath, moduleResolutionCache.directoryToModuleNameMap.ownMap); + moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.set(projPath, moduleResolutionCache.moduleNameToDirectoryMap.ownMap); + } + else { + // Set correct own map + Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size > 0); + + const ref: ResolvedProjectReference = { + sourceFile: configFile.options.configFile!, + commandLine: configFile + }; + moduleResolutionCache.directoryToModuleNameMap.setOwnMap(moduleResolutionCache.directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref)); + moduleResolutionCache.moduleNameToDirectoryMap.setOwnMap(moduleResolutionCache.moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref)); + } + moduleResolutionCache.directoryToModuleNameMap.setOwnOptions(configFile.options); + moduleResolutionCache.moduleNameToDirectoryMap.setOwnOptions(configFile.options); + } + + // Create program + const program = host.createProgram( + configFile.fileNames, + configFile.options, + compilerHost, + getOldProgram(state, resolvedPath, configFile), + configFile.errors, + configFile.projectReferences + ); + + // Don't emit anything in the presence of syntactic errors or options diagnostics + const syntaxDiagnostics = [ + ...program.getConfigFileParsingDiagnostics(), + ...program.getOptionsDiagnostics(cancellationToken), + ...program.getGlobalDiagnostics(cancellationToken), + ...program.getSyntacticDiagnostics(/*sourceFile*/ undefined, cancellationToken)]; + if (syntaxDiagnostics.length) { + return buildErrors( + state, + resolvedPath, + program, + syntaxDiagnostics, + BuildResultFlags.SyntaxErrors, + "Syntactic" + ); + } + + // Same as above but now for semantic diagnostics + const semanticDiagnostics = program.getSemanticDiagnostics(/*sourceFile*/ undefined, cancellationToken); + if (semanticDiagnostics.length) { + return buildErrors( + state, + resolvedPath, + program, + semanticDiagnostics, + BuildResultFlags.TypeErrors, + "Semantic" + ); + } + + // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly + program.backupState(); + let declDiagnostics: Diagnostic[] | undefined; + const reportDeclarationDiagnostics = (d: Diagnostic) => (declDiagnostics || (declDiagnostics = [])).push(d); + const outputFiles: OutputFile[] = []; + emitFilesAndReportErrors( + program, + reportDeclarationDiagnostics, + /*writeFileName*/ undefined, + /*reportSummary*/ undefined, + (name, text, writeByteOrderMark) => outputFiles.push({ name, text, writeByteOrderMark }), + cancellationToken + ); + // Don't emit .d.ts if there are decl file errors + if (declDiagnostics) { + program.restoreState(); + return buildErrors( + state, + resolvedPath, + program, + declDiagnostics, + BuildResultFlags.DeclarationEmitErrors, + "Declaration file" + ); + } + + // Actual Emit + let resultFlags = BuildResultFlags.DeclarationOutputUnchanged; + let newestDeclarationFileContentChangedTime = minimumDate; + let anyDtsChanged = false; + const emitterDiagnostics = createDiagnosticCollection(); + const emittedOutputs = createMap() as FileMap; + outputFiles.forEach(({ name, text, writeByteOrderMark }) => { + let priorChangeTime: Date | undefined; + if (!anyDtsChanged && isDeclarationFile(name)) { + // Check for unchanged .d.ts files + if (host.fileExists(name) && state.readFileWithCache(name) === text) { + priorChangeTime = host.getModifiedTime(name); + } + else { + resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; + anyDtsChanged = true; + } + } + + emittedOutputs.set(toPath(state, name), name); + writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); + if (priorChangeTime !== undefined) { + newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime); + } + }); + + const emitDiagnostics = emitterDiagnostics.getDiagnostics(); + if (emitDiagnostics.length) { + return buildErrors( + state, + resolvedPath, + program, + emitDiagnostics, + BuildResultFlags.EmitErrors, + "Emit" + ); + } + + if (state.writeFileName) { + emittedOutputs.forEach(name => listEmittedFile(state, configFile, name)); + listFiles(program, state.writeFileName); + } + + // Update time stamps for rest of the outputs + newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, configFile, newestDeclarationFileContentChangedTime, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); + diagnostics.delete(resolvedPath); + projectStatus.set(resolvedPath, { + type: UpToDateStatusType.UpToDate, + newestDeclarationFileContentChangedTime: anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime, + oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(configFile, !host.useCaseSensitiveFileNames()) + }); + afterProgramCreate(state, resolvedPath, program); + state.projectCompilerOptions = state.baseCompilerOptions; + return resultFlags; + } + + function updateBundle(state: SolutionBuilderState, proj: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, cancellationToken: CancellationToken | undefined): BuildResultFlags { + if (state.options.dry) { + reportStatus(state, Diagnostics.A_non_dry_build_would_update_output_of_project_0, proj); + return BuildResultFlags.Success; + } + + if (state.options.verbose) reportStatus(state, Diagnostics.Updating_output_of_project_0, proj); + + // Update js, and source map + const { projectStatus, diagnostics, compilerHost } = state; + const config = Debug.assertDefined(parseConfigFile(state, proj, resolvedPath)); + state.projectCompilerOptions = config.options; + const outputFiles = emitUsingBuildInfo( + config, + compilerHost, + ref => { + const refName = resolveProjectName(state, ref.path); + return parseConfigFile(state, refName, toResolvedConfigFilePath(state, refName)); + }); + if (isString(outputFiles)) { + reportStatus(state, Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, proj, relName(state, outputFiles)); + return buildSingleProject(state, proj, resolvedPath, cancellationToken); + } + + // Actual Emit + Debug.assert(!!outputFiles.length); + const emitterDiagnostics = createDiagnosticCollection(); + const emittedOutputs = createMap() as FileMap; + outputFiles.forEach(({ name, text, writeByteOrderMark }) => { + emittedOutputs.set(toPath(state, name), name); + writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); + }); + const emitDiagnostics = emitterDiagnostics.getDiagnostics(); + if (emitDiagnostics.length) { + return buildErrors( + state, + resolvedPath, + /*program*/ undefined, + emitDiagnostics, + BuildResultFlags.EmitErrors, + "Emit" + ); + } + + if (state.writeFileName) { + emittedOutputs.forEach(name => listEmittedFile(state, config, name)); + } + + // Update timestamps for dts + const newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, minimumDate, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); + diagnostics.delete(resolvedPath); + projectStatus.set(resolvedPath, { + type: UpToDateStatusType.UpToDate, + newestDeclarationFileContentChangedTime, + oldestOutputFileName: outputFiles[0].name + }); + state.projectCompilerOptions = state.baseCompilerOptions; + return BuildResultFlags.DeclarationOutputUnchanged; + } + + function checkConfigFileUpToDateStatus(state: SolutionBuilderState, configFile: string, oldestOutputFileTime: Date, oldestOutputFileName: string): Status.OutOfDateWithSelf | undefined { + // Check tsconfig time + const tsconfigTime = state.host.getModifiedTime(configFile) || missingFileModifiedTime; + if (oldestOutputFileTime < tsconfigTime) { + return { + type: UpToDateStatusType.OutOfDateWithSelf, + outOfDateOutputFileName: oldestOutputFileName, + newerInputFileName: configFile + }; + } + } + + function getUpToDateStatusWorker(state: SolutionBuilderState, project: ParsedCommandLine, resolvedPath: ResolvedConfigFilePath): UpToDateStatus { + let newestInputFileName: string = undefined!; + let newestInputFileTime = minimumDate; + const { host } = state; + // Get timestamps of input files + for (const inputFile of project.fileNames) { + if (!host.fileExists(inputFile)) { + return { + type: UpToDateStatusType.Unbuildable, + reason: `${inputFile} does not exist` + }; + } + + const inputTime = host.getModifiedTime(inputFile) || missingFileModifiedTime; + if (inputTime > newestInputFileTime) { + newestInputFileName = inputFile; + newestInputFileTime = inputTime; + } + } + + // Container if no files are specified in the project + if (!project.fileNames.length && !canJsonReportNoInutFiles(project.raw)) { + return { + type: UpToDateStatusType.ContainerOnly + }; + } + + // Collect the expected outputs of this project + const outputs = getAllProjectOutputs(project, !host.useCaseSensitiveFileNames()); + + // Now see if all outputs are newer than the newest input + let oldestOutputFileName = "(none)"; + let oldestOutputFileTime = maximumDate; + let newestOutputFileName = "(none)"; + let newestOutputFileTime = minimumDate; + let missingOutputFileName: string | undefined; + let newestDeclarationFileContentChangedTime = minimumDate; + let isOutOfDateWithInputs = false; + for (const output of outputs) { + // Output is missing; can stop checking + // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status + if (!host.fileExists(output)) { + missingOutputFileName = output; + break; + } + + const outputTime = host.getModifiedTime(output) || missingFileModifiedTime; + if (outputTime < oldestOutputFileTime) { + oldestOutputFileTime = outputTime; + oldestOutputFileName = output; + } + + // If an output is older than the newest input, we can stop checking + // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status + if (outputTime < newestInputFileTime) { + isOutOfDateWithInputs = true; + break; + } + + if (outputTime > newestOutputFileTime) { + newestOutputFileTime = outputTime; + newestOutputFileName = output; + } + + // Keep track of when the most recent time a .d.ts file was changed. + // In addition to file timestamps, we also keep track of when a .d.ts file + // had its file touched but not had its contents changed - this allows us + // to skip a downstream typecheck + if (isDeclarationFile(output)) { + const outputModifiedTime = host.getModifiedTime(output) || missingFileModifiedTime; + newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime); + } + } + + let pseudoUpToDate = false; + let usesPrepend = false; + let upstreamChangedProject: string | undefined; + if (project.projectReferences) { + state.projectStatus.set(resolvedPath, { type: UpToDateStatusType.ComputingUpstream }); + for (const ref of project.projectReferences) { + usesPrepend = usesPrepend || !!(ref.prepend); + const resolvedRef = resolveProjectReferencePath(ref); + const resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef); + const refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath); + + // Its a circular reference ignore the status of this project + if (refStatus.type === UpToDateStatusType.ComputingUpstream) { + continue; + } + + // An upstream project is blocked + if (refStatus.type === UpToDateStatusType.Unbuildable) { + return { + type: UpToDateStatusType.UpstreamBlocked, + upstreamProjectName: ref.path + }; + } + + // If the upstream project is out of date, then so are we (someone shouldn't have asked, though?) + if (refStatus.type !== UpToDateStatusType.UpToDate) { + return { + type: UpToDateStatusType.UpstreamOutOfDate, + upstreamProjectName: ref.path + }; + } + + // Check oldest output file name only if there is no missing output file name + if (!missingOutputFileName) { + // If the upstream project's newest file is older than our oldest output, we + // can't be out of date because of it + if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) { + continue; + } + + // If the upstream project has only change .d.ts files, and we've built + // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild + if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) { + pseudoUpToDate = true; + upstreamChangedProject = ref.path; + continue; + } + + // We have an output older than an upstream output - we are out of date + Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here"); + return { + type: UpToDateStatusType.OutOfDateWithUpstream, + outOfDateOutputFileName: oldestOutputFileName, + newerProjectName: ref.path + }; + } + } + } + + if (missingOutputFileName !== undefined) { + return { + type: UpToDateStatusType.OutputMissing, + missingOutputFileName + }; + } + + if (isOutOfDateWithInputs) { + return { + type: UpToDateStatusType.OutOfDateWithSelf, + outOfDateOutputFileName: oldestOutputFileName, + newerInputFileName: newestInputFileName + }; + } + else { + // Check tsconfig time + const configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath!, oldestOutputFileTime, oldestOutputFileName); + if (configStatus) return configStatus; + + // Check extended config time + const extendedConfigStatus = forEach(project.options.configFile!.extendedSourceFiles || emptyArray, configFile => checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName)); + if (extendedConfigStatus) return extendedConfigStatus; + } + + if (!state.buildInfoChecked.has(resolvedPath)) { + state.buildInfoChecked.set(resolvedPath, true); + const buildInfoPath = getOutputPathForBuildInfo(project.options); + if (buildInfoPath) { + const value = state.readFileWithCache(buildInfoPath); + const buildInfo = value && getBuildInfo(value); + if (buildInfo && buildInfo.version !== version) { + return { + type: UpToDateStatusType.TsVersionOutputOfDate, + version: buildInfo.version + }; + } + } + } + + if (usesPrepend && pseudoUpToDate) { + return { + type: UpToDateStatusType.OutOfDateWithPrepend, + outOfDateOutputFileName: oldestOutputFileName, + newerProjectName: upstreamChangedProject! + }; + } + + // Up to date + return { + type: pseudoUpToDate ? UpToDateStatusType.UpToDateWithUpstreamTypes : UpToDateStatusType.UpToDate, + newestDeclarationFileContentChangedTime, + newestInputFileTime, + newestOutputFileTime, + newestInputFileName, + newestOutputFileName, + oldestOutputFileName + }; + } + + function getUpToDateStatus(state: SolutionBuilderState, project: ParsedCommandLine | undefined, resolvedPath: ResolvedConfigFilePath): UpToDateStatus { + if (project === undefined) { + return { type: UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" }; + } + + const prior = state.projectStatus.get(resolvedPath); + if (prior !== undefined) { + return prior; + } + + const actual = getUpToDateStatusWorker(state, project, resolvedPath); + state.projectStatus.set(resolvedPath, actual); + return actual; + } + + function updateOutputTimestampsWorker(state: SolutionBuilderState, proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: FileMap) { + const { host } = state; + const outputs = getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames()); + if (!skipOutputs || outputs.length !== skipOutputs.size) { + let reportVerbose = !!state.options.verbose; + const now = host.now ? host.now() : new Date(); + for (const file of outputs) { + if (skipOutputs && skipOutputs.has(toPath(state, file))) { + continue; + } + + if (reportVerbose) { + reportVerbose = false; + reportStatus(state, verboseMessage, proj.options.configFilePath!); + } + + if (isDeclarationFile(file)) { + priorNewestUpdateTime = newer(priorNewestUpdateTime, host.getModifiedTime(file) || missingFileModifiedTime); + } + + host.setModifiedTime(file, now); + listEmittedFile(state, proj, file); + } + } + + return priorNewestUpdateTime; + } + + function updateOutputTimestamps(state: SolutionBuilderState, proj: ParsedCommandLine, resolvedPath: ResolvedConfigFilePath) { + if (state.options.dry) { + return reportStatus(state, Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath!); + } + const priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, Diagnostics.Updating_output_timestamps_of_project_0); + state.projectStatus.set(resolvedPath, { + type: UpToDateStatusType.UpToDate, + newestDeclarationFileContentChangedTime: priorNewestUpdateTime, + oldestOutputFileName: getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames()) + }); + } + + function needsBuild({ options }: SolutionBuilderState, status: UpToDateStatus, config: ParsedCommandLine) { + if (status.type !== UpToDateStatusType.OutOfDateWithPrepend || options.force) return true; + return config.fileNames.length === 0 || + !!config.errors.length || + !isIncrementalCompilation(config.options); + } + + function buildInvalidatedProject(state: SolutionBuilderState, { project, projectPath, reloadLevel, projectIndex, buildOrder }: InvalidatedProject, cancellationToken?: CancellationToken) { + const { options, projectPendingBuild } = state; + const config = parseConfigFile(state, project, projectPath); + if (!config) { + reportParseConfigFileDiagnostic(state, projectPath); + projectPendingBuild.delete(projectPath); + return; + } + + if (reloadLevel === ConfigFileProgramReloadLevel.Full) { + watchConfigFile(state, project, projectPath); + watchWildCardDirectories(state, project, projectPath, config); + watchInputFiles(state, project, projectPath, config); + } + else if (reloadLevel === ConfigFileProgramReloadLevel.Partial) { + // Update file names + const result = getFileNamesFromConfigSpecs(config.configFileSpecs!, getDirectoryPath(project), config.options, state.parseConfigFileHost); + updateErrorForNoInputFiles(result, project, config.configFileSpecs!, config.errors, canJsonReportNoInutFiles(config.raw)); + config.fileNames = result.fileNames; + watchInputFiles(state, project, projectPath, config); + } + + const status = getUpToDateStatus(state, config, projectPath); + verboseReportProjectStatus(state, project, status); + if (!options.force) { + if (status.type === UpToDateStatusType.UpToDate) { + reportAndStoreErrors(state, projectPath, config.errors); + projectPendingBuild.delete(projectPath); + // Up to date, skip + if (options.dry) { + // In a dry build, inform the user of this fact + reportStatus(state, Diagnostics.Project_0_is_up_to_date, project); + } + return; + } + + if (status.type === UpToDateStatusType.UpToDateWithUpstreamTypes) { + reportAndStoreErrors(state, projectPath, config.errors); + projectPendingBuild.delete(projectPath); + // Fake that files have been built by updating output file stamps + updateOutputTimestamps(state, config, projectPath); + return; + } + } + + if (status.type === UpToDateStatusType.UpstreamBlocked) { + reportAndStoreErrors(state, projectPath, config.errors); + projectPendingBuild.delete(projectPath); + if (options.verbose) reportStatus(state, Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, project, status.upstreamProjectName); + return; + } + + if (status.type === UpToDateStatusType.ContainerOnly) { + reportAndStoreErrors(state, projectPath, config.errors); + projectPendingBuild.delete(projectPath); + // Do nothing + return; + } + + const buildResult = needsBuild(state, status, config) ? + buildSingleProject(state, project, projectPath, cancellationToken) : // Actual build + updateBundle(state, project, projectPath, cancellationToken); // Fake that files have been built by manipulating prepend and existing output + projectPendingBuild.delete(projectPath); + // Only composite projects can be referenced by other projects + if (!(buildResult & BuildResultFlags.AnyErrors) && config.options.composite) { + queueReferencingProjects(state, project, projectPath, projectIndex, buildOrder, !(buildResult & BuildResultFlags.DeclarationOutputUnchanged)); + } + } + + function queueReferencingProjects( + state: SolutionBuilderState, + project: ResolvedConfigFileName, + projectPath: ResolvedConfigFilePath, + projectIndex: number, + buildOrder: readonly ResolvedConfigFileName[], + declarationOutputChanged: boolean + ) { + // Always use build order to queue projects + for (let index = projectIndex + 1; index < buildOrder.length; index++) { + const nextProject = buildOrder[index]; + const nextProjectPath = toResolvedConfigFilePath(state, nextProject); + if (state.projectPendingBuild.has(nextProjectPath)) continue; + + const nextProjectConfig = parseConfigFile(state, nextProject, nextProjectPath); + if (!nextProjectConfig || !nextProjectConfig.projectReferences) continue; + for (const ref of nextProjectConfig.projectReferences) { + const resolvedRefPath = resolveProjectName(state, ref.path); + if (toResolvedConfigFilePath(state, resolvedRefPath) !== projectPath) continue; + // If the project is referenced with prepend, always build downstream projects, + // If declaration output is changed, build the project + // otherwise mark the project UpToDateWithUpstreamTypes so it updates output time stamps + const status = state.projectStatus.get(nextProjectPath); + if (status) { + switch (status.type) { + case UpToDateStatusType.UpToDate: + if (!declarationOutputChanged) { + if (ref.prepend) { + state.projectStatus.set(nextProjectPath, { + type: UpToDateStatusType.OutOfDateWithPrepend, + outOfDateOutputFileName: status.oldestOutputFileName, + newerProjectName: project + }); + } + else { + status.type = UpToDateStatusType.UpToDateWithUpstreamTypes; + } + break; + } + + // falls through + case UpToDateStatusType.UpToDateWithUpstreamTypes: + case UpToDateStatusType.OutOfDateWithPrepend: + if (declarationOutputChanged) { + state.projectStatus.set(nextProjectPath, { + type: UpToDateStatusType.OutOfDateWithUpstream, + outOfDateOutputFileName: status.type === UpToDateStatusType.OutOfDateWithPrepend ? status.outOfDateOutputFileName : status.oldestOutputFileName, + newerProjectName: project + }); + } + break; + + case UpToDateStatusType.UpstreamBlocked: + if (toResolvedConfigFilePath(state, resolveProjectName(state, status.upstreamProjectName)) === projectPath) { + clearProjectStatus(state, nextProjectPath); + } + break; + } + } + addProjToQueue(state, nextProjectPath, ConfigFileProgramReloadLevel.None); + break; + } + } + } + + function buildNextProject(state: SolutionBuilderState, cancellationToken?: CancellationToken): SolutionBuilderResult | undefined { + setupInitialBuild(state, cancellationToken); + const invalidatedProject = getNextInvalidatedProject(state, getBuildOrder(state)); + if (!invalidatedProject) return undefined; + + buildInvalidatedProject(state, invalidatedProject, cancellationToken); + return { + project: invalidatedProject.project, + result: state.diagnostics.has(invalidatedProject.projectPath) ? + ExitStatus.DiagnosticsPresent_OutputsSkipped : + ExitStatus.Success + }; + } + + function build(state: SolutionBuilderState, project?: string, cancellationToken?: CancellationToken): ExitStatus { + const buildOrder = getBuildOrderFor(state, project); + if (!buildOrder) return ExitStatus.InvalidProject_OutputsSkipped; + + setupInitialBuild(state, cancellationToken); + + let successfulProjects = 0; + let errorProjects = 0; + while (true) { + const invalidatedProject = getNextInvalidatedProject(state, buildOrder); + if (!invalidatedProject) break; + buildInvalidatedProject(state, invalidatedProject, cancellationToken); + if (state.diagnostics.has(invalidatedProject.projectPath)) { + errorProjects++; + } + else { + successfulProjects++; + } + } + + disableCache(state); + reportErrorSummary(state); + startWatching(state); + + return errorProjects ? + successfulProjects ? + ExitStatus.DiagnosticsPresent_OutputsGenerated : + ExitStatus.DiagnosticsPresent_OutputsSkipped : + ExitStatus.Success; + } + + function clean(state: SolutionBuilderState, project?: string) { + const buildOrder = getBuildOrderFor(state, project); + if (!buildOrder) return ExitStatus.InvalidProject_OutputsSkipped; + + const { options, host } = state; + const filesToDelete = options.dry ? [] as string[] : undefined; + for (const proj of buildOrder) { + const resolvedPath = toResolvedConfigFilePath(state, proj); + const parsed = parseConfigFile(state, proj, resolvedPath); + if (parsed === undefined) { + // File has gone missing; fine to ignore here + reportParseConfigFileDiagnostic(state, resolvedPath); + continue; + } + const outputs = getAllProjectOutputs(parsed, !host.useCaseSensitiveFileNames()); + for (const output of outputs) { + if (host.fileExists(output)) { + if (filesToDelete) { + filesToDelete.push(output); + } + else { + host.deleteFile(output); + invalidateProject(state, resolvedPath, ConfigFileProgramReloadLevel.None); + } + } + } + } + + if (filesToDelete) { + reportStatus(state, Diagnostics.A_non_dry_build_would_delete_the_following_files_Colon_0, filesToDelete.map(f => `\r\n * ${f}`).join("")); + } + + return ExitStatus.Success; + } + + function invalidateProject(state: SolutionBuilderState, resolved: ResolvedConfigFilePath, reloadLevel: ConfigFileProgramReloadLevel) { + if (reloadLevel === ConfigFileProgramReloadLevel.Full) { + state.configFileCache.delete(resolved); + state.buildOrder = undefined; + } + state.needsSummary = true; + clearProjectStatus(state, resolved); + addProjToQueue(state, resolved, reloadLevel); + enableCache(state); + } + + function invalidateProjectAndScheduleBuilds(state: SolutionBuilderState, resolvedPath: ResolvedConfigFilePath, reloadLevel: ConfigFileProgramReloadLevel) { + state.reportFileChangeDetected = true; + invalidateProject(state, resolvedPath, reloadLevel); + scheduleBuildInvalidatedProject(state); + } + + function scheduleBuildInvalidatedProject(state: SolutionBuilderState) { + const { hostWithWatch } = state; + if (!hostWithWatch.setTimeout || !hostWithWatch.clearTimeout) { + return; + } + if (state.timerToBuildInvalidatedProject) { + hostWithWatch.clearTimeout(state.timerToBuildInvalidatedProject); + } + state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, 250, state); + } + + function buildNextInvalidatedProject(state: SolutionBuilderState) { + state.timerToBuildInvalidatedProject = undefined; + if (state.reportFileChangeDetected) { + state.reportFileChangeDetected = false; + state.projectErrorsReported.clear(); + reportWatchStatus(state, Diagnostics.File_change_detected_Starting_incremental_compilation); + } + const invalidatedProject = getNextInvalidatedProject(state, getBuildOrder(state)); + if (invalidatedProject) { + buildInvalidatedProject(state, invalidatedProject); + if (state.projectPendingBuild.size) { + // Schedule next project for build + if (state.watch && !state.timerToBuildInvalidatedProject) { + scheduleBuildInvalidatedProject(state); + } + } + else { + disableCache(state); + reportErrorSummary(state); + } + } + } + + function watchConfigFile(state: SolutionBuilderState, resolved: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath) { + if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath)) return; + state.allWatchedConfigFiles.set(resolvedPath, state.watchFile( + state.hostWithWatch, + resolved, + () => { + invalidateProjectAndScheduleBuilds(state, resolvedPath, ConfigFileProgramReloadLevel.Full); + }, + PollingInterval.High, + WatchType.ConfigFile, + resolved + )); + } + + function isSameFile(state: SolutionBuilderState, file1: string, file2: string) { + return comparePaths(file1, file2, state.currentDirectory, !state.host.useCaseSensitiveFileNames()) === Comparison.EqualTo; + } + + function isOutputFile(state: SolutionBuilderState, fileName: string, configFile: ParsedCommandLine) { + if (configFile.options.noEmit) return false; + + // ts or tsx files are not output + if (!fileExtensionIs(fileName, Extension.Dts) && + (fileExtensionIs(fileName, Extension.Ts) || fileExtensionIs(fileName, Extension.Tsx))) { + return false; + } + + // If options have --outFile or --out, check if its that + const out = configFile.options.outFile || configFile.options.out; + if (out && (isSameFile(state, fileName, out) || isSameFile(state, fileName, removeFileExtension(out) + Extension.Dts))) { + return true; + } + + // If declarationDir is specified, return if its a file in that directory + if (configFile.options.declarationDir && containsPath(configFile.options.declarationDir, fileName, state.currentDirectory, !state.host.useCaseSensitiveFileNames())) { + return true; + } + + // If --outDir, check if file is in that directory + if (configFile.options.outDir && containsPath(configFile.options.outDir, fileName, state.currentDirectory, !state.host.useCaseSensitiveFileNames())) { + return true; + } + + return !forEach(configFile.fileNames, inputFile => isSameFile(state, fileName, inputFile)); + } + + function watchWildCardDirectories(state: SolutionBuilderState, resolved: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, parsed: ParsedCommandLine) { + if (!state.watch) return; + updateWatchingWildcardDirectories( + getOrCreateValueMapFromConfigFileMap(state.allWatchedWildcardDirectories, resolvedPath), + createMapFromTemplate(parsed.configFileSpecs!.wildcardDirectories), + (dir, flags) => state.watchDirectory( + state.hostWithWatch, + dir, + fileOrDirectory => { + const fileOrDirectoryPath = toPath(state, fileOrDirectory); + if (fileOrDirectoryPath !== toPath(state, dir) && hasExtension(fileOrDirectoryPath) && !isSupportedSourceFileName(fileOrDirectory, parsed.options)) { + state.writeLog(`Project: ${resolved} Detected file add/remove of non supported extension: ${fileOrDirectory}`); + return; + } + + if (isOutputFile(state, fileOrDirectory, parsed)) { + state.writeLog(`${fileOrDirectory} is output file`); + return; + } + + invalidateProjectAndScheduleBuilds(state, resolvedPath, ConfigFileProgramReloadLevel.Partial); + }, + flags, + WatchType.WildcardDirectory, + resolved + ) + ); + } + + function watchInputFiles(state: SolutionBuilderState, resolved: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, parsed: ParsedCommandLine) { + if (!state.watch) return; + mutateMap( + getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), + arrayToMap(parsed.fileNames, fileName => toPath(state, fileName)), + { + createNewValue: (path, input) => state.watchFilePath( + state.hostWithWatch, + input, + () => invalidateProjectAndScheduleBuilds(state, resolvedPath, ConfigFileProgramReloadLevel.None), + PollingInterval.Low, + path as Path, + WatchType.SourceFile, + resolved + ), + onDeleteValue: closeFileWatcher, + } + ); + } + + function startWatching(state: SolutionBuilderState) { + if (!state.watchAllProjectsPending) return; + state.watchAllProjectsPending = false; + for (const resolved of getBuildOrder(state)) { + const resolvedPath = toResolvedConfigFilePath(state, resolved); + // Watch this file + watchConfigFile(state, resolved, resolvedPath); + + const cfg = parseConfigFile(state, resolved, resolvedPath); + if (cfg) { + // Update watchers for wildcard directories + watchWildCardDirectories(state, resolved, resolvedPath, cfg); + + // Watch input files + watchInputFiles(state, resolved, resolvedPath, cfg); + } + } + } + /** * A SolutionBuilder has an immutable set of rootNames that are the "entry point" projects, but * can dynamically add/remove other projects based on changes on the rootNames' references */ function createSolutionBuilderWorker(watch: false, host: SolutionBuilderHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; function createSolutionBuilderWorker(watch: true, host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; - function createSolutionBuilderWorker(watch: boolean, hostOrHostWithWatch: SolutionBuilderHost | SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder { - const host = hostOrHostWithWatch as SolutionBuilderHost; - const hostWithWatch = hostOrHostWithWatch as SolutionBuilderWithWatchHost; - const currentDirectory = host.getCurrentDirectory(); - const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames()); - const parseConfigFileHost = parseConfigHostFromCompilerHostLike(host); - - // State of the solution - const options = defaultOptions; - const baseCompilerOptions = getCompilerOptionsOfBuildOptions(options); - const resolvedConfigFilePaths = createMap(); - type ConfigFileCacheEntry = ParsedCommandLine | Diagnostic; - const configFileCache = createMap() as ConfigFileMap; - /** Map from config file name to up-to-date status */ - const projectStatus = createMap() as ConfigFileMap; - let buildOrder: readonly ResolvedConfigFileName[] | undefined; - const writeFileName = host.trace ? (s: string) => host.trace!(s) : undefined; - let readFileWithCache = (f: string) => host.readFile(f); - let projectCompilerOptions = baseCompilerOptions; - const compilerHost = createCompilerHostFromProgramHost(host, () => projectCompilerOptions); - setGetSourceFileAsHashVersioned(compilerHost, host); - compilerHost.getParsedCommandLine = fileName => parseConfigFile(fileName as ResolvedConfigFileName, toResolvedConfigFilePath(fileName as ResolvedConfigFileName)); - - compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames); - compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives); - const moduleResolutionCache = !compilerHost.resolveModuleNames ? createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined; - if (!compilerHost.resolveModuleNames) { - const loader = (moduleName: string, containingFile: string, redirectedReference: ResolvedProjectReference | undefined) => resolveModuleName(moduleName, containingFile, projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference).resolvedModule!; - compilerHost.resolveModuleNames = (moduleNames, containingFile, _reusedNames, redirectedReference) => - loadWithLocalCache(Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader); - } - let cacheState: { - originalReadFile: CompilerHost["readFile"]; - originalFileExists: CompilerHost["fileExists"]; - originalDirectoryExists: CompilerHost["directoryExists"]; - originalCreateDirectory: CompilerHost["createDirectory"]; - originalWriteFile: CompilerHost["writeFile"] | undefined; - originalReadFileWithCache: CompilerHost["readFile"]; - originalGetSourceFile: CompilerHost["getSourceFile"]; - } | undefined; - - const buildInfoChecked = createMap() as ConfigFileMap; - const extendedConfigCache = createMap(); - - // Watch state - const builderPrograms = createMap() as ConfigFileMap; - const diagnostics = createMap() as ConfigFileMap>; - const projectPendingBuild = createMap() as ConfigFileMap; - const projectErrorsReported = createMap() as ConfigFileMap; - let timerToBuildInvalidatedProject: any; - let reportFileChangeDetected = false; - const { watchFile, watchFilePath, watchDirectory, writeLog } = createWatchFactory(hostWithWatch, options); - - // Watches for the solution - const allWatchedWildcardDirectories = createMap() as ConfigFileMap>; - const allWatchedInputFiles = createMap() as ConfigFileMap>; - const allWatchedConfigFiles = createMap() as ConfigFileMap; - - let allProjectBuildPending = true; - let needsSummary = true; - let watchAllProjectsPending = watch; - + function createSolutionBuilderWorker(watch: boolean, hostOrHostWithWatch: SolutionBuilderHost | SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, options: BuildOptions): SolutionBuilder { + const state = createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, options); return { - build, - clean, - buildNextProject, - getBuildOrder, - getUpToDateStatusOfProject, - invalidateProject, - buildNextInvalidatedProject, + build: (project, cancellationToken) => build(state, project, cancellationToken), + clean: project => clean(state, project), + buildNextProject: cancellationToken => buildNextProject(state, cancellationToken), + getBuildOrder: () => getBuildOrder(state), + getUpToDateStatusOfProject: project => { + const configFileName = resolveProjectName(state, project); + const configFilePath = toResolvedConfigFilePath(state, configFileName); + return getUpToDateStatus(state, parseConfigFile(state, configFileName, configFilePath), configFilePath); + }, + invalidateProject: (configFilePath, reloadLevel) => invalidateProject(state, configFilePath, reloadLevel || ConfigFileProgramReloadLevel.None), + buildNextInvalidatedProject: () => buildNextInvalidatedProject(state), }; + } - function toPath(fileName: string) { - return ts.toPath(fileName, currentDirectory, getCanonicalFileName); - } + function relName(state: SolutionBuilderState, path: string): string { + return convertToRelativePath(path, state.currentDirectory, f => state.getCanonicalFileName(f)); + } - function toResolvedConfigFilePath(fileName: ResolvedConfigFileName): ResolvedConfigFilePath { - const path = resolvedConfigFilePaths.get(fileName); - if (path !== undefined) return path; + function reportStatus(state: SolutionBuilderState, message: DiagnosticMessage, ...args: string[]) { + state.host.reportSolutionBuilderStatus(createCompilerDiagnostic(message, ...args)); + } - const resolvedPath = toPath(fileName) as ResolvedConfigFilePath; - resolvedConfigFilePaths.set(fileName, resolvedPath); - return resolvedPath; - } - - function isParsedCommandLine(entry: ConfigFileCacheEntry): entry is ParsedCommandLine { - return !!(entry as ParsedCommandLine).options; - } - - function parseConfigFile(configFileName: ResolvedConfigFileName, configFilePath: ResolvedConfigFilePath): ParsedCommandLine | undefined { - const value = configFileCache.get(configFilePath); - if (value) { - return isParsedCommandLine(value) ? value : undefined; - } - - let diagnostic: Diagnostic | undefined; - parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = d => diagnostic = d; - const parsed = getParsedCommandLineOfConfigFile(configFileName, baseCompilerOptions, parseConfigFileHost, extendedConfigCache); - parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = noop; - configFileCache.set(configFilePath, parsed || diagnostic!); - return parsed; - } - - function reportStatus(message: DiagnosticMessage, ...args: string[]) { - host.reportSolutionBuilderStatus(createCompilerDiagnostic(message, ...args)); - } - - function reportWatchStatus(message: DiagnosticMessage, ...args: (string | number | undefined)[]) { - if (hostWithWatch.onWatchStatusChange) { - hostWithWatch.onWatchStatusChange(createCompilerDiagnostic(message, ...args), host.getNewLine(), baseCompilerOptions); - } - } - - function startWatching() { - for (const resolved of getBuildOrder()) { - const resolvedPath = toResolvedConfigFilePath(resolved); - // Watch this file - watchConfigFile(resolved, resolvedPath); - - const cfg = parseConfigFile(resolved, resolvedPath); - if (cfg) { - // Update watchers for wildcard directories - watchWildCardDirectories(resolved, resolvedPath, cfg); - - // Watch input files - watchInputFiles(resolved, resolvedPath, cfg); - } - } - - } - - function watchConfigFile(resolved: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath) { - if (watch && !allWatchedConfigFiles.has(resolvedPath)) { - allWatchedConfigFiles.set(resolvedPath, watchFile( - hostWithWatch, - resolved, - () => { - invalidateProjectAndScheduleBuilds(resolvedPath, ConfigFileProgramReloadLevel.Full); - }, - PollingInterval.High, - WatchType.ConfigFile, - resolved - )); - } - } - - function watchWildCardDirectories(resolved: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, parsed: ParsedCommandLine) { - if (!watch) return; - updateWatchingWildcardDirectories( - getOrCreateValueMapFromConfigFileMap(allWatchedWildcardDirectories, resolvedPath), - createMapFromTemplate(parsed.configFileSpecs!.wildcardDirectories), - (dir, flags) => { - return watchDirectory( - hostWithWatch, - dir, - fileOrDirectory => { - const fileOrDirectoryPath = toPath(fileOrDirectory); - if (fileOrDirectoryPath !== toPath(dir) && hasExtension(fileOrDirectoryPath) && !isSupportedSourceFileName(fileOrDirectory, parsed.options)) { - writeLog(`Project: ${resolved} Detected file add/remove of non supported extension: ${fileOrDirectory}`); - return; - } - - if (isOutputFile(fileOrDirectory, parsed)) { - writeLog(`${fileOrDirectory} is output file`); - return; - } - - invalidateProjectAndScheduleBuilds(resolvedPath, ConfigFileProgramReloadLevel.Partial); - }, - flags, - WatchType.WildcardDirectory, - resolved - ); - } - ); - } - - function watchInputFiles(resolved: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, parsed: ParsedCommandLine) { - if (!watch) return; - mutateMap( - getOrCreateValueMapFromConfigFileMap(allWatchedInputFiles, resolvedPath), - arrayToMap(parsed.fileNames, toPath), - { - createNewValue: (path, input) => watchFilePath( - hostWithWatch, - input, - () => invalidateProjectAndScheduleBuilds(resolvedPath, ConfigFileProgramReloadLevel.None), - PollingInterval.Low, - path as Path, - WatchType.SourceFile, - resolved - ), - onDeleteValue: closeFileWatcher, - } - ); - } - - function isOutputFile(fileName: string, configFile: ParsedCommandLine) { - if (configFile.options.noEmit) return false; - - // ts or tsx files are not output - if (!fileExtensionIs(fileName, Extension.Dts) && - (fileExtensionIs(fileName, Extension.Ts) || fileExtensionIs(fileName, Extension.Tsx))) { - return false; - } - - // If options have --outFile or --out, check if its that - const out = configFile.options.outFile || configFile.options.out; - if (out && (isSameFile(fileName, out) || isSameFile(fileName, removeFileExtension(out) + Extension.Dts))) { - return true; - } - - // If declarationDir is specified, return if its a file in that directory - if (configFile.options.declarationDir && containsPath(configFile.options.declarationDir, fileName, currentDirectory, !host.useCaseSensitiveFileNames())) { - return true; - } - - // If --outDir, check if file is in that directory - if (configFile.options.outDir && containsPath(configFile.options.outDir, fileName, currentDirectory, !host.useCaseSensitiveFileNames())) { - return true; - } - - return !forEach(configFile.fileNames, inputFile => isSameFile(fileName, inputFile)); - } - - function isSameFile(file1: string, file2: string) { - return comparePaths(file1, file2, currentDirectory, !host.useCaseSensitiveFileNames()) === Comparison.EqualTo; - } - - function invalidateProjectAndScheduleBuilds(resolvedPath: ResolvedConfigFilePath, reloadLevel: ConfigFileProgramReloadLevel) { - reportFileChangeDetected = true; - invalidateResolvedProject(resolvedPath, reloadLevel); - scheduleBuildInvalidatedProject(); - } - - function getUpToDateStatusOfProject(project: string): UpToDateStatus { - const configFileName = resolveProjectName(project); - const configFilePath = toResolvedConfigFilePath(configFileName); - return getUpToDateStatus(parseConfigFile(configFileName, configFilePath), configFilePath); - } - - function getBuildOrder() { - return buildOrder || (buildOrder = createBuildOrder(resolveProjectNames(rootNames))); - } - - function getUpToDateStatus(project: ParsedCommandLine | undefined, resolvedPath: ResolvedConfigFilePath): UpToDateStatus { - if (project === undefined) { - return { type: UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" }; - } - - const prior = projectStatus.get(resolvedPath); - if (prior !== undefined) { - return prior; - } - - const actual = getUpToDateStatusWorker(project, resolvedPath); - projectStatus.set(resolvedPath, actual); - return actual; - } - - function getUpToDateStatusWorker(project: ParsedCommandLine, resolvedPath: ResolvedConfigFilePath): UpToDateStatus { - let newestInputFileName: string = undefined!; - let newestInputFileTime = minimumDate; - // Get timestamps of input files - for (const inputFile of project.fileNames) { - if (!host.fileExists(inputFile)) { - return { - type: UpToDateStatusType.Unbuildable, - reason: `${inputFile} does not exist` - }; - } - - const inputTime = host.getModifiedTime(inputFile) || missingFileModifiedTime; - if (inputTime > newestInputFileTime) { - newestInputFileName = inputFile; - newestInputFileTime = inputTime; - } - } - - // Container if no files are specified in the project - if (!project.fileNames.length && !canJsonReportNoInutFiles(project.raw)) { - return { - type: UpToDateStatusType.ContainerOnly - }; - } - - // Collect the expected outputs of this project - const outputs = getAllProjectOutputs(project, !host.useCaseSensitiveFileNames()); - - // Now see if all outputs are newer than the newest input - let oldestOutputFileName = "(none)"; - let oldestOutputFileTime = maximumDate; - let newestOutputFileName = "(none)"; - let newestOutputFileTime = minimumDate; - let missingOutputFileName: string | undefined; - let newestDeclarationFileContentChangedTime = minimumDate; - let isOutOfDateWithInputs = false; - for (const output of outputs) { - // Output is missing; can stop checking - // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status - if (!host.fileExists(output)) { - missingOutputFileName = output; - break; - } - - const outputTime = host.getModifiedTime(output) || missingFileModifiedTime; - if (outputTime < oldestOutputFileTime) { - oldestOutputFileTime = outputTime; - oldestOutputFileName = output; - } - - // If an output is older than the newest input, we can stop checking - // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status - if (outputTime < newestInputFileTime) { - isOutOfDateWithInputs = true; - break; - } - - if (outputTime > newestOutputFileTime) { - newestOutputFileTime = outputTime; - newestOutputFileName = output; - } - - // Keep track of when the most recent time a .d.ts file was changed. - // In addition to file timestamps, we also keep track of when a .d.ts file - // had its file touched but not had its contents changed - this allows us - // to skip a downstream typecheck - if (isDeclarationFile(output)) { - const outputModifiedTime = host.getModifiedTime(output) || missingFileModifiedTime; - newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime); - } - } - - let pseudoUpToDate = false; - let usesPrepend = false; - let upstreamChangedProject: string | undefined; - if (project.projectReferences) { - projectStatus.set(resolvedPath, { type: UpToDateStatusType.ComputingUpstream }); - for (const ref of project.projectReferences) { - usesPrepend = usesPrepend || !!(ref.prepend); - const resolvedRef = resolveProjectReferencePath(ref); - const resolvedRefPath = toResolvedConfigFilePath(resolvedRef); - const refStatus = getUpToDateStatus(parseConfigFile(resolvedRef, resolvedRefPath), resolvedRefPath); - - // Its a circular reference ignore the status of this project - if (refStatus.type === UpToDateStatusType.ComputingUpstream) { - continue; - } - - // An upstream project is blocked - if (refStatus.type === UpToDateStatusType.Unbuildable) { - return { - type: UpToDateStatusType.UpstreamBlocked, - upstreamProjectName: ref.path - }; - } - - // If the upstream project is out of date, then so are we (someone shouldn't have asked, though?) - if (refStatus.type !== UpToDateStatusType.UpToDate) { - return { - type: UpToDateStatusType.UpstreamOutOfDate, - upstreamProjectName: ref.path - }; - } - - // Check oldest output file name only if there is no missing output file name - if (!missingOutputFileName) { - // If the upstream project's newest file is older than our oldest output, we - // can't be out of date because of it - if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) { - continue; - } - - // If the upstream project has only change .d.ts files, and we've built - // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild - if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) { - pseudoUpToDate = true; - upstreamChangedProject = ref.path; - continue; - } - - // We have an output older than an upstream output - we are out of date - Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here"); - return { - type: UpToDateStatusType.OutOfDateWithUpstream, - outOfDateOutputFileName: oldestOutputFileName, - newerProjectName: ref.path - }; - } - } - } - - if (missingOutputFileName !== undefined) { - return { - type: UpToDateStatusType.OutputMissing, - missingOutputFileName - }; - } - - if (isOutOfDateWithInputs) { - return { - type: UpToDateStatusType.OutOfDateWithSelf, - outOfDateOutputFileName: oldestOutputFileName, - newerInputFileName: newestInputFileName - }; - } - else { - // Check tsconfig time - const configStatus = checkConfigFileUpToDateStatus(project.options.configFilePath!, oldestOutputFileTime, oldestOutputFileName); - if (configStatus) return configStatus; - - // Check extended config time - const extendedConfigStatus = forEach(project.options.configFile!.extendedSourceFiles || emptyArray, configFile => checkConfigFileUpToDateStatus(configFile, oldestOutputFileTime, oldestOutputFileName)); - if (extendedConfigStatus) return extendedConfigStatus; - } - - if (!buildInfoChecked.has(resolvedPath)) { - buildInfoChecked.set(resolvedPath, true); - const buildInfoPath = getOutputPathForBuildInfo(project.options); - if (buildInfoPath) { - const value = readFileWithCache(buildInfoPath); - const buildInfo = value && getBuildInfo(value); - if (buildInfo && buildInfo.version !== version) { - return { - type: UpToDateStatusType.TsVersionOutputOfDate, - version: buildInfo.version - }; - } - } - } - - if (usesPrepend && pseudoUpToDate) { - return { - type: UpToDateStatusType.OutOfDateWithPrepend, - outOfDateOutputFileName: oldestOutputFileName, - newerProjectName: upstreamChangedProject! - }; - } - - // Up to date - return { - type: pseudoUpToDate ? UpToDateStatusType.UpToDateWithUpstreamTypes : UpToDateStatusType.UpToDate, - newestDeclarationFileContentChangedTime, - newestInputFileTime, - newestOutputFileTime, - newestInputFileName, - newestOutputFileName, - oldestOutputFileName - }; - } - - function checkConfigFileUpToDateStatus(configFile: string, oldestOutputFileTime: Date, oldestOutputFileName: string): Status.OutOfDateWithSelf | undefined { - // Check tsconfig time - const tsconfigTime = host.getModifiedTime(configFile) || missingFileModifiedTime; - if (oldestOutputFileTime < tsconfigTime) { - return { - type: UpToDateStatusType.OutOfDateWithSelf, - outOfDateOutputFileName: oldestOutputFileName, - newerInputFileName: configFile - }; - } - } - - function invalidateProject(configFileName: string, reloadLevel?: ConfigFileProgramReloadLevel) { - invalidateResolvedProject(toResolvedConfigFilePath(resolveProjectName(configFileName)), reloadLevel || ConfigFileProgramReloadLevel.None); - } - - function invalidateResolvedProject(resolved: ResolvedConfigFilePath, reloadLevel: ConfigFileProgramReloadLevel) { - if (reloadLevel === ConfigFileProgramReloadLevel.Full) { - configFileCache.delete(resolved); - buildOrder = undefined; - } - needsSummary = true; - clearProjectStatus(resolved); - addProjToQueue(resolved, reloadLevel); - enableCache(); - } - - function clearProjectStatus(resolved: ResolvedConfigFilePath) { - projectStatus.delete(resolved); - diagnostics.delete(resolved); - } - - /** - * return true if new addition - */ - function addProjToQueue(proj: ResolvedConfigFilePath, reloadLevel: ConfigFileProgramReloadLevel) { - const value = projectPendingBuild.get(proj); - if (value === undefined) { - projectPendingBuild.set(proj, reloadLevel); - } - else if (value < reloadLevel) { - projectPendingBuild.set(proj, reloadLevel); - } - } - - function getNextInvalidatedProject(buildOrder: readonly ResolvedConfigFileName[]): InvalidatedProject | undefined { - return hasPendingInvalidatedProjects() ? - forEach(buildOrder, (project, projectIndex) => { - const projectPath = toResolvedConfigFilePath(project); - const reloadLevel = projectPendingBuild.get(projectPath); - if (reloadLevel !== undefined) { - return { project, projectPath, reloadLevel, projectIndex }; - } - }) : - undefined; - } - - function hasPendingInvalidatedProjects() { - return !!projectPendingBuild.size; - } - - function scheduleBuildInvalidatedProject() { - if (!hostWithWatch.setTimeout || !hostWithWatch.clearTimeout) { - return; - } - if (timerToBuildInvalidatedProject) { - hostWithWatch.clearTimeout(timerToBuildInvalidatedProject); - } - timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, 250); - } - - function buildNextInvalidatedProject() { - timerToBuildInvalidatedProject = undefined; - if (reportFileChangeDetected) { - reportFileChangeDetected = false; - projectErrorsReported.clear(); - reportWatchStatus(Diagnostics.File_change_detected_Starting_incremental_compilation); - } - const invalidatedProject = getNextInvalidatedProject(getBuildOrder()); - if (invalidatedProject) { - buildInvalidatedProject(invalidatedProject); - if (hasPendingInvalidatedProjects()) { - if (watch && !timerToBuildInvalidatedProject) { - scheduleBuildInvalidatedProject(); - } - } - else { - disableCache(); - reportErrorSummary(); - } - } - } - - function reportErrorSummary() { - if (watch || host.reportErrorSummary) { - needsSummary = false; - // Report errors from the other projects - getBuildOrder().forEach(project => { - const projectPath = toResolvedConfigFilePath(project); - if (!projectErrorsReported.has(projectPath)) { - reportErrors(diagnostics.get(projectPath) || emptyArray); - } - }); - let totalErrors = 0; - diagnostics.forEach(singleProjectErrors => totalErrors += getErrorCountForSummary(singleProjectErrors)); - if (watch) { - reportWatchStatus(getWatchErrorSummaryDiagnosticMessage(totalErrors), totalErrors); - } - else { - host.reportErrorSummary!(totalErrors); - } - } - } - - function buildInvalidatedProject({ project, projectPath, reloadLevel, projectIndex }: InvalidatedProject, cancellationToken?: CancellationToken) { - const config = parseConfigFile(project, projectPath); - if (!config) { - reportParseConfigFileDiagnostic(projectPath); - projectPendingBuild.delete(projectPath); - return; - } - - if (reloadLevel === ConfigFileProgramReloadLevel.Full) { - watchConfigFile(project, projectPath); - watchWildCardDirectories(project, projectPath, config); - watchInputFiles(project, projectPath, config); - } - else if (reloadLevel === ConfigFileProgramReloadLevel.Partial) { - // Update file names - const result = getFileNamesFromConfigSpecs(config.configFileSpecs!, getDirectoryPath(project), config.options, parseConfigFileHost); - updateErrorForNoInputFiles(result, project, config.configFileSpecs!, config.errors, canJsonReportNoInutFiles(config.raw)); - config.fileNames = result.fileNames; - watchInputFiles(project, projectPath, config); - } - - const status = getUpToDateStatus(config, projectPath); - verboseReportProjectStatus(project, status); - if (status.type === UpToDateStatusType.UpToDate && !options.force) { - reportAndStoreErrors(projectPath, config.errors); - // Up to date, skip - if (options.dry) { - // In a dry build, inform the user of this fact - reportStatus(Diagnostics.Project_0_is_up_to_date, project); - } - projectPendingBuild.delete(projectPath); - return; - } - - if (status.type === UpToDateStatusType.UpToDateWithUpstreamTypes && !options.force) { - reportAndStoreErrors(projectPath, config.errors); - // Fake that files have been built by updating output file stamps - updateOutputTimestamps(config, projectPath); - projectPendingBuild.delete(projectPath); - return; - } - - if (status.type === UpToDateStatusType.UpstreamBlocked) { - reportAndStoreErrors(projectPath, config.errors); - if (options.verbose) reportStatus(Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, project, status.upstreamProjectName); - projectPendingBuild.delete(projectPath); - return; - } - - if (status.type === UpToDateStatusType.ContainerOnly) { - reportAndStoreErrors(projectPath, config.errors); - // Do nothing - projectPendingBuild.delete(projectPath); - return; - } - - const buildResult = needsBuild(status, config) ? - buildSingleProject(project, projectPath, cancellationToken) : // Actual build - updateBundle(project, projectPath, cancellationToken); // Fake that files have been built by manipulating prepend and existing output - projectPendingBuild.delete(projectPath); - // Only composite projects can be referenced by other projects - if (!(buildResult & BuildResultFlags.AnyErrors) && config.options.composite) { - queueReferencingProjects(project, projectPath, projectIndex, !(buildResult & BuildResultFlags.DeclarationOutputUnchanged)); - } - } - - function queueReferencingProjects(project: ResolvedConfigFileName, projectPath: ResolvedConfigFilePath, projectIndex: number, declarationOutputChanged: boolean) { - // Always use build order to queue projects - const buildOrder = getBuildOrder(); - for (let index = projectIndex + 1; index < buildOrder.length; index++) { - const nextProject = buildOrder[index]; - const nextProjectPath = toResolvedConfigFilePath(nextProject); - if (projectPendingBuild.has(nextProjectPath)) continue; - - const nextProjectConfig = parseConfigFile(nextProject, nextProjectPath); - if (!nextProjectConfig || !nextProjectConfig.projectReferences) continue; - for (const ref of nextProjectConfig.projectReferences) { - const resolvedRefPath = resolveProjectName(ref.path); - if (toResolvedConfigFilePath(resolvedRefPath) !== projectPath) continue; - // If the project is referenced with prepend, always build downstream projects, - // If declaration output is changed, build the project - // otherwise mark the project UpToDateWithUpstreamTypes so it updates output time stamps - const status = projectStatus.get(nextProjectPath); - if (status) { - switch (status.type) { - case UpToDateStatusType.UpToDate: - if (!declarationOutputChanged) { - if (ref.prepend) { - projectStatus.set(nextProjectPath, { - type: UpToDateStatusType.OutOfDateWithPrepend, - outOfDateOutputFileName: status.oldestOutputFileName, - newerProjectName: project - }); - } - else { - status.type = UpToDateStatusType.UpToDateWithUpstreamTypes; - } - break; - } - - // falls through - case UpToDateStatusType.UpToDateWithUpstreamTypes: - case UpToDateStatusType.OutOfDateWithPrepend: - if (declarationOutputChanged) { - projectStatus.set(nextProjectPath, { - type: UpToDateStatusType.OutOfDateWithUpstream, - outOfDateOutputFileName: status.type === UpToDateStatusType.OutOfDateWithPrepend ? status.outOfDateOutputFileName : status.oldestOutputFileName, - newerProjectName: project - }); - } - break; - - case UpToDateStatusType.UpstreamBlocked: - if (toResolvedConfigFilePath(resolveProjectName(status.upstreamProjectName)) === projectPath) { - clearProjectStatus(nextProjectPath); - } - break; - } - } - addProjToQueue(nextProjectPath, ConfigFileProgramReloadLevel.None); - break; - } - } - } - - function createBuildOrder(roots: readonly ResolvedConfigFileName[]): readonly ResolvedConfigFileName[] { - const temporaryMarks = createMap() as ConfigFileMap; - const permanentMarks = createMap() as ConfigFileMap; - const circularityReportStack: string[] = []; - let buildOrder: ResolvedConfigFileName[] | undefined; - for (const root of roots) { - visit(root); - } - - return buildOrder || emptyArray; - - function visit(configFileName: ResolvedConfigFileName, inCircularContext?: boolean) { - const projPath = toResolvedConfigFilePath(configFileName); - // Already visited - if (permanentMarks.has(projPath)) return; - // Circular - if (temporaryMarks.has(projPath)) { - if (!inCircularContext) { - // TODO:: Do we report this as error? - reportStatus(Diagnostics.Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0, circularityReportStack.join("\r\n")); - } - return; - } - - temporaryMarks.set(projPath, true); - circularityReportStack.push(configFileName); - const parsed = parseConfigFile(configFileName, projPath); - if (parsed && parsed.projectReferences) { - for (const ref of parsed.projectReferences) { - const resolvedRefPath = resolveProjectName(ref.path); - visit(resolvedRefPath, inCircularContext || ref.circular); - } - } - - circularityReportStack.pop(); - permanentMarks.set(projPath, true); - (buildOrder || (buildOrder = [])).push(configFileName); - } - } - - function buildSingleProject(proj: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, cancellationToken: CancellationToken | undefined): BuildResultFlags { - if (options.dry) { - reportStatus(Diagnostics.A_non_dry_build_would_build_project_0, proj); - return BuildResultFlags.Success; - } - - if (options.verbose) reportStatus(Diagnostics.Building_project_0, proj); - - let resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - - const configFile = parseConfigFile(proj, resolvedPath); - if (!configFile) { - // Failed to read the config file - resultFlags |= BuildResultFlags.ConfigFileErrors; - reportParseConfigFileDiagnostic(resolvedPath); - projectStatus.set(resolvedPath, { type: UpToDateStatusType.Unbuildable, reason: "Config file errors" }); - return resultFlags; - } - if (configFile.fileNames.length === 0) { - reportAndStoreErrors(resolvedPath, configFile.errors); - // Nothing to build - must be a solution file, basically - return BuildResultFlags.None; - } - - // TODO: handle resolve module name to cache result in project reference redirect - projectCompilerOptions = configFile.options; - // Update module resolution cache if needed - if (moduleResolutionCache) { - const projPath = toPath(proj); - if (moduleResolutionCache.directoryToModuleNameMap.redirectsMap.size === 0) { - // The own map will be for projectCompilerOptions - Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size === 0); - moduleResolutionCache.directoryToModuleNameMap.redirectsMap.set(projPath, moduleResolutionCache.directoryToModuleNameMap.ownMap); - moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.set(projPath, moduleResolutionCache.moduleNameToDirectoryMap.ownMap); - } - else { - // Set correct own map - Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size > 0); - - const ref: ResolvedProjectReference = { - sourceFile: projectCompilerOptions.configFile!, - commandLine: configFile - }; - moduleResolutionCache.directoryToModuleNameMap.setOwnMap(moduleResolutionCache.directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref)); - moduleResolutionCache.moduleNameToDirectoryMap.setOwnMap(moduleResolutionCache.moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref)); - } - moduleResolutionCache.directoryToModuleNameMap.setOwnOptions(projectCompilerOptions); - moduleResolutionCache.moduleNameToDirectoryMap.setOwnOptions(projectCompilerOptions); - } - - const program = host.createProgram( - configFile.fileNames, - configFile.options, - compilerHost, - getOldProgram(resolvedPath, configFile), - configFile.errors, - configFile.projectReferences - ); - - // Don't emit anything in the presence of syntactic errors or options diagnostics - const syntaxDiagnostics = [ - ...program.getConfigFileParsingDiagnostics(), - ...program.getOptionsDiagnostics(cancellationToken), - ...program.getGlobalDiagnostics(cancellationToken), - ...program.getSyntacticDiagnostics(/*sourceFile*/ undefined, cancellationToken)]; - if (syntaxDiagnostics.length) { - return buildErrors(syntaxDiagnostics, BuildResultFlags.SyntaxErrors, "Syntactic"); - } - - // Same as above but now for semantic diagnostics - const semanticDiagnostics = program.getSemanticDiagnostics(/*sourceFile*/ undefined, cancellationToken); - if (semanticDiagnostics.length) { - return buildErrors(semanticDiagnostics, BuildResultFlags.TypeErrors, "Semantic"); - } - - // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly - program.backupState(); - let newestDeclarationFileContentChangedTime = minimumDate; - let anyDtsChanged = false; - let declDiagnostics: Diagnostic[] | undefined; - const reportDeclarationDiagnostics = (d: Diagnostic) => (declDiagnostics || (declDiagnostics = [])).push(d); - const outputFiles: OutputFile[] = []; - emitFilesAndReportErrors( - program, - reportDeclarationDiagnostics, - /*writeFileName*/ undefined, - /*reportSummary*/ undefined, - (name, text, writeByteOrderMark) => outputFiles.push({ name, text, writeByteOrderMark }), - cancellationToken - ); - // Don't emit .d.ts if there are decl file errors - if (declDiagnostics) { - program.restoreState(); - return buildErrors(declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"); - } - - // Actual Emit - const emitterDiagnostics = createDiagnosticCollection(); - const emittedOutputs = createMap() as FileMap; - outputFiles.forEach(({ name, text, writeByteOrderMark }) => { - let priorChangeTime: Date | undefined; - if (!anyDtsChanged && isDeclarationFile(name)) { - // Check for unchanged .d.ts files - if (host.fileExists(name) && readFileWithCache(name) === text) { - priorChangeTime = host.getModifiedTime(name); - } - else { - resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; - anyDtsChanged = true; - } - } - - emittedOutputs.set(toPath(name), name); - writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); - if (priorChangeTime !== undefined) { - newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime); - } - }); - - const emitDiagnostics = emitterDiagnostics.getDiagnostics(); - if (emitDiagnostics.length) { - return buildErrors(emitDiagnostics, BuildResultFlags.EmitErrors, "Emit"); - } - - if (writeFileName) { - emittedOutputs.forEach(name => listEmittedFile(configFile, name)); - listFiles(program, writeFileName); - } - - // Update time stamps for rest of the outputs - newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(configFile, newestDeclarationFileContentChangedTime, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); - - const status: Status.UpToDate = { - type: UpToDateStatusType.UpToDate, - newestDeclarationFileContentChangedTime: anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime, - oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(configFile, !host.useCaseSensitiveFileNames()) - }; - diagnostics.delete(resolvedPath); - projectStatus.set(resolvedPath, status); - afterProgramCreate(resolvedPath, program); - projectCompilerOptions = baseCompilerOptions; - return resultFlags; - - function buildErrors(diagnostics: ReadonlyArray, errorFlags: BuildResultFlags, errorType: string) { - resultFlags |= errorFlags; - reportAndStoreErrors(resolvedPath, diagnostics); - // List files if any other build error using program (emit errors already report files) - if (writeFileName) listFiles(program, writeFileName); - projectStatus.set(resolvedPath, { type: UpToDateStatusType.Unbuildable, reason: `${errorType} errors` }); - afterProgramCreate(resolvedPath, program); - projectCompilerOptions = baseCompilerOptions; - return resultFlags; - } - } - - function listEmittedFile(proj: ParsedCommandLine, file: string) { - if (writeFileName && proj.options.listEmittedFiles) { - writeFileName(`TSFILE: ${file}`); - } - } - - function afterProgramCreate(proj: ResolvedConfigFilePath, program: T) { - if (host.afterProgramEmitAndDiagnostics) { - host.afterProgramEmitAndDiagnostics(program); - } - if (watch) { - program.releaseProgram(); - builderPrograms.set(proj, program); - } - } - - function getOldProgram(proj: ResolvedConfigFilePath, parsed: ParsedCommandLine) { - if (options.force) return undefined; - const value = builderPrograms.get(proj); - if (value) return value; - return readBuilderProgram(parsed.options, readFileWithCache) as any as T; - } - - function updateBundle(proj: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, cancellationToken: CancellationToken | undefined): BuildResultFlags { - if (options.dry) { - reportStatus(Diagnostics.A_non_dry_build_would_update_output_of_project_0, proj); - return BuildResultFlags.Success; - } - - if (options.verbose) reportStatus(Diagnostics.Updating_output_of_project_0, proj); - - // Update js, and source map - const config = Debug.assertDefined(parseConfigFile(proj, resolvedPath)); - projectCompilerOptions = config.options; - const outputFiles = emitUsingBuildInfo( - config, - compilerHost, - ref => { - const refName = resolveProjectName(ref.path); - return parseConfigFile(refName, toResolvedConfigFilePath(refName)); - }); - if (isString(outputFiles)) { - reportStatus(Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, proj, relName(outputFiles)); - return buildSingleProject(proj, resolvedPath, cancellationToken); - } - - // Actual Emit - Debug.assert(!!outputFiles.length); - const emitterDiagnostics = createDiagnosticCollection(); - const emittedOutputs = createMap() as FileMap; - outputFiles.forEach(({ name, text, writeByteOrderMark }) => { - emittedOutputs.set(toPath(name), name); - writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); - }); - const emitDiagnostics = emitterDiagnostics.getDiagnostics(); - if (emitDiagnostics.length) { - reportAndStoreErrors(resolvedPath, emitDiagnostics); - projectStatus.set(resolvedPath, { type: UpToDateStatusType.Unbuildable, reason: "Emit errors" }); - projectCompilerOptions = baseCompilerOptions; - return BuildResultFlags.DeclarationOutputUnchanged | BuildResultFlags.EmitErrors; - } - - if (writeFileName) { - emittedOutputs.forEach(name => listEmittedFile(config, name)); - } - - // Update timestamps for dts - const newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(config, minimumDate, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); - - const status: Status.UpToDate = { - type: UpToDateStatusType.UpToDate, - newestDeclarationFileContentChangedTime, - oldestOutputFileName: outputFiles[0].name - }; - - diagnostics.delete(resolvedPath); - projectStatus.set(resolvedPath, status); - projectCompilerOptions = baseCompilerOptions; - return BuildResultFlags.DeclarationOutputUnchanged; - } - - function updateOutputTimestamps(proj: ParsedCommandLine, resolvedPath: ResolvedConfigFilePath) { - if (options.dry) { - return reportStatus(Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath!); - } - const priorNewestUpdateTime = updateOutputTimestampsWorker(proj, minimumDate, Diagnostics.Updating_output_timestamps_of_project_0); - const status: Status.UpToDate = { - type: UpToDateStatusType.UpToDate, - newestDeclarationFileContentChangedTime: priorNewestUpdateTime, - oldestOutputFileName: getFirstProjectOutput(proj, !host.useCaseSensitiveFileNames()) - }; - projectStatus.set(resolvedPath, status); - } - - function updateOutputTimestampsWorker(proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: FileMap) { - const outputs = getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames()); - if (!skipOutputs || outputs.length !== skipOutputs.size) { - if (options.verbose) { - reportStatus(verboseMessage, proj.options.configFilePath!); - } - const now = host.now ? host.now() : new Date(); - for (const file of outputs) { - if (skipOutputs && skipOutputs.has(toPath(file))) { - continue; - } - - if (isDeclarationFile(file)) { - priorNewestUpdateTime = newer(priorNewestUpdateTime, host.getModifiedTime(file) || missingFileModifiedTime); - } - - host.setModifiedTime(file, now); - listEmittedFile(proj, file); - } - } - - return priorNewestUpdateTime; - } - - function clean(project?: string) { - const buildOrder = getBuildOrderFor(project); - if (!buildOrder) return ExitStatus.InvalidProject_OutputsSkipped; - - const filesToDelete = options.dry ? [] as string[] : undefined; - for (const proj of buildOrder) { - const resolvedPath = toResolvedConfigFilePath(proj); - const parsed = parseConfigFile(proj, resolvedPath); - if (parsed === undefined) { - // File has gone missing; fine to ignore here - reportParseConfigFileDiagnostic(resolvedPath); - continue; - } - const outputs = getAllProjectOutputs(parsed, !host.useCaseSensitiveFileNames()); - for (const output of outputs) { - if (host.fileExists(output)) { - if (filesToDelete) { - filesToDelete.push(output); - } - else { - host.deleteFile(output); - invalidateResolvedProject(resolvedPath, ConfigFileProgramReloadLevel.None); - } - } - } - } - - if (filesToDelete) { - reportStatus(Diagnostics.A_non_dry_build_would_delete_the_following_files_Colon_0, filesToDelete.map(f => `\r\n * ${f}`).join("")); - } - - return ExitStatus.Success; - } - - function resolveProjectName(name: string): ResolvedConfigFileName { - return resolveConfigFileProjectName(resolvePath(host.getCurrentDirectory(), name)); - } - - function resolveProjectNames(configFileNames: ReadonlyArray): ResolvedConfigFileName[] { - return configFileNames.map(resolveProjectName); - } - - function enableCache() { - if (cacheState) { - disableCache(); - } - - const originalReadFileWithCache = readFileWithCache; - const originalGetSourceFile = compilerHost.getSourceFile; - - const { originalReadFile, originalFileExists, originalDirectoryExists, - originalCreateDirectory, originalWriteFile, getSourceFileWithCache, - readFileWithCache: newReadFileWithCache - } = changeCompilerHostLikeToUseCache(host, toPath, (...args) => originalGetSourceFile.call(compilerHost, ...args)); - readFileWithCache = newReadFileWithCache; - compilerHost.getSourceFile = getSourceFileWithCache!; - - cacheState = { - originalReadFile, - originalFileExists, - originalDirectoryExists, - originalCreateDirectory, - originalWriteFile, - originalReadFileWithCache, - originalGetSourceFile, - }; - } - - function disableCache() { - if (!cacheState) return; - - host.readFile = cacheState.originalReadFile; - host.fileExists = cacheState.originalFileExists; - host.directoryExists = cacheState.originalDirectoryExists; - host.createDirectory = cacheState.originalCreateDirectory; - host.writeFile = cacheState.originalWriteFile; - compilerHost.getSourceFile = cacheState.originalGetSourceFile; - readFileWithCache = cacheState.originalReadFileWithCache; - extendedConfigCache.clear(); - if (moduleResolutionCache) { - moduleResolutionCache.directoryToModuleNameMap.clear(); - moduleResolutionCache.moduleNameToDirectoryMap.clear(); - } - cacheState = undefined; - } - - function getBuildOrderFor(project: string | undefined) { - const resolvedProject = project && resolveProjectName(project); - if (resolvedProject) { - const projectPath = toResolvedConfigFilePath(resolvedProject); - const projectIndex = findIndex( - getBuildOrder(), - configFileName => toResolvedConfigFilePath(configFileName) === projectPath - ); - if (projectIndex === -1) return undefined; - } - return resolvedProject ? createBuildOrder([resolvedProject]) : getBuildOrder(); - } - - function setupInitialBuild(cancellationToken: CancellationToken | undefined) { - // Set initial build if not already built - if (allProjectBuildPending) { - allProjectBuildPending = false; - if (options.watch) { reportWatchStatus(Diagnostics.Starting_compilation_in_watch_mode); } - enableCache(); - const buildOrder = getBuildOrder(); - reportBuildQueue(buildOrder); - buildOrder.forEach(configFileName => - projectPendingBuild.set(toResolvedConfigFilePath(configFileName), ConfigFileProgramReloadLevel.None)); - - if (cancellationToken) { - cancellationToken.throwIfCancellationRequested(); - } - } - } - - function buildNextProject(cancellationToken?: CancellationToken): SolutionBuilderResult | undefined { - setupInitialBuild(cancellationToken); - const invalidatedProject = getNextInvalidatedProject(getBuildOrder()); - if (!invalidatedProject) return undefined; - - buildInvalidatedProject(invalidatedProject, cancellationToken); - return { - project: invalidatedProject.project, - result: diagnostics.has(invalidatedProject.projectPath) ? - ExitStatus.DiagnosticsPresent_OutputsSkipped : - ExitStatus.Success - }; - } - - function build(project?: string, cancellationToken?: CancellationToken): ExitStatus { - const buildOrder = getBuildOrderFor(project); - if (!buildOrder) return ExitStatus.InvalidProject_OutputsSkipped; - - setupInitialBuild(cancellationToken); - - let successfulProjects = 0; - let errorProjects = 0; - while (true) { - const invalidatedProject = getNextInvalidatedProject(buildOrder); - if (!invalidatedProject) { - if (needsSummary) { - disableCache(); - reportErrorSummary(); - } - if (watchAllProjectsPending) { - watchAllProjectsPending = false; - startWatching(); - } - break; - } - - buildInvalidatedProject(invalidatedProject, cancellationToken); - if (diagnostics.has(invalidatedProject.projectPath)) { - errorProjects++; - } - else { - successfulProjects++; - } - } - - return errorProjects ? - successfulProjects ? - ExitStatus.DiagnosticsPresent_OutputsGenerated : - ExitStatus.DiagnosticsPresent_OutputsSkipped : - ExitStatus.Success; - } - - function needsBuild(status: UpToDateStatus, config: ParsedCommandLine) { - if (status.type !== UpToDateStatusType.OutOfDateWithPrepend || options.force) return true; - return config.fileNames.length === 0 || - !!config.errors.length || - !isIncrementalCompilation(config.options); - } - - function reportParseConfigFileDiagnostic(proj: ResolvedConfigFilePath) { - reportAndStoreErrors(proj, [configFileCache.get(proj) as Diagnostic]); - } - - function reportAndStoreErrors(proj: ResolvedConfigFilePath, errors: ReadonlyArray) { - reportErrors(errors); - projectErrorsReported.set(proj, true); - if (errors.length) { - diagnostics.set(proj, errors); - } - } - - function reportErrors(errors: ReadonlyArray) { - errors.forEach(err => host.reportDiagnostic(err)); - } - - /** - * Report the build ordering inferred from the current project graph if we're in verbose mode - */ - function reportBuildQueue(buildQueue: readonly ResolvedConfigFileName[]) { - if (options.verbose) { - reportStatus(Diagnostics.Projects_in_this_build_Colon_0, buildQueue.map(s => "\r\n * " + relName(s)).join("")); - } - } - - function relName(path: string): string { - return convertToRelativePath(path, host.getCurrentDirectory(), f => compilerHost.getCanonicalFileName(f)); - } - - /** - * Report the up-to-date status of a project if we're in verbose mode - */ - function verboseReportProjectStatus(configFileName: string, status: UpToDateStatus) { - if (!options.verbose) return; - return formatUpToDateStatus(configFileName, status, relName, reportStatus); + function reportWatchStatus(state: SolutionBuilderState, message: DiagnosticMessage, ...args: (string | number | undefined)[]) { + if (state.hostWithWatch.onWatchStatusChange) { + state.hostWithWatch.onWatchStatusChange(createCompilerDiagnostic(message, ...args), state.host.getNewLine(), state.baseCompilerOptions); } } - function formatUpToDateStatus(configFileName: string, status: UpToDateStatus, relName: (fileName: string) => string, formatMessage: (message: DiagnosticMessage, ...args: string[]) => T) { + function reportErrors({ host }: SolutionBuilderState, errors: ReadonlyArray) { + errors.forEach(err => host.reportDiagnostic(err)); + } + + function reportAndStoreErrors(state: SolutionBuilderState, proj: ResolvedConfigFilePath, errors: ReadonlyArray) { + reportErrors(state, errors); + state.projectErrorsReported.set(proj, true); + if (errors.length) { + state.diagnostics.set(proj, errors); + } + } + + function reportParseConfigFileDiagnostic(state: SolutionBuilderState, proj: ResolvedConfigFilePath) { + reportAndStoreErrors(state, proj, [state.configFileCache.get(proj) as Diagnostic]); + } + + function reportErrorSummary(state: SolutionBuilderState) { + if (!state.needsSummary || (!state.watch && !state.host.reportErrorSummary)) return; + state.needsSummary = false; + const { diagnostics } = state; + // Report errors from the other projects + getBuildOrder(state).forEach(project => { + const projectPath = toResolvedConfigFilePath(state, project); + if (!state.projectErrorsReported.has(projectPath)) { + reportErrors(state, diagnostics.get(projectPath) || emptyArray); + } + }); + let totalErrors = 0; + diagnostics.forEach(singleProjectErrors => totalErrors += getErrorCountForSummary(singleProjectErrors)); + if (state.watch) { + reportWatchStatus(state, getWatchErrorSummaryDiagnosticMessage(totalErrors), totalErrors); + } + else { + state.host.reportErrorSummary!(totalErrors); + } + } + + /** + * Report the build ordering inferred from the current project graph if we're in verbose mode + */ + function reportBuildQueue(state: SolutionBuilderState, buildQueue: readonly ResolvedConfigFileName[]) { + if (state.options.verbose) { + reportStatus(state, Diagnostics.Projects_in_this_build_Colon_0, buildQueue.map(s => "\r\n * " + relName(state, s)).join("")); + } + } + + function reportUpToDateStatus(state: SolutionBuilderState, configFileName: string, status: UpToDateStatus) { switch (status.type) { case UpToDateStatusType.OutOfDateWithSelf: - return formatMessage(Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, - relName(configFileName), - relName(status.outOfDateOutputFileName), - relName(status.newerInputFileName)); + return reportStatus( + state, + Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, + relName(state, configFileName), + relName(state, status.outOfDateOutputFileName), + relName(state, status.newerInputFileName) + ); case UpToDateStatusType.OutOfDateWithUpstream: - return formatMessage(Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, - relName(configFileName), - relName(status.outOfDateOutputFileName), - relName(status.newerProjectName)); + return reportStatus( + state, + Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, + relName(state, configFileName), + relName(state, status.outOfDateOutputFileName), + relName(state, status.newerProjectName) + ); case UpToDateStatusType.OutputMissing: - return formatMessage(Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, - relName(configFileName), - relName(status.missingOutputFileName)); + return reportStatus( + state, + Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, + relName(state, configFileName), + relName(state, status.missingOutputFileName) + ); case UpToDateStatusType.UpToDate: if (status.newestInputFileTime !== undefined) { - return formatMessage(Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, - relName(configFileName), - relName(status.newestInputFileName || ""), - relName(status.oldestOutputFileName || "")); + return reportStatus( + state, + Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, + relName(state, configFileName), + relName(state, status.newestInputFileName || ""), + relName(state, status.oldestOutputFileName || "") + ); } // Don't report anything for "up to date because it was already built" -- too verbose break; case UpToDateStatusType.OutOfDateWithPrepend: - return formatMessage(Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed, - relName(configFileName), - relName(status.newerProjectName)); + return reportStatus( + state, + Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed, + relName(state, configFileName), + relName(state, status.newerProjectName) + ); case UpToDateStatusType.UpToDateWithUpstreamTypes: - return formatMessage(Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, - relName(configFileName)); + return reportStatus( + state, + Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, + relName(state, configFileName) + ); case UpToDateStatusType.UpstreamOutOfDate: - return formatMessage(Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date, - relName(configFileName), - relName(status.upstreamProjectName)); + return reportStatus( + state, + Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date, + relName(state, configFileName), + relName(state, status.upstreamProjectName) + ); case UpToDateStatusType.UpstreamBlocked: - return formatMessage(Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, - relName(configFileName), - relName(status.upstreamProjectName)); + return reportStatus( + state, + Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, + relName(state, configFileName), + relName(state, status.upstreamProjectName) + ); case UpToDateStatusType.Unbuildable: - return formatMessage(Diagnostics.Failed_to_parse_file_0_Colon_1, - relName(configFileName), - status.reason); + return reportStatus( + state, + Diagnostics.Failed_to_parse_file_0_Colon_1, + relName(state, configFileName), + status.reason + ); case UpToDateStatusType.TsVersionOutputOfDate: - return formatMessage(Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2, - relName(configFileName), + return reportStatus( + state, + Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2, + relName(state, configFileName), status.version, - version); + version + ); case UpToDateStatusType.ContainerOnly: - // Don't report status on "solution" projects + // Don't report status on "solution" projects case UpToDateStatusType.ComputingUpstream: // Should never leak from getUptoDateStatusWorker break; @@ -1616,4 +1760,13 @@ namespace ts { assertType(status); } } + + /** + * Report the up-to-date status of a project if we're in verbose mode + */ + function verboseReportProjectStatus(state: SolutionBuilderState, configFileName: string, status: UpToDateStatus) { + if (state.options.verbose) { + reportUpToDateStatus(state, configFileName, status); + } + } } diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 7f9f2260d6d..056e894bf53 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -437,7 +437,7 @@ export class cNew {}`); function verifyInvalidation(expectedToWriteTests: boolean) { // Rebuild this project tick(); - builder.invalidateProject("/src/logic"); + builder.invalidateProject("/src/logic/tsconfig.json" as ResolvedConfigFilePath); builder.buildNextInvalidatedProject(); // The file should be updated assert.isTrue(writtenFiles.has("/src/logic/index.js"), "JS file should have been rebuilt"); diff --git a/src/testRunner/unittests/tsbuildWatchMode.ts b/src/testRunner/unittests/tsbuildWatchMode.ts index 70fe602c8a2..f67b575e979 100644 --- a/src/testRunner/unittests/tsbuildWatchMode.ts +++ b/src/testRunner/unittests/tsbuildWatchMode.ts @@ -721,7 +721,7 @@ let x: string = 10;`); host.writeFile(logic[1].path, `${logic[1].content} function foo() { }`); - solutionBuilder.invalidateProject(`${project}/${SubProject.logic}`); + solutionBuilder.invalidateProject(logic[0].path.toLowerCase() as ResolvedConfigFilePath); solutionBuilder.buildNextInvalidatedProject(); // not ideal, but currently because of d.ts but no new file is written @@ -734,7 +734,7 @@ function foo() { host.writeFile(logic[1].path, `${logic[1].content} export function gfoo() { }`); - solutionBuilder.invalidateProject(logic[0].path); + solutionBuilder.invalidateProject(logic[0].path.toLowerCase() as ResolvedConfigFilePath); solutionBuilder.buildNextInvalidatedProject(); }, expectedProgramFiles); }); @@ -745,7 +745,7 @@ export function gfoo() { compilerOptions: { composite: true, declaration: true, declarationDir: "decls" }, references: [{ path: "../core" }] })); - solutionBuilder.invalidateProject(logic[0].path, ConfigFileProgramReloadLevel.Full); + solutionBuilder.invalidateProject(logic[0].path.toLowerCase() as ResolvedConfigFilePath, ConfigFileProgramReloadLevel.Full); solutionBuilder.buildNextInvalidatedProject(); }, [tests[1].path, libFile.path, coreIndexDts, coreAnotherModuleDts, projectFilePath(SubProject.logic, "decls/index.d.ts")]); }); @@ -965,7 +965,7 @@ export function gfoo() { host.writeFile(bTs.path, `${bTs.content} export function gfoo() { }`); - solutionBuilder.invalidateProject(bTsconfig.path); + solutionBuilder.invalidateProject(bTsconfig.path.toLowerCase() as ResolvedConfigFilePath); solutionBuilder.buildNextInvalidatedProject(); }, emptyArray, From 6227fabbed1d1c46fcef46ba6ef5bd4fcc86c1af Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 7 May 2019 13:05:24 -0700 Subject: [PATCH 065/384] Make invalidated project when only need to be built or updated --- src/compiler/tsbuild.ts | 295 ++++++++++++++++++++++++---------------- 1 file changed, 177 insertions(+), 118 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 22bc8ba8238..e015e8bb13f 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -283,14 +283,30 @@ namespace ts { /*@internal*/ buildNextInvalidatedProject(): void; } - interface InvalidatedProject { + const enum InvalidatedProjectKind { + BuildProject, + UpdateBundle, + UpdateOutputFileStamps + } + + interface UpdateOutputFileStampsProject { + readonly kind: InvalidatedProjectKind.UpdateOutputFileStamps; + readonly project: ResolvedConfigFileName; + readonly projectPath: ResolvedConfigFilePath; + readonly config: ParsedCommandLine; + } + + interface BuildOrUpdateBundleProject { + readonly kind: InvalidatedProjectKind.BuildProject | InvalidatedProjectKind.UpdateBundle; readonly project: ResolvedConfigFileName; readonly projectPath: ResolvedConfigFilePath; - readonly reloadLevel: ConfigFileProgramReloadLevel; readonly projectIndex: number; + readonly config: ParsedCommandLine; readonly buildOrder: readonly ResolvedConfigFileName[]; } + type InvalidatedProject = UpdateOutputFileStampsProject | BuildOrUpdateBundleProject; + /** * Create a function that reports watch status by writing to the system and handles the formating of the diagnostic */ @@ -663,15 +679,90 @@ namespace ts { } function getNextInvalidatedProject(state: SolutionBuilderState, buildOrder: readonly ResolvedConfigFileName[]): InvalidatedProject | undefined { - return state.projectPendingBuild.size ? - forEach(buildOrder, (project, projectIndex) => { - const projectPath = toResolvedConfigFilePath(state, project); - const reloadLevel = state.projectPendingBuild.get(projectPath); - if (reloadLevel !== undefined) { - return { project, projectPath, reloadLevel, projectIndex, buildOrder }; + if (!state.projectPendingBuild.size) return undefined; + + const { options, projectPendingBuild } = state; + for (let projectIndex = 0; projectIndex < buildOrder.length; projectIndex++) { + const project = buildOrder[projectIndex]; + const projectPath = toResolvedConfigFilePath(state, project); + const reloadLevel = state.projectPendingBuild.get(projectPath); + if (reloadLevel === undefined) continue; + + const config = parseConfigFile(state, project, projectPath); + if (!config) { + reportParseConfigFileDiagnostic(state, projectPath); + projectPendingBuild.delete(projectPath); + continue; + } + + if (reloadLevel === ConfigFileProgramReloadLevel.Full) { + watchConfigFile(state, project, projectPath); + watchWildCardDirectories(state, project, projectPath, config); + watchInputFiles(state, project, projectPath, config); + } + else if (reloadLevel === ConfigFileProgramReloadLevel.Partial) { + // Update file names + const result = getFileNamesFromConfigSpecs(config.configFileSpecs!, getDirectoryPath(project), config.options, state.parseConfigFileHost); + updateErrorForNoInputFiles(result, project, config.configFileSpecs!, config.errors, canJsonReportNoInutFiles(config.raw)); + config.fileNames = result.fileNames; + watchInputFiles(state, project, projectPath, config); + } + + const status = getUpToDateStatus(state, config, projectPath); + verboseReportProjectStatus(state, project, status); + if (!options.force) { + if (status.type === UpToDateStatusType.UpToDate) { + reportAndStoreErrors(state, projectPath, config.errors); + projectPendingBuild.delete(projectPath); + // Up to date, skip + if (options.dry) { + // In a dry build, inform the user of this fact + reportStatus(state, Diagnostics.Project_0_is_up_to_date, project); + } + continue; } - }) : - undefined; + + if (status.type === UpToDateStatusType.UpToDateWithUpstreamTypes) { + reportAndStoreErrors(state, projectPath, config.errors); + return { + kind: InvalidatedProjectKind.UpdateOutputFileStamps, + project, + projectPath, + config + }; + + continue; + } + } + + if (status.type === UpToDateStatusType.UpstreamBlocked) { + reportAndStoreErrors(state, projectPath, config.errors); + projectPendingBuild.delete(projectPath); + if (options.verbose) reportStatus(state, Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, project, status.upstreamProjectName); + continue; + } + + if (status.type === UpToDateStatusType.ContainerOnly) { + reportAndStoreErrors(state, projectPath, config.errors); + projectPendingBuild.delete(projectPath); + // Do nothing + continue; + } + + + return { + kind: needsBuild(state, status, config) ? + InvalidatedProjectKind.BuildProject : + InvalidatedProjectKind.UpdateBundle, + project, + projectPath, + projectIndex, + config, + buildOrder + }; + } + + return undefined; } function listEmittedFile({ writeFileName }: SolutionBuilderState, proj: ParsedCommandLine, file: string) { @@ -714,7 +805,44 @@ namespace ts { return errorFlags; } - function buildSingleProject(state: SolutionBuilderState, proj: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, cancellationToken: CancellationToken | undefined): BuildResultFlags { + function updateModuleResolutionCache( + state: SolutionBuilderState, + proj: ResolvedConfigFileName, + config: ParsedCommandLine + ) { + if (!state.moduleResolutionCache) return; + + // Update module resolution cache if needed + const { moduleResolutionCache } = state; + const projPath = toPath(state, proj); + if (moduleResolutionCache.directoryToModuleNameMap.redirectsMap.size === 0) { + // The own map will be for projectCompilerOptions + Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size === 0); + moduleResolutionCache.directoryToModuleNameMap.redirectsMap.set(projPath, moduleResolutionCache.directoryToModuleNameMap.ownMap); + moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.set(projPath, moduleResolutionCache.moduleNameToDirectoryMap.ownMap); + } + else { + // Set correct own map + Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size > 0); + + const ref: ResolvedProjectReference = { + sourceFile: config.options.configFile!, + commandLine: config + }; + moduleResolutionCache.directoryToModuleNameMap.setOwnMap(moduleResolutionCache.directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref)); + moduleResolutionCache.moduleNameToDirectoryMap.setOwnMap(moduleResolutionCache.moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref)); + } + moduleResolutionCache.directoryToModuleNameMap.setOwnOptions(config.options); + moduleResolutionCache.moduleNameToDirectoryMap.setOwnOptions(config.options); + } + + function buildSingleProject( + state: SolutionBuilderState, + proj: ResolvedConfigFileName, + resolvedPath: ResolvedConfigFilePath, + config: ParsedCommandLine, + cancellationToken: CancellationToken | undefined + ): BuildResultFlags { if (state.options.dry) { reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, proj); return BuildResultFlags.Success; @@ -722,54 +850,25 @@ namespace ts { if (state.options.verbose) reportStatus(state, Diagnostics.Building_project_0, proj); - const { host, projectStatus, diagnostics, compilerHost, moduleResolutionCache, } = state; - const configFile = parseConfigFile(state, proj, resolvedPath); - if (!configFile) { - // Failed to read the config file - reportParseConfigFileDiagnostic(state, resolvedPath); - projectStatus.set(resolvedPath, { type: UpToDateStatusType.Unbuildable, reason: "Config file errors" }); - return BuildResultFlags.ConfigFileErrors; - } - - if (configFile.fileNames.length === 0) { - reportAndStoreErrors(state, resolvedPath, configFile.errors); + if (config.fileNames.length === 0) { + reportAndStoreErrors(state, resolvedPath, config.errors); // Nothing to build - must be a solution file, basically return BuildResultFlags.None; } - state.projectCompilerOptions = configFile.options; + const { host, projectStatus, diagnostics, compilerHost } = state; + state.projectCompilerOptions = config.options; // Update module resolution cache if needed - if (moduleResolutionCache) { - const projPath = toPath(state, proj); - if (moduleResolutionCache.directoryToModuleNameMap.redirectsMap.size === 0) { - // The own map will be for projectCompilerOptions - Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size === 0); - moduleResolutionCache.directoryToModuleNameMap.redirectsMap.set(projPath, moduleResolutionCache.directoryToModuleNameMap.ownMap); - moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.set(projPath, moduleResolutionCache.moduleNameToDirectoryMap.ownMap); - } - else { - // Set correct own map - Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size > 0); - - const ref: ResolvedProjectReference = { - sourceFile: configFile.options.configFile!, - commandLine: configFile - }; - moduleResolutionCache.directoryToModuleNameMap.setOwnMap(moduleResolutionCache.directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref)); - moduleResolutionCache.moduleNameToDirectoryMap.setOwnMap(moduleResolutionCache.moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref)); - } - moduleResolutionCache.directoryToModuleNameMap.setOwnOptions(configFile.options); - moduleResolutionCache.moduleNameToDirectoryMap.setOwnOptions(configFile.options); - } + updateModuleResolutionCache(state, proj, config); // Create program const program = host.createProgram( - configFile.fileNames, - configFile.options, + config.fileNames, + config.options, compilerHost, - getOldProgram(state, resolvedPath, configFile), - configFile.errors, - configFile.projectReferences + getOldProgram(state, resolvedPath, config), + config.errors, + config.projectReferences ); // Don't emit anything in the presence of syntactic errors or options diagnostics @@ -867,24 +966,30 @@ namespace ts { } if (state.writeFileName) { - emittedOutputs.forEach(name => listEmittedFile(state, configFile, name)); + emittedOutputs.forEach(name => listEmittedFile(state, config, name)); listFiles(program, state.writeFileName); } // Update time stamps for rest of the outputs - newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, configFile, newestDeclarationFileContentChangedTime, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); + newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, newestDeclarationFileContentChangedTime, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); diagnostics.delete(resolvedPath); projectStatus.set(resolvedPath, { type: UpToDateStatusType.UpToDate, newestDeclarationFileContentChangedTime: anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime, - oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(configFile, !host.useCaseSensitiveFileNames()) + oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()) }); afterProgramCreate(state, resolvedPath, program); state.projectCompilerOptions = state.baseCompilerOptions; return resultFlags; } - function updateBundle(state: SolutionBuilderState, proj: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, cancellationToken: CancellationToken | undefined): BuildResultFlags { + function updateBundle( + state: SolutionBuilderState, + proj: ResolvedConfigFileName, + resolvedPath: ResolvedConfigFilePath, + config: ParsedCommandLine, + cancellationToken: CancellationToken | undefined + ): BuildResultFlags { if (state.options.dry) { reportStatus(state, Diagnostics.A_non_dry_build_would_update_output_of_project_0, proj); return BuildResultFlags.Success; @@ -894,7 +999,6 @@ namespace ts { // Update js, and source map const { projectStatus, diagnostics, compilerHost } = state; - const config = Debug.assertDefined(parseConfigFile(state, proj, resolvedPath)); state.projectCompilerOptions = config.options; const outputFiles = emitUsingBuildInfo( config, @@ -905,7 +1009,7 @@ namespace ts { }); if (isString(outputFiles)) { reportStatus(state, Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, proj, relName(state, outputFiles)); - return buildSingleProject(state, proj, resolvedPath, cancellationToken); + return buildSingleProject(state, proj, resolvedPath, config, cancellationToken); } // Actual Emit @@ -1210,68 +1314,24 @@ namespace ts { !isIncrementalCompilation(config.options); } - function buildInvalidatedProject(state: SolutionBuilderState, { project, projectPath, reloadLevel, projectIndex, buildOrder }: InvalidatedProject, cancellationToken?: CancellationToken) { - const { options, projectPendingBuild } = state; - const config = parseConfigFile(state, project, projectPath); - if (!config) { - reportParseConfigFileDiagnostic(state, projectPath); + function buildInvalidatedProject( + state: SolutionBuilderState, + invalidatedProject: InvalidatedProject, + cancellationToken?: CancellationToken + ) { + const { projectPendingBuild } = state; + if (invalidatedProject.kind === InvalidatedProjectKind.UpdateOutputFileStamps) { + // Fake that files have been built by updating output file stamps + const { projectPath, config } = invalidatedProject; + updateOutputTimestamps(state, config, projectPath); projectPendingBuild.delete(projectPath); return; } - if (reloadLevel === ConfigFileProgramReloadLevel.Full) { - watchConfigFile(state, project, projectPath); - watchWildCardDirectories(state, project, projectPath, config); - watchInputFiles(state, project, projectPath, config); - } - else if (reloadLevel === ConfigFileProgramReloadLevel.Partial) { - // Update file names - const result = getFileNamesFromConfigSpecs(config.configFileSpecs!, getDirectoryPath(project), config.options, state.parseConfigFileHost); - updateErrorForNoInputFiles(result, project, config.configFileSpecs!, config.errors, canJsonReportNoInutFiles(config.raw)); - config.fileNames = result.fileNames; - watchInputFiles(state, project, projectPath, config); - } - - const status = getUpToDateStatus(state, config, projectPath); - verboseReportProjectStatus(state, project, status); - if (!options.force) { - if (status.type === UpToDateStatusType.UpToDate) { - reportAndStoreErrors(state, projectPath, config.errors); - projectPendingBuild.delete(projectPath); - // Up to date, skip - if (options.dry) { - // In a dry build, inform the user of this fact - reportStatus(state, Diagnostics.Project_0_is_up_to_date, project); - } - return; - } - - if (status.type === UpToDateStatusType.UpToDateWithUpstreamTypes) { - reportAndStoreErrors(state, projectPath, config.errors); - projectPendingBuild.delete(projectPath); - // Fake that files have been built by updating output file stamps - updateOutputTimestamps(state, config, projectPath); - return; - } - } - - if (status.type === UpToDateStatusType.UpstreamBlocked) { - reportAndStoreErrors(state, projectPath, config.errors); - projectPendingBuild.delete(projectPath); - if (options.verbose) reportStatus(state, Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, project, status.upstreamProjectName); - return; - } - - if (status.type === UpToDateStatusType.ContainerOnly) { - reportAndStoreErrors(state, projectPath, config.errors); - projectPendingBuild.delete(projectPath); - // Do nothing - return; - } - - const buildResult = needsBuild(state, status, config) ? - buildSingleProject(state, project, projectPath, cancellationToken) : // Actual build - updateBundle(state, project, projectPath, cancellationToken); // Fake that files have been built by manipulating prepend and existing output + const { kind, project, projectPath, projectIndex, config, buildOrder } = invalidatedProject; + const buildResult = kind === InvalidatedProjectKind.BuildProject ? + buildSingleProject(state, project, projectPath, config, cancellationToken) : // Actual build + updateBundle(state, project, projectPath, config, cancellationToken); // Fake that files have been built by manipulating prepend and existing output projectPendingBuild.delete(projectPath); // Only composite projects can be referenced by other projects if (!(buildResult & BuildResultFlags.AnyErrors) && config.options.composite) { @@ -1467,12 +1527,11 @@ namespace ts { if (state.watch && !state.timerToBuildInvalidatedProject) { scheduleBuildInvalidatedProject(state); } - } - else { - disableCache(state); - reportErrorSummary(state); + return; } } + disableCache(state); + reportErrorSummary(state); } function watchConfigFile(state: SolutionBuilderState, resolved: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath) { From 5270b7e9b0da74d258bf96045a51878623acc5f7 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 7 May 2019 14:14:30 -0700 Subject: [PATCH 066/384] Make invalidated projects as api so we can expose it later --- src/compiler/tsbuild.ts | 210 +++++++++++++++++++++++++--------------- 1 file changed, 132 insertions(+), 78 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index e015e8bb13f..b99567e54a7 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -283,30 +283,6 @@ namespace ts { /*@internal*/ buildNextInvalidatedProject(): void; } - const enum InvalidatedProjectKind { - BuildProject, - UpdateBundle, - UpdateOutputFileStamps - } - - interface UpdateOutputFileStampsProject { - readonly kind: InvalidatedProjectKind.UpdateOutputFileStamps; - readonly project: ResolvedConfigFileName; - readonly projectPath: ResolvedConfigFilePath; - readonly config: ParsedCommandLine; - } - - interface BuildOrUpdateBundleProject { - readonly kind: InvalidatedProjectKind.BuildProject | InvalidatedProjectKind.UpdateBundle; - readonly project: ResolvedConfigFileName; - readonly projectPath: ResolvedConfigFilePath; - readonly projectIndex: number; - readonly config: ParsedCommandLine; - readonly buildOrder: readonly ResolvedConfigFileName[]; - } - - type InvalidatedProject = UpdateOutputFileStampsProject | BuildOrUpdateBundleProject; - /** * Create a function that reports watch status by writing to the system and handles the formating of the diagnostic */ @@ -678,6 +654,121 @@ namespace ts { } } + const enum InvalidatedProjectKind { + Build, + UpdateBundle, + UpdateOutputFileStamps + } + + interface InvalidatedProjectBase { + readonly kind: InvalidatedProjectKind; + readonly project: ResolvedConfigFileName; + readonly projectPath: ResolvedConfigFilePath; + /** + * To dispose this project and ensure that all the necessary actions are taken and state is updated accordingly + */ + done(cancellationToken?: CancellationToken): void; + } + + interface UpdateOutputFileStampsProject extends InvalidatedProjectBase { + readonly kind: InvalidatedProjectKind.UpdateOutputFileStamps; + updateOutputFileStatmps(): void; + } + + interface BuildInvalidedProject extends InvalidatedProjectBase { + readonly kind: InvalidatedProjectKind.Build; + build(cancellationToken?: CancellationToken): BuildResultFlags; + } + + interface UpdateBundleProject extends InvalidatedProjectBase { + readonly kind: InvalidatedProjectKind.UpdateBundle; + updateBundle(cancellationToken?: CancellationToken): BuildResultFlags; + } + + type InvalidatedProject = UpdateOutputFileStampsProject | BuildInvalidedProject | UpdateBundleProject; + + function createUpdateOutputFileStampsProject(state: SolutionBuilderState, project: ResolvedConfigFileName, projectPath: ResolvedConfigFilePath, config: ParsedCommandLine): UpdateOutputFileStampsProject { + let updateOutputFileStampsPending = true; + return { + kind: InvalidatedProjectKind.UpdateOutputFileStamps, + project, + projectPath, + updateOutputFileStatmps: () => { + updateOutputTimestamps(state, config, projectPath); + updateOutputFileStampsPending = false; + }, + done: () => { + if (updateOutputFileStampsPending) { + updateOutputTimestamps(state, config, projectPath); + } + state.projectPendingBuild.delete(projectPath); + } + }; + } + + function createBuildInvalidedProject( + state: SolutionBuilderState, + project: ResolvedConfigFileName, + projectPath: ResolvedConfigFilePath, + projectIndex: number, + config: ParsedCommandLine, + buildOrder: readonly ResolvedConfigFileName[] + ): BuildInvalidedProject { + let buildPending = true; + return { + kind: InvalidatedProjectKind.Build, + project, + projectPath, + build, + done: cancellationToken => { + if (buildPending) build(cancellationToken); + state.projectPendingBuild.delete(projectPath); + } + }; + + function build(cancellationToken?: CancellationToken) { + const buildResult = buildSingleProject(state, project, projectPath, config, cancellationToken); + queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, buildResult); + buildPending = false; + return buildResult; + } + } + + function createUpdateBundleProject( + state: SolutionBuilderState, + project: ResolvedConfigFileName, + projectPath: ResolvedConfigFilePath, + projectIndex: number, + config: ParsedCommandLine, + buildOrder: readonly ResolvedConfigFileName[] + ): UpdateBundleProject { + let updatePending = true; + return { + kind: InvalidatedProjectKind.UpdateBundle, + project, + projectPath, + updateBundle: update, + done: cancellationToken => { + if (updatePending) update(cancellationToken); + state.projectPendingBuild.delete(projectPath); + } + }; + + function update(cancellationToken?: CancellationToken) { + const buildResult = updateBundle(state, project, projectPath, config, cancellationToken); + queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, buildResult); + updatePending = false; + return buildResult; + } + } + + function needsBuild({ options }: SolutionBuilderState, status: UpToDateStatus, config: ParsedCommandLine) { + if (status.type !== UpToDateStatusType.OutOfDateWithPrepend || options.force) return true; + return config.fileNames.length === 0 || + !!config.errors.length || + !isIncrementalCompilation(config.options); + } + function getNextInvalidatedProject(state: SolutionBuilderState, buildOrder: readonly ResolvedConfigFileName[]): InvalidatedProject | undefined { if (!state.projectPendingBuild.size) return undefined; @@ -724,14 +815,12 @@ namespace ts { if (status.type === UpToDateStatusType.UpToDateWithUpstreamTypes) { reportAndStoreErrors(state, projectPath, config.errors); - return { - kind: InvalidatedProjectKind.UpdateOutputFileStamps, + return createUpdateOutputFileStampsProject( + state, project, projectPath, config - }; - - continue; + ); } } @@ -749,17 +838,9 @@ namespace ts { continue; } - - return { - kind: needsBuild(state, status, config) ? - InvalidatedProjectKind.BuildProject : - InvalidatedProjectKind.UpdateBundle, - project, - projectPath, - projectIndex, - config, - buildOrder - }; + return needsBuild(state, status, config) ? + createBuildInvalidedProject(state, project, projectPath, projectIndex, config, buildOrder) : + createUpdateBundleProject(state, project, projectPath, projectIndex, config, buildOrder); } return undefined; @@ -1307,46 +1388,19 @@ namespace ts { }); } - function needsBuild({ options }: SolutionBuilderState, status: UpToDateStatus, config: ParsedCommandLine) { - if (status.type !== UpToDateStatusType.OutOfDateWithPrepend || options.force) return true; - return config.fileNames.length === 0 || - !!config.errors.length || - !isIncrementalCompilation(config.options); - } - - function buildInvalidatedProject( - state: SolutionBuilderState, - invalidatedProject: InvalidatedProject, - cancellationToken?: CancellationToken - ) { - const { projectPendingBuild } = state; - if (invalidatedProject.kind === InvalidatedProjectKind.UpdateOutputFileStamps) { - // Fake that files have been built by updating output file stamps - const { projectPath, config } = invalidatedProject; - updateOutputTimestamps(state, config, projectPath); - projectPendingBuild.delete(projectPath); - return; - } - - const { kind, project, projectPath, projectIndex, config, buildOrder } = invalidatedProject; - const buildResult = kind === InvalidatedProjectKind.BuildProject ? - buildSingleProject(state, project, projectPath, config, cancellationToken) : // Actual build - updateBundle(state, project, projectPath, config, cancellationToken); // Fake that files have been built by manipulating prepend and existing output - projectPendingBuild.delete(projectPath); - // Only composite projects can be referenced by other projects - if (!(buildResult & BuildResultFlags.AnyErrors) && config.options.composite) { - queueReferencingProjects(state, project, projectPath, projectIndex, buildOrder, !(buildResult & BuildResultFlags.DeclarationOutputUnchanged)); - } - } - function queueReferencingProjects( state: SolutionBuilderState, project: ResolvedConfigFileName, projectPath: ResolvedConfigFilePath, projectIndex: number, + config: ParsedCommandLine, buildOrder: readonly ResolvedConfigFileName[], - declarationOutputChanged: boolean + buildResult: BuildResultFlags ) { + // Queue only if there are no errors + if (buildResult & BuildResultFlags.AnyErrors) return; + // Only composite projects can be referenced by other projects + if (!config.options.composite) return; // Always use build order to queue projects for (let index = projectIndex + 1; index < buildOrder.length; index++) { const nextProject = buildOrder[index]; @@ -1365,7 +1419,7 @@ namespace ts { if (status) { switch (status.type) { case UpToDateStatusType.UpToDate: - if (!declarationOutputChanged) { + if (buildResult & BuildResultFlags.DeclarationOutputUnchanged) { if (ref.prepend) { state.projectStatus.set(nextProjectPath, { type: UpToDateStatusType.OutOfDateWithPrepend, @@ -1382,7 +1436,7 @@ namespace ts { // falls through case UpToDateStatusType.UpToDateWithUpstreamTypes: case UpToDateStatusType.OutOfDateWithPrepend: - if (declarationOutputChanged) { + if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) { state.projectStatus.set(nextProjectPath, { type: UpToDateStatusType.OutOfDateWithUpstream, outOfDateOutputFileName: status.type === UpToDateStatusType.OutOfDateWithPrepend ? status.outOfDateOutputFileName : status.oldestOutputFileName, @@ -1409,7 +1463,7 @@ namespace ts { const invalidatedProject = getNextInvalidatedProject(state, getBuildOrder(state)); if (!invalidatedProject) return undefined; - buildInvalidatedProject(state, invalidatedProject, cancellationToken); + invalidatedProject.done(cancellationToken); return { project: invalidatedProject.project, result: state.diagnostics.has(invalidatedProject.projectPath) ? @@ -1429,7 +1483,7 @@ namespace ts { while (true) { const invalidatedProject = getNextInvalidatedProject(state, buildOrder); if (!invalidatedProject) break; - buildInvalidatedProject(state, invalidatedProject, cancellationToken); + invalidatedProject.done(cancellationToken); if (state.diagnostics.has(invalidatedProject.projectPath)) { errorProjects++; } @@ -1521,7 +1575,7 @@ namespace ts { } const invalidatedProject = getNextInvalidatedProject(state, getBuildOrder(state)); if (invalidatedProject) { - buildInvalidatedProject(state, invalidatedProject); + invalidatedProject.done(); if (state.projectPendingBuild.size) { // Schedule next project for build if (state.watch && !state.timerToBuildInvalidatedProject) { From e4fe4acc17d3f7dbae6e911c49b1604e114c1660 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 7 May 2019 14:22:34 -0700 Subject: [PATCH 067/384] Make update bundle return invalidated project if it cant update the bundle --- src/compiler/tsbuild.ts | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index b99567e54a7..05e6d0d2790 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -682,7 +682,7 @@ namespace ts { interface UpdateBundleProject extends InvalidatedProjectBase { readonly kind: InvalidatedProjectKind.UpdateBundle; - updateBundle(cancellationToken?: CancellationToken): BuildResultFlags; + updateBundle(): BuildResultFlags | BuildInvalidedProject; } type InvalidatedProject = UpdateOutputFileStampsProject | BuildInvalidedProject | UpdateBundleProject; @@ -749,13 +749,21 @@ namespace ts { projectPath, updateBundle: update, done: cancellationToken => { - if (updatePending) update(cancellationToken); + if (updatePending) { + const result = update(); + if ((result as BuildInvalidedProject).project) { + return (result as BuildInvalidedProject).done(cancellationToken); + } + } state.projectPendingBuild.delete(projectPath); } }; - function update(cancellationToken?: CancellationToken) { - const buildResult = updateBundle(state, project, projectPath, config, cancellationToken); + function update() { + const buildResult = updateBundle(state, project, projectPath, config); + if (isString(buildResult)) { + return createBuildInvalidedProject(state, project, projectPath, projectIndex, config, buildOrder); + } queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, buildResult); updatePending = false; return buildResult; @@ -1068,9 +1076,8 @@ namespace ts { state: SolutionBuilderState, proj: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath, - config: ParsedCommandLine, - cancellationToken: CancellationToken | undefined - ): BuildResultFlags { + config: ParsedCommandLine + ): BuildResultFlags | string { if (state.options.dry) { reportStatus(state, Diagnostics.A_non_dry_build_would_update_output_of_project_0, proj); return BuildResultFlags.Success; @@ -1090,7 +1097,7 @@ namespace ts { }); if (isString(outputFiles)) { reportStatus(state, Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, proj, relName(state, outputFiles)); - return buildSingleProject(state, proj, resolvedPath, config, cancellationToken); + return outputFiles; } // Actual Emit From 9f9ae000cb395543650306c53b9995aed94efcb8 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 7 May 2019 15:53:01 -0700 Subject: [PATCH 068/384] Enable getSemanticDiagnosticsOfNextAffectedFile for EmitAndSemanticDiagnosticsBuilder --- src/compiler/builder.ts | 22 ++++---- src/harness/fakes.ts | 52 ++++++++++--------- .../unittests/tscWatch/incremental.ts | 16 +++++- .../reference/api/tsserverlibrary.d.ts | 2 +- tests/baselines/reference/api/typescript.d.ts | 2 +- 5 files changed, 54 insertions(+), 40 deletions(-) diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 78058bf5a53..7190407dd86 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -796,6 +796,7 @@ namespace ts { (result as SemanticDiagnosticsBuilderProgram).getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile; } else if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) { + (result as EmitAndSemanticDiagnosticsBuilderProgram).getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile; (result as EmitAndSemanticDiagnosticsBuilderProgram).emitNextAffectedFile = emitNextAffectedFile; } else { @@ -913,6 +914,11 @@ namespace ts { ); } + // Add file to affected file pending emit to handle for later emit time + if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) { + addToAffectedFilesPendingEmit(state, [(affected as SourceFile).path]); + } + // Get diagnostics for the affected file if its not ignored if (ignoreSourceFile && ignoreSourceFile(affected as SourceFile)) { // Get next affected file @@ -951,18 +957,8 @@ namespace ts { // When semantic builder asks for diagnostics of the whole program, // ensure that all the affected files are handled - let affected: SourceFile | Program | undefined; - let affectedFilesPendingEmit: Path[] | undefined; - while (affected = getNextAffectedFile(state, cancellationToken, computeHash)) { - if (affected !== state.program && kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) { - (affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push((affected as SourceFile).path); - } - doneWithAffectedFile(state, affected); - } - - // In case of emit builder, cache the files to be emitted - if (affectedFilesPendingEmit) { - addToAffectedFilesPendingEmit(state, affectedFilesPendingEmit); + // tslint:disable-next-line no-empty + while (getSemanticDiagnosticsOfNextAffectedFile(cancellationToken)) { } let diagnostics: Diagnostic[] | undefined; @@ -1181,7 +1177,7 @@ namespace ts { * The builder that can handle the changes in program and iterate through changed file to emit the files * The semantic diagnostics are cached per file and managed by clearing for the changed/affected files */ - export interface EmitAndSemanticDiagnosticsBuilderProgram extends BuilderProgram { + export interface EmitAndSemanticDiagnosticsBuilderProgram extends SemanticDiagnosticsBuilderProgram { /** * Emits the next affected file's emit result (EmitResult and sourceFiles emitted) or returns undefined if iteration is complete * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host diff --git a/src/harness/fakes.ts b/src/harness/fakes.ts index 489a41dd677..c3a3bb621ce 100644 --- a/src/harness/fakes.ts +++ b/src/harness/fakes.ts @@ -388,6 +388,33 @@ namespace fakes { return ts.compareStringsCaseSensitive(ts.isString(a) ? a : a[0], ts.isString(b) ? b : b[0]); } + export function sanitizeBuildInfoProgram(buildInfo: ts.BuildInfo) { + if (buildInfo.program) { + // reference Map + if (buildInfo.program.referencedMap) { + const referencedMap: ts.MapLike = {}; + for (const path of ts.getOwnKeys(buildInfo.program.referencedMap).sort()) { + referencedMap[path] = buildInfo.program.referencedMap[path].sort(); + } + buildInfo.program.referencedMap = referencedMap; + } + + // exportedModulesMap + if (buildInfo.program.exportedModulesMap) { + const exportedModulesMap: ts.MapLike = {}; + for (const path of ts.getOwnKeys(buildInfo.program.exportedModulesMap).sort()) { + exportedModulesMap[path] = buildInfo.program.exportedModulesMap[path].sort(); + } + buildInfo.program.exportedModulesMap = exportedModulesMap; + } + + // semanticDiagnosticsPerFile + if (buildInfo.program.semanticDiagnosticsPerFile) { + buildInfo.program.semanticDiagnosticsPerFile.sort(compareProgramBuildInfoDiagnostic); + } + } + } + export const version = "FakeTSVersion"; export class SolutionBuilderHost extends CompilerHost implements ts.SolutionBuilderHost { @@ -405,30 +432,7 @@ namespace fakes { public writeFile(fileName: string, content: string, writeByteOrderMark: boolean) { if (!ts.isBuildInfoFile(fileName)) return super.writeFile(fileName, content, writeByteOrderMark); const buildInfo = ts.getBuildInfo(content); - if (buildInfo.program) { - // reference Map - if (buildInfo.program.referencedMap) { - const referencedMap: ts.MapLike = {}; - for (const path of ts.getOwnKeys(buildInfo.program.referencedMap).sort()) { - referencedMap[path] = buildInfo.program.referencedMap[path].sort(); - } - buildInfo.program.referencedMap = referencedMap; - } - - // exportedModulesMap - if (buildInfo.program.exportedModulesMap) { - const exportedModulesMap: ts.MapLike = {}; - for (const path of ts.getOwnKeys(buildInfo.program.exportedModulesMap).sort()) { - exportedModulesMap[path] = buildInfo.program.exportedModulesMap[path].sort(); - } - buildInfo.program.exportedModulesMap = exportedModulesMap; - } - - // semanticDiagnosticsPerFile - if (buildInfo.program.semanticDiagnosticsPerFile) { - buildInfo.program.semanticDiagnosticsPerFile.sort(compareProgramBuildInfoDiagnostic); - } - } + sanitizeBuildInfoProgram(buildInfo); buildInfo.version = version; super.writeFile(fileName, ts.getBuildInfoText(buildInfo), writeByteOrderMark); } diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts index 35ec5bff555..54109dec846 100644 --- a/src/testRunner/unittests/tscWatch/incremental.ts +++ b/src/testRunner/unittests/tscWatch/incremental.ts @@ -105,9 +105,23 @@ namespace ts.tscWatch { result.close(); } + function sanitizeBuildInfo(content: string) { + const buildInfo = getBuildInfo(content); + fakes.sanitizeBuildInfoProgram(buildInfo); + return getBuildInfoText(buildInfo); + } + function checkFileEmit(actual: Map, expected: ReadonlyArray) { assert.equal(actual.size, expected.length, `Actual: ${JSON.stringify(arrayFrom(actual.entries()), /*replacer*/ undefined, " ")}\nExpected: ${JSON.stringify(expected, /*replacer*/ undefined, " ")}`); - expected.forEach(file => assert.equal(actual.get(file.path), file.content, `Emit for ${file.path}`)); + expected.forEach(file => { + let expectedContent = file.content; + let actualContent = actual.get(file.path); + if (isBuildInfoFile(file.path)) { + actualContent = actualContent && sanitizeBuildInfo(actualContent); + expectedContent = sanitizeBuildInfo(expectedContent); + } + assert.equal(actualContent, expectedContent, `Emit for ${file.path}`); + }); } const libFileInfo: BuilderState.FileInfo = { diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index f13d0ab3f51..df479429c17 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4417,7 +4417,7 @@ declare namespace ts { * The builder that can handle the changes in program and iterate through changed file to emit the files * The semantic diagnostics are cached per file and managed by clearing for the changed/affected files */ - interface EmitAndSemanticDiagnosticsBuilderProgram extends BuilderProgram { + interface EmitAndSemanticDiagnosticsBuilderProgram extends SemanticDiagnosticsBuilderProgram { /** * Emits the next affected file's emit result (EmitResult and sourceFiles emitted) or returns undefined if iteration is complete * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index e5e5046794a..4062969e8cd 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4417,7 +4417,7 @@ declare namespace ts { * The builder that can handle the changes in program and iterate through changed file to emit the files * The semantic diagnostics are cached per file and managed by clearing for the changed/affected files */ - interface EmitAndSemanticDiagnosticsBuilderProgram extends BuilderProgram { + interface EmitAndSemanticDiagnosticsBuilderProgram extends SemanticDiagnosticsBuilderProgram { /** * Emits the next affected file's emit result (EmitResult and sourceFiles emitted) or returns undefined if iteration is complete * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host From 4af3a3b54113b50db727b2a392e31f3a2b8d812e Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 8 May 2019 14:11:51 -0700 Subject: [PATCH 069/384] Lower priority for inferences made from partial reverse mapped types --- src/compiler/checker.ts | 13 +++++++------ src/compiler/types.ts | 17 +++++++++-------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 61607e9c904..e8299a89c4e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14898,11 +14898,8 @@ namespace ts { function createReverseMappedType(source: Type, target: MappedType, constraint: IndexType) { // We consider a source type reverse mappable if it has a string index signature or if - // it has one or more properties and all properties have inferable types. - const properties = getPropertiesOfType(source); - const isReverseMappable = getIndexInfoOfType(source, IndexKind.String) || - properties.length !== 0 && every(properties, prop => isPartiallyInferableType(getTypeOfSymbol(prop))); - if (!isReverseMappable) { + // it has one or more properties and is of a partially inferable type. + if (!(getIndexInfoOfType(source, IndexKind.String) || getPropertiesOfType(source).length !== 0 && isPartiallyInferableType(source))) { return undefined; } // For arrays and tuples we infer new arrays and tuples where the reverse mapping has been @@ -15287,7 +15284,11 @@ namespace ts { const inferredType = inferTypeForHomomorphicMappedType(source, target, constraintType); if (inferredType) { const savePriority = priority; - priority |= InferencePriority.HomomorphicMappedType; + // We assign a lower priority to inferences made from types containing non-inferrable + // types because we may only have a partial result (i.e. we may have failed to make + // reverse inferences for some properties). + priority |= getObjectFlags(source) & ObjectFlags.NonInferrableType ? + InferencePriority.PartialHomomorphicMappedType : InferencePriority.HomomorphicMappedType; inferFromTypes(inferredType, inference.typeParameter); priority = savePriority; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5e2d6aba474..6c6e585d492 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4405,15 +4405,16 @@ namespace ts { export type TypeMapper = (t: TypeParameter) => Type; export const enum InferencePriority { - NakedTypeVariable = 1 << 0, // Naked type variable in union or intersection type - HomomorphicMappedType = 1 << 1, // Reverse inference for homomorphic mapped type - MappedTypeConstraint = 1 << 2, // Reverse inference for mapped type - ReturnType = 1 << 3, // Inference made from return type of generic function - LiteralKeyof = 1 << 4, // Inference made from a string literal to a keyof T - NoConstraints = 1 << 5, // Don't infer from constraints of instantiable types - AlwaysStrict = 1 << 6, // Always use strict rules for contravariant inferences + NakedTypeVariable = 1 << 0, // Naked type variable in union or intersection type + HomomorphicMappedType = 1 << 1, // Reverse inference for homomorphic mapped type + PartialHomomorphicMappedType = 1 << 2, // Partial reverse inference for homomorphic mapped type + MappedTypeConstraint = 1 << 3, // Reverse inference for mapped type + ReturnType = 1 << 4, // Inference made from return type of generic function + LiteralKeyof = 1 << 5, // Inference made from a string literal to a keyof T + NoConstraints = 1 << 6, // Don't infer from constraints of instantiable types + AlwaysStrict = 1 << 7, // Always use strict rules for contravariant inferences - PriorityImpliesCombination = ReturnType | MappedTypeConstraint | LiteralKeyof, // These priorities imply that the resulting type should be a combination of all candidates + PriorityImpliesCombination = ReturnType | MappedTypeConstraint | LiteralKeyof, // These priorities imply that the resulting type should be a combination of all candidates } /* @internal */ From c104aa162ebcc976ad7983edbe90e32f5f6d9828 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 8 May 2019 14:22:34 -0700 Subject: [PATCH 070/384] Accept new baselines --- tests/baselines/reference/api/tsserverlibrary.d.ts | 13 +++++++------ tests/baselines/reference/api/typescript.d.ts | 13 +++++++------ .../reference/mappedTypeInferenceErrors.errors.txt | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index fb95102e791..98a8f05d418 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2413,12 +2413,13 @@ declare namespace ts { enum InferencePriority { NakedTypeVariable = 1, HomomorphicMappedType = 2, - MappedTypeConstraint = 4, - ReturnType = 8, - LiteralKeyof = 16, - NoConstraints = 32, - AlwaysStrict = 64, - PriorityImpliesCombination = 28 + PartialHomomorphicMappedType = 4, + MappedTypeConstraint = 8, + ReturnType = 16, + LiteralKeyof = 32, + NoConstraints = 64, + AlwaysStrict = 128, + PriorityImpliesCombination = 56 } /** @deprecated Use FileExtensionInfo instead. */ type JsFileExtensionInfo = FileExtensionInfo; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 170cb00b9e8..592c99936f9 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2413,12 +2413,13 @@ declare namespace ts { enum InferencePriority { NakedTypeVariable = 1, HomomorphicMappedType = 2, - MappedTypeConstraint = 4, - ReturnType = 8, - LiteralKeyof = 16, - NoConstraints = 32, - AlwaysStrict = 64, - PriorityImpliesCombination = 28 + PartialHomomorphicMappedType = 4, + MappedTypeConstraint = 8, + ReturnType = 16, + LiteralKeyof = 32, + NoConstraints = 64, + AlwaysStrict = 128, + PriorityImpliesCombination = 56 } /** @deprecated Use FileExtensionInfo instead. */ type JsFileExtensionInfo = FileExtensionInfo; diff --git a/tests/baselines/reference/mappedTypeInferenceErrors.errors.txt b/tests/baselines/reference/mappedTypeInferenceErrors.errors.txt index f83f01f77bf..0c5e835db96 100644 --- a/tests/baselines/reference/mappedTypeInferenceErrors.errors.txt +++ b/tests/baselines/reference/mappedTypeInferenceErrors.errors.txt @@ -20,7 +20,7 @@ tests/cases/conformance/types/mapped/mappedTypeInferenceErrors.ts(16,9): error T baz: 42 ~~~ !!! error TS2322: Type 'number' is not assignable to type '() => unknown'. -!!! related TS6500 tests/cases/conformance/types/mapped/mappedTypeInferenceErrors.ts:16:9: The expected type comes from property 'baz' which is declared here on type 'ComputedOf<{ bar: number; baz: unknown; }>' +!!! related TS6500 tests/cases/conformance/types/mapped/mappedTypeInferenceErrors.ts:16:9: The expected type comes from property 'baz' which is declared here on type 'ComputedOf<{ bar: unknown; baz: unknown; }>' } }); \ No newline at end of file From f0b7e08d2ca2d6380bea31f36d32f28d3b905a84 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 9 May 2019 13:13:50 -0700 Subject: [PATCH 071/384] Move towards BuildInvalidatedProject api where one can query program and perform its operations --- src/compiler/tsbuild.ts | 490 ++++++++++++++++++++++++++-------------- src/compiler/watch.ts | 40 +++- src/tsc/tsc.ts | 2 +- 3 files changed, 359 insertions(+), 173 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 05e6d0d2790..5498c710983 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -675,17 +675,44 @@ namespace ts { updateOutputFileStatmps(): void; } - interface BuildInvalidedProject extends InvalidatedProjectBase { + interface BuildInvalidedProject extends InvalidatedProjectBase { readonly kind: InvalidatedProjectKind.Build; - build(cancellationToken?: CancellationToken): BuildResultFlags; + /* + * Emitting with this builder program without the api provided for this project + * can result in build system going into invalid state as files written reflect the state of the project + */ + getBuilderProgram(): T | undefined; + getProgram(): Program | undefined; + getCompilerOptions(): CompilerOptions; + getSourceFile(fileName: string): SourceFile | undefined; + getSourceFiles(): ReadonlyArray; + getOptionsDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; + getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; + getConfigFileParsingDiagnostics(): ReadonlyArray; + getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + getAllDependencies(sourceFile: SourceFile): ReadonlyArray; + getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + getSemanticDiagnosticsOfNextAffectedFile(cancellationToken?: CancellationToken, ignoreSourceFile?: (sourceFile: SourceFile) => boolean): AffectedFileResult>; + /* + * Calling emit directly with targetSourceFile and emitOnlyDtsFiles set to true is not advised since + * emit in build system is responsible in updating status of the project + * If called with targetSourceFile and emitOnlyDtsFiles set to true, the emit just passes to underlying builder and + * wont reflect the status of file as being emitted in the builder + * (if that emit of that source file is required it would be emitted again when making sure invalidated project is completed) + * This emit is not considered actual emit (and hence uptodate status is not reflected if + */ + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult | undefined; + // TODO(shkamat):: investigate later if we can emit even when there are declaration diagnostics + // emitNextAffectedFile(writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, customTransformers?: CustomTransformers): AffectedFileResult; + getCurrentDirectory(): string; } - interface UpdateBundleProject extends InvalidatedProjectBase { + interface UpdateBundleProject extends InvalidatedProjectBase { readonly kind: InvalidatedProjectKind.UpdateBundle; - updateBundle(): BuildResultFlags | BuildInvalidedProject; + updateBundle(): BuildResultFlags | BuildInvalidedProject; } - type InvalidatedProject = UpdateOutputFileStampsProject | BuildInvalidedProject | UpdateBundleProject; + type InvalidatedProject = UpdateOutputFileStampsProject | BuildInvalidedProject | UpdateBundleProject; function createUpdateOutputFileStampsProject(state: SolutionBuilderState, project: ResolvedConfigFileName, projectPath: ResolvedConfigFilePath, config: ParsedCommandLine): UpdateOutputFileStampsProject { let updateOutputFileStampsPending = true; @@ -706,42 +733,318 @@ namespace ts { }; } - function createBuildInvalidedProject( - state: SolutionBuilderState, + function createBuildInvalidedProject( + state: SolutionBuilderState, project: ResolvedConfigFileName, projectPath: ResolvedConfigFilePath, projectIndex: number, config: ParsedCommandLine, buildOrder: readonly ResolvedConfigFileName[] - ): BuildInvalidedProject { - let buildPending = true; + ): BuildInvalidedProject { + enum Step { + CreateProgram, + SyntaxDiagnostics, + SemanticDiagnostics, + Emit, + QueueReferencingProjects, + Done + } + + let step = Step.CreateProgram; + let program: T | undefined; + let buildResult: BuildResultFlags | undefined; + return { kind: InvalidatedProjectKind.Build, project, projectPath, - build, + getBuilderProgram: () => withProgramOrUndefined(identity), + getProgram: () => + withProgramOrUndefined( + program => program.getProgramOrUndefined() + ), + getCompilerOptions: () => config.options, + getSourceFile: fileName => + withProgramOrUndefined( + program => program.getSourceFile(fileName) + ), + getSourceFiles: () => + withProgramOrEmptyArray( + program => program.getSourceFiles() + ), + getOptionsDiagnostics: cancellationToken => + withProgramOrEmptyArray( + program => program.getOptionsDiagnostics(cancellationToken) + ), + getGlobalDiagnostics: cancellationToken => + withProgramOrEmptyArray( + program => program.getGlobalDiagnostics(cancellationToken) + ), + getConfigFileParsingDiagnostics: () => + withProgramOrEmptyArray( + program => program.getConfigFileParsingDiagnostics() + ), + getSyntacticDiagnostics: (sourceFile, cancellationToken) => + withProgramOrEmptyArray( + program => program.getSyntacticDiagnostics(sourceFile, cancellationToken) + ), + getAllDependencies: sourceFile => + withProgramOrEmptyArray( + program => program.getAllDependencies(sourceFile) + ), + getSemanticDiagnostics: (sourceFile, cancellationToken) => + withProgramOrEmptyArray( + program => program.getSemanticDiagnostics(sourceFile, cancellationToken) + ), + getSemanticDiagnosticsOfNextAffectedFile: (cancellationToken, ignoreSourceFile) => + withProgramOrUndefined( + program => + ((program as any as SemanticDiagnosticsBuilderProgram).getSemanticDiagnosticsOfNextAffectedFile) && + (program as any as SemanticDiagnosticsBuilderProgram).getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) + ), + emit: (targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) => { + if (targetSourceFile || emitOnlyDtsFiles) { + return withProgramOrUndefined( + program => program.emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) + ); + } + executeSteps(Step.SemanticDiagnostics, cancellationToken); + if (step !== Step.Emit) return undefined; + return emit(writeFile, cancellationToken, customTransformers); + }, + getCurrentDirectory: () => state.currentDirectory, done: cancellationToken => { - if (buildPending) build(cancellationToken); + executeSteps(Step.Done, cancellationToken); state.projectPendingBuild.delete(projectPath); } }; - function build(cancellationToken?: CancellationToken) { - const buildResult = buildSingleProject(state, project, projectPath, config, cancellationToken); - queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, buildResult); - buildPending = false; - return buildResult; + function withProgramOrUndefined(action: (program: T) => U | undefined): U | undefined { + executeSteps(Step.CreateProgram); + return program && action(program); + } + + function withProgramOrEmptyArray(action: (program: T) => ReadonlyArray): ReadonlyArray { + return withProgramOrUndefined(action) || emptyArray; + } + + function createProgram() { + Debug.assert(program === undefined); + + if (state.options.dry) { + reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project); + buildResult = BuildResultFlags.Success; + step = Step.QueueReferencingProjects; + return; + } + + if (state.options.verbose) reportStatus(state, Diagnostics.Building_project_0, project); + + if (config.fileNames.length === 0) { + reportAndStoreErrors(state, projectPath, config.errors); + // Nothing to build - must be a solution file, basically + buildResult = BuildResultFlags.None; + step = Step.QueueReferencingProjects; + return; + } + + const { host, compilerHost } = state; + state.projectCompilerOptions = config.options; + // Update module resolution cache if needed + updateModuleResolutionCache(state, project, config); + + // Create program + program = host.createProgram( + config.fileNames, + config.options, + compilerHost, + getOldProgram(state, projectPath, config), + config.errors, + config.projectReferences + ); + step++; + } + + function handleDiagnostics(diagnostics: ReadonlyArray, errorFlags: BuildResultFlags, errorType: string) { + if (diagnostics.length) { + buildResult = buildErrors( + state, + projectPath, + program, + diagnostics, + errorFlags, + errorType + ); + step = Step.QueueReferencingProjects; + } + else { + step++; + } + } + + function getSyntaxDiagnostics(cancellationToken?: CancellationToken) { + Debug.assertDefined(program); + handleDiagnostics( + [ + ...program!.getConfigFileParsingDiagnostics(), + ...program!.getOptionsDiagnostics(cancellationToken), + ...program!.getGlobalDiagnostics(cancellationToken), + ...program!.getSyntacticDiagnostics(/*sourceFile*/ undefined, cancellationToken) + ], + BuildResultFlags.SyntaxErrors, + "Syntactic" + ); + } + + function getSemanticDiagnostics(cancellationToken?: CancellationToken) { + handleDiagnostics( + Debug.assertDefined(program).getSemanticDiagnostics(/*sourceFile*/ undefined, cancellationToken), + BuildResultFlags.TypeErrors, + "Semantic" + ); + } + + function emit(writeFileCallback?: WriteFileCallback, cancellationToken?: CancellationToken, customTransformers?: CustomTransformers): EmitResult { + Debug.assertDefined(program); + Debug.assert(step === Step.Emit); + // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly + program!.backupState(); + let declDiagnostics: Diagnostic[] | undefined; + const reportDeclarationDiagnostics = (d: Diagnostic) => (declDiagnostics || (declDiagnostics = [])).push(d); + const outputFiles: OutputFile[] = []; + const { emitResult } = emitFilesAndReportErrors( + program!, + reportDeclarationDiagnostics, + /*writeFileName*/ undefined, + /*reportSummary*/ undefined, + (name, text, writeByteOrderMark) => outputFiles.push({ name, text, writeByteOrderMark }), + cancellationToken, + /*emitOnlyDts*/ false, + customTransformers + ); + // Don't emit .d.ts if there are decl file errors + if (declDiagnostics) { + program!.restoreState(); + buildResult = buildErrors( + state, + projectPath, + program, + declDiagnostics, + BuildResultFlags.DeclarationEmitErrors, + "Declaration file" + ); + step = Step.QueueReferencingProjects; + return { + emitSkipped: true, + diagnostics: emitResult.diagnostics + }; + } + + // Actual Emit + const { host, compilerHost, diagnostics, projectStatus } = state; + let resultFlags = BuildResultFlags.DeclarationOutputUnchanged; + let newestDeclarationFileContentChangedTime = minimumDate; + let anyDtsChanged = false; + const emitterDiagnostics = createDiagnosticCollection(); + const emittedOutputs = createMap() as FileMap; + outputFiles.forEach(({ name, text, writeByteOrderMark }) => { + let priorChangeTime: Date | undefined; + if (!anyDtsChanged && isDeclarationFile(name)) { + // Check for unchanged .d.ts files + if (host.fileExists(name) && state.readFileWithCache(name) === text) { + priorChangeTime = host.getModifiedTime(name); + } + else { + resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; + anyDtsChanged = true; + } + } + + emittedOutputs.set(toPath(state, name), name); + writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); + if (priorChangeTime !== undefined) { + newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime); + } + }); + + const emitDiagnostics = emitterDiagnostics.getDiagnostics(); + if (emitDiagnostics.length) { + buildResult = buildErrors( + state, + projectPath, + program, + emitDiagnostics, + BuildResultFlags.EmitErrors, + "Emit" + ); + step = Step.QueueReferencingProjects; + return emitResult; + } + + if (state.writeFileName) { + emittedOutputs.forEach(name => listEmittedFile(state, config, name)); + listFiles(program!, state.writeFileName); + } + + // Update time stamps for rest of the outputs + newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, newestDeclarationFileContentChangedTime, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); + diagnostics.delete(projectPath); + projectStatus.set(projectPath, { + type: UpToDateStatusType.UpToDate, + newestDeclarationFileContentChangedTime: anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime, + oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()) + }); + afterProgramCreate(state, projectPath, program!); + state.projectCompilerOptions = state.baseCompilerOptions; + step++; + buildResult = resultFlags; + return emitResult; + } + + function executeSteps(till: Step, cancellationToken?: CancellationToken) { + while (step <= till && step < Step.Done) { + const currentStep = step; + switch (step) { + case Step.CreateProgram: + createProgram(); + break; + + case Step.SyntaxDiagnostics: + getSyntaxDiagnostics(cancellationToken); + break; + + case Step.SemanticDiagnostics: + getSemanticDiagnostics(cancellationToken); + break; + + case Step.Emit: + emit(/*writeFileCallback*/ undefined, cancellationToken); + break; + + case Step.QueueReferencingProjects: + queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.assertDefined(buildResult)); + step++; + break; + + // Should never be done + case Step.Done: + default: + assertType(step); + + } + Debug.assert(step > currentStep); + } } } - function createUpdateBundleProject( - state: SolutionBuilderState, + function createUpdateBundleProject( + state: SolutionBuilderState, project: ResolvedConfigFileName, projectPath: ResolvedConfigFilePath, projectIndex: number, config: ParsedCommandLine, buildOrder: readonly ResolvedConfigFileName[] - ): UpdateBundleProject { + ): UpdateBundleProject { let updatePending = true; return { kind: InvalidatedProjectKind.UpdateBundle, @@ -777,7 +1080,7 @@ namespace ts { !isIncrementalCompilation(config.options); } - function getNextInvalidatedProject(state: SolutionBuilderState, buildOrder: readonly ResolvedConfigFileName[]): InvalidatedProject | undefined { + function getNextInvalidatedProject(state: SolutionBuilderState, buildOrder: readonly ResolvedConfigFileName[]): InvalidatedProject | undefined { if (!state.projectPendingBuild.size) return undefined; const { options, projectPendingBuild } = state; @@ -925,153 +1228,6 @@ namespace ts { moduleResolutionCache.moduleNameToDirectoryMap.setOwnOptions(config.options); } - function buildSingleProject( - state: SolutionBuilderState, - proj: ResolvedConfigFileName, - resolvedPath: ResolvedConfigFilePath, - config: ParsedCommandLine, - cancellationToken: CancellationToken | undefined - ): BuildResultFlags { - if (state.options.dry) { - reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, proj); - return BuildResultFlags.Success; - } - - if (state.options.verbose) reportStatus(state, Diagnostics.Building_project_0, proj); - - if (config.fileNames.length === 0) { - reportAndStoreErrors(state, resolvedPath, config.errors); - // Nothing to build - must be a solution file, basically - return BuildResultFlags.None; - } - - const { host, projectStatus, diagnostics, compilerHost } = state; - state.projectCompilerOptions = config.options; - // Update module resolution cache if needed - updateModuleResolutionCache(state, proj, config); - - // Create program - const program = host.createProgram( - config.fileNames, - config.options, - compilerHost, - getOldProgram(state, resolvedPath, config), - config.errors, - config.projectReferences - ); - - // Don't emit anything in the presence of syntactic errors or options diagnostics - const syntaxDiagnostics = [ - ...program.getConfigFileParsingDiagnostics(), - ...program.getOptionsDiagnostics(cancellationToken), - ...program.getGlobalDiagnostics(cancellationToken), - ...program.getSyntacticDiagnostics(/*sourceFile*/ undefined, cancellationToken)]; - if (syntaxDiagnostics.length) { - return buildErrors( - state, - resolvedPath, - program, - syntaxDiagnostics, - BuildResultFlags.SyntaxErrors, - "Syntactic" - ); - } - - // Same as above but now for semantic diagnostics - const semanticDiagnostics = program.getSemanticDiagnostics(/*sourceFile*/ undefined, cancellationToken); - if (semanticDiagnostics.length) { - return buildErrors( - state, - resolvedPath, - program, - semanticDiagnostics, - BuildResultFlags.TypeErrors, - "Semantic" - ); - } - - // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly - program.backupState(); - let declDiagnostics: Diagnostic[] | undefined; - const reportDeclarationDiagnostics = (d: Diagnostic) => (declDiagnostics || (declDiagnostics = [])).push(d); - const outputFiles: OutputFile[] = []; - emitFilesAndReportErrors( - program, - reportDeclarationDiagnostics, - /*writeFileName*/ undefined, - /*reportSummary*/ undefined, - (name, text, writeByteOrderMark) => outputFiles.push({ name, text, writeByteOrderMark }), - cancellationToken - ); - // Don't emit .d.ts if there are decl file errors - if (declDiagnostics) { - program.restoreState(); - return buildErrors( - state, - resolvedPath, - program, - declDiagnostics, - BuildResultFlags.DeclarationEmitErrors, - "Declaration file" - ); - } - - // Actual Emit - let resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - let newestDeclarationFileContentChangedTime = minimumDate; - let anyDtsChanged = false; - const emitterDiagnostics = createDiagnosticCollection(); - const emittedOutputs = createMap() as FileMap; - outputFiles.forEach(({ name, text, writeByteOrderMark }) => { - let priorChangeTime: Date | undefined; - if (!anyDtsChanged && isDeclarationFile(name)) { - // Check for unchanged .d.ts files - if (host.fileExists(name) && state.readFileWithCache(name) === text) { - priorChangeTime = host.getModifiedTime(name); - } - else { - resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; - anyDtsChanged = true; - } - } - - emittedOutputs.set(toPath(state, name), name); - writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); - if (priorChangeTime !== undefined) { - newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime); - } - }); - - const emitDiagnostics = emitterDiagnostics.getDiagnostics(); - if (emitDiagnostics.length) { - return buildErrors( - state, - resolvedPath, - program, - emitDiagnostics, - BuildResultFlags.EmitErrors, - "Emit" - ); - } - - if (state.writeFileName) { - emittedOutputs.forEach(name => listEmittedFile(state, config, name)); - listFiles(program, state.writeFileName); - } - - // Update time stamps for rest of the outputs - newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, newestDeclarationFileContentChangedTime, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); - diagnostics.delete(resolvedPath); - projectStatus.set(resolvedPath, { - type: UpToDateStatusType.UpToDate, - newestDeclarationFileContentChangedTime: anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime, - oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()) - }); - afterProgramCreate(state, resolvedPath, program); - state.projectCompilerOptions = state.baseCompilerOptions; - return resultFlags; - } - function updateBundle( state: SolutionBuilderState, proj: ResolvedConfigFileName, diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 4f974add57d..9378478664f 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -116,7 +116,7 @@ namespace ts { getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; getConfigFileParsingDiagnostics(): ReadonlyArray; - emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult; + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult; } export function listFiles(program: ProgramToEmitFilesAndReportErrors, writeFileName: (s: string) => void) { @@ -136,7 +136,9 @@ namespace ts { writeFileName?: (s: string) => void, reportSummary?: ReportEmitErrorSummary, writeFile?: WriteFileCallback, - cancellationToken?: CancellationToken + cancellationToken?: CancellationToken, + emitOnlyDtsFiles?: boolean, + customTransformers?: CustomTransformers ) { // First get and report any syntactic errors. const diagnostics = program.getConfigFileParsingDiagnostics().slice(); @@ -155,7 +157,8 @@ namespace ts { } // Emit and report any errors we ran into. - const { emittedFiles, emitSkipped, diagnostics: emitDiagnostics } = program.emit(/*targetSourceFile*/ undefined, writeFile, cancellationToken); + const emitResult = program.emit(/*targetSourceFile*/ undefined, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers); + const { emittedFiles, diagnostics: emitDiagnostics } = emitResult; addRange(diagnostics, emitDiagnostics); sortAndDeduplicateDiagnostics(diagnostics).forEach(reportDiagnostic); @@ -172,7 +175,34 @@ namespace ts { reportSummary(getErrorCountForSummary(diagnostics)); } - if (emitSkipped && diagnostics.length > 0) { + return { + emitResult, + diagnostics, + }; + } + + export function emitFilesAndReportErrorsAndGetExitStatus( + program: ProgramToEmitFilesAndReportErrors, + reportDiagnostic: DiagnosticReporter, + writeFileName?: (s: string) => void, + reportSummary?: ReportEmitErrorSummary, + writeFile?: WriteFileCallback, + cancellationToken?: CancellationToken, + emitOnlyDtsFiles?: boolean, + customTransformers?: CustomTransformers + ) { + const { emitResult, diagnostics } = emitFilesAndReportErrors( + program, + reportDiagnostic, + writeFileName, + reportSummary, + writeFile, + cancellationToken, + emitOnlyDtsFiles, + customTransformers + ); + + if (emitResult.emitSkipped && diagnostics.length > 0) { // If the emitter didn't emit anything, then pass that value along. return ExitStatus.DiagnosticsPresent_OutputsSkipped; } @@ -395,7 +425,7 @@ namespace ts { const system = input.system || sys; const host = input.host || (input.host = createIncrementalCompilerHost(input.options, system)); const builderProgram = createIncrementalProgram(input); - const exitStatus = emitFilesAndReportErrors( + const exitStatus = emitFilesAndReportErrorsAndGetExitStatus( builderProgram, input.reportDiagnostic || createDiagnosticReporter(system), s => host.trace && host.trace(s), diff --git a/src/tsc/tsc.ts b/src/tsc/tsc.ts index 47814a1f68b..6a340109238 100644 --- a/src/tsc/tsc.ts +++ b/src/tsc/tsc.ts @@ -246,7 +246,7 @@ namespace ts { configFileParsingDiagnostics }; const program = createProgram(programOptions); - const exitStatus = emitFilesAndReportErrors( + const exitStatus = emitFilesAndReportErrorsAndGetExitStatus( program, reportDiagnostic, s => sys.write(s + sys.newLine), From 8c489bfdf8bd141089c45d888c4ad4b02da53b4b Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 9 May 2019 15:30:16 -0700 Subject: [PATCH 072/384] UpdateBundleProject to contain emit method --- src/compiler/emitter.ts | 9 +- src/compiler/tsbuild.ts | 378 +++++++++++++++++++++------------------- 2 files changed, 203 insertions(+), 184 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 8f91e3d25c1..2b1e1309609 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -638,7 +638,12 @@ namespace ts { } /*@internal*/ - export function emitUsingBuildInfo(config: ParsedCommandLine, host: EmitUsingBuildInfoHost, getCommandLine: (ref: ProjectReference) => ParsedCommandLine | undefined): EmitUsingBuildInfoResult { + export function emitUsingBuildInfo( + config: ParsedCommandLine, + host: EmitUsingBuildInfoHost, + getCommandLine: (ref: ProjectReference) => ParsedCommandLine | undefined, + customTransformers?: CustomTransformers + ): EmitUsingBuildInfoResult { const { buildInfoPath, jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath } = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false); const buildInfoText = host.readFile(Debug.assertDefined(buildInfoPath)); if (!buildInfoText) return buildInfoPath!; @@ -723,7 +728,7 @@ namespace ts { useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(), getProgramBuildInfo: returnUndefined }; - emitFiles(notImplementedResolver, emitHost, /*targetSourceFile*/ undefined, /*emitOnlyDtsFiles*/ false, getTransformers(config.options)); + emitFiles(notImplementedResolver, emitHost, /*targetSourceFile*/ undefined, /*emitOnlyDtsFiles*/ false, getTransformers(config.options, customTransformers)); return outputFiles; } diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 5498c710983..d66874f3a41 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -709,7 +709,7 @@ namespace ts { interface UpdateBundleProject extends InvalidatedProjectBase { readonly kind: InvalidatedProjectKind.UpdateBundle; - updateBundle(): BuildResultFlags | BuildInvalidedProject; + emit(writeFile?: WriteFileCallback, customTransformers?: CustomTransformers): EmitResult | BuildInvalidedProject | undefined; } type InvalidatedProject = UpdateOutputFileStampsProject | BuildInvalidedProject | UpdateBundleProject; @@ -733,91 +733,109 @@ namespace ts { }; } - function createBuildInvalidedProject( + function createBuildOrUpdateInvalidedProject( + kind: InvalidatedProjectKind.Build | InvalidatedProjectKind.UpdateBundle, state: SolutionBuilderState, project: ResolvedConfigFileName, projectPath: ResolvedConfigFilePath, projectIndex: number, config: ParsedCommandLine, - buildOrder: readonly ResolvedConfigFileName[] - ): BuildInvalidedProject { + buildOrder: readonly ResolvedConfigFileName[], + ): BuildInvalidedProject | UpdateBundleProject { enum Step { CreateProgram, SyntaxDiagnostics, SemanticDiagnostics, Emit, + EmitBundle, + BuildInvalidatedProjectOfBundle, QueueReferencingProjects, Done } - let step = Step.CreateProgram; + let step = kind === InvalidatedProjectKind.Build ? Step.CreateProgram : Step.EmitBundle; let program: T | undefined; let buildResult: BuildResultFlags | undefined; + let invalidatedProjectOfBundle: BuildInvalidedProject | undefined; - return { - kind: InvalidatedProjectKind.Build, - project, - projectPath, - getBuilderProgram: () => withProgramOrUndefined(identity), - getProgram: () => - withProgramOrUndefined( - program => program.getProgramOrUndefined() - ), - getCompilerOptions: () => config.options, - getSourceFile: fileName => - withProgramOrUndefined( - program => program.getSourceFile(fileName) - ), - getSourceFiles: () => - withProgramOrEmptyArray( - program => program.getSourceFiles() - ), - getOptionsDiagnostics: cancellationToken => - withProgramOrEmptyArray( - program => program.getOptionsDiagnostics(cancellationToken) - ), - getGlobalDiagnostics: cancellationToken => - withProgramOrEmptyArray( - program => program.getGlobalDiagnostics(cancellationToken) - ), - getConfigFileParsingDiagnostics: () => - withProgramOrEmptyArray( - program => program.getConfigFileParsingDiagnostics() - ), - getSyntacticDiagnostics: (sourceFile, cancellationToken) => - withProgramOrEmptyArray( - program => program.getSyntacticDiagnostics(sourceFile, cancellationToken) - ), - getAllDependencies: sourceFile => - withProgramOrEmptyArray( - program => program.getAllDependencies(sourceFile) - ), - getSemanticDiagnostics: (sourceFile, cancellationToken) => - withProgramOrEmptyArray( - program => program.getSemanticDiagnostics(sourceFile, cancellationToken) - ), - getSemanticDiagnosticsOfNextAffectedFile: (cancellationToken, ignoreSourceFile) => - withProgramOrUndefined( - program => - ((program as any as SemanticDiagnosticsBuilderProgram).getSemanticDiagnosticsOfNextAffectedFile) && - (program as any as SemanticDiagnosticsBuilderProgram).getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) - ), - emit: (targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) => { - if (targetSourceFile || emitOnlyDtsFiles) { - return withProgramOrUndefined( - program => program.emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) - ); + return kind === InvalidatedProjectKind.Build ? + { + kind, + project, + projectPath, + getBuilderProgram: () => withProgramOrUndefined(identity), + getProgram: () => + withProgramOrUndefined( + program => program.getProgramOrUndefined() + ), + getCompilerOptions: () => config.options, + getSourceFile: fileName => + withProgramOrUndefined( + program => program.getSourceFile(fileName) + ), + getSourceFiles: () => + withProgramOrEmptyArray( + program => program.getSourceFiles() + ), + getOptionsDiagnostics: cancellationToken => + withProgramOrEmptyArray( + program => program.getOptionsDiagnostics(cancellationToken) + ), + getGlobalDiagnostics: cancellationToken => + withProgramOrEmptyArray( + program => program.getGlobalDiagnostics(cancellationToken) + ), + getConfigFileParsingDiagnostics: () => + withProgramOrEmptyArray( + program => program.getConfigFileParsingDiagnostics() + ), + getSyntacticDiagnostics: (sourceFile, cancellationToken) => + withProgramOrEmptyArray( + program => program.getSyntacticDiagnostics(sourceFile, cancellationToken) + ), + getAllDependencies: sourceFile => + withProgramOrEmptyArray( + program => program.getAllDependencies(sourceFile) + ), + getSemanticDiagnostics: (sourceFile, cancellationToken) => + withProgramOrEmptyArray( + program => program.getSemanticDiagnostics(sourceFile, cancellationToken) + ), + getSemanticDiagnosticsOfNextAffectedFile: (cancellationToken, ignoreSourceFile) => + withProgramOrUndefined( + program => + ((program as any as SemanticDiagnosticsBuilderProgram).getSemanticDiagnosticsOfNextAffectedFile) && + (program as any as SemanticDiagnosticsBuilderProgram).getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) + ), + emit: (targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) => { + if (targetSourceFile || emitOnlyDtsFiles) { + return withProgramOrUndefined( + program => program.emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) + ); + } + executeSteps(Step.SemanticDiagnostics, cancellationToken); + if (step !== Step.Emit) return undefined; + return emit(writeFile, cancellationToken, customTransformers); + }, + getCurrentDirectory: () => state.currentDirectory, + done: cancellationToken => { + executeSteps(Step.Done, cancellationToken); + state.projectPendingBuild.delete(projectPath); } - executeSteps(Step.SemanticDiagnostics, cancellationToken); - if (step !== Step.Emit) return undefined; - return emit(writeFile, cancellationToken, customTransformers); - }, - getCurrentDirectory: () => state.currentDirectory, - done: cancellationToken => { - executeSteps(Step.Done, cancellationToken); - state.projectPendingBuild.delete(projectPath); - } - }; + } : + { + kind, + project, + projectPath, + emit: (writeFile: WriteFileCallback | undefined, customTransformers: CustomTransformers | undefined) => { + if (step !== Step.EmitBundle) return invalidatedProjectOfBundle; + return emitBundle(writeFile, customTransformers); + }, + done: cancellationToken => { + executeSteps(Step.Done, cancellationToken); + state.projectPendingBuild.delete(projectPath); + } + }; function withProgramOrUndefined(action: (program: T) => U | undefined): U | undefined { executeSteps(Step.CreateProgram); @@ -941,7 +959,7 @@ namespace ts { } // Actual Emit - const { host, compilerHost, diagnostics, projectStatus } = state; + const { host, compilerHost } = state; let resultFlags = BuildResultFlags.DeclarationOutputUnchanged; let newestDeclarationFileContentChangedTime = minimumDate; let anyDtsChanged = false; @@ -967,6 +985,25 @@ namespace ts { } }); + finishEmit( + emitterDiagnostics, + emittedOutputs, + newestDeclarationFileContentChangedTime, + /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, + outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), + resultFlags + ); + return emitResult; + } + + function finishEmit( + emitterDiagnostics: DiagnosticCollection, + emittedOutputs: FileMap, + priorNewestUpdateTime: Date, + newestDeclarationFileContentChangedTimeIsMaximumDate: boolean, + oldestOutputFileName: string, + resultFlags: BuildResultFlags + ) { const emitDiagnostics = emitterDiagnostics.getDiagnostics(); if (emitDiagnostics.length) { buildResult = buildErrors( @@ -978,27 +1015,87 @@ namespace ts { "Emit" ); step = Step.QueueReferencingProjects; - return emitResult; + return emitDiagnostics; } if (state.writeFileName) { emittedOutputs.forEach(name => listEmittedFile(state, config, name)); - listFiles(program!, state.writeFileName); + if (program) listFiles(program, state.writeFileName); } // Update time stamps for rest of the outputs - newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, newestDeclarationFileContentChangedTime, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); - diagnostics.delete(projectPath); - projectStatus.set(projectPath, { + const newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); + state.diagnostics.delete(projectPath); + state.projectStatus.set(projectPath, { type: UpToDateStatusType.UpToDate, - newestDeclarationFileContentChangedTime: anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime, - oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()) + newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ? + maximumDate : + newestDeclarationFileContentChangedTime, + oldestOutputFileName }); - afterProgramCreate(state, projectPath, program!); + if (program) afterProgramCreate(state, projectPath, program); state.projectCompilerOptions = state.baseCompilerOptions; - step++; + step = Step.QueueReferencingProjects; buildResult = resultFlags; - return emitResult; + return emitDiagnostics; + } + + function emitBundle(writeFileCallback?: WriteFileCallback, customTransformers?: CustomTransformers): EmitResult | BuildInvalidedProject | undefined { + Debug.assert(kind === InvalidatedProjectKind.UpdateBundle); + if (state.options.dry) { + reportStatus(state, Diagnostics.A_non_dry_build_would_update_output_of_project_0, project); + buildResult = BuildResultFlags.Success; + step = Step.QueueReferencingProjects; + return undefined; + } + + if (state.options.verbose) reportStatus(state, Diagnostics.Updating_output_of_project_0, project); + + // Update js, and source map + const { compilerHost } = state; + state.projectCompilerOptions = config.options; + const outputFiles = emitUsingBuildInfo( + config, + compilerHost, + ref => { + const refName = resolveProjectName(state, ref.path); + return parseConfigFile(state, refName, toResolvedConfigFilePath(state, refName)); + }, + customTransformers + ); + + if (isString(outputFiles)) { + reportStatus(state, Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, project, relName(state, outputFiles)); + step = Step.BuildInvalidatedProjectOfBundle; + return invalidatedProjectOfBundle = createBuildOrUpdateInvalidedProject( + InvalidatedProjectKind.Build, + state, + project, + projectPath, + projectIndex, + config, + buildOrder + ) as BuildInvalidedProject; + } + + // Actual Emit + Debug.assert(!!outputFiles.length); + const emitterDiagnostics = createDiagnosticCollection(); + const emittedOutputs = createMap() as FileMap; + outputFiles.forEach(({ name, text, writeByteOrderMark }) => { + emittedOutputs.set(toPath(state, name), name); + writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); + }); + + const emitDiagnostics = finishEmit( + emitterDiagnostics, + emittedOutputs, + minimumDate, + /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, + outputFiles[0].name, + BuildResultFlags.DeclarationOutputUnchanged + ); + return { emitSkipped: false, diagnostics: emitDiagnostics }; } function executeSteps(till: Step, cancellationToken?: CancellationToken) { @@ -1021,6 +1118,15 @@ namespace ts { emit(/*writeFileCallback*/ undefined, cancellationToken); break; + case Step.EmitBundle: + emitBundle(); + break; + + case Step.BuildInvalidatedProjectOfBundle: + Debug.assertDefined(invalidatedProjectOfBundle).done(cancellationToken); + step = Step.Done; + break; + case Step.QueueReferencingProjects: queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.assertDefined(buildResult)); step++; @@ -1037,42 +1143,6 @@ namespace ts { } } - function createUpdateBundleProject( - state: SolutionBuilderState, - project: ResolvedConfigFileName, - projectPath: ResolvedConfigFilePath, - projectIndex: number, - config: ParsedCommandLine, - buildOrder: readonly ResolvedConfigFileName[] - ): UpdateBundleProject { - let updatePending = true; - return { - kind: InvalidatedProjectKind.UpdateBundle, - project, - projectPath, - updateBundle: update, - done: cancellationToken => { - if (updatePending) { - const result = update(); - if ((result as BuildInvalidedProject).project) { - return (result as BuildInvalidedProject).done(cancellationToken); - } - } - state.projectPendingBuild.delete(projectPath); - } - }; - - function update() { - const buildResult = updateBundle(state, project, projectPath, config); - if (isString(buildResult)) { - return createBuildInvalidedProject(state, project, projectPath, projectIndex, config, buildOrder); - } - queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, buildResult); - updatePending = false; - return buildResult; - } - } - function needsBuild({ options }: SolutionBuilderState, status: UpToDateStatus, config: ParsedCommandLine) { if (status.type !== UpToDateStatusType.OutOfDateWithPrepend || options.force) return true; return config.fileNames.length === 0 || @@ -1149,9 +1219,17 @@ namespace ts { continue; } - return needsBuild(state, status, config) ? - createBuildInvalidedProject(state, project, projectPath, projectIndex, config, buildOrder) : - createUpdateBundleProject(state, project, projectPath, projectIndex, config, buildOrder); + return createBuildOrUpdateInvalidedProject( + needsBuild(state, status, config) ? + InvalidatedProjectKind.Build : + InvalidatedProjectKind.UpdateBundle, + state, + project, + projectPath, + projectIndex, + config, + buildOrder, + ); } return undefined; @@ -1228,70 +1306,6 @@ namespace ts { moduleResolutionCache.moduleNameToDirectoryMap.setOwnOptions(config.options); } - function updateBundle( - state: SolutionBuilderState, - proj: ResolvedConfigFileName, - resolvedPath: ResolvedConfigFilePath, - config: ParsedCommandLine - ): BuildResultFlags | string { - if (state.options.dry) { - reportStatus(state, Diagnostics.A_non_dry_build_would_update_output_of_project_0, proj); - return BuildResultFlags.Success; - } - - if (state.options.verbose) reportStatus(state, Diagnostics.Updating_output_of_project_0, proj); - - // Update js, and source map - const { projectStatus, diagnostics, compilerHost } = state; - state.projectCompilerOptions = config.options; - const outputFiles = emitUsingBuildInfo( - config, - compilerHost, - ref => { - const refName = resolveProjectName(state, ref.path); - return parseConfigFile(state, refName, toResolvedConfigFilePath(state, refName)); - }); - if (isString(outputFiles)) { - reportStatus(state, Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, proj, relName(state, outputFiles)); - return outputFiles; - } - - // Actual Emit - Debug.assert(!!outputFiles.length); - const emitterDiagnostics = createDiagnosticCollection(); - const emittedOutputs = createMap() as FileMap; - outputFiles.forEach(({ name, text, writeByteOrderMark }) => { - emittedOutputs.set(toPath(state, name), name); - writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); - }); - const emitDiagnostics = emitterDiagnostics.getDiagnostics(); - if (emitDiagnostics.length) { - return buildErrors( - state, - resolvedPath, - /*program*/ undefined, - emitDiagnostics, - BuildResultFlags.EmitErrors, - "Emit" - ); - } - - if (state.writeFileName) { - emittedOutputs.forEach(name => listEmittedFile(state, config, name)); - } - - // Update timestamps for dts - const newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, minimumDate, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); - diagnostics.delete(resolvedPath); - projectStatus.set(resolvedPath, { - type: UpToDateStatusType.UpToDate, - newestDeclarationFileContentChangedTime, - oldestOutputFileName: outputFiles[0].name - }); - state.projectCompilerOptions = state.baseCompilerOptions; - return BuildResultFlags.DeclarationOutputUnchanged; - } - function checkConfigFileUpToDateStatus(state: SolutionBuilderState, configFile: string, oldestOutputFileTime: Date, oldestOutputFileName: string): Status.OutOfDateWithSelf | undefined { // Check tsconfig time const tsconfigTime = state.host.getModifiedTime(configFile) || missingFileModifiedTime; From 97fcea14d51f4187d9373dad235fb3aeee5bf08f Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 9 May 2019 13:30:53 -0700 Subject: [PATCH 073/384] Api to get next invalidated project --- src/compiler/tsbuild.ts | 117 ++++++++++-------- src/testRunner/unittests/tsbuild/sample.ts | 12 +- src/testRunner/unittests/tsbuildWatchMode.ts | 4 +- .../reference/api/tsserverlibrary.d.ts | 51 ++++++-- tests/baselines/reference/api/typescript.d.ts | 51 ++++++-- 5 files changed, 164 insertions(+), 71 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index d66874f3a41..f30800c100d 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -264,15 +264,10 @@ namespace ts { export interface SolutionBuilderWithWatchHost extends SolutionBuilderHostBase, WatchHost { } - export interface SolutionBuilderResult { - project: ResolvedConfigFileName; - result: T; - } - - export interface SolutionBuilder { + export interface SolutionBuilder { build(project?: string, cancellationToken?: CancellationToken): ExitStatus; clean(project?: string): ExitStatus; - buildNextProject(cancellationToken?: CancellationToken): SolutionBuilderResult | undefined; + getNextInvalidatedProject(cancellationToken?: CancellationToken): InvalidatedProject | undefined; // Currently used for testing but can be made public if needed: /*@internal*/ getBuildOrder(): ReadonlyArray; @@ -325,11 +320,11 @@ namespace ts { return result; } - export function createSolutionBuilder(host: SolutionBuilderHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder { + export function createSolutionBuilder(host: SolutionBuilderHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder { return createSolutionBuilderWorker(/*watch*/ false, host, rootNames, defaultOptions); } - export function createSolutionBuilderWithWatch(host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder { + export function createSolutionBuilderWithWatch(host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder { return createSolutionBuilderWorker(/*watch*/ true, host, rootNames, defaultOptions); } @@ -380,6 +375,7 @@ namespace ts { allProjectBuildPending: boolean; needsSummary: boolean; watchAllProjectsPending: boolean; + currentInvalidatedProject: InvalidatedProject | undefined; // Watch state readonly watch: boolean; @@ -452,6 +448,7 @@ namespace ts { allProjectBuildPending: true, needsSummary: true, watchAllProjectsPending: watch, + currentInvalidatedProject: undefined, // Watch state watch, @@ -654,28 +651,31 @@ namespace ts { } } - const enum InvalidatedProjectKind { + export enum InvalidatedProjectKind { Build, UpdateBundle, UpdateOutputFileStamps } - interface InvalidatedProjectBase { + export interface InvalidatedProjectBase { readonly kind: InvalidatedProjectKind; readonly project: ResolvedConfigFileName; - readonly projectPath: ResolvedConfigFilePath; + /*@internal*/ readonly projectPath: ResolvedConfigFilePath; + /*@internal*/ readonly buildOrder: readonly ResolvedConfigFileName[]; /** * To dispose this project and ensure that all the necessary actions are taken and state is updated accordingly */ - done(cancellationToken?: CancellationToken): void; + done(cancellationToken?: CancellationToken): ExitStatus; + getCompilerOptions(): CompilerOptions; + getCurrentDirectory(): string; } - interface UpdateOutputFileStampsProject extends InvalidatedProjectBase { + export interface UpdateOutputFileStampsProject extends InvalidatedProjectBase { readonly kind: InvalidatedProjectKind.UpdateOutputFileStamps; updateOutputFileStatmps(): void; } - interface BuildInvalidedProject extends InvalidatedProjectBase { + export interface BuildInvalidedProject extends InvalidatedProjectBase { readonly kind: InvalidatedProjectKind.Build; /* * Emitting with this builder program without the api provided for this project @@ -683,7 +683,6 @@ namespace ts { */ getBuilderProgram(): T | undefined; getProgram(): Program | undefined; - getCompilerOptions(): CompilerOptions; getSourceFile(fileName: string): SourceFile | undefined; getSourceFiles(): ReadonlyArray; getOptionsDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; @@ -704,22 +703,41 @@ namespace ts { emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult | undefined; // TODO(shkamat):: investigate later if we can emit even when there are declaration diagnostics // emitNextAffectedFile(writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, customTransformers?: CustomTransformers): AffectedFileResult; - getCurrentDirectory(): string; } - interface UpdateBundleProject extends InvalidatedProjectBase { + export interface UpdateBundleProject extends InvalidatedProjectBase { readonly kind: InvalidatedProjectKind.UpdateBundle; emit(writeFile?: WriteFileCallback, customTransformers?: CustomTransformers): EmitResult | BuildInvalidedProject | undefined; } - type InvalidatedProject = UpdateOutputFileStampsProject | BuildInvalidedProject | UpdateBundleProject; + export type InvalidatedProject = UpdateOutputFileStampsProject | BuildInvalidedProject | UpdateBundleProject; - function createUpdateOutputFileStampsProject(state: SolutionBuilderState, project: ResolvedConfigFileName, projectPath: ResolvedConfigFilePath, config: ParsedCommandLine): UpdateOutputFileStampsProject { + function doneInvalidatedProject( + state: SolutionBuilderState, + projectPath: ResolvedConfigFilePath + ) { + state.projectPendingBuild.delete(projectPath); + state.currentInvalidatedProject = undefined; + return state.diagnostics.has(projectPath) ? + ExitStatus.DiagnosticsPresent_OutputsSkipped : + ExitStatus.Success; + } + + function createUpdateOutputFileStampsProject( + state: SolutionBuilderState, + project: ResolvedConfigFileName, + projectPath: ResolvedConfigFilePath, + config: ParsedCommandLine, + buildOrder: readonly ResolvedConfigFileName[] + ): UpdateOutputFileStampsProject { let updateOutputFileStampsPending = true; return { kind: InvalidatedProjectKind.UpdateOutputFileStamps, project, projectPath, + buildOrder, + getCompilerOptions: () => config.options, + getCurrentDirectory: () => state.currentDirectory, updateOutputFileStatmps: () => { updateOutputTimestamps(state, config, projectPath); updateOutputFileStampsPending = false; @@ -728,7 +746,7 @@ namespace ts { if (updateOutputFileStampsPending) { updateOutputTimestamps(state, config, projectPath); } - state.projectPendingBuild.delete(projectPath); + return doneInvalidatedProject(state, projectPath); } }; } @@ -763,12 +781,14 @@ namespace ts { kind, project, projectPath, + buildOrder, + getCompilerOptions: () => config.options, + getCurrentDirectory: () => state.currentDirectory, getBuilderProgram: () => withProgramOrUndefined(identity), getProgram: () => withProgramOrUndefined( program => program.getProgramOrUndefined() ), - getCompilerOptions: () => config.options, getSourceFile: fileName => withProgramOrUndefined( program => program.getSourceFile(fileName) @@ -817,26 +837,27 @@ namespace ts { if (step !== Step.Emit) return undefined; return emit(writeFile, cancellationToken, customTransformers); }, - getCurrentDirectory: () => state.currentDirectory, - done: cancellationToken => { - executeSteps(Step.Done, cancellationToken); - state.projectPendingBuild.delete(projectPath); - } + done } : { kind, project, projectPath, + buildOrder, + getCompilerOptions: () => config.options, + getCurrentDirectory: () => state.currentDirectory, emit: (writeFile: WriteFileCallback | undefined, customTransformers: CustomTransformers | undefined) => { if (step !== Step.EmitBundle) return invalidatedProjectOfBundle; return emitBundle(writeFile, customTransformers); }, - done: cancellationToken => { - executeSteps(Step.Done, cancellationToken); - state.projectPendingBuild.delete(projectPath); - } + done, }; + function done(cancellationToken?: CancellationToken) { + executeSteps(Step.Done, cancellationToken); + return doneInvalidatedProject(state, projectPath); + } + function withProgramOrUndefined(action: (program: T) => U | undefined): U | undefined { executeSteps(Step.CreateProgram); return program && action(program); @@ -1152,6 +1173,12 @@ namespace ts { function getNextInvalidatedProject(state: SolutionBuilderState, buildOrder: readonly ResolvedConfigFileName[]): InvalidatedProject | undefined { if (!state.projectPendingBuild.size) return undefined; + if (state.currentInvalidatedProject) { + // Only if same buildOrder the currentInvalidated project can be sent again + return arrayIsEqualTo(state.currentInvalidatedProject.buildOrder, buildOrder) ? + state.currentInvalidatedProject : + undefined; + } const { options, projectPendingBuild } = state; for (let projectIndex = 0; projectIndex < buildOrder.length; projectIndex++) { @@ -1200,7 +1227,8 @@ namespace ts { state, project, projectPath, - config + config, + buildOrder ); } } @@ -1635,20 +1663,6 @@ namespace ts { } } - function buildNextProject(state: SolutionBuilderState, cancellationToken?: CancellationToken): SolutionBuilderResult | undefined { - setupInitialBuild(state, cancellationToken); - const invalidatedProject = getNextInvalidatedProject(state, getBuildOrder(state)); - if (!invalidatedProject) return undefined; - - invalidatedProject.done(cancellationToken); - return { - project: invalidatedProject.project, - result: state.diagnostics.has(invalidatedProject.projectPath) ? - ExitStatus.DiagnosticsPresent_OutputsSkipped : - ExitStatus.Success - }; - } - function build(state: SolutionBuilderState, project?: string, cancellationToken?: CancellationToken): ExitStatus { const buildOrder = getBuildOrderFor(state, project); if (!buildOrder) return ExitStatus.InvalidProject_OutputsSkipped; @@ -1883,14 +1897,17 @@ namespace ts { * A SolutionBuilder has an immutable set of rootNames that are the "entry point" projects, but * can dynamically add/remove other projects based on changes on the rootNames' references */ - function createSolutionBuilderWorker(watch: false, host: SolutionBuilderHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; - function createSolutionBuilderWorker(watch: true, host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; - function createSolutionBuilderWorker(watch: boolean, hostOrHostWithWatch: SolutionBuilderHost | SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, options: BuildOptions): SolutionBuilder { + function createSolutionBuilderWorker(watch: false, host: SolutionBuilderHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; + function createSolutionBuilderWorker(watch: true, host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; + function createSolutionBuilderWorker(watch: boolean, hostOrHostWithWatch: SolutionBuilderHost | SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, options: BuildOptions): SolutionBuilder { const state = createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, options); return { build: (project, cancellationToken) => build(state, project, cancellationToken), clean: project => clean(state, project), - buildNextProject: cancellationToken => buildNextProject(state, cancellationToken), + getNextInvalidatedProject: cancellationToken => { + setupInitialBuild(state, cancellationToken); + return getNextInvalidatedProject(state, getBuildOrder(state)); + }, getBuildOrder: () => getBuildOrder(state), getUpToDateStatusOfProject: project => { const configFileName = resolveProjectName(state, project); diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 056e894bf53..130ebd9b8eb 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -350,7 +350,12 @@ namespace ts { assert.equal(result, ExitStatus.InvalidProject_OutputsSkipped); }); - it("building using buildNextProject", () => { + it("building using getNextInvalidatedProject", () => { + interface SolutionBuilderResult { + project: ResolvedConfigFileName; + result: T; + } + const fs = projFs.shadow(); const host = new fakes.SolutionBuilderHost(fs); const builder = createSolutionBuilder(host, ["/src/tests"], {}); @@ -376,8 +381,9 @@ namespace ts { presentOutputs: readonly string[], absentOutputs: readonly string[] ) { - const result = builder.buildNextProject(); - assert.deepEqual(result, expected); + const project = builder.getNextInvalidatedProject(); + const result = project && project.done(); + assert.deepEqual(project && { project: project.project, result }, expected); verifyOutputsPresent(fs, presentOutputs); verifyOutputsAbsent(fs, absentOutputs); } diff --git a/src/testRunner/unittests/tsbuildWatchMode.ts b/src/testRunner/unittests/tsbuildWatchMode.ts index f67b575e979..54f174356b5 100644 --- a/src/testRunner/unittests/tsbuildWatchMode.ts +++ b/src/testRunner/unittests/tsbuildWatchMode.ts @@ -676,7 +676,7 @@ let x: string = 10;`); } function verifyScenario( - edit: (host: TsBuildWatchSystem, solutionBuilder: SolutionBuilder) => void, + edit: (host: TsBuildWatchSystem, solutionBuilder: SolutionBuilder) => void, expectedFilesAfterEdit: ReadonlyArray ) { it("with tsc-watch", () => { @@ -899,7 +899,7 @@ export function gfoo() { } function verifyScenario( - edit: (host: TsBuildWatchSystem, solutionBuilder: SolutionBuilder) => void, + edit: (host: TsBuildWatchSystem, solutionBuilder: SolutionBuilder) => void, expectedEditErrors: ReadonlyArray, expectedProgramFiles: ReadonlyArray, expectedWatchedFiles: ReadonlyArray, diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index df479429c17..05d823728e4 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4594,14 +4594,10 @@ declare namespace ts { } interface SolutionBuilderWithWatchHost extends SolutionBuilderHostBase, WatchHost { } - interface SolutionBuilderResult { - project: ResolvedConfigFileName; - result: T; - } - interface SolutionBuilder { + interface SolutionBuilder { build(project?: string, cancellationToken?: CancellationToken): ExitStatus; clean(project?: string): ExitStatus; - buildNextProject(cancellationToken?: CancellationToken): SolutionBuilderResult | undefined; + getNextInvalidatedProject(cancellationToken?: CancellationToken): InvalidatedProject | undefined; } /** * Create a function that reports watch status by writing to the system and handles the formating of the diagnostic @@ -4609,8 +4605,47 @@ declare namespace ts { function createBuilderStatusReporter(system: System, pretty?: boolean): DiagnosticReporter; function createSolutionBuilderHost(system?: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportErrorSummary?: ReportEmitErrorSummary): SolutionBuilderHost; function createSolutionBuilderWithWatchHost(system?: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): SolutionBuilderWithWatchHost; - function createSolutionBuilder(host: SolutionBuilderHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; - function createSolutionBuilderWithWatch(host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; + function createSolutionBuilder(host: SolutionBuilderHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; + function createSolutionBuilderWithWatch(host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; + enum InvalidatedProjectKind { + Build = 0, + UpdateBundle = 1, + UpdateOutputFileStamps = 2 + } + interface InvalidatedProjectBase { + readonly kind: InvalidatedProjectKind; + readonly project: ResolvedConfigFileName; + /** + * To dispose this project and ensure that all the necessary actions are taken and state is updated accordingly + */ + done(cancellationToken?: CancellationToken): ExitStatus; + getCompilerOptions(): CompilerOptions; + getCurrentDirectory(): string; + } + interface UpdateOutputFileStampsProject extends InvalidatedProjectBase { + readonly kind: InvalidatedProjectKind.UpdateOutputFileStamps; + updateOutputFileStatmps(): void; + } + interface BuildInvalidedProject extends InvalidatedProjectBase { + readonly kind: InvalidatedProjectKind.Build; + getBuilderProgram(): T | undefined; + getProgram(): Program | undefined; + getSourceFile(fileName: string): SourceFile | undefined; + getSourceFiles(): ReadonlyArray; + getOptionsDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; + getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; + getConfigFileParsingDiagnostics(): ReadonlyArray; + getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + getAllDependencies(sourceFile: SourceFile): ReadonlyArray; + getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + getSemanticDiagnosticsOfNextAffectedFile(cancellationToken?: CancellationToken, ignoreSourceFile?: (sourceFile: SourceFile) => boolean): AffectedFileResult>; + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult | undefined; + } + interface UpdateBundleProject extends InvalidatedProjectBase { + readonly kind: InvalidatedProjectKind.UpdateBundle; + emit(writeFile?: WriteFileCallback, customTransformers?: CustomTransformers): EmitResult | BuildInvalidedProject | undefined; + } + type InvalidatedProject = UpdateOutputFileStampsProject | BuildInvalidedProject | UpdateBundleProject; } declare namespace ts.server { type ActionSet = "action::set"; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 4062969e8cd..357186f140d 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4594,14 +4594,10 @@ declare namespace ts { } interface SolutionBuilderWithWatchHost extends SolutionBuilderHostBase, WatchHost { } - interface SolutionBuilderResult { - project: ResolvedConfigFileName; - result: T; - } - interface SolutionBuilder { + interface SolutionBuilder { build(project?: string, cancellationToken?: CancellationToken): ExitStatus; clean(project?: string): ExitStatus; - buildNextProject(cancellationToken?: CancellationToken): SolutionBuilderResult | undefined; + getNextInvalidatedProject(cancellationToken?: CancellationToken): InvalidatedProject | undefined; } /** * Create a function that reports watch status by writing to the system and handles the formating of the diagnostic @@ -4609,8 +4605,47 @@ declare namespace ts { function createBuilderStatusReporter(system: System, pretty?: boolean): DiagnosticReporter; function createSolutionBuilderHost(system?: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportErrorSummary?: ReportEmitErrorSummary): SolutionBuilderHost; function createSolutionBuilderWithWatchHost(system?: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): SolutionBuilderWithWatchHost; - function createSolutionBuilder(host: SolutionBuilderHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; - function createSolutionBuilderWithWatch(host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; + function createSolutionBuilder(host: SolutionBuilderHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; + function createSolutionBuilderWithWatch(host: SolutionBuilderWithWatchHost, rootNames: ReadonlyArray, defaultOptions: BuildOptions): SolutionBuilder; + enum InvalidatedProjectKind { + Build = 0, + UpdateBundle = 1, + UpdateOutputFileStamps = 2 + } + interface InvalidatedProjectBase { + readonly kind: InvalidatedProjectKind; + readonly project: ResolvedConfigFileName; + /** + * To dispose this project and ensure that all the necessary actions are taken and state is updated accordingly + */ + done(cancellationToken?: CancellationToken): ExitStatus; + getCompilerOptions(): CompilerOptions; + getCurrentDirectory(): string; + } + interface UpdateOutputFileStampsProject extends InvalidatedProjectBase { + readonly kind: InvalidatedProjectKind.UpdateOutputFileStamps; + updateOutputFileStatmps(): void; + } + interface BuildInvalidedProject extends InvalidatedProjectBase { + readonly kind: InvalidatedProjectKind.Build; + getBuilderProgram(): T | undefined; + getProgram(): Program | undefined; + getSourceFile(fileName: string): SourceFile | undefined; + getSourceFiles(): ReadonlyArray; + getOptionsDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; + getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; + getConfigFileParsingDiagnostics(): ReadonlyArray; + getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + getAllDependencies(sourceFile: SourceFile): ReadonlyArray; + getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + getSemanticDiagnosticsOfNextAffectedFile(cancellationToken?: CancellationToken, ignoreSourceFile?: (sourceFile: SourceFile) => boolean): AffectedFileResult>; + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult | undefined; + } + interface UpdateBundleProject extends InvalidatedProjectBase { + readonly kind: InvalidatedProjectKind.UpdateBundle; + emit(writeFile?: WriteFileCallback, customTransformers?: CustomTransformers): EmitResult | BuildInvalidedProject | undefined; + } + type InvalidatedProject = UpdateOutputFileStampsProject | BuildInvalidedProject | UpdateBundleProject; } declare namespace ts.server { type ActionSet = "action::set"; From 46a278d449a064c49e2a398126c357c62d4cc536 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 10 May 2019 09:48:33 -0700 Subject: [PATCH 074/384] Consistently check conditional extends type for type parameter references --- src/compiler/checker.ts | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 764f926ecdb..5341821d91e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10480,21 +10480,6 @@ namespace ts { return result; } - function isPossiblyReferencedInConditionalType(tp: TypeParameter, node: Node) { - if (isTypeParameterPossiblyReferenced(tp, node)) { - return true; - } - while (node) { - if (node.kind === SyntaxKind.ConditionalType) { - if (isTypeParameterPossiblyReferenced(tp, (node).extendsType)) { - return true; - } - } - node = node.parent; - } - return false; - } - function getTypeFromConditionalTypeNode(node: ConditionalTypeNode): Type { const links = getNodeLinks(node); if (!links.resolvedType) { @@ -10502,7 +10487,7 @@ namespace ts { const aliasSymbol = getAliasSymbolForTypeNode(node); const aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol); const allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true); - const outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : filter(allOuterTypeParameters, tp => isPossiblyReferencedInConditionalType(tp, node)); + const outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : filter(allOuterTypeParameters, tp => isTypeParameterPossiblyReferenced(tp, node)); const root: ConditionalRoot = { node, checkType, @@ -11196,9 +11181,12 @@ namespace ts { // type parameter, or if the node contains type queries, we consider the type parameter possibly referenced. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { const container = tp.symbol.declarations[0].parent; - if (findAncestor(node, n => n.kind === SyntaxKind.Block ? "quit" : n === container)) { - return !!forEachChild(node, containsReference); + for (let n = node; n !== container; n = n.parent) { + if (!n || n.kind === SyntaxKind.Block || n.kind === SyntaxKind.ConditionalType && forEachChild((n).extendsType, containsReference)) { + return true; + } } + return !!forEachChild(node, containsReference); } return true; function containsReference(node: Node): boolean { From ee59cee381ff1a114634da192abcf0606b74ba29 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 10 May 2019 09:56:17 -0700 Subject: [PATCH 075/384] Add regression test --- .../conformance/types/conditional/conditionalTypes2.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/cases/conformance/types/conditional/conditionalTypes2.ts b/tests/cases/conformance/types/conditional/conditionalTypes2.ts index 4b65b5ddeb2..bb70093f233 100644 --- a/tests/cases/conformance/types/conditional/conditionalTypes2.ts +++ b/tests/cases/conformance/types/conditional/conditionalTypes2.ts @@ -190,3 +190,9 @@ type ProductComplementComplement = { }; type PCCA = ProductComplementComplement['a']; type PCCB = ProductComplementComplement['b']; + +// Repro from #31326 + +type Hmm = U extends T ? { [K in keyof U]: number } : never; +type What = Hmm<{}, { a: string }> +const w: What = { a: 4 }; From 1366cc7d2b60f24eda964766d6951640b9264276 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 10 May 2019 09:56:23 -0700 Subject: [PATCH 076/384] Accept new baselines --- .../reference/conditionalTypes2.errors.txt | 6 +++++ .../baselines/reference/conditionalTypes2.js | 14 ++++++++++++ .../reference/conditionalTypes2.symbols | 22 +++++++++++++++++++ .../reference/conditionalTypes2.types | 15 +++++++++++++ 4 files changed, 57 insertions(+) diff --git a/tests/baselines/reference/conditionalTypes2.errors.txt b/tests/baselines/reference/conditionalTypes2.errors.txt index f17a55dd61c..4093bf46fb0 100644 --- a/tests/baselines/reference/conditionalTypes2.errors.txt +++ b/tests/baselines/reference/conditionalTypes2.errors.txt @@ -267,4 +267,10 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(75,12): error TS2 }; type PCCA = ProductComplementComplement['a']; type PCCB = ProductComplementComplement['b']; + + // Repro from #31326 + + type Hmm = U extends T ? { [K in keyof U]: number } : never; + type What = Hmm<{}, { a: string }> + const w: What = { a: 4 }; \ No newline at end of file diff --git a/tests/baselines/reference/conditionalTypes2.js b/tests/baselines/reference/conditionalTypes2.js index 4f4f35e821a..cb35ac6cc2d 100644 --- a/tests/baselines/reference/conditionalTypes2.js +++ b/tests/baselines/reference/conditionalTypes2.js @@ -188,6 +188,12 @@ type ProductComplementComplement = { }; type PCCA = ProductComplementComplement['a']; type PCCB = ProductComplementComplement['b']; + +// Repro from #31326 + +type Hmm = U extends T ? { [K in keyof U]: number } : never; +type What = Hmm<{}, { a: string }> +const w: What = { a: 4 }; //// [conditionalTypes2.js] @@ -265,6 +271,7 @@ function foo(value) { toString2(value); } } +var w = { a: 4 }; //// [conditionalTypes2.d.ts] @@ -392,3 +399,10 @@ declare type ProductComplementComplement = { }; declare type PCCA = ProductComplementComplement['a']; declare type PCCB = ProductComplementComplement['b']; +declare type Hmm = U extends T ? { + [K in keyof U]: number; +} : never; +declare type What = Hmm<{}, { + a: string; +}>; +declare const w: What; diff --git a/tests/baselines/reference/conditionalTypes2.symbols b/tests/baselines/reference/conditionalTypes2.symbols index b164d26e450..f665cbc3c71 100644 --- a/tests/baselines/reference/conditionalTypes2.symbols +++ b/tests/baselines/reference/conditionalTypes2.symbols @@ -685,3 +685,25 @@ type PCCB = ProductComplementComplement['b']; >PCCB : Symbol(PCCB, Decl(conditionalTypes2.ts, 187, 45)) >ProductComplementComplement : Symbol(ProductComplementComplement, Decl(conditionalTypes2.ts, 181, 34)) +// Repro from #31326 + +type Hmm = U extends T ? { [K in keyof U]: number } : never; +>Hmm : Symbol(Hmm, Decl(conditionalTypes2.ts, 188, 45)) +>T : Symbol(T, Decl(conditionalTypes2.ts, 192, 9)) +>U : Symbol(U, Decl(conditionalTypes2.ts, 192, 11)) +>T : Symbol(T, Decl(conditionalTypes2.ts, 192, 9)) +>U : Symbol(U, Decl(conditionalTypes2.ts, 192, 11)) +>T : Symbol(T, Decl(conditionalTypes2.ts, 192, 9)) +>K : Symbol(K, Decl(conditionalTypes2.ts, 192, 44)) +>U : Symbol(U, Decl(conditionalTypes2.ts, 192, 11)) + +type What = Hmm<{}, { a: string }> +>What : Symbol(What, Decl(conditionalTypes2.ts, 192, 76)) +>Hmm : Symbol(Hmm, Decl(conditionalTypes2.ts, 188, 45)) +>a : Symbol(a, Decl(conditionalTypes2.ts, 193, 21)) + +const w: What = { a: 4 }; +>w : Symbol(w, Decl(conditionalTypes2.ts, 194, 5)) +>What : Symbol(What, Decl(conditionalTypes2.ts, 192, 76)) +>a : Symbol(a, Decl(conditionalTypes2.ts, 194, 17)) + diff --git a/tests/baselines/reference/conditionalTypes2.types b/tests/baselines/reference/conditionalTypes2.types index aac6ba47475..e3d949f268e 100644 --- a/tests/baselines/reference/conditionalTypes2.types +++ b/tests/baselines/reference/conditionalTypes2.types @@ -431,3 +431,18 @@ type PCCA = ProductComplementComplement['a']; type PCCB = ProductComplementComplement['b']; >PCCB : Product<"b", 1> +// Repro from #31326 + +type Hmm = U extends T ? { [K in keyof U]: number } : never; +>Hmm : Hmm + +type What = Hmm<{}, { a: string }> +>What : { a: number; } +>a : string + +const w: What = { a: 4 }; +>w : { a: number; } +>{ a: 4 } : { a: number; } +>a : number +>4 : 4 + From d8f2702a5d67d39e5e7396f4914a191e210d4d30 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 10 May 2019 11:48:44 -0700 Subject: [PATCH 077/384] Cache control flow results across invocations (#31003) * Modify flow loop cache key to include all inputs * Add test case, cache similarly to loop cache, reuse loop cache key (now corrected) * Use simpler singleton key and type cache for FlowAssignment nodes --- src/compiler/checker.ts | 43 +- src/compiler/types.ts | 2 + ...ryArithmeticControlFlowGraphNotTooLarge.js | 2562 +++ ...thmeticControlFlowGraphNotTooLarge.symbols | 7408 +++++++ ...rithmeticControlFlowGraphNotTooLarge.types | 16864 ++++++++++++++++ ...ryArithmeticControlFlowGraphNotTooLarge.ts | 1298 ++ 6 files changed, 28169 insertions(+), 8 deletions(-) create mode 100644 tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js create mode 100644 tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.symbols create mode 100644 tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.types create mode 100644 tests/cases/compiler/binaryArithmeticControlFlowGraphNotTooLarge.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 764f926ecdb..a297646d887 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -559,6 +559,8 @@ namespace ts { const symbolLinks: SymbolLinks[] = []; const nodeLinks: NodeLinks[] = []; const flowLoopCaches: Map[] = []; + const flowAssignmentKeys: string[] = []; + const flowAssignmentTypes: FlowType[] = []; const flowLoopNodes: FlowNode[] = []; const flowLoopKeys: string[] = []; const flowLoopTypes: Type[][] = []; @@ -15666,21 +15668,21 @@ namespace ts { // The result is undefined if the reference isn't a dotted name. We prefix nodes // occurring in an apparent type position with '@' because the control flow type // of such nodes may be based on the apparent type instead of the declared type. - function getFlowCacheKey(node: Node): string | undefined { + function getFlowCacheKey(node: Node, declaredType: Type, initialType: Type, flowContainer: Node | undefined): string | undefined { switch (node.kind) { case SyntaxKind.Identifier: const symbol = getResolvedSymbol(node); - return symbol !== unknownSymbol ? (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined; + return symbol !== unknownSymbol ? `${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}|${isConstraintPosition(node) ? "@" : ""}${getSymbolId(symbol)}` : undefined; case SyntaxKind.ThisKeyword: return "0"; case SyntaxKind.NonNullExpression: case SyntaxKind.ParenthesizedExpression: - return getFlowCacheKey((node).expression); + return getFlowCacheKey((node).expression, declaredType, initialType, flowContainer); case SyntaxKind.PropertyAccessExpression: case SyntaxKind.ElementAccessExpression: const propName = getAccessedPropertyName(node); if (propName !== undefined) { - const key = getFlowCacheKey((node).expression); + const key = getFlowCacheKey((node).expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } } @@ -16345,6 +16347,7 @@ namespace ts { function getFlowTypeOfReference(reference: Node, declaredType: Type, initialType = declaredType, flowContainer?: Node, couldBeUninitialized?: boolean) { let key: string | undefined; + let keySet = false; let flowDepth = 0; if (flowAnalysisDisabled) { return errorType; @@ -16365,6 +16368,14 @@ namespace ts { } return resultType; + function getOrSetCacheKey() { + if (keySet) { + return key; + } + keySet = true; + return key = getFlowCacheKey(reference, declaredType, initialType, flowContainer); + } + function getTypeAtFlowNode(flow: FlowNode): FlowType { if (flowDepth === 2000) { // We have made 2000 recursive invocations. To avoid overflowing the call stack we report an error @@ -16376,6 +16387,15 @@ namespace ts { flowDepth++; while (true) { const flags = flow.flags; + if (flags & FlowFlags.Cached) { + const key = getOrSetCacheKey(); + if (key) { + const id = getFlowNodeId(flow); + if (flowAssignmentKeys[id] === key) { + return flowAssignmentTypes[id]; + } + } + } if (flags & FlowFlags.Shared) { // We cache results of flow type resolution for shared nodes that were previously visited in // the same getFlowTypeOfReference invocation. A node is considered shared when it is the @@ -16406,6 +16426,15 @@ namespace ts { flow = (flow).antecedent; continue; } + else if (flowLoopCount === flowLoopStart) { // Only cache assignments when not within loop analysis + const key = getOrSetCacheKey(); + if (key && !isIncomplete(type)) { + flow.flags |= FlowFlags.Cached; + const id = getFlowNodeId(flow); + flowAssignmentKeys[id] = key; + flowAssignmentTypes[id] = type; + } + } } else if (flags & FlowFlags.Condition) { type = getTypeAtFlowCondition(flow); @@ -16618,12 +16647,10 @@ namespace ts { // this flow loop junction, return the cached type. const id = getFlowNodeId(flow); const cache = flowLoopCaches[id] || (flowLoopCaches[id] = createMap()); + const key = getOrSetCacheKey(); if (!key) { - key = getFlowCacheKey(reference); // No cache key is generated when binding patterns are in unnarrowable situations - if (!key) { - return declaredType; - } + return declaredType; } const cached = cache.get(key); if (cached) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 0e3ab5bec24..53b3d82bc27 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2546,6 +2546,8 @@ namespace ts { Shared = 1 << 10, // Referenced as antecedent more than once PreFinally = 1 << 11, // Injected edge that links pre-finally label and pre-try flow AfterFinally = 1 << 12, // Injected edge that links post-finally flow with the rest of the graph + /** @internal */ + Cached = 1 << 13, // Indicates that at least one cross-call cache entry exists for this node, even if not a loop participant Label = BranchLabel | LoopLabel, Condition = TrueCondition | FalseCondition } diff --git a/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js b/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js new file mode 100644 index 00000000000..ab5cd46e599 --- /dev/null +++ b/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.js @@ -0,0 +1,2562 @@ +//// [binaryArithmeticControlFlowGraphNotTooLarge.ts] +// Repro from #29926 (expanded 10x for good measure) + +const foo = function (this: any) { + var a, b, c, d, ab, bc, cd, da, blocks = this.blocks; + + if (this.first) { + a = blocks[0] - 1; + a = (a << 3) | (a >>> 29); + d = ((a & 0xefcdab89) | (~a & 0x98badcfe)) + blocks[1] + 271733878; + d = (d << 7) | (d >>> 25); + c = ((d & a) | (~d & 0xefcdab89)) + blocks[2] - 1732584194; + c = (c << 11) | (c >>> 21); + b = ((c & d) | (~c & a)) + blocks[3] - 271733879; + b = (b << 19) | (b >>> 13); + } else { + a = this.h0; + b = this.h1; + c = this.h2; + d = this.h3; + a += ((b & c) | (~b & d)) + blocks[0]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[1]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[2]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[3]; + b = (b << 19) | (b >>> 13); + } + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + if (this.first) { + this.h0 = a + 1732584193 << 0; + this.h1 = b - 271733879 << 0; + this.h2 = c - 1732584194 << 0; + this.h3 = d + 271733878 << 0; + this.first = false; + } else { + this.h0 = this.h0 + a << 0; + this.h1 = this.h1 + b << 0; + this.h2 = this.h2 + c << 0; + this.h3 = this.h3 + d << 0; + } +}; + +//// [binaryArithmeticControlFlowGraphNotTooLarge.js] +"use strict"; +// Repro from #29926 (expanded 10x for good measure) +var foo = function () { + var a, b, c, d, ab, bc, cd, da, blocks = this.blocks; + if (this.first) { + a = blocks[0] - 1; + a = (a << 3) | (a >>> 29); + d = ((a & 0xefcdab89) | (~a & 0x98badcfe)) + blocks[1] + 271733878; + d = (d << 7) | (d >>> 25); + c = ((d & a) | (~d & 0xefcdab89)) + blocks[2] - 1732584194; + c = (c << 11) | (c >>> 21); + b = ((c & d) | (~c & a)) + blocks[3] - 271733879; + b = (b << 19) | (b >>> 13); + } + else { + a = this.h0; + b = this.h1; + c = this.h2; + d = this.h3; + a += ((b & c) | (~b & d)) + blocks[0]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[1]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[2]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[3]; + b = (b << 19) | (b >>> 13); + } + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + if (this.first) { + this.h0 = a + 1732584193 << 0; + this.h1 = b - 271733879 << 0; + this.h2 = c - 1732584194 << 0; + this.h3 = d + 271733878 << 0; + this.first = false; + } + else { + this.h0 = this.h0 + a << 0; + this.h1 = this.h1 + b << 0; + this.h2 = this.h2 + c << 0; + this.h3 = this.h3 + d << 0; + } +}; diff --git a/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.symbols b/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.symbols new file mode 100644 index 00000000000..66da14318d6 --- /dev/null +++ b/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.symbols @@ -0,0 +1,7408 @@ +=== tests/cases/compiler/binaryArithmeticControlFlowGraphNotTooLarge.ts === +// Repro from #29926 (expanded 10x for good measure) + +const foo = function (this: any) { +>foo : Symbol(foo, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 5)) +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) + + var a, b, c, d, ab, bc, cd, da, blocks = this.blocks; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) + + if (this.first) { +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) + + a = blocks[0] - 1; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d = ((a & 0xefcdab89) | (~a & 0x98badcfe)) + blocks[1] + 271733878; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c = ((d & a) | (~d & 0xefcdab89)) + blocks[2] - 1732584194; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b = ((c & d) | (~c & a)) + blocks[3] - 271733879; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + } else { + a = this.h0; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) + + b = this.h1; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) + + c = this.h2; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) + + d = this.h3; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) + + a += ((b & c) | (~b & d)) + blocks[0]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[1]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[2]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[3]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + } + + a += ((b & c) | (~b & d)) + blocks[4]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[5]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[6]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[7]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[8]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[9]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[10]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[11]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[12]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[13]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[14]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[15]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[0] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[8] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[4] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[12] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[2] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[10] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[6] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[14] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[1] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[9] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[5] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[13] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[3] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[11] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[7] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[15] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[4]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[5]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[6]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[7]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[8]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[9]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[10]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[11]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[12]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[13]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[14]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[15]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[0] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[8] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[4] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[12] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[2] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[10] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[6] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[14] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[1] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[9] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[5] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[13] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[3] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[11] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[7] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[15] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[4]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[5]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[6]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[7]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[8]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[9]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[10]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[11]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[12]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[13]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[14]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[15]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[0] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[8] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[4] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[12] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[2] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[10] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[6] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[14] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[1] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[9] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[5] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[13] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[3] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[11] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[7] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[15] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[4]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[5]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[6]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[7]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[8]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[9]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[10]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[11]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[12]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[13]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[14]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[15]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[0] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[8] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[4] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[12] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[2] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[10] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[6] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[14] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[1] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[9] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[5] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[13] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[3] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[11] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[7] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[15] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[4]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[5]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[6]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[7]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[8]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[9]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[10]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[11]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[12]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[13]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[14]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[15]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[0] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[8] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[4] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[12] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[2] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[10] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[6] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[14] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[1] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[9] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[5] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[13] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[3] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[11] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[7] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[15] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[4]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[5]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[6]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[7]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[8]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[9]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[10]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[11]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[12]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[13]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[14]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[15]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[0] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[8] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[4] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[12] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[2] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[10] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[6] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[14] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[1] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[9] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[5] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[13] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[3] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[11] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[7] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[15] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[4]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[5]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[6]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[7]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[8]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[9]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[10]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[11]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[12]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[13]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[14]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[15]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[0] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[8] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[4] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[12] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[2] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[10] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[6] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[14] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[1] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[9] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[5] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[13] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[3] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[11] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[7] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[15] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[4]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[5]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[6]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[7]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[8]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[9]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[10]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[11]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[12]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[13]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[14]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[15]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[0] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[8] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[4] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[12] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[2] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[10] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[6] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[14] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[1] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[9] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[5] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[13] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[3] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[11] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[7] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[15] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[4]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[5]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[6]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[7]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[8]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[9]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[10]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[11]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[12]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[13]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[14]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[15]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[0] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[8] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[4] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[12] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[2] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[10] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[6] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[14] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[1] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[9] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[5] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[13] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[3] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[11] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[7] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[15] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[4]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[5]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[6]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[7]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[8]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[9]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[10]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[11]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[12]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[13]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[14]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[15]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[0] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[8] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[4] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[12] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[2] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[10] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[6] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[14] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[1] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[9] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[5] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[13] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[3] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[11] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[7] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[15] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[4]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[5]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[6]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[7]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[8]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[9]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[10]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[11]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + a += ((b & c) | (~b & d)) + blocks[12]; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += ((a & b) | (~a & c)) + blocks[13]; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 7) | (d >>> 25); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + c += ((d & a) | (~d & b)) + blocks[14]; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (~c & a)) + blocks[15]; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 19) | (b >>> 13); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + cd = c & d; +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b & c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>cd : Symbol(cd, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 27)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + ab = a & b; +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 5) | (d >>> 27); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d & a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>ab : Symbol(ab, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 19)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 9) | (c >>> 23); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 13) | (b >>> 19); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[0] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[8] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[4] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[12] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[2] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[10] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[6] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[14] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[1] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[9] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[5] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[13] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + bc = b ^ c; +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + a += (bc ^ d) + blocks[3] + 1859775393; +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + a = (a << 3) | (a >>> 29); +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + d += (bc ^ a) + blocks[11] + 1859775393; +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>bc : Symbol(bc, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 23)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + d = (d << 9) | (d >>> 23); +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + da = d ^ a; +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + c += (da ^ b) + blocks[7] + 1859775393; +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + c = (c << 11) | (c >>> 21); +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + b += (da ^ c) + blocks[15] + 1859775393; +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>da : Symbol(da, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 31)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) +>blocks : Symbol(blocks, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 35)) + + b = (b << 15) | (b >>> 17); +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + if (this.first) { +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) + + this.h0 = a + 1732584193 << 0; +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + this.h1 = b - 271733879 << 0; +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + this.h2 = c - 1732584194 << 0; +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + this.h3 = d + 271733878 << 0; +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + + this.first = false; +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) + + } else { + this.h0 = this.h0 + a << 0; +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) +>a : Symbol(a, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 7)) + + this.h1 = this.h1 + b << 0; +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) +>b : Symbol(b, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 10)) + + this.h2 = this.h2 + c << 0; +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) +>c : Symbol(c, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 13)) + + this.h3 = this.h3 + d << 0; +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) +>this : Symbol(this, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 2, 22)) +>d : Symbol(d, Decl(binaryArithmeticControlFlowGraphNotTooLarge.ts, 3, 16)) + } +}; diff --git a/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.types b/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.types new file mode 100644 index 00000000000..73618259b5b --- /dev/null +++ b/tests/baselines/reference/binaryArithmeticControlFlowGraphNotTooLarge.types @@ -0,0 +1,16864 @@ +=== tests/cases/compiler/binaryArithmeticControlFlowGraphNotTooLarge.ts === +// Repro from #29926 (expanded 10x for good measure) + +const foo = function (this: any) { +>foo : (this: any) => void +>function (this: any) { var a, b, c, d, ab, bc, cd, da, blocks = this.blocks; if (this.first) { a = blocks[0] - 1; a = (a << 3) | (a >>> 29); d = ((a & 0xefcdab89) | (~a & 0x98badcfe)) + blocks[1] + 271733878; d = (d << 7) | (d >>> 25); c = ((d & a) | (~d & 0xefcdab89)) + blocks[2] - 1732584194; c = (c << 11) | (c >>> 21); b = ((c & d) | (~c & a)) + blocks[3] - 271733879; b = (b << 19) | (b >>> 13); } else { a = this.h0; b = this.h1; c = this.h2; d = this.h3; a += ((b & c) | (~b & d)) + blocks[0]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[1]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[2]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[3]; b = (b << 19) | (b >>> 13); } a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[6]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[7]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[8]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[9]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[10]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[11]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[12]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[13]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[14]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[4] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[8] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[12] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[1] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[5] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[9] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[13] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[2] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[6] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[10] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[14] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[3] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[7] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[11] + 1518500249; c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[8] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[4] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[12] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[2] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[10] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[6] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[14] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[1] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[9] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[5] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[13] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[3] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[11] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[7] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[6]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[7]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[8]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[9]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[10]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[11]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[12]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[13]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[14]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[4] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[8] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[12] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[1] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[5] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[9] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[13] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[2] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[6] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[10] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[14] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[3] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[7] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[11] + 1518500249; c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[8] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[4] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[12] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[2] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[10] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[6] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[14] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[1] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[9] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[5] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[13] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[3] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[11] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[7] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[6]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[7]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[8]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[9]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[10]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[11]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[12]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[13]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[14]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[4] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[8] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[12] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[1] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[5] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[9] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[13] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[2] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[6] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[10] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[14] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[3] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[7] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[11] + 1518500249; c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[8] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[4] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[12] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[2] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[10] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[6] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[14] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[1] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[9] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[5] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[13] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[3] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[11] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[7] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[6]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[7]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[8]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[9]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[10]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[11]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[12]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[13]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[14]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[4] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[8] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[12] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[1] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[5] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[9] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[13] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[2] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[6] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[10] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[14] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[3] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[7] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[11] + 1518500249; c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[8] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[4] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[12] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[2] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[10] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[6] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[14] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[1] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[9] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[5] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[13] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[3] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[11] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[7] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[6]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[7]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[8]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[9]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[10]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[11]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[12]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[13]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[14]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[4] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[8] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[12] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[1] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[5] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[9] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[13] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[2] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[6] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[10] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[14] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[3] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[7] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[11] + 1518500249; c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[8] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[4] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[12] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[2] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[10] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[6] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[14] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[1] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[9] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[5] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[13] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[3] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[11] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[7] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[6]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[7]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[8]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[9]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[10]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[11]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[12]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[13]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[14]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[4] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[8] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[12] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[1] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[5] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[9] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[13] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[2] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[6] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[10] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[14] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[3] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[7] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[11] + 1518500249; c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[8] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[4] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[12] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[2] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[10] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[6] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[14] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[1] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[9] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[5] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[13] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[3] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[11] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[7] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[6]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[7]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[8]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[9]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[10]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[11]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[12]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[13]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[14]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[4] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[8] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[12] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[1] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[5] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[9] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[13] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[2] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[6] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[10] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[14] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[3] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[7] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[11] + 1518500249; c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[8] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[4] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[12] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[2] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[10] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[6] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[14] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[1] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[9] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[5] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[13] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[3] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[11] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[7] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[6]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[7]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[8]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[9]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[10]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[11]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[12]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[13]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[14]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[4] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[8] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[12] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[1] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[5] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[9] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[13] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[2] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[6] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[10] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[14] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[3] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[7] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[11] + 1518500249; c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[8] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[4] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[12] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[2] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[10] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[6] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[14] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[1] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[9] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[5] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[13] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[3] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[11] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[7] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[6]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[7]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[8]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[9]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[10]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[11]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[12]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[13]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[14]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[4] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[8] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[12] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[1] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[5] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[9] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[13] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[2] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[6] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[10] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[14] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[3] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[7] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[11] + 1518500249; c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[8] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[4] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[12] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[2] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[10] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[6] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[14] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[1] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[9] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[5] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[13] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[3] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[11] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[7] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[6]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[7]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[8]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[9]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[10]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[11]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[12]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[13]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[14]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[4] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[8] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[12] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[1] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[5] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[9] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[13] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[2] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[6] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[10] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[14] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[3] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[7] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[11] + 1518500249; c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[8] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[4] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[12] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[2] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[10] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[6] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[14] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[1] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[9] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[5] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[13] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[3] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[11] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[7] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); a += ((b & c) | (~b & d)) + blocks[4]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[5]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[6]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[7]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[8]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[9]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[10]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[11]; b = (b << 19) | (b >>> 13); a += ((b & c) | (~b & d)) + blocks[12]; a = (a << 3) | (a >>> 29); d += ((a & b) | (~a & c)) + blocks[13]; d = (d << 7) | (d >>> 25); c += ((d & a) | (~d & b)) + blocks[14]; c = (c << 11) | (c >>> 21); b += ((c & d) | (~c & a)) + blocks[15]; b = (b << 19) | (b >>> 13); bc = b & c; a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[4] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[8] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[12] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[1] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[5] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[9] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[13] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[2] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[6] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[10] + 1518500249; c = (c << 9) | (c >>> 23); cd = c & d; b += (cd | (c & a) | da) + blocks[14] + 1518500249; b = (b << 13) | (b >>> 19); bc = b & c; a += (bc | (b & d) | cd) + blocks[3] + 1518500249; a = (a << 3) | (a >>> 29); ab = a & b; d += (ab | (a & c) | bc) + blocks[7] + 1518500249; d = (d << 5) | (d >>> 27); da = d & a; c += (da | (d & b) | ab) + blocks[11] + 1518500249; c = (c << 9) | (c >>> 23); b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; b = (b << 13) | (b >>> 19); bc = b ^ c; a += (bc ^ d) + blocks[0] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[8] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[4] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[12] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[2] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[10] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[6] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[14] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[1] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[9] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[5] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[13] + 1859775393; b = (b << 15) | (b >>> 17); bc = b ^ c; a += (bc ^ d) + blocks[3] + 1859775393; a = (a << 3) | (a >>> 29); d += (bc ^ a) + blocks[11] + 1859775393; d = (d << 9) | (d >>> 23); da = d ^ a; c += (da ^ b) + blocks[7] + 1859775393; c = (c << 11) | (c >>> 21); b += (da ^ c) + blocks[15] + 1859775393; b = (b << 15) | (b >>> 17); if (this.first) { this.h0 = a + 1732584193 << 0; this.h1 = b - 271733879 << 0; this.h2 = c - 1732584194 << 0; this.h3 = d + 271733878 << 0; this.first = false; } else { this.h0 = this.h0 + a << 0; this.h1 = this.h1 + b << 0; this.h2 = this.h2 + c << 0; this.h3 = this.h3 + d << 0; }} : (this: any) => void +>this : any + + var a, b, c, d, ab, bc, cd, da, blocks = this.blocks; +>a : any +>b : any +>c : any +>d : any +>ab : any +>bc : any +>cd : any +>da : any +>blocks : any +>this.blocks : any +>this : any +>blocks : any + + if (this.first) { +>this.first : any +>this : any +>first : any + + a = blocks[0] - 1; +>a = blocks[0] - 1 : number +>a : any +>blocks[0] - 1 : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1 : 1 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d = ((a & 0xefcdab89) | (~a & 0x98badcfe)) + blocks[1] + 271733878; +>d = ((a & 0xefcdab89) | (~a & 0x98badcfe)) + blocks[1] + 271733878 : any +>d : any +>((a & 0xefcdab89) | (~a & 0x98badcfe)) + blocks[1] + 271733878 : any +>((a & 0xefcdab89) | (~a & 0x98badcfe)) + blocks[1] : any +>((a & 0xefcdab89) | (~a & 0x98badcfe)) : number +>(a & 0xefcdab89) | (~a & 0x98badcfe) : number +>(a & 0xefcdab89) : number +>a & 0xefcdab89 : number +>a : number +>0xefcdab89 : 4023233417 +>(~a & 0x98badcfe) : number +>~a & 0x98badcfe : number +>~a : number +>a : number +>0x98badcfe : 2562383102 +>blocks[1] : any +>blocks : any +>1 : 1 +>271733878 : 271733878 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : any +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : any +>25 : 25 + + c = ((d & a) | (~d & 0xefcdab89)) + blocks[2] - 1732584194; +>c = ((d & a) | (~d & 0xefcdab89)) + blocks[2] - 1732584194 : number +>c : any +>((d & a) | (~d & 0xefcdab89)) + blocks[2] - 1732584194 : number +>((d & a) | (~d & 0xefcdab89)) + blocks[2] : any +>((d & a) | (~d & 0xefcdab89)) : number +>(d & a) | (~d & 0xefcdab89) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & 0xefcdab89) : number +>~d & 0xefcdab89 : number +>~d : number +>d : number +>0xefcdab89 : 4023233417 +>blocks[2] : any +>blocks : any +>2 : 2 +>1732584194 : 1732584194 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b = ((c & d) | (~c & a)) + blocks[3] - 271733879; +>b = ((c & d) | (~c & a)) + blocks[3] - 271733879 : number +>b : any +>((c & d) | (~c & a)) + blocks[3] - 271733879 : number +>((c & d) | (~c & a)) + blocks[3] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[3] : any +>blocks : any +>3 : 3 +>271733879 : 271733879 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + } else { + a = this.h0; +>a = this.h0 : any +>a : any +>this.h0 : any +>this : any +>h0 : any + + b = this.h1; +>b = this.h1 : any +>b : any +>this.h1 : any +>this : any +>h1 : any + + c = this.h2; +>c = this.h2 : any +>c : any +>this.h2 : any +>this : any +>h2 : any + + d = this.h3; +>d = this.h3 : any +>d : any +>this.h3 : any +>this : any +>h3 : any + + a += ((b & c) | (~b & d)) + blocks[0]; +>a += ((b & c) | (~b & d)) + blocks[0] : any +>a : any +>((b & c) | (~b & d)) + blocks[0] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : any +>c : any +>(~b & d) : number +>~b & d : number +>~b : number +>b : any +>d : any +>blocks[0] : any +>blocks : any +>0 : 0 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : any +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : any +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[1]; +>d += ((a & b) | (~a & c)) + blocks[1] : any +>d : any +>((a & b) | (~a & c)) + blocks[1] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : any +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : any +>blocks[1] : any +>blocks : any +>1 : 1 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : any +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : any +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[2]; +>c += ((d & a) | (~d & b)) + blocks[2] : any +>c : any +>((d & a) | (~d & b)) + blocks[2] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : any +>blocks[2] : any +>blocks : any +>2 : 2 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : any +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : any +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[3]; +>b += ((c & d) | (~c & a)) + blocks[3] : any +>b : any +>((c & d) | (~c & a)) + blocks[3] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[3] : any +>blocks : any +>3 : 3 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : any +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : any +>13 : 13 + } + + a += ((b & c) | (~b & d)) + blocks[4]; +>a += ((b & c) | (~b & d)) + blocks[4] : any +>a : number +>((b & c) | (~b & d)) + blocks[4] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[4] : any +>blocks : any +>4 : 4 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[5]; +>d += ((a & b) | (~a & c)) + blocks[5] : any +>d : number +>((a & b) | (~a & c)) + blocks[5] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[5] : any +>blocks : any +>5 : 5 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[6]; +>c += ((d & a) | (~d & b)) + blocks[6] : any +>c : number +>((d & a) | (~d & b)) + blocks[6] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[7]; +>b += ((c & d) | (~c & a)) + blocks[7] : any +>b : number +>((c & d) | (~c & a)) + blocks[7] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[7] : any +>blocks : any +>7 : 7 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[8]; +>a += ((b & c) | (~b & d)) + blocks[8] : any +>a : number +>((b & c) | (~b & d)) + blocks[8] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[8] : any +>blocks : any +>8 : 8 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[9]; +>d += ((a & b) | (~a & c)) + blocks[9] : any +>d : number +>((a & b) | (~a & c)) + blocks[9] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[9] : any +>blocks : any +>9 : 9 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[10]; +>c += ((d & a) | (~d & b)) + blocks[10] : any +>c : number +>((d & a) | (~d & b)) + blocks[10] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[10] : any +>blocks : any +>10 : 10 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[11]; +>b += ((c & d) | (~c & a)) + blocks[11] : any +>b : number +>((c & d) | (~c & a)) + blocks[11] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[12]; +>a += ((b & c) | (~b & d)) + blocks[12] : any +>a : number +>((b & c) | (~b & d)) + blocks[12] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[12] : any +>blocks : any +>12 : 12 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[13]; +>d += ((a & b) | (~a & c)) + blocks[13] : any +>d : number +>((a & b) | (~a & c)) + blocks[13] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[14]; +>c += ((d & a) | (~d & b)) + blocks[14] : any +>c : number +>((d & a) | (~d & b)) + blocks[14] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[14] : any +>blocks : any +>14 : 14 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[15]; +>b += ((c & d) | (~c & a)) + blocks[15] : any +>b : number +>((c & d) | (~c & a)) + blocks[15] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[15] : any +>blocks : any +>15 : 15 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>a : number +>(bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>(bc | (b & d) | (c & d)) + blocks[0] : any +>(bc | (b & d) | (c & d)) : number +>bc | (b & d) | (c & d) : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[4] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c += (da | (d & b) | ab) + blocks[8] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[8] + 1518500249 : any +>(da | (d & b) | ab) + blocks[8] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b += (cd | (c & a) | da) + blocks[12] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[12] + 1518500249 : any +>(cd | (c & a) | da) + blocks[12] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[1] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[5] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c += (da | (d & b) | ab) + blocks[9] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[9] + 1518500249 : any +>(da | (d & b) | ab) + blocks[9] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b += (cd | (c & a) | da) + blocks[13] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[13] + 1518500249 : any +>(cd | (c & a) | da) + blocks[13] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[2] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[6] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c += (da | (d & b) | ab) + blocks[10] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[10] + 1518500249 : any +>(da | (d & b) | ab) + blocks[10] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b += (cd | (c & a) | da) + blocks[14] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[14] + 1518500249 : any +>(cd | (c & a) | da) + blocks[14] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[3] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[7] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c += (da | (d & b) | ab) + blocks[11] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[11] + 1518500249 : any +>(da | (d & b) | ab) + blocks[11] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>b : number +>((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>((c & d) | (c & a) | da) + blocks[15] : any +>((c & d) | (c & a) | da) : number +>(c & d) | (c & a) | da : number +>(c & d) | (c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[0] + 1859775393; +>a += (bc ^ d) + blocks[0] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[0] + 1859775393 : any +>(bc ^ d) + blocks[0] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[8] + 1859775393; +>d += (bc ^ a) + blocks[8] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[8] + 1859775393 : any +>(bc ^ a) + blocks[8] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[4] + 1859775393; +>c += (da ^ b) + blocks[4] + 1859775393 : any +>c : number +>(da ^ b) + blocks[4] + 1859775393 : any +>(da ^ b) + blocks[4] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[12] + 1859775393; +>b += (da ^ c) + blocks[12] + 1859775393 : any +>b : number +>(da ^ c) + blocks[12] + 1859775393 : any +>(da ^ c) + blocks[12] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[2] + 1859775393; +>a += (bc ^ d) + blocks[2] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[2] + 1859775393 : any +>(bc ^ d) + blocks[2] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[10] + 1859775393; +>d += (bc ^ a) + blocks[10] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[10] + 1859775393 : any +>(bc ^ a) + blocks[10] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[6] + 1859775393; +>c += (da ^ b) + blocks[6] + 1859775393 : any +>c : number +>(da ^ b) + blocks[6] + 1859775393 : any +>(da ^ b) + blocks[6] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[14] + 1859775393; +>b += (da ^ c) + blocks[14] + 1859775393 : any +>b : number +>(da ^ c) + blocks[14] + 1859775393 : any +>(da ^ c) + blocks[14] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[1] + 1859775393; +>a += (bc ^ d) + blocks[1] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[1] + 1859775393 : any +>(bc ^ d) + blocks[1] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[9] + 1859775393; +>d += (bc ^ a) + blocks[9] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[9] + 1859775393 : any +>(bc ^ a) + blocks[9] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[5] + 1859775393; +>c += (da ^ b) + blocks[5] + 1859775393 : any +>c : number +>(da ^ b) + blocks[5] + 1859775393 : any +>(da ^ b) + blocks[5] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[13] + 1859775393; +>b += (da ^ c) + blocks[13] + 1859775393 : any +>b : number +>(da ^ c) + blocks[13] + 1859775393 : any +>(da ^ c) + blocks[13] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[3] + 1859775393; +>a += (bc ^ d) + blocks[3] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[3] + 1859775393 : any +>(bc ^ d) + blocks[3] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[11] + 1859775393; +>d += (bc ^ a) + blocks[11] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[11] + 1859775393 : any +>(bc ^ a) + blocks[11] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[7] + 1859775393; +>c += (da ^ b) + blocks[7] + 1859775393 : any +>c : number +>(da ^ b) + blocks[7] + 1859775393 : any +>(da ^ b) + blocks[7] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[15] + 1859775393; +>b += (da ^ c) + blocks[15] + 1859775393 : any +>b : number +>(da ^ c) + blocks[15] + 1859775393 : any +>(da ^ c) + blocks[15] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + a += ((b & c) | (~b & d)) + blocks[4]; +>a += ((b & c) | (~b & d)) + blocks[4] : any +>a : number +>((b & c) | (~b & d)) + blocks[4] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[4] : any +>blocks : any +>4 : 4 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[5]; +>d += ((a & b) | (~a & c)) + blocks[5] : any +>d : number +>((a & b) | (~a & c)) + blocks[5] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[5] : any +>blocks : any +>5 : 5 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[6]; +>c += ((d & a) | (~d & b)) + blocks[6] : any +>c : number +>((d & a) | (~d & b)) + blocks[6] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[7]; +>b += ((c & d) | (~c & a)) + blocks[7] : any +>b : number +>((c & d) | (~c & a)) + blocks[7] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[7] : any +>blocks : any +>7 : 7 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[8]; +>a += ((b & c) | (~b & d)) + blocks[8] : any +>a : number +>((b & c) | (~b & d)) + blocks[8] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[8] : any +>blocks : any +>8 : 8 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[9]; +>d += ((a & b) | (~a & c)) + blocks[9] : any +>d : number +>((a & b) | (~a & c)) + blocks[9] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[9] : any +>blocks : any +>9 : 9 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[10]; +>c += ((d & a) | (~d & b)) + blocks[10] : any +>c : number +>((d & a) | (~d & b)) + blocks[10] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[10] : any +>blocks : any +>10 : 10 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[11]; +>b += ((c & d) | (~c & a)) + blocks[11] : any +>b : number +>((c & d) | (~c & a)) + blocks[11] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[12]; +>a += ((b & c) | (~b & d)) + blocks[12] : any +>a : number +>((b & c) | (~b & d)) + blocks[12] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[12] : any +>blocks : any +>12 : 12 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[13]; +>d += ((a & b) | (~a & c)) + blocks[13] : any +>d : number +>((a & b) | (~a & c)) + blocks[13] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[14]; +>c += ((d & a) | (~d & b)) + blocks[14] : any +>c : number +>((d & a) | (~d & b)) + blocks[14] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[14] : any +>blocks : any +>14 : 14 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[15]; +>b += ((c & d) | (~c & a)) + blocks[15] : any +>b : number +>((c & d) | (~c & a)) + blocks[15] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[15] : any +>blocks : any +>15 : 15 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>a : number +>(bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>(bc | (b & d) | (c & d)) + blocks[0] : any +>(bc | (b & d) | (c & d)) : number +>bc | (b & d) | (c & d) : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[4] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c += (da | (d & b) | ab) + blocks[8] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[8] + 1518500249 : any +>(da | (d & b) | ab) + blocks[8] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b += (cd | (c & a) | da) + blocks[12] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[12] + 1518500249 : any +>(cd | (c & a) | da) + blocks[12] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[1] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[5] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c += (da | (d & b) | ab) + blocks[9] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[9] + 1518500249 : any +>(da | (d & b) | ab) + blocks[9] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b += (cd | (c & a) | da) + blocks[13] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[13] + 1518500249 : any +>(cd | (c & a) | da) + blocks[13] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[2] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[6] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c += (da | (d & b) | ab) + blocks[10] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[10] + 1518500249 : any +>(da | (d & b) | ab) + blocks[10] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b += (cd | (c & a) | da) + blocks[14] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[14] + 1518500249 : any +>(cd | (c & a) | da) + blocks[14] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[3] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[7] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c += (da | (d & b) | ab) + blocks[11] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[11] + 1518500249 : any +>(da | (d & b) | ab) + blocks[11] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>b : number +>((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>((c & d) | (c & a) | da) + blocks[15] : any +>((c & d) | (c & a) | da) : number +>(c & d) | (c & a) | da : number +>(c & d) | (c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[0] + 1859775393; +>a += (bc ^ d) + blocks[0] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[0] + 1859775393 : any +>(bc ^ d) + blocks[0] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[8] + 1859775393; +>d += (bc ^ a) + blocks[8] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[8] + 1859775393 : any +>(bc ^ a) + blocks[8] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[4] + 1859775393; +>c += (da ^ b) + blocks[4] + 1859775393 : any +>c : number +>(da ^ b) + blocks[4] + 1859775393 : any +>(da ^ b) + blocks[4] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[12] + 1859775393; +>b += (da ^ c) + blocks[12] + 1859775393 : any +>b : number +>(da ^ c) + blocks[12] + 1859775393 : any +>(da ^ c) + blocks[12] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[2] + 1859775393; +>a += (bc ^ d) + blocks[2] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[2] + 1859775393 : any +>(bc ^ d) + blocks[2] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[10] + 1859775393; +>d += (bc ^ a) + blocks[10] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[10] + 1859775393 : any +>(bc ^ a) + blocks[10] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[6] + 1859775393; +>c += (da ^ b) + blocks[6] + 1859775393 : any +>c : number +>(da ^ b) + blocks[6] + 1859775393 : any +>(da ^ b) + blocks[6] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[14] + 1859775393; +>b += (da ^ c) + blocks[14] + 1859775393 : any +>b : number +>(da ^ c) + blocks[14] + 1859775393 : any +>(da ^ c) + blocks[14] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[1] + 1859775393; +>a += (bc ^ d) + blocks[1] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[1] + 1859775393 : any +>(bc ^ d) + blocks[1] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[9] + 1859775393; +>d += (bc ^ a) + blocks[9] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[9] + 1859775393 : any +>(bc ^ a) + blocks[9] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[5] + 1859775393; +>c += (da ^ b) + blocks[5] + 1859775393 : any +>c : number +>(da ^ b) + blocks[5] + 1859775393 : any +>(da ^ b) + blocks[5] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[13] + 1859775393; +>b += (da ^ c) + blocks[13] + 1859775393 : any +>b : number +>(da ^ c) + blocks[13] + 1859775393 : any +>(da ^ c) + blocks[13] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[3] + 1859775393; +>a += (bc ^ d) + blocks[3] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[3] + 1859775393 : any +>(bc ^ d) + blocks[3] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[11] + 1859775393; +>d += (bc ^ a) + blocks[11] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[11] + 1859775393 : any +>(bc ^ a) + blocks[11] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[7] + 1859775393; +>c += (da ^ b) + blocks[7] + 1859775393 : any +>c : number +>(da ^ b) + blocks[7] + 1859775393 : any +>(da ^ b) + blocks[7] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[15] + 1859775393; +>b += (da ^ c) + blocks[15] + 1859775393 : any +>b : number +>(da ^ c) + blocks[15] + 1859775393 : any +>(da ^ c) + blocks[15] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + a += ((b & c) | (~b & d)) + blocks[4]; +>a += ((b & c) | (~b & d)) + blocks[4] : any +>a : number +>((b & c) | (~b & d)) + blocks[4] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[4] : any +>blocks : any +>4 : 4 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[5]; +>d += ((a & b) | (~a & c)) + blocks[5] : any +>d : number +>((a & b) | (~a & c)) + blocks[5] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[5] : any +>blocks : any +>5 : 5 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[6]; +>c += ((d & a) | (~d & b)) + blocks[6] : any +>c : number +>((d & a) | (~d & b)) + blocks[6] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[7]; +>b += ((c & d) | (~c & a)) + blocks[7] : any +>b : number +>((c & d) | (~c & a)) + blocks[7] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[7] : any +>blocks : any +>7 : 7 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[8]; +>a += ((b & c) | (~b & d)) + blocks[8] : any +>a : number +>((b & c) | (~b & d)) + blocks[8] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[8] : any +>blocks : any +>8 : 8 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[9]; +>d += ((a & b) | (~a & c)) + blocks[9] : any +>d : number +>((a & b) | (~a & c)) + blocks[9] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[9] : any +>blocks : any +>9 : 9 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[10]; +>c += ((d & a) | (~d & b)) + blocks[10] : any +>c : number +>((d & a) | (~d & b)) + blocks[10] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[10] : any +>blocks : any +>10 : 10 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[11]; +>b += ((c & d) | (~c & a)) + blocks[11] : any +>b : number +>((c & d) | (~c & a)) + blocks[11] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[12]; +>a += ((b & c) | (~b & d)) + blocks[12] : any +>a : number +>((b & c) | (~b & d)) + blocks[12] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[12] : any +>blocks : any +>12 : 12 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[13]; +>d += ((a & b) | (~a & c)) + blocks[13] : any +>d : number +>((a & b) | (~a & c)) + blocks[13] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[14]; +>c += ((d & a) | (~d & b)) + blocks[14] : any +>c : number +>((d & a) | (~d & b)) + blocks[14] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[14] : any +>blocks : any +>14 : 14 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[15]; +>b += ((c & d) | (~c & a)) + blocks[15] : any +>b : number +>((c & d) | (~c & a)) + blocks[15] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[15] : any +>blocks : any +>15 : 15 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>a : number +>(bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>(bc | (b & d) | (c & d)) + blocks[0] : any +>(bc | (b & d) | (c & d)) : number +>bc | (b & d) | (c & d) : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[4] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c += (da | (d & b) | ab) + blocks[8] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[8] + 1518500249 : any +>(da | (d & b) | ab) + blocks[8] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b += (cd | (c & a) | da) + blocks[12] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[12] + 1518500249 : any +>(cd | (c & a) | da) + blocks[12] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[1] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[5] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c += (da | (d & b) | ab) + blocks[9] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[9] + 1518500249 : any +>(da | (d & b) | ab) + blocks[9] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b += (cd | (c & a) | da) + blocks[13] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[13] + 1518500249 : any +>(cd | (c & a) | da) + blocks[13] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[2] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[6] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c += (da | (d & b) | ab) + blocks[10] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[10] + 1518500249 : any +>(da | (d & b) | ab) + blocks[10] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b += (cd | (c & a) | da) + blocks[14] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[14] + 1518500249 : any +>(cd | (c & a) | da) + blocks[14] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[3] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[7] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c += (da | (d & b) | ab) + blocks[11] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[11] + 1518500249 : any +>(da | (d & b) | ab) + blocks[11] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>b : number +>((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>((c & d) | (c & a) | da) + blocks[15] : any +>((c & d) | (c & a) | da) : number +>(c & d) | (c & a) | da : number +>(c & d) | (c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[0] + 1859775393; +>a += (bc ^ d) + blocks[0] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[0] + 1859775393 : any +>(bc ^ d) + blocks[0] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[8] + 1859775393; +>d += (bc ^ a) + blocks[8] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[8] + 1859775393 : any +>(bc ^ a) + blocks[8] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[4] + 1859775393; +>c += (da ^ b) + blocks[4] + 1859775393 : any +>c : number +>(da ^ b) + blocks[4] + 1859775393 : any +>(da ^ b) + blocks[4] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[12] + 1859775393; +>b += (da ^ c) + blocks[12] + 1859775393 : any +>b : number +>(da ^ c) + blocks[12] + 1859775393 : any +>(da ^ c) + blocks[12] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[2] + 1859775393; +>a += (bc ^ d) + blocks[2] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[2] + 1859775393 : any +>(bc ^ d) + blocks[2] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[10] + 1859775393; +>d += (bc ^ a) + blocks[10] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[10] + 1859775393 : any +>(bc ^ a) + blocks[10] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[6] + 1859775393; +>c += (da ^ b) + blocks[6] + 1859775393 : any +>c : number +>(da ^ b) + blocks[6] + 1859775393 : any +>(da ^ b) + blocks[6] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[14] + 1859775393; +>b += (da ^ c) + blocks[14] + 1859775393 : any +>b : number +>(da ^ c) + blocks[14] + 1859775393 : any +>(da ^ c) + blocks[14] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[1] + 1859775393; +>a += (bc ^ d) + blocks[1] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[1] + 1859775393 : any +>(bc ^ d) + blocks[1] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[9] + 1859775393; +>d += (bc ^ a) + blocks[9] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[9] + 1859775393 : any +>(bc ^ a) + blocks[9] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[5] + 1859775393; +>c += (da ^ b) + blocks[5] + 1859775393 : any +>c : number +>(da ^ b) + blocks[5] + 1859775393 : any +>(da ^ b) + blocks[5] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[13] + 1859775393; +>b += (da ^ c) + blocks[13] + 1859775393 : any +>b : number +>(da ^ c) + blocks[13] + 1859775393 : any +>(da ^ c) + blocks[13] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[3] + 1859775393; +>a += (bc ^ d) + blocks[3] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[3] + 1859775393 : any +>(bc ^ d) + blocks[3] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[11] + 1859775393; +>d += (bc ^ a) + blocks[11] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[11] + 1859775393 : any +>(bc ^ a) + blocks[11] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[7] + 1859775393; +>c += (da ^ b) + blocks[7] + 1859775393 : any +>c : number +>(da ^ b) + blocks[7] + 1859775393 : any +>(da ^ b) + blocks[7] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[15] + 1859775393; +>b += (da ^ c) + blocks[15] + 1859775393 : any +>b : number +>(da ^ c) + blocks[15] + 1859775393 : any +>(da ^ c) + blocks[15] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + a += ((b & c) | (~b & d)) + blocks[4]; +>a += ((b & c) | (~b & d)) + blocks[4] : any +>a : number +>((b & c) | (~b & d)) + blocks[4] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[4] : any +>blocks : any +>4 : 4 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[5]; +>d += ((a & b) | (~a & c)) + blocks[5] : any +>d : number +>((a & b) | (~a & c)) + blocks[5] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[5] : any +>blocks : any +>5 : 5 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[6]; +>c += ((d & a) | (~d & b)) + blocks[6] : any +>c : number +>((d & a) | (~d & b)) + blocks[6] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[7]; +>b += ((c & d) | (~c & a)) + blocks[7] : any +>b : number +>((c & d) | (~c & a)) + blocks[7] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[7] : any +>blocks : any +>7 : 7 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[8]; +>a += ((b & c) | (~b & d)) + blocks[8] : any +>a : number +>((b & c) | (~b & d)) + blocks[8] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[8] : any +>blocks : any +>8 : 8 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[9]; +>d += ((a & b) | (~a & c)) + blocks[9] : any +>d : number +>((a & b) | (~a & c)) + blocks[9] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[9] : any +>blocks : any +>9 : 9 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[10]; +>c += ((d & a) | (~d & b)) + blocks[10] : any +>c : number +>((d & a) | (~d & b)) + blocks[10] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[10] : any +>blocks : any +>10 : 10 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[11]; +>b += ((c & d) | (~c & a)) + blocks[11] : any +>b : number +>((c & d) | (~c & a)) + blocks[11] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[12]; +>a += ((b & c) | (~b & d)) + blocks[12] : any +>a : number +>((b & c) | (~b & d)) + blocks[12] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[12] : any +>blocks : any +>12 : 12 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[13]; +>d += ((a & b) | (~a & c)) + blocks[13] : any +>d : number +>((a & b) | (~a & c)) + blocks[13] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[14]; +>c += ((d & a) | (~d & b)) + blocks[14] : any +>c : number +>((d & a) | (~d & b)) + blocks[14] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[14] : any +>blocks : any +>14 : 14 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[15]; +>b += ((c & d) | (~c & a)) + blocks[15] : any +>b : number +>((c & d) | (~c & a)) + blocks[15] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[15] : any +>blocks : any +>15 : 15 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>a : number +>(bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>(bc | (b & d) | (c & d)) + blocks[0] : any +>(bc | (b & d) | (c & d)) : number +>bc | (b & d) | (c & d) : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[4] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c += (da | (d & b) | ab) + blocks[8] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[8] + 1518500249 : any +>(da | (d & b) | ab) + blocks[8] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b += (cd | (c & a) | da) + blocks[12] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[12] + 1518500249 : any +>(cd | (c & a) | da) + blocks[12] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[1] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[5] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c += (da | (d & b) | ab) + blocks[9] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[9] + 1518500249 : any +>(da | (d & b) | ab) + blocks[9] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b += (cd | (c & a) | da) + blocks[13] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[13] + 1518500249 : any +>(cd | (c & a) | da) + blocks[13] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[2] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[6] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c += (da | (d & b) | ab) + blocks[10] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[10] + 1518500249 : any +>(da | (d & b) | ab) + blocks[10] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b += (cd | (c & a) | da) + blocks[14] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[14] + 1518500249 : any +>(cd | (c & a) | da) + blocks[14] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[3] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[7] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c += (da | (d & b) | ab) + blocks[11] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[11] + 1518500249 : any +>(da | (d & b) | ab) + blocks[11] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>b : number +>((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>((c & d) | (c & a) | da) + blocks[15] : any +>((c & d) | (c & a) | da) : number +>(c & d) | (c & a) | da : number +>(c & d) | (c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[0] + 1859775393; +>a += (bc ^ d) + blocks[0] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[0] + 1859775393 : any +>(bc ^ d) + blocks[0] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[8] + 1859775393; +>d += (bc ^ a) + blocks[8] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[8] + 1859775393 : any +>(bc ^ a) + blocks[8] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[4] + 1859775393; +>c += (da ^ b) + blocks[4] + 1859775393 : any +>c : number +>(da ^ b) + blocks[4] + 1859775393 : any +>(da ^ b) + blocks[4] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[12] + 1859775393; +>b += (da ^ c) + blocks[12] + 1859775393 : any +>b : number +>(da ^ c) + blocks[12] + 1859775393 : any +>(da ^ c) + blocks[12] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[2] + 1859775393; +>a += (bc ^ d) + blocks[2] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[2] + 1859775393 : any +>(bc ^ d) + blocks[2] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[10] + 1859775393; +>d += (bc ^ a) + blocks[10] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[10] + 1859775393 : any +>(bc ^ a) + blocks[10] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[6] + 1859775393; +>c += (da ^ b) + blocks[6] + 1859775393 : any +>c : number +>(da ^ b) + blocks[6] + 1859775393 : any +>(da ^ b) + blocks[6] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[14] + 1859775393; +>b += (da ^ c) + blocks[14] + 1859775393 : any +>b : number +>(da ^ c) + blocks[14] + 1859775393 : any +>(da ^ c) + blocks[14] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[1] + 1859775393; +>a += (bc ^ d) + blocks[1] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[1] + 1859775393 : any +>(bc ^ d) + blocks[1] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[9] + 1859775393; +>d += (bc ^ a) + blocks[9] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[9] + 1859775393 : any +>(bc ^ a) + blocks[9] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[5] + 1859775393; +>c += (da ^ b) + blocks[5] + 1859775393 : any +>c : number +>(da ^ b) + blocks[5] + 1859775393 : any +>(da ^ b) + blocks[5] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[13] + 1859775393; +>b += (da ^ c) + blocks[13] + 1859775393 : any +>b : number +>(da ^ c) + blocks[13] + 1859775393 : any +>(da ^ c) + blocks[13] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[3] + 1859775393; +>a += (bc ^ d) + blocks[3] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[3] + 1859775393 : any +>(bc ^ d) + blocks[3] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[11] + 1859775393; +>d += (bc ^ a) + blocks[11] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[11] + 1859775393 : any +>(bc ^ a) + blocks[11] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[7] + 1859775393; +>c += (da ^ b) + blocks[7] + 1859775393 : any +>c : number +>(da ^ b) + blocks[7] + 1859775393 : any +>(da ^ b) + blocks[7] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[15] + 1859775393; +>b += (da ^ c) + blocks[15] + 1859775393 : any +>b : number +>(da ^ c) + blocks[15] + 1859775393 : any +>(da ^ c) + blocks[15] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + a += ((b & c) | (~b & d)) + blocks[4]; +>a += ((b & c) | (~b & d)) + blocks[4] : any +>a : number +>((b & c) | (~b & d)) + blocks[4] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[4] : any +>blocks : any +>4 : 4 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[5]; +>d += ((a & b) | (~a & c)) + blocks[5] : any +>d : number +>((a & b) | (~a & c)) + blocks[5] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[5] : any +>blocks : any +>5 : 5 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[6]; +>c += ((d & a) | (~d & b)) + blocks[6] : any +>c : number +>((d & a) | (~d & b)) + blocks[6] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[7]; +>b += ((c & d) | (~c & a)) + blocks[7] : any +>b : number +>((c & d) | (~c & a)) + blocks[7] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[7] : any +>blocks : any +>7 : 7 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[8]; +>a += ((b & c) | (~b & d)) + blocks[8] : any +>a : number +>((b & c) | (~b & d)) + blocks[8] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[8] : any +>blocks : any +>8 : 8 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[9]; +>d += ((a & b) | (~a & c)) + blocks[9] : any +>d : number +>((a & b) | (~a & c)) + blocks[9] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[9] : any +>blocks : any +>9 : 9 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[10]; +>c += ((d & a) | (~d & b)) + blocks[10] : any +>c : number +>((d & a) | (~d & b)) + blocks[10] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[10] : any +>blocks : any +>10 : 10 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[11]; +>b += ((c & d) | (~c & a)) + blocks[11] : any +>b : number +>((c & d) | (~c & a)) + blocks[11] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[12]; +>a += ((b & c) | (~b & d)) + blocks[12] : any +>a : number +>((b & c) | (~b & d)) + blocks[12] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[12] : any +>blocks : any +>12 : 12 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[13]; +>d += ((a & b) | (~a & c)) + blocks[13] : any +>d : number +>((a & b) | (~a & c)) + blocks[13] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[14]; +>c += ((d & a) | (~d & b)) + blocks[14] : any +>c : number +>((d & a) | (~d & b)) + blocks[14] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[14] : any +>blocks : any +>14 : 14 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[15]; +>b += ((c & d) | (~c & a)) + blocks[15] : any +>b : number +>((c & d) | (~c & a)) + blocks[15] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[15] : any +>blocks : any +>15 : 15 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>a : number +>(bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>(bc | (b & d) | (c & d)) + blocks[0] : any +>(bc | (b & d) | (c & d)) : number +>bc | (b & d) | (c & d) : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[4] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c += (da | (d & b) | ab) + blocks[8] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[8] + 1518500249 : any +>(da | (d & b) | ab) + blocks[8] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b += (cd | (c & a) | da) + blocks[12] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[12] + 1518500249 : any +>(cd | (c & a) | da) + blocks[12] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[1] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[5] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c += (da | (d & b) | ab) + blocks[9] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[9] + 1518500249 : any +>(da | (d & b) | ab) + blocks[9] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b += (cd | (c & a) | da) + blocks[13] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[13] + 1518500249 : any +>(cd | (c & a) | da) + blocks[13] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[2] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[6] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c += (da | (d & b) | ab) + blocks[10] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[10] + 1518500249 : any +>(da | (d & b) | ab) + blocks[10] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b += (cd | (c & a) | da) + blocks[14] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[14] + 1518500249 : any +>(cd | (c & a) | da) + blocks[14] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[3] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[7] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c += (da | (d & b) | ab) + blocks[11] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[11] + 1518500249 : any +>(da | (d & b) | ab) + blocks[11] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>b : number +>((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>((c & d) | (c & a) | da) + blocks[15] : any +>((c & d) | (c & a) | da) : number +>(c & d) | (c & a) | da : number +>(c & d) | (c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[0] + 1859775393; +>a += (bc ^ d) + blocks[0] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[0] + 1859775393 : any +>(bc ^ d) + blocks[0] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[8] + 1859775393; +>d += (bc ^ a) + blocks[8] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[8] + 1859775393 : any +>(bc ^ a) + blocks[8] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[4] + 1859775393; +>c += (da ^ b) + blocks[4] + 1859775393 : any +>c : number +>(da ^ b) + blocks[4] + 1859775393 : any +>(da ^ b) + blocks[4] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[12] + 1859775393; +>b += (da ^ c) + blocks[12] + 1859775393 : any +>b : number +>(da ^ c) + blocks[12] + 1859775393 : any +>(da ^ c) + blocks[12] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[2] + 1859775393; +>a += (bc ^ d) + blocks[2] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[2] + 1859775393 : any +>(bc ^ d) + blocks[2] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[10] + 1859775393; +>d += (bc ^ a) + blocks[10] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[10] + 1859775393 : any +>(bc ^ a) + blocks[10] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[6] + 1859775393; +>c += (da ^ b) + blocks[6] + 1859775393 : any +>c : number +>(da ^ b) + blocks[6] + 1859775393 : any +>(da ^ b) + blocks[6] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[14] + 1859775393; +>b += (da ^ c) + blocks[14] + 1859775393 : any +>b : number +>(da ^ c) + blocks[14] + 1859775393 : any +>(da ^ c) + blocks[14] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[1] + 1859775393; +>a += (bc ^ d) + blocks[1] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[1] + 1859775393 : any +>(bc ^ d) + blocks[1] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[9] + 1859775393; +>d += (bc ^ a) + blocks[9] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[9] + 1859775393 : any +>(bc ^ a) + blocks[9] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[5] + 1859775393; +>c += (da ^ b) + blocks[5] + 1859775393 : any +>c : number +>(da ^ b) + blocks[5] + 1859775393 : any +>(da ^ b) + blocks[5] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[13] + 1859775393; +>b += (da ^ c) + blocks[13] + 1859775393 : any +>b : number +>(da ^ c) + blocks[13] + 1859775393 : any +>(da ^ c) + blocks[13] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[3] + 1859775393; +>a += (bc ^ d) + blocks[3] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[3] + 1859775393 : any +>(bc ^ d) + blocks[3] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[11] + 1859775393; +>d += (bc ^ a) + blocks[11] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[11] + 1859775393 : any +>(bc ^ a) + blocks[11] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[7] + 1859775393; +>c += (da ^ b) + blocks[7] + 1859775393 : any +>c : number +>(da ^ b) + blocks[7] + 1859775393 : any +>(da ^ b) + blocks[7] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[15] + 1859775393; +>b += (da ^ c) + blocks[15] + 1859775393 : any +>b : number +>(da ^ c) + blocks[15] + 1859775393 : any +>(da ^ c) + blocks[15] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + a += ((b & c) | (~b & d)) + blocks[4]; +>a += ((b & c) | (~b & d)) + blocks[4] : any +>a : number +>((b & c) | (~b & d)) + blocks[4] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[4] : any +>blocks : any +>4 : 4 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[5]; +>d += ((a & b) | (~a & c)) + blocks[5] : any +>d : number +>((a & b) | (~a & c)) + blocks[5] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[5] : any +>blocks : any +>5 : 5 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[6]; +>c += ((d & a) | (~d & b)) + blocks[6] : any +>c : number +>((d & a) | (~d & b)) + blocks[6] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[7]; +>b += ((c & d) | (~c & a)) + blocks[7] : any +>b : number +>((c & d) | (~c & a)) + blocks[7] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[7] : any +>blocks : any +>7 : 7 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[8]; +>a += ((b & c) | (~b & d)) + blocks[8] : any +>a : number +>((b & c) | (~b & d)) + blocks[8] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[8] : any +>blocks : any +>8 : 8 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[9]; +>d += ((a & b) | (~a & c)) + blocks[9] : any +>d : number +>((a & b) | (~a & c)) + blocks[9] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[9] : any +>blocks : any +>9 : 9 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[10]; +>c += ((d & a) | (~d & b)) + blocks[10] : any +>c : number +>((d & a) | (~d & b)) + blocks[10] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[10] : any +>blocks : any +>10 : 10 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[11]; +>b += ((c & d) | (~c & a)) + blocks[11] : any +>b : number +>((c & d) | (~c & a)) + blocks[11] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[12]; +>a += ((b & c) | (~b & d)) + blocks[12] : any +>a : number +>((b & c) | (~b & d)) + blocks[12] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[12] : any +>blocks : any +>12 : 12 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[13]; +>d += ((a & b) | (~a & c)) + blocks[13] : any +>d : number +>((a & b) | (~a & c)) + blocks[13] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[14]; +>c += ((d & a) | (~d & b)) + blocks[14] : any +>c : number +>((d & a) | (~d & b)) + blocks[14] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[14] : any +>blocks : any +>14 : 14 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[15]; +>b += ((c & d) | (~c & a)) + blocks[15] : any +>b : number +>((c & d) | (~c & a)) + blocks[15] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[15] : any +>blocks : any +>15 : 15 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>a : number +>(bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>(bc | (b & d) | (c & d)) + blocks[0] : any +>(bc | (b & d) | (c & d)) : number +>bc | (b & d) | (c & d) : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[4] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c += (da | (d & b) | ab) + blocks[8] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[8] + 1518500249 : any +>(da | (d & b) | ab) + blocks[8] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b += (cd | (c & a) | da) + blocks[12] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[12] + 1518500249 : any +>(cd | (c & a) | da) + blocks[12] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[1] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[5] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c += (da | (d & b) | ab) + blocks[9] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[9] + 1518500249 : any +>(da | (d & b) | ab) + blocks[9] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b += (cd | (c & a) | da) + blocks[13] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[13] + 1518500249 : any +>(cd | (c & a) | da) + blocks[13] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[2] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[6] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c += (da | (d & b) | ab) + blocks[10] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[10] + 1518500249 : any +>(da | (d & b) | ab) + blocks[10] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b += (cd | (c & a) | da) + blocks[14] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[14] + 1518500249 : any +>(cd | (c & a) | da) + blocks[14] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[3] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[7] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c += (da | (d & b) | ab) + blocks[11] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[11] + 1518500249 : any +>(da | (d & b) | ab) + blocks[11] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>b : number +>((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>((c & d) | (c & a) | da) + blocks[15] : any +>((c & d) | (c & a) | da) : number +>(c & d) | (c & a) | da : number +>(c & d) | (c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[0] + 1859775393; +>a += (bc ^ d) + blocks[0] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[0] + 1859775393 : any +>(bc ^ d) + blocks[0] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[8] + 1859775393; +>d += (bc ^ a) + blocks[8] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[8] + 1859775393 : any +>(bc ^ a) + blocks[8] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[4] + 1859775393; +>c += (da ^ b) + blocks[4] + 1859775393 : any +>c : number +>(da ^ b) + blocks[4] + 1859775393 : any +>(da ^ b) + blocks[4] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[12] + 1859775393; +>b += (da ^ c) + blocks[12] + 1859775393 : any +>b : number +>(da ^ c) + blocks[12] + 1859775393 : any +>(da ^ c) + blocks[12] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[2] + 1859775393; +>a += (bc ^ d) + blocks[2] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[2] + 1859775393 : any +>(bc ^ d) + blocks[2] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[10] + 1859775393; +>d += (bc ^ a) + blocks[10] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[10] + 1859775393 : any +>(bc ^ a) + blocks[10] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[6] + 1859775393; +>c += (da ^ b) + blocks[6] + 1859775393 : any +>c : number +>(da ^ b) + blocks[6] + 1859775393 : any +>(da ^ b) + blocks[6] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[14] + 1859775393; +>b += (da ^ c) + blocks[14] + 1859775393 : any +>b : number +>(da ^ c) + blocks[14] + 1859775393 : any +>(da ^ c) + blocks[14] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[1] + 1859775393; +>a += (bc ^ d) + blocks[1] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[1] + 1859775393 : any +>(bc ^ d) + blocks[1] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[9] + 1859775393; +>d += (bc ^ a) + blocks[9] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[9] + 1859775393 : any +>(bc ^ a) + blocks[9] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[5] + 1859775393; +>c += (da ^ b) + blocks[5] + 1859775393 : any +>c : number +>(da ^ b) + blocks[5] + 1859775393 : any +>(da ^ b) + blocks[5] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[13] + 1859775393; +>b += (da ^ c) + blocks[13] + 1859775393 : any +>b : number +>(da ^ c) + blocks[13] + 1859775393 : any +>(da ^ c) + blocks[13] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[3] + 1859775393; +>a += (bc ^ d) + blocks[3] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[3] + 1859775393 : any +>(bc ^ d) + blocks[3] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[11] + 1859775393; +>d += (bc ^ a) + blocks[11] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[11] + 1859775393 : any +>(bc ^ a) + blocks[11] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[7] + 1859775393; +>c += (da ^ b) + blocks[7] + 1859775393 : any +>c : number +>(da ^ b) + blocks[7] + 1859775393 : any +>(da ^ b) + blocks[7] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[15] + 1859775393; +>b += (da ^ c) + blocks[15] + 1859775393 : any +>b : number +>(da ^ c) + blocks[15] + 1859775393 : any +>(da ^ c) + blocks[15] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + a += ((b & c) | (~b & d)) + blocks[4]; +>a += ((b & c) | (~b & d)) + blocks[4] : any +>a : number +>((b & c) | (~b & d)) + blocks[4] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[4] : any +>blocks : any +>4 : 4 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[5]; +>d += ((a & b) | (~a & c)) + blocks[5] : any +>d : number +>((a & b) | (~a & c)) + blocks[5] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[5] : any +>blocks : any +>5 : 5 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[6]; +>c += ((d & a) | (~d & b)) + blocks[6] : any +>c : number +>((d & a) | (~d & b)) + blocks[6] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[7]; +>b += ((c & d) | (~c & a)) + blocks[7] : any +>b : number +>((c & d) | (~c & a)) + blocks[7] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[7] : any +>blocks : any +>7 : 7 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[8]; +>a += ((b & c) | (~b & d)) + blocks[8] : any +>a : number +>((b & c) | (~b & d)) + blocks[8] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[8] : any +>blocks : any +>8 : 8 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[9]; +>d += ((a & b) | (~a & c)) + blocks[9] : any +>d : number +>((a & b) | (~a & c)) + blocks[9] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[9] : any +>blocks : any +>9 : 9 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[10]; +>c += ((d & a) | (~d & b)) + blocks[10] : any +>c : number +>((d & a) | (~d & b)) + blocks[10] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[10] : any +>blocks : any +>10 : 10 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[11]; +>b += ((c & d) | (~c & a)) + blocks[11] : any +>b : number +>((c & d) | (~c & a)) + blocks[11] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[12]; +>a += ((b & c) | (~b & d)) + blocks[12] : any +>a : number +>((b & c) | (~b & d)) + blocks[12] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[12] : any +>blocks : any +>12 : 12 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[13]; +>d += ((a & b) | (~a & c)) + blocks[13] : any +>d : number +>((a & b) | (~a & c)) + blocks[13] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[14]; +>c += ((d & a) | (~d & b)) + blocks[14] : any +>c : number +>((d & a) | (~d & b)) + blocks[14] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[14] : any +>blocks : any +>14 : 14 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[15]; +>b += ((c & d) | (~c & a)) + blocks[15] : any +>b : number +>((c & d) | (~c & a)) + blocks[15] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[15] : any +>blocks : any +>15 : 15 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>a : number +>(bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>(bc | (b & d) | (c & d)) + blocks[0] : any +>(bc | (b & d) | (c & d)) : number +>bc | (b & d) | (c & d) : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[4] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c += (da | (d & b) | ab) + blocks[8] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[8] + 1518500249 : any +>(da | (d & b) | ab) + blocks[8] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b += (cd | (c & a) | da) + blocks[12] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[12] + 1518500249 : any +>(cd | (c & a) | da) + blocks[12] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[1] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[5] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c += (da | (d & b) | ab) + blocks[9] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[9] + 1518500249 : any +>(da | (d & b) | ab) + blocks[9] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b += (cd | (c & a) | da) + blocks[13] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[13] + 1518500249 : any +>(cd | (c & a) | da) + blocks[13] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[2] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[6] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c += (da | (d & b) | ab) + blocks[10] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[10] + 1518500249 : any +>(da | (d & b) | ab) + blocks[10] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b += (cd | (c & a) | da) + blocks[14] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[14] + 1518500249 : any +>(cd | (c & a) | da) + blocks[14] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[3] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[7] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c += (da | (d & b) | ab) + blocks[11] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[11] + 1518500249 : any +>(da | (d & b) | ab) + blocks[11] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>b : number +>((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>((c & d) | (c & a) | da) + blocks[15] : any +>((c & d) | (c & a) | da) : number +>(c & d) | (c & a) | da : number +>(c & d) | (c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[0] + 1859775393; +>a += (bc ^ d) + blocks[0] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[0] + 1859775393 : any +>(bc ^ d) + blocks[0] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[8] + 1859775393; +>d += (bc ^ a) + blocks[8] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[8] + 1859775393 : any +>(bc ^ a) + blocks[8] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[4] + 1859775393; +>c += (da ^ b) + blocks[4] + 1859775393 : any +>c : number +>(da ^ b) + blocks[4] + 1859775393 : any +>(da ^ b) + blocks[4] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[12] + 1859775393; +>b += (da ^ c) + blocks[12] + 1859775393 : any +>b : number +>(da ^ c) + blocks[12] + 1859775393 : any +>(da ^ c) + blocks[12] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[2] + 1859775393; +>a += (bc ^ d) + blocks[2] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[2] + 1859775393 : any +>(bc ^ d) + blocks[2] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[10] + 1859775393; +>d += (bc ^ a) + blocks[10] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[10] + 1859775393 : any +>(bc ^ a) + blocks[10] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[6] + 1859775393; +>c += (da ^ b) + blocks[6] + 1859775393 : any +>c : number +>(da ^ b) + blocks[6] + 1859775393 : any +>(da ^ b) + blocks[6] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[14] + 1859775393; +>b += (da ^ c) + blocks[14] + 1859775393 : any +>b : number +>(da ^ c) + blocks[14] + 1859775393 : any +>(da ^ c) + blocks[14] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[1] + 1859775393; +>a += (bc ^ d) + blocks[1] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[1] + 1859775393 : any +>(bc ^ d) + blocks[1] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[9] + 1859775393; +>d += (bc ^ a) + blocks[9] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[9] + 1859775393 : any +>(bc ^ a) + blocks[9] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[5] + 1859775393; +>c += (da ^ b) + blocks[5] + 1859775393 : any +>c : number +>(da ^ b) + blocks[5] + 1859775393 : any +>(da ^ b) + blocks[5] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[13] + 1859775393; +>b += (da ^ c) + blocks[13] + 1859775393 : any +>b : number +>(da ^ c) + blocks[13] + 1859775393 : any +>(da ^ c) + blocks[13] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[3] + 1859775393; +>a += (bc ^ d) + blocks[3] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[3] + 1859775393 : any +>(bc ^ d) + blocks[3] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[11] + 1859775393; +>d += (bc ^ a) + blocks[11] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[11] + 1859775393 : any +>(bc ^ a) + blocks[11] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[7] + 1859775393; +>c += (da ^ b) + blocks[7] + 1859775393 : any +>c : number +>(da ^ b) + blocks[7] + 1859775393 : any +>(da ^ b) + blocks[7] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[15] + 1859775393; +>b += (da ^ c) + blocks[15] + 1859775393 : any +>b : number +>(da ^ c) + blocks[15] + 1859775393 : any +>(da ^ c) + blocks[15] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + a += ((b & c) | (~b & d)) + blocks[4]; +>a += ((b & c) | (~b & d)) + blocks[4] : any +>a : number +>((b & c) | (~b & d)) + blocks[4] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[4] : any +>blocks : any +>4 : 4 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[5]; +>d += ((a & b) | (~a & c)) + blocks[5] : any +>d : number +>((a & b) | (~a & c)) + blocks[5] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[5] : any +>blocks : any +>5 : 5 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[6]; +>c += ((d & a) | (~d & b)) + blocks[6] : any +>c : number +>((d & a) | (~d & b)) + blocks[6] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[7]; +>b += ((c & d) | (~c & a)) + blocks[7] : any +>b : number +>((c & d) | (~c & a)) + blocks[7] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[7] : any +>blocks : any +>7 : 7 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[8]; +>a += ((b & c) | (~b & d)) + blocks[8] : any +>a : number +>((b & c) | (~b & d)) + blocks[8] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[8] : any +>blocks : any +>8 : 8 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[9]; +>d += ((a & b) | (~a & c)) + blocks[9] : any +>d : number +>((a & b) | (~a & c)) + blocks[9] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[9] : any +>blocks : any +>9 : 9 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[10]; +>c += ((d & a) | (~d & b)) + blocks[10] : any +>c : number +>((d & a) | (~d & b)) + blocks[10] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[10] : any +>blocks : any +>10 : 10 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[11]; +>b += ((c & d) | (~c & a)) + blocks[11] : any +>b : number +>((c & d) | (~c & a)) + blocks[11] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[12]; +>a += ((b & c) | (~b & d)) + blocks[12] : any +>a : number +>((b & c) | (~b & d)) + blocks[12] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[12] : any +>blocks : any +>12 : 12 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[13]; +>d += ((a & b) | (~a & c)) + blocks[13] : any +>d : number +>((a & b) | (~a & c)) + blocks[13] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[14]; +>c += ((d & a) | (~d & b)) + blocks[14] : any +>c : number +>((d & a) | (~d & b)) + blocks[14] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[14] : any +>blocks : any +>14 : 14 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[15]; +>b += ((c & d) | (~c & a)) + blocks[15] : any +>b : number +>((c & d) | (~c & a)) + blocks[15] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[15] : any +>blocks : any +>15 : 15 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>a : number +>(bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>(bc | (b & d) | (c & d)) + blocks[0] : any +>(bc | (b & d) | (c & d)) : number +>bc | (b & d) | (c & d) : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[4] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c += (da | (d & b) | ab) + blocks[8] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[8] + 1518500249 : any +>(da | (d & b) | ab) + blocks[8] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b += (cd | (c & a) | da) + blocks[12] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[12] + 1518500249 : any +>(cd | (c & a) | da) + blocks[12] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[1] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[5] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c += (da | (d & b) | ab) + blocks[9] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[9] + 1518500249 : any +>(da | (d & b) | ab) + blocks[9] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b += (cd | (c & a) | da) + blocks[13] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[13] + 1518500249 : any +>(cd | (c & a) | da) + blocks[13] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[2] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[6] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c += (da | (d & b) | ab) + blocks[10] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[10] + 1518500249 : any +>(da | (d & b) | ab) + blocks[10] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b += (cd | (c & a) | da) + blocks[14] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[14] + 1518500249 : any +>(cd | (c & a) | da) + blocks[14] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[3] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[7] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c += (da | (d & b) | ab) + blocks[11] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[11] + 1518500249 : any +>(da | (d & b) | ab) + blocks[11] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>b : number +>((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>((c & d) | (c & a) | da) + blocks[15] : any +>((c & d) | (c & a) | da) : number +>(c & d) | (c & a) | da : number +>(c & d) | (c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[0] + 1859775393; +>a += (bc ^ d) + blocks[0] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[0] + 1859775393 : any +>(bc ^ d) + blocks[0] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[8] + 1859775393; +>d += (bc ^ a) + blocks[8] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[8] + 1859775393 : any +>(bc ^ a) + blocks[8] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[4] + 1859775393; +>c += (da ^ b) + blocks[4] + 1859775393 : any +>c : number +>(da ^ b) + blocks[4] + 1859775393 : any +>(da ^ b) + blocks[4] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[12] + 1859775393; +>b += (da ^ c) + blocks[12] + 1859775393 : any +>b : number +>(da ^ c) + blocks[12] + 1859775393 : any +>(da ^ c) + blocks[12] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[2] + 1859775393; +>a += (bc ^ d) + blocks[2] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[2] + 1859775393 : any +>(bc ^ d) + blocks[2] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[10] + 1859775393; +>d += (bc ^ a) + blocks[10] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[10] + 1859775393 : any +>(bc ^ a) + blocks[10] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[6] + 1859775393; +>c += (da ^ b) + blocks[6] + 1859775393 : any +>c : number +>(da ^ b) + blocks[6] + 1859775393 : any +>(da ^ b) + blocks[6] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[14] + 1859775393; +>b += (da ^ c) + blocks[14] + 1859775393 : any +>b : number +>(da ^ c) + blocks[14] + 1859775393 : any +>(da ^ c) + blocks[14] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[1] + 1859775393; +>a += (bc ^ d) + blocks[1] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[1] + 1859775393 : any +>(bc ^ d) + blocks[1] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[9] + 1859775393; +>d += (bc ^ a) + blocks[9] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[9] + 1859775393 : any +>(bc ^ a) + blocks[9] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[5] + 1859775393; +>c += (da ^ b) + blocks[5] + 1859775393 : any +>c : number +>(da ^ b) + blocks[5] + 1859775393 : any +>(da ^ b) + blocks[5] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[13] + 1859775393; +>b += (da ^ c) + blocks[13] + 1859775393 : any +>b : number +>(da ^ c) + blocks[13] + 1859775393 : any +>(da ^ c) + blocks[13] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[3] + 1859775393; +>a += (bc ^ d) + blocks[3] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[3] + 1859775393 : any +>(bc ^ d) + blocks[3] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[11] + 1859775393; +>d += (bc ^ a) + blocks[11] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[11] + 1859775393 : any +>(bc ^ a) + blocks[11] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[7] + 1859775393; +>c += (da ^ b) + blocks[7] + 1859775393 : any +>c : number +>(da ^ b) + blocks[7] + 1859775393 : any +>(da ^ b) + blocks[7] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[15] + 1859775393; +>b += (da ^ c) + blocks[15] + 1859775393 : any +>b : number +>(da ^ c) + blocks[15] + 1859775393 : any +>(da ^ c) + blocks[15] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + a += ((b & c) | (~b & d)) + blocks[4]; +>a += ((b & c) | (~b & d)) + blocks[4] : any +>a : number +>((b & c) | (~b & d)) + blocks[4] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[4] : any +>blocks : any +>4 : 4 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[5]; +>d += ((a & b) | (~a & c)) + blocks[5] : any +>d : number +>((a & b) | (~a & c)) + blocks[5] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[5] : any +>blocks : any +>5 : 5 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[6]; +>c += ((d & a) | (~d & b)) + blocks[6] : any +>c : number +>((d & a) | (~d & b)) + blocks[6] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[7]; +>b += ((c & d) | (~c & a)) + blocks[7] : any +>b : number +>((c & d) | (~c & a)) + blocks[7] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[7] : any +>blocks : any +>7 : 7 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[8]; +>a += ((b & c) | (~b & d)) + blocks[8] : any +>a : number +>((b & c) | (~b & d)) + blocks[8] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[8] : any +>blocks : any +>8 : 8 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[9]; +>d += ((a & b) | (~a & c)) + blocks[9] : any +>d : number +>((a & b) | (~a & c)) + blocks[9] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[9] : any +>blocks : any +>9 : 9 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[10]; +>c += ((d & a) | (~d & b)) + blocks[10] : any +>c : number +>((d & a) | (~d & b)) + blocks[10] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[10] : any +>blocks : any +>10 : 10 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[11]; +>b += ((c & d) | (~c & a)) + blocks[11] : any +>b : number +>((c & d) | (~c & a)) + blocks[11] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[12]; +>a += ((b & c) | (~b & d)) + blocks[12] : any +>a : number +>((b & c) | (~b & d)) + blocks[12] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[12] : any +>blocks : any +>12 : 12 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[13]; +>d += ((a & b) | (~a & c)) + blocks[13] : any +>d : number +>((a & b) | (~a & c)) + blocks[13] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[14]; +>c += ((d & a) | (~d & b)) + blocks[14] : any +>c : number +>((d & a) | (~d & b)) + blocks[14] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[14] : any +>blocks : any +>14 : 14 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[15]; +>b += ((c & d) | (~c & a)) + blocks[15] : any +>b : number +>((c & d) | (~c & a)) + blocks[15] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[15] : any +>blocks : any +>15 : 15 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>a : number +>(bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>(bc | (b & d) | (c & d)) + blocks[0] : any +>(bc | (b & d) | (c & d)) : number +>bc | (b & d) | (c & d) : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[4] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c += (da | (d & b) | ab) + blocks[8] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[8] + 1518500249 : any +>(da | (d & b) | ab) + blocks[8] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b += (cd | (c & a) | da) + blocks[12] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[12] + 1518500249 : any +>(cd | (c & a) | da) + blocks[12] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[1] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[5] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c += (da | (d & b) | ab) + blocks[9] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[9] + 1518500249 : any +>(da | (d & b) | ab) + blocks[9] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b += (cd | (c & a) | da) + blocks[13] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[13] + 1518500249 : any +>(cd | (c & a) | da) + blocks[13] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[2] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[6] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c += (da | (d & b) | ab) + blocks[10] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[10] + 1518500249 : any +>(da | (d & b) | ab) + blocks[10] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b += (cd | (c & a) | da) + blocks[14] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[14] + 1518500249 : any +>(cd | (c & a) | da) + blocks[14] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[3] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[7] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c += (da | (d & b) | ab) + blocks[11] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[11] + 1518500249 : any +>(da | (d & b) | ab) + blocks[11] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>b : number +>((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>((c & d) | (c & a) | da) + blocks[15] : any +>((c & d) | (c & a) | da) : number +>(c & d) | (c & a) | da : number +>(c & d) | (c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[0] + 1859775393; +>a += (bc ^ d) + blocks[0] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[0] + 1859775393 : any +>(bc ^ d) + blocks[0] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[8] + 1859775393; +>d += (bc ^ a) + blocks[8] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[8] + 1859775393 : any +>(bc ^ a) + blocks[8] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[4] + 1859775393; +>c += (da ^ b) + blocks[4] + 1859775393 : any +>c : number +>(da ^ b) + blocks[4] + 1859775393 : any +>(da ^ b) + blocks[4] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[12] + 1859775393; +>b += (da ^ c) + blocks[12] + 1859775393 : any +>b : number +>(da ^ c) + blocks[12] + 1859775393 : any +>(da ^ c) + blocks[12] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[2] + 1859775393; +>a += (bc ^ d) + blocks[2] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[2] + 1859775393 : any +>(bc ^ d) + blocks[2] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[10] + 1859775393; +>d += (bc ^ a) + blocks[10] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[10] + 1859775393 : any +>(bc ^ a) + blocks[10] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[6] + 1859775393; +>c += (da ^ b) + blocks[6] + 1859775393 : any +>c : number +>(da ^ b) + blocks[6] + 1859775393 : any +>(da ^ b) + blocks[6] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[14] + 1859775393; +>b += (da ^ c) + blocks[14] + 1859775393 : any +>b : number +>(da ^ c) + blocks[14] + 1859775393 : any +>(da ^ c) + blocks[14] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[1] + 1859775393; +>a += (bc ^ d) + blocks[1] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[1] + 1859775393 : any +>(bc ^ d) + blocks[1] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[9] + 1859775393; +>d += (bc ^ a) + blocks[9] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[9] + 1859775393 : any +>(bc ^ a) + blocks[9] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[5] + 1859775393; +>c += (da ^ b) + blocks[5] + 1859775393 : any +>c : number +>(da ^ b) + blocks[5] + 1859775393 : any +>(da ^ b) + blocks[5] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[13] + 1859775393; +>b += (da ^ c) + blocks[13] + 1859775393 : any +>b : number +>(da ^ c) + blocks[13] + 1859775393 : any +>(da ^ c) + blocks[13] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[3] + 1859775393; +>a += (bc ^ d) + blocks[3] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[3] + 1859775393 : any +>(bc ^ d) + blocks[3] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[11] + 1859775393; +>d += (bc ^ a) + blocks[11] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[11] + 1859775393 : any +>(bc ^ a) + blocks[11] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[7] + 1859775393; +>c += (da ^ b) + blocks[7] + 1859775393 : any +>c : number +>(da ^ b) + blocks[7] + 1859775393 : any +>(da ^ b) + blocks[7] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[15] + 1859775393; +>b += (da ^ c) + blocks[15] + 1859775393 : any +>b : number +>(da ^ c) + blocks[15] + 1859775393 : any +>(da ^ c) + blocks[15] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + a += ((b & c) | (~b & d)) + blocks[4]; +>a += ((b & c) | (~b & d)) + blocks[4] : any +>a : number +>((b & c) | (~b & d)) + blocks[4] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[4] : any +>blocks : any +>4 : 4 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[5]; +>d += ((a & b) | (~a & c)) + blocks[5] : any +>d : number +>((a & b) | (~a & c)) + blocks[5] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[5] : any +>blocks : any +>5 : 5 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[6]; +>c += ((d & a) | (~d & b)) + blocks[6] : any +>c : number +>((d & a) | (~d & b)) + blocks[6] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[7]; +>b += ((c & d) | (~c & a)) + blocks[7] : any +>b : number +>((c & d) | (~c & a)) + blocks[7] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[7] : any +>blocks : any +>7 : 7 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[8]; +>a += ((b & c) | (~b & d)) + blocks[8] : any +>a : number +>((b & c) | (~b & d)) + blocks[8] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[8] : any +>blocks : any +>8 : 8 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[9]; +>d += ((a & b) | (~a & c)) + blocks[9] : any +>d : number +>((a & b) | (~a & c)) + blocks[9] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[9] : any +>blocks : any +>9 : 9 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[10]; +>c += ((d & a) | (~d & b)) + blocks[10] : any +>c : number +>((d & a) | (~d & b)) + blocks[10] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[10] : any +>blocks : any +>10 : 10 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[11]; +>b += ((c & d) | (~c & a)) + blocks[11] : any +>b : number +>((c & d) | (~c & a)) + blocks[11] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[12]; +>a += ((b & c) | (~b & d)) + blocks[12] : any +>a : number +>((b & c) | (~b & d)) + blocks[12] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[12] : any +>blocks : any +>12 : 12 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[13]; +>d += ((a & b) | (~a & c)) + blocks[13] : any +>d : number +>((a & b) | (~a & c)) + blocks[13] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[14]; +>c += ((d & a) | (~d & b)) + blocks[14] : any +>c : number +>((d & a) | (~d & b)) + blocks[14] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[14] : any +>blocks : any +>14 : 14 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[15]; +>b += ((c & d) | (~c & a)) + blocks[15] : any +>b : number +>((c & d) | (~c & a)) + blocks[15] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[15] : any +>blocks : any +>15 : 15 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>a : number +>(bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>(bc | (b & d) | (c & d)) + blocks[0] : any +>(bc | (b & d) | (c & d)) : number +>bc | (b & d) | (c & d) : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[4] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c += (da | (d & b) | ab) + blocks[8] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[8] + 1518500249 : any +>(da | (d & b) | ab) + blocks[8] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b += (cd | (c & a) | da) + blocks[12] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[12] + 1518500249 : any +>(cd | (c & a) | da) + blocks[12] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[1] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[5] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c += (da | (d & b) | ab) + blocks[9] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[9] + 1518500249 : any +>(da | (d & b) | ab) + blocks[9] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b += (cd | (c & a) | da) + blocks[13] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[13] + 1518500249 : any +>(cd | (c & a) | da) + blocks[13] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[2] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[6] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c += (da | (d & b) | ab) + blocks[10] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[10] + 1518500249 : any +>(da | (d & b) | ab) + blocks[10] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b += (cd | (c & a) | da) + blocks[14] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[14] + 1518500249 : any +>(cd | (c & a) | da) + blocks[14] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[3] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[7] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c += (da | (d & b) | ab) + blocks[11] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[11] + 1518500249 : any +>(da | (d & b) | ab) + blocks[11] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>b : number +>((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>((c & d) | (c & a) | da) + blocks[15] : any +>((c & d) | (c & a) | da) : number +>(c & d) | (c & a) | da : number +>(c & d) | (c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[0] + 1859775393; +>a += (bc ^ d) + blocks[0] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[0] + 1859775393 : any +>(bc ^ d) + blocks[0] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[8] + 1859775393; +>d += (bc ^ a) + blocks[8] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[8] + 1859775393 : any +>(bc ^ a) + blocks[8] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[4] + 1859775393; +>c += (da ^ b) + blocks[4] + 1859775393 : any +>c : number +>(da ^ b) + blocks[4] + 1859775393 : any +>(da ^ b) + blocks[4] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[12] + 1859775393; +>b += (da ^ c) + blocks[12] + 1859775393 : any +>b : number +>(da ^ c) + blocks[12] + 1859775393 : any +>(da ^ c) + blocks[12] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[2] + 1859775393; +>a += (bc ^ d) + blocks[2] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[2] + 1859775393 : any +>(bc ^ d) + blocks[2] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[10] + 1859775393; +>d += (bc ^ a) + blocks[10] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[10] + 1859775393 : any +>(bc ^ a) + blocks[10] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[6] + 1859775393; +>c += (da ^ b) + blocks[6] + 1859775393 : any +>c : number +>(da ^ b) + blocks[6] + 1859775393 : any +>(da ^ b) + blocks[6] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[14] + 1859775393; +>b += (da ^ c) + blocks[14] + 1859775393 : any +>b : number +>(da ^ c) + blocks[14] + 1859775393 : any +>(da ^ c) + blocks[14] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[1] + 1859775393; +>a += (bc ^ d) + blocks[1] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[1] + 1859775393 : any +>(bc ^ d) + blocks[1] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[9] + 1859775393; +>d += (bc ^ a) + blocks[9] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[9] + 1859775393 : any +>(bc ^ a) + blocks[9] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[5] + 1859775393; +>c += (da ^ b) + blocks[5] + 1859775393 : any +>c : number +>(da ^ b) + blocks[5] + 1859775393 : any +>(da ^ b) + blocks[5] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[13] + 1859775393; +>b += (da ^ c) + blocks[13] + 1859775393 : any +>b : number +>(da ^ c) + blocks[13] + 1859775393 : any +>(da ^ c) + blocks[13] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[3] + 1859775393; +>a += (bc ^ d) + blocks[3] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[3] + 1859775393 : any +>(bc ^ d) + blocks[3] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[11] + 1859775393; +>d += (bc ^ a) + blocks[11] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[11] + 1859775393 : any +>(bc ^ a) + blocks[11] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[7] + 1859775393; +>c += (da ^ b) + blocks[7] + 1859775393 : any +>c : number +>(da ^ b) + blocks[7] + 1859775393 : any +>(da ^ b) + blocks[7] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[15] + 1859775393; +>b += (da ^ c) + blocks[15] + 1859775393 : any +>b : number +>(da ^ c) + blocks[15] + 1859775393 : any +>(da ^ c) + blocks[15] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + a += ((b & c) | (~b & d)) + blocks[4]; +>a += ((b & c) | (~b & d)) + blocks[4] : any +>a : number +>((b & c) | (~b & d)) + blocks[4] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[4] : any +>blocks : any +>4 : 4 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[5]; +>d += ((a & b) | (~a & c)) + blocks[5] : any +>d : number +>((a & b) | (~a & c)) + blocks[5] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[5] : any +>blocks : any +>5 : 5 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[6]; +>c += ((d & a) | (~d & b)) + blocks[6] : any +>c : number +>((d & a) | (~d & b)) + blocks[6] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[7]; +>b += ((c & d) | (~c & a)) + blocks[7] : any +>b : number +>((c & d) | (~c & a)) + blocks[7] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[7] : any +>blocks : any +>7 : 7 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[8]; +>a += ((b & c) | (~b & d)) + blocks[8] : any +>a : number +>((b & c) | (~b & d)) + blocks[8] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[8] : any +>blocks : any +>8 : 8 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[9]; +>d += ((a & b) | (~a & c)) + blocks[9] : any +>d : number +>((a & b) | (~a & c)) + blocks[9] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[9] : any +>blocks : any +>9 : 9 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[10]; +>c += ((d & a) | (~d & b)) + blocks[10] : any +>c : number +>((d & a) | (~d & b)) + blocks[10] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[10] : any +>blocks : any +>10 : 10 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[11]; +>b += ((c & d) | (~c & a)) + blocks[11] : any +>b : number +>((c & d) | (~c & a)) + blocks[11] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + a += ((b & c) | (~b & d)) + blocks[12]; +>a += ((b & c) | (~b & d)) + blocks[12] : any +>a : number +>((b & c) | (~b & d)) + blocks[12] : any +>((b & c) | (~b & d)) : number +>(b & c) | (~b & d) : number +>(b & c) : number +>b & c : number +>b : number +>c : number +>(~b & d) : number +>~b & d : number +>~b : number +>b : number +>d : number +>blocks[12] : any +>blocks : any +>12 : 12 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += ((a & b) | (~a & c)) + blocks[13]; +>d += ((a & b) | (~a & c)) + blocks[13] : any +>d : number +>((a & b) | (~a & c)) + blocks[13] : any +>((a & b) | (~a & c)) : number +>(a & b) | (~a & c) : number +>(a & b) : number +>a & b : number +>a : number +>b : number +>(~a & c) : number +>~a & c : number +>~a : number +>a : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 + + d = (d << 7) | (d >>> 25); +>d = (d << 7) | (d >>> 25) : number +>d : any +>(d << 7) | (d >>> 25) : number +>(d << 7) : number +>d << 7 : number +>d : number +>7 : 7 +>(d >>> 25) : number +>d >>> 25 : number +>d : number +>25 : 25 + + c += ((d & a) | (~d & b)) + blocks[14]; +>c += ((d & a) | (~d & b)) + blocks[14] : any +>c : number +>((d & a) | (~d & b)) + blocks[14] : any +>((d & a) | (~d & b)) : number +>(d & a) | (~d & b) : number +>(d & a) : number +>d & a : number +>d : number +>a : number +>(~d & b) : number +>~d & b : number +>~d : number +>d : number +>b : number +>blocks[14] : any +>blocks : any +>14 : 14 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += ((c & d) | (~c & a)) + blocks[15]; +>b += ((c & d) | (~c & a)) + blocks[15] : any +>b : number +>((c & d) | (~c & a)) + blocks[15] : any +>((c & d) | (~c & a)) : number +>(c & d) | (~c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(~c & a) : number +>~c & a : number +>~c : number +>c : number +>a : number +>blocks[15] : any +>blocks : any +>15 : 15 + + b = (b << 19) | (b >>> 13); +>b = (b << 19) | (b >>> 13) : number +>b : any +>(b << 19) | (b >>> 13) : number +>(b << 19) : number +>b << 19 : number +>b : number +>19 : 19 +>(b >>> 13) : number +>b >>> 13 : number +>b : number +>13 : 13 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; +>a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>a : number +>(bc | (b & d) | (c & d)) + blocks[0] + 1518500249 : any +>(bc | (b & d) | (c & d)) + blocks[0] : any +>(bc | (b & d) | (c & d)) : number +>bc | (b & d) | (c & d) : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[4] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[4] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[8] + 1518500249; +>c += (da | (d & b) | ab) + blocks[8] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[8] + 1518500249 : any +>(da | (d & b) | ab) + blocks[8] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[12] + 1518500249; +>b += (cd | (c & a) | da) + blocks[12] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[12] + 1518500249 : any +>(cd | (c & a) | da) + blocks[12] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[1] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[1] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[5] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[5] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[9] + 1518500249; +>c += (da | (d & b) | ab) + blocks[9] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[9] + 1518500249 : any +>(da | (d & b) | ab) + blocks[9] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[13] + 1518500249; +>b += (cd | (c & a) | da) + blocks[13] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[13] + 1518500249 : any +>(cd | (c & a) | da) + blocks[13] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[2] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[2] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[6] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[6] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[10] + 1518500249; +>c += (da | (d & b) | ab) + blocks[10] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[10] + 1518500249 : any +>(da | (d & b) | ab) + blocks[10] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + cd = c & d; +>cd = c & d : number +>cd : any +>c & d : number +>c : number +>d : number + + b += (cd | (c & a) | da) + blocks[14] + 1518500249; +>b += (cd | (c & a) | da) + blocks[14] + 1518500249 : any +>b : number +>(cd | (c & a) | da) + blocks[14] + 1518500249 : any +>(cd | (c & a) | da) + blocks[14] : any +>(cd | (c & a) | da) : number +>cd | (c & a) | da : number +>cd | (c & a) : number +>cd : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b & c; +>bc = b & c : number +>bc : any +>b & c : number +>b : number +>c : number + + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; +>a += (bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>a : number +>(bc | (b & d) | cd) + blocks[3] + 1518500249 : any +>(bc | (b & d) | cd) + blocks[3] : any +>(bc | (b & d) | cd) : number +>bc | (b & d) | cd : number +>bc | (b & d) : number +>bc : number +>(b & d) : number +>b & d : number +>b : number +>d : number +>cd : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1518500249 : 1518500249 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + ab = a & b; +>ab = a & b : number +>ab : any +>a & b : number +>a : number +>b : number + + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; +>d += (ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>d : number +>(ab | (a & c) | bc) + blocks[7] + 1518500249 : any +>(ab | (a & c) | bc) + blocks[7] : any +>(ab | (a & c) | bc) : number +>ab | (a & c) | bc : number +>ab | (a & c) : number +>ab : number +>(a & c) : number +>a & c : number +>a : number +>c : number +>bc : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1518500249 : 1518500249 + + d = (d << 5) | (d >>> 27); +>d = (d << 5) | (d >>> 27) : number +>d : any +>(d << 5) | (d >>> 27) : number +>(d << 5) : number +>d << 5 : number +>d : number +>5 : 5 +>(d >>> 27) : number +>d >>> 27 : number +>d : number +>27 : 27 + + da = d & a; +>da = d & a : number +>da : any +>d & a : number +>d : number +>a : number + + c += (da | (d & b) | ab) + blocks[11] + 1518500249; +>c += (da | (d & b) | ab) + blocks[11] + 1518500249 : any +>c : number +>(da | (d & b) | ab) + blocks[11] + 1518500249 : any +>(da | (d & b) | ab) + blocks[11] : any +>(da | (d & b) | ab) : number +>da | (d & b) | ab : number +>da | (d & b) : number +>da : number +>(d & b) : number +>d & b : number +>d : number +>b : number +>ab : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1518500249 : 1518500249 + + c = (c << 9) | (c >>> 23); +>c = (c << 9) | (c >>> 23) : number +>c : any +>(c << 9) | (c >>> 23) : number +>(c << 9) : number +>c << 9 : number +>c : number +>9 : 9 +>(c >>> 23) : number +>c >>> 23 : number +>c : number +>23 : 23 + + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; +>b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>b : number +>((c & d) | (c & a) | da) + blocks[15] + 1518500249 : any +>((c & d) | (c & a) | da) + blocks[15] : any +>((c & d) | (c & a) | da) : number +>(c & d) | (c & a) | da : number +>(c & d) | (c & a) : number +>(c & d) : number +>c & d : number +>c : number +>d : number +>(c & a) : number +>c & a : number +>c : number +>a : number +>da : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1518500249 : 1518500249 + + b = (b << 13) | (b >>> 19); +>b = (b << 13) | (b >>> 19) : number +>b : any +>(b << 13) | (b >>> 19) : number +>(b << 13) : number +>b << 13 : number +>b : number +>13 : 13 +>(b >>> 19) : number +>b >>> 19 : number +>b : number +>19 : 19 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[0] + 1859775393; +>a += (bc ^ d) + blocks[0] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[0] + 1859775393 : any +>(bc ^ d) + blocks[0] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[0] : any +>blocks : any +>0 : 0 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[8] + 1859775393; +>d += (bc ^ a) + blocks[8] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[8] + 1859775393 : any +>(bc ^ a) + blocks[8] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[8] : any +>blocks : any +>8 : 8 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[4] + 1859775393; +>c += (da ^ b) + blocks[4] + 1859775393 : any +>c : number +>(da ^ b) + blocks[4] + 1859775393 : any +>(da ^ b) + blocks[4] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[4] : any +>blocks : any +>4 : 4 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[12] + 1859775393; +>b += (da ^ c) + blocks[12] + 1859775393 : any +>b : number +>(da ^ c) + blocks[12] + 1859775393 : any +>(da ^ c) + blocks[12] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[12] : any +>blocks : any +>12 : 12 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[2] + 1859775393; +>a += (bc ^ d) + blocks[2] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[2] + 1859775393 : any +>(bc ^ d) + blocks[2] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[2] : any +>blocks : any +>2 : 2 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[10] + 1859775393; +>d += (bc ^ a) + blocks[10] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[10] + 1859775393 : any +>(bc ^ a) + blocks[10] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[10] : any +>blocks : any +>10 : 10 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[6] + 1859775393; +>c += (da ^ b) + blocks[6] + 1859775393 : any +>c : number +>(da ^ b) + blocks[6] + 1859775393 : any +>(da ^ b) + blocks[6] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[6] : any +>blocks : any +>6 : 6 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[14] + 1859775393; +>b += (da ^ c) + blocks[14] + 1859775393 : any +>b : number +>(da ^ c) + blocks[14] + 1859775393 : any +>(da ^ c) + blocks[14] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[14] : any +>blocks : any +>14 : 14 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[1] + 1859775393; +>a += (bc ^ d) + blocks[1] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[1] + 1859775393 : any +>(bc ^ d) + blocks[1] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[1] : any +>blocks : any +>1 : 1 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[9] + 1859775393; +>d += (bc ^ a) + blocks[9] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[9] + 1859775393 : any +>(bc ^ a) + blocks[9] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[9] : any +>blocks : any +>9 : 9 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[5] + 1859775393; +>c += (da ^ b) + blocks[5] + 1859775393 : any +>c : number +>(da ^ b) + blocks[5] + 1859775393 : any +>(da ^ b) + blocks[5] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[5] : any +>blocks : any +>5 : 5 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[13] + 1859775393; +>b += (da ^ c) + blocks[13] + 1859775393 : any +>b : number +>(da ^ c) + blocks[13] + 1859775393 : any +>(da ^ c) + blocks[13] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[13] : any +>blocks : any +>13 : 13 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + bc = b ^ c; +>bc = b ^ c : number +>bc : any +>b ^ c : number +>b : number +>c : number + + a += (bc ^ d) + blocks[3] + 1859775393; +>a += (bc ^ d) + blocks[3] + 1859775393 : any +>a : number +>(bc ^ d) + blocks[3] + 1859775393 : any +>(bc ^ d) + blocks[3] : any +>(bc ^ d) : number +>bc ^ d : number +>bc : number +>d : number +>blocks[3] : any +>blocks : any +>3 : 3 +>1859775393 : 1859775393 + + a = (a << 3) | (a >>> 29); +>a = (a << 3) | (a >>> 29) : number +>a : any +>(a << 3) | (a >>> 29) : number +>(a << 3) : number +>a << 3 : number +>a : number +>3 : 3 +>(a >>> 29) : number +>a >>> 29 : number +>a : number +>29 : 29 + + d += (bc ^ a) + blocks[11] + 1859775393; +>d += (bc ^ a) + blocks[11] + 1859775393 : any +>d : number +>(bc ^ a) + blocks[11] + 1859775393 : any +>(bc ^ a) + blocks[11] : any +>(bc ^ a) : number +>bc ^ a : number +>bc : number +>a : number +>blocks[11] : any +>blocks : any +>11 : 11 +>1859775393 : 1859775393 + + d = (d << 9) | (d >>> 23); +>d = (d << 9) | (d >>> 23) : number +>d : any +>(d << 9) | (d >>> 23) : number +>(d << 9) : number +>d << 9 : number +>d : number +>9 : 9 +>(d >>> 23) : number +>d >>> 23 : number +>d : number +>23 : 23 + + da = d ^ a; +>da = d ^ a : number +>da : any +>d ^ a : number +>d : number +>a : number + + c += (da ^ b) + blocks[7] + 1859775393; +>c += (da ^ b) + blocks[7] + 1859775393 : any +>c : number +>(da ^ b) + blocks[7] + 1859775393 : any +>(da ^ b) + blocks[7] : any +>(da ^ b) : number +>da ^ b : number +>da : number +>b : number +>blocks[7] : any +>blocks : any +>7 : 7 +>1859775393 : 1859775393 + + c = (c << 11) | (c >>> 21); +>c = (c << 11) | (c >>> 21) : number +>c : any +>(c << 11) | (c >>> 21) : number +>(c << 11) : number +>c << 11 : number +>c : number +>11 : 11 +>(c >>> 21) : number +>c >>> 21 : number +>c : number +>21 : 21 + + b += (da ^ c) + blocks[15] + 1859775393; +>b += (da ^ c) + blocks[15] + 1859775393 : any +>b : number +>(da ^ c) + blocks[15] + 1859775393 : any +>(da ^ c) + blocks[15] : any +>(da ^ c) : number +>da ^ c : number +>da : number +>c : number +>blocks[15] : any +>blocks : any +>15 : 15 +>1859775393 : 1859775393 + + b = (b << 15) | (b >>> 17); +>b = (b << 15) | (b >>> 17) : number +>b : any +>(b << 15) | (b >>> 17) : number +>(b << 15) : number +>b << 15 : number +>b : number +>15 : 15 +>(b >>> 17) : number +>b >>> 17 : number +>b : number +>17 : 17 + + if (this.first) { +>this.first : any +>this : any +>first : any + + this.h0 = a + 1732584193 << 0; +>this.h0 = a + 1732584193 << 0 : number +>this.h0 : any +>this : any +>h0 : any +>a + 1732584193 << 0 : number +>a + 1732584193 : number +>a : number +>1732584193 : 1732584193 +>0 : 0 + + this.h1 = b - 271733879 << 0; +>this.h1 = b - 271733879 << 0 : number +>this.h1 : any +>this : any +>h1 : any +>b - 271733879 << 0 : number +>b - 271733879 : number +>b : number +>271733879 : 271733879 +>0 : 0 + + this.h2 = c - 1732584194 << 0; +>this.h2 = c - 1732584194 << 0 : number +>this.h2 : any +>this : any +>h2 : any +>c - 1732584194 << 0 : number +>c - 1732584194 : number +>c : number +>1732584194 : 1732584194 +>0 : 0 + + this.h3 = d + 271733878 << 0; +>this.h3 = d + 271733878 << 0 : number +>this.h3 : any +>this : any +>h3 : any +>d + 271733878 << 0 : number +>d + 271733878 : number +>d : number +>271733878 : 271733878 +>0 : 0 + + this.first = false; +>this.first = false : false +>this.first : any +>this : any +>first : any +>false : false + + } else { + this.h0 = this.h0 + a << 0; +>this.h0 = this.h0 + a << 0 : number +>this.h0 : any +>this : any +>h0 : any +>this.h0 + a << 0 : number +>this.h0 + a : any +>this.h0 : any +>this : any +>h0 : any +>a : number +>0 : 0 + + this.h1 = this.h1 + b << 0; +>this.h1 = this.h1 + b << 0 : number +>this.h1 : any +>this : any +>h1 : any +>this.h1 + b << 0 : number +>this.h1 + b : any +>this.h1 : any +>this : any +>h1 : any +>b : number +>0 : 0 + + this.h2 = this.h2 + c << 0; +>this.h2 = this.h2 + c << 0 : number +>this.h2 : any +>this : any +>h2 : any +>this.h2 + c << 0 : number +>this.h2 + c : any +>this.h2 : any +>this : any +>h2 : any +>c : number +>0 : 0 + + this.h3 = this.h3 + d << 0; +>this.h3 = this.h3 + d << 0 : number +>this.h3 : any +>this : any +>h3 : any +>this.h3 + d << 0 : number +>this.h3 + d : any +>this.h3 : any +>this : any +>h3 : any +>d : number +>0 : 0 + } +}; diff --git a/tests/cases/compiler/binaryArithmeticControlFlowGraphNotTooLarge.ts b/tests/cases/compiler/binaryArithmeticControlFlowGraphNotTooLarge.ts new file mode 100644 index 00000000000..9368fc4c34e --- /dev/null +++ b/tests/cases/compiler/binaryArithmeticControlFlowGraphNotTooLarge.ts @@ -0,0 +1,1298 @@ +// @strict: true + +// Repro from #29926 (expanded 10x for good measure) + +const foo = function (this: any) { + var a, b, c, d, ab, bc, cd, da, blocks = this.blocks; + + if (this.first) { + a = blocks[0] - 1; + a = (a << 3) | (a >>> 29); + d = ((a & 0xefcdab89) | (~a & 0x98badcfe)) + blocks[1] + 271733878; + d = (d << 7) | (d >>> 25); + c = ((d & a) | (~d & 0xefcdab89)) + blocks[2] - 1732584194; + c = (c << 11) | (c >>> 21); + b = ((c & d) | (~c & a)) + blocks[3] - 271733879; + b = (b << 19) | (b >>> 13); + } else { + a = this.h0; + b = this.h1; + c = this.h2; + d = this.h3; + a += ((b & c) | (~b & d)) + blocks[0]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[1]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[2]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[3]; + b = (b << 19) | (b >>> 13); + } + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + a += ((b & c) | (~b & d)) + blocks[4]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[5]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[6]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[7]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[8]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[9]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[10]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[11]; + b = (b << 19) | (b >>> 13); + a += ((b & c) | (~b & d)) + blocks[12]; + a = (a << 3) | (a >>> 29); + d += ((a & b) | (~a & c)) + blocks[13]; + d = (d << 7) | (d >>> 25); + c += ((d & a) | (~d & b)) + blocks[14]; + c = (c << 11) | (c >>> 21); + b += ((c & d) | (~c & a)) + blocks[15]; + b = (b << 19) | (b >>> 13); + + bc = b & c; + a += (bc | (b & d) | (c & d)) + blocks[0] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[4] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[8] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[12] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[1] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[5] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[9] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[13] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[2] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[6] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[10] + 1518500249; + c = (c << 9) | (c >>> 23); + cd = c & d; + b += (cd | (c & a) | da) + blocks[14] + 1518500249; + b = (b << 13) | (b >>> 19); + bc = b & c; + a += (bc | (b & d) | cd) + blocks[3] + 1518500249; + a = (a << 3) | (a >>> 29); + ab = a & b; + d += (ab | (a & c) | bc) + blocks[7] + 1518500249; + d = (d << 5) | (d >>> 27); + da = d & a; + c += (da | (d & b) | ab) + blocks[11] + 1518500249; + c = (c << 9) | (c >>> 23); + b += ((c & d) | (c & a) | da) + blocks[15] + 1518500249; + b = (b << 13) | (b >>> 19); + + bc = b ^ c; + a += (bc ^ d) + blocks[0] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[8] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[4] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[12] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[2] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[10] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[6] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[14] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[1] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[9] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[5] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[13] + 1859775393; + b = (b << 15) | (b >>> 17); + bc = b ^ c; + a += (bc ^ d) + blocks[3] + 1859775393; + a = (a << 3) | (a >>> 29); + d += (bc ^ a) + blocks[11] + 1859775393; + d = (d << 9) | (d >>> 23); + da = d ^ a; + c += (da ^ b) + blocks[7] + 1859775393; + c = (c << 11) | (c >>> 21); + b += (da ^ c) + blocks[15] + 1859775393; + b = (b << 15) | (b >>> 17); + + if (this.first) { + this.h0 = a + 1732584193 << 0; + this.h1 = b - 271733879 << 0; + this.h2 = c - 1732584194 << 0; + this.h3 = d + 271733878 << 0; + this.first = false; + } else { + this.h0 = this.h0 + a << 0; + this.h1 = this.h1 + b << 0; + this.h2 = this.h2 + c << 0; + this.h3 = this.h3 + d << 0; + } +}; \ No newline at end of file From 71fe8e824e30b9bb71d9e2b3f0cc5f6b0199bcb6 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 11 May 2019 09:39:06 -0700 Subject: [PATCH 078/384] Defer resolution of the true and false branches of conditional types --- src/compiler/checker.ts | 69 ++++++++++++++++++----------------------- src/compiler/types.ts | 4 +-- 2 files changed, 32 insertions(+), 41 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cc4c8476de6..5d3bc864a50 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -394,7 +394,6 @@ namespace ts { const intersectionTypes = createMap(); const literalTypes = createMap(); const indexedAccessTypes = createMap(); - const conditionalTypes = createMap(); const substitutionTypes = createMap(); const evolvingArrayTypes: EvolvingArrayType[] = []; const undefinedProperties = createMap() as UnderscoreEscapedMap; @@ -3648,8 +3647,8 @@ namespace ts { context.inferTypeParameters = (type).root.inferTypeParameters; const extendsTypeNode = typeToTypeNodeHelper((type).extendsType, context); context.inferTypeParameters = saveInferTypeParameters; - const trueTypeNode = typeToTypeNodeHelper((type).trueType, context); - const falseTypeNode = typeToTypeNodeHelper((type).falseType, context); + const trueTypeNode = typeToTypeNodeHelper(getTrueTypeFromConditionalType(type), context); + const falseTypeNode = typeToTypeNodeHelper(getFalseTypeFromConditionalType(type), context); context.approximateLength += 15; return createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode); } @@ -7674,7 +7673,7 @@ namespace ts { // just `any`. This result is _usually_ unwanted - so instead here we elide an `any` branch from the constraint type, // in effect treating `any` like `never` rather than `unknown` in this location. const trueConstraint = getInferredTrueTypeFromConditionalType(type); - const falseConstraint = type.falseType; + const falseConstraint = getFalseTypeFromConditionalType(type); type.resolvedDefaultConstraint = isTypeAny(trueConstraint) ? falseConstraint : isTypeAny(falseConstraint) ? trueConstraint : getUnionType([trueConstraint, falseConstraint]); } return type.resolvedDefaultConstraint; @@ -10377,37 +10376,23 @@ namespace ts { if (checkType === wildcardType || extendsType === wildcardType) { return wildcardType; } - const trueType = instantiateType(root.trueType, mapper); - const falseType = instantiateType(root.falseType, mapper); - const instantiationId = `${root.isDistributive ? "d" : ""}${getTypeId(checkType)}>${getTypeId(extendsType)}?${getTypeId(trueType)}:${getTypeId(falseType)}`; - const result = conditionalTypes.get(instantiationId); - if (result) { - return result; - } - const newResult = getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType); - conditionalTypes.set(instantiationId, newResult); - return newResult; - } - - function getConditionalTypeWorker(root: ConditionalRoot, mapper: TypeMapper | undefined, checkType: Type, extendsType: Type, trueType: Type, falseType: Type) { // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`. - if (falseType.flags & TypeFlags.Never && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) { + if (root.falseType.flags & TypeFlags.Never && getActualTypeVariable(root.trueType) === getActualTypeVariable(root.checkType)) { if (checkType.flags & TypeFlags.Any || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true - return trueType; + return instantiateType(root.trueType, mapper); } else if (isIntersectionEmpty(checkType, extendsType)) { // Always false return neverType; } } - else if (trueType.flags & TypeFlags.Never && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) { + else if (root.trueType.flags & TypeFlags.Never && getActualTypeVariable(root.falseType) === getActualTypeVariable(root.checkType)) { if (!(checkType.flags & TypeFlags.Any) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true return neverType; } else if (checkType.flags & TypeFlags.Any || isIntersectionEmpty(checkType, extendsType)) { // Always false - return falseType; + return instantiateType(root.falseType, mapper); } } - const checkTypeInstantiable = maybeTypeOfKind(checkType, TypeFlags.Instantiable | TypeFlags.GenericMappedType); let combinedMapper: TypeMapper | undefined; if (root.inferTypeParameters) { @@ -10425,18 +10410,18 @@ namespace ts { // We attempt to resolve the conditional type only when the check and extends types are non-generic if (!checkTypeInstantiable && !maybeTypeOfKind(inferredExtendsType, TypeFlags.Instantiable | TypeFlags.GenericMappedType)) { if (inferredExtendsType.flags & TypeFlags.AnyOrUnknown) { - return combinedMapper ? instantiateType(root.trueType, combinedMapper) : trueType; + return instantiateType(root.trueType, combinedMapper || mapper); } // Return union of trueType and falseType for 'any' since it matches anything if (checkType.flags & TypeFlags.Any) { - return getUnionType([combinedMapper ? instantiateType(root.trueType, combinedMapper) : trueType, falseType]); + return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), instantiateType(root.falseType, mapper)]); } // Return falseType for a definitely false extends check. We check an instantiations of the two // types with type parameters mapped to the wildcard type, the most permissive instantiations // possible (the wildcard type is assignable to and from all types). If those are not related, // then no instantiations will be and we can just return the false branch type. if (!isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType))) { - return falseType; + return instantiateType(root.falseType, mapper); } // Return trueType for a definitely true extends check. We check instantiations of the two // types with type parameters mapped to their restrictive form, i.e. a form of the type parameter @@ -10444,14 +10429,14 @@ namespace ts { // type Foo = T extends { x: string } ? string : number // doesn't immediately resolve to 'string' instead of being deferred. if (isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(inferredExtendsType))) { - return combinedMapper ? instantiateType(root.trueType, combinedMapper) : trueType; + return instantiateType(root.trueType, combinedMapper || mapper); } } // Return a deferred type for a check that is neither definitely true nor definitely false - return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType); + return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType); } - function getDeferredConditionalType(root: ConditionalRoot, mapper: TypeMapper | undefined, combinedMapper: TypeMapper | undefined, checkType: Type, extendsType: Type, trueType: Type, falseType: Type) { + function getDeferredConditionalType(root: ConditionalRoot, mapper: TypeMapper | undefined, combinedMapper: TypeMapper | undefined, checkType: Type, extendsType: Type) { const erasedCheckType = getActualTypeVariable(checkType); const result = createType(TypeFlags.Conditional); result.root = root; @@ -10459,15 +10444,21 @@ namespace ts { result.extendsType = extendsType; result.mapper = mapper; result.combinedMapper = combinedMapper; - result.trueType = trueType; - result.falseType = falseType; result.aliasSymbol = root.aliasSymbol; result.aliasTypeArguments = instantiateTypes(root.aliasTypeArguments, mapper!); // TODO: GH#18217 return result; } + function getTrueTypeFromConditionalType(type: ConditionalType) { + return type.resolvedTrueType || (type.resolvedTrueType = instantiateType(type.root.trueType, type.mapper)); + } + + function getFalseTypeFromConditionalType(type: ConditionalType) { + return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(type.root.falseType, type.mapper)); + } + function getInferredTrueTypeFromConditionalType(type: ConditionalType) { - return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = instantiateType(type.root.trueType, type.combinedMapper || type.mapper)); + return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = type.combinedMapper ? instantiateType(type.root.trueType, type.combinedMapper) : getTrueTypeFromConditionalType(type)); } function getInferTypeParameters(node: ConditionalTypeNode): TypeParameter[] | undefined { @@ -12987,8 +12978,8 @@ namespace ts { if ((source).root.isDistributive === (target).root.isDistributive) { if (result = isRelatedTo((source).checkType, (target).checkType, /*reportErrors*/ false)) { if (result &= isRelatedTo((source).extendsType, (target).extendsType, /*reportErrors*/ false)) { - if (result &= isRelatedTo((source).trueType, (target).trueType, /*reportErrors*/ false)) { - if (result &= isRelatedTo((source).falseType, (target).falseType, /*reportErrors*/ false)) { + if (result &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), /*reportErrors*/ false)) { + if (result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), /*reportErrors*/ false)) { return result; } } @@ -13147,8 +13138,8 @@ namespace ts { // and Y1 is related to Y2. if (isTypeIdenticalTo((source).extendsType, (target).extendsType) && (isRelatedTo((source).checkType, (target).checkType) || isRelatedTo((target).checkType, (source).checkType))) { - if (result = isRelatedTo((source).trueType, (target).trueType, reportErrors)) { - result &= isRelatedTo((source).falseType, (target).falseType, reportErrors); + if (result = isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), reportErrors)) { + result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), reportErrors); } if (result) { errorInfo = saveErrorInfo; @@ -15181,12 +15172,12 @@ namespace ts { else if (source.flags & TypeFlags.Conditional && target.flags & TypeFlags.Conditional) { inferFromTypes((source).checkType, (target).checkType); inferFromTypes((source).extendsType, (target).extendsType); - inferFromTypes((source).trueType, (target).trueType); - inferFromTypes((source).falseType, (target).falseType); + inferFromTypes(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target)); + inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target)); } else if (target.flags & TypeFlags.Conditional && !contravariant) { - inferFromTypes(source, (target).trueType); - inferFromTypes(source, (target).falseType); + inferFromTypes(source, getTrueTypeFromConditionalType(target)); + inferFromTypes(source, getFalseTypeFromConditionalType(target)); } else if (target.flags & TypeFlags.UnionOrIntersection) { // We infer from types that are not naked type variables first so that inferences we diff --git a/src/compiler/types.ts b/src/compiler/types.ts index e33d0f44785..ecb569bd9b0 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4338,8 +4338,8 @@ namespace ts { root: ConditionalRoot; checkType: Type; extendsType: Type; - trueType: Type; - falseType: Type; + resolvedTrueType: Type; + resolvedFalseType: Type; /* @internal */ resolvedInferredTrueType?: Type; // The `trueType` instantiated with the `combinedMapper`, if present /* @internal */ From 33c7e7fd2c1d0b64c040603fc24188b2d9cb15a8 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 11 May 2019 09:39:51 -0700 Subject: [PATCH 079/384] Accept new baselines --- .../reference/api/tsserverlibrary.d.ts | 4 +- tests/baselines/reference/api/typescript.d.ts | 4 +- ...nalNoInfiniteInstantiationDepth.errors.txt | 76 +++++++------ .../baselines/reference/conditionalTypes1.js | 2 +- .../reference/conditionalTypes1.types | 6 +- ...itionalTypesSimplifyWhenTrivial.errors.txt | 100 ++++++++++++++++++ .../conditionalTypesSimplifyWhenTrivial.types | 64 +++++------ ...iasAssignableToConstraintSameAsAlias.types | 2 +- ...ferredInferenceAllowsAssignment.errors.txt | 76 +++++++------ 9 files changed, 229 insertions(+), 105 deletions(-) create mode 100644 tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.errors.txt diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 4bdfa84ca49..ca97395891a 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2390,8 +2390,8 @@ declare namespace ts { root: ConditionalRoot; checkType: Type; extendsType: Type; - trueType: Type; - falseType: Type; + resolvedTrueType: Type; + resolvedFalseType: Type; } interface SubstitutionType extends InstantiableType { typeVariable: TypeVariable; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 7f0e63cfc03..e136f2c96e4 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2390,8 +2390,8 @@ declare namespace ts { root: ConditionalRoot; checkType: Type; extendsType: Type; - trueType: Type; - falseType: Type; + resolvedTrueType: Type; + resolvedFalseType: Type; } interface SubstitutionType extends InstantiableType { typeVariable: TypeVariable; diff --git a/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt b/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt index 04a88a4b1e5..74835c4a55b 100644 --- a/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt +++ b/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt @@ -11,22 +11,28 @@ tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfin Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[Extract>] | (TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. ==== tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.ts (1 errors) ==== @@ -107,20 +113,26 @@ tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfin !!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. !!! error TS2344: Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. !!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[Extract>] | (TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. \ No newline at end of file diff --git a/tests/baselines/reference/conditionalTypes1.js b/tests/baselines/reference/conditionalTypes1.js index 5dc48518384..7ce19ce17e7 100644 --- a/tests/baselines/reference/conditionalTypes1.js +++ b/tests/baselines/reference/conditionalTypes1.js @@ -645,7 +645,7 @@ declare type T82 = Eq2; declare type T83 = Eq2; declare type Foo = T extends string ? boolean : number; declare type Bar = T extends string ? boolean : number; -declare const convert: (value: Foo) => Foo; +declare const convert: (value: Foo) => Bar; declare type Baz = Foo; declare const convert2: (value: Foo) => Foo; declare function f31(): void; diff --git a/tests/baselines/reference/conditionalTypes1.types b/tests/baselines/reference/conditionalTypes1.types index bc70e68f0ca..234fc071d74 100644 --- a/tests/baselines/reference/conditionalTypes1.types +++ b/tests/baselines/reference/conditionalTypes1.types @@ -779,8 +779,8 @@ type Bar = T extends string ? boolean : number; >Bar : Bar const convert = (value: Foo): Bar => value; ->convert : (value: Foo) => Foo ->(value: Foo): Bar => value : (value: Foo) => Foo +>convert : (value: Foo) => Bar +>(value: Foo): Bar => value : (value: Foo) => Bar >value : Foo >value : Foo @@ -832,7 +832,7 @@ function f33() { >T1 : Foo type T2 = Bar; ->T2 : Foo +>T2 : Bar var z: T1; >z : Foo diff --git a/tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.errors.txt b/tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.errors.txt new file mode 100644 index 00000000000..ca38e867e4f --- /dev/null +++ b/tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.errors.txt @@ -0,0 +1,100 @@ +tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(27,14): error TS2322: Type 'Pick>' is not assignable to type 'Params'. + 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. +tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(31,5): error TS2322: Type 'T' is not assignable to type 'ExcludeWithDefault'. +tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(36,14): error TS2322: Type 'Pick>' is not assignable to type 'Params'. + 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. +tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(40,5): error TS2322: Type 'T' is not assignable to type 'ExtractWithDefault'. +tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(47,14): error TS2322: Type 'Pick>' is not assignable to type 'Params'. + 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. +tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(51,5): error TS2322: Type 'T' is not assignable to type 'TemplatedConditional'. +tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(56,14): error TS2322: Type 'Pick>' is not assignable to type 'Params'. + 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. +tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(60,5): error TS2322: Type 'T' is not assignable to type 'TemplatedConditional'. + + +==== tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts (8 errors) ==== + const fn1 = ( + params: Pick>, + ): Params => params; + + function fn2(x: Exclude) { + var y: T = x; + x = y; + } + + const fn3 = ( + params: Pick>, + ): Params => params; + + function fn4(x: Extract) { + var y: T = x; + x = y; + } + + declare var x: Extract; // Should be `numebr | string` and not `any` + + type ExtractWithDefault = T extends U ? T : D; + + type ExcludeWithDefault = T extends U ? D : T; + + const fn5 = ( + params: Pick>, + ): Params => params; + ~~~~~~ +!!! error TS2322: Type 'Pick>' is not assignable to type 'Params'. +!!! error TS2322: 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. + + function fn6(x: ExcludeWithDefault) { + var y: T = x; + x = y; + ~ +!!! error TS2322: Type 'T' is not assignable to type 'ExcludeWithDefault'. + } + + const fn7 = ( + params: Pick>, + ): Params => params; + ~~~~~~ +!!! error TS2322: Type 'Pick>' is not assignable to type 'Params'. +!!! error TS2322: 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. + + function fn8(x: ExtractWithDefault) { + var y: T = x; + x = y; + ~ +!!! error TS2322: Type 'T' is not assignable to type 'ExtractWithDefault'. + } + + type TemplatedConditional = TCheck extends TExtends ? TTrue : TFalse; + + const fn9 = ( + params: Pick>, + ): Params => params; + ~~~~~~ +!!! error TS2322: Type 'Pick>' is not assignable to type 'Params'. +!!! error TS2322: 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. + + function fn10(x: TemplatedConditional) { + var y: T = x; + x = y; + ~ +!!! error TS2322: Type 'T' is not assignable to type 'TemplatedConditional'. + } + + const fn11 = ( + params: Pick>, + ): Params => params; + ~~~~~~ +!!! error TS2322: Type 'Pick>' is not assignable to type 'Params'. +!!! error TS2322: 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. + + function fn12(x: TemplatedConditional) { + var y: T = x; + x = y; + ~ +!!! error TS2322: Type 'T' is not assignable to type 'TemplatedConditional'. + } + + declare var z: any; + const zee = z!!!; // since x is `any`, `x extends null | undefined` should be both true and false - and thus yield `any` + \ No newline at end of file diff --git a/tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.types b/tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.types index 5f513153560..27ac10ff161 100644 --- a/tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.types +++ b/tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.types @@ -57,50 +57,50 @@ type ExcludeWithDefault = T extends U ? D : T; >ExcludeWithDefault : ExcludeWithDefault const fn5 = ( ->fn5 : (params: Pick) => Params ->( params: Pick>,): Params => params : (params: Pick) => Params +>fn5 : (params: Pick>) => Params +>( params: Pick>,): Params => params : (params: Pick>) => Params params: Pick>, ->params : Pick +>params : Pick> ): Params => params; ->params : Pick +>params : Pick> function fn6(x: ExcludeWithDefault) { ->fn6 : (x: T) => void ->x : T +>fn6 : (x: ExcludeWithDefault) => void +>x : ExcludeWithDefault var y: T = x; >y : T ->x : T +>x : ExcludeWithDefault x = y; >x = y : T ->x : T +>x : ExcludeWithDefault >y : T } const fn7 = ( ->fn7 : (params: Pick) => Params ->( params: Pick>,): Params => params : (params: Pick) => Params +>fn7 : (params: Pick>) => Params +>( params: Pick>,): Params => params : (params: Pick>) => Params params: Pick>, ->params : Pick +>params : Pick> ): Params => params; ->params : Pick +>params : Pick> function fn8(x: ExtractWithDefault) { ->fn8 : (x: T) => void ->x : T +>fn8 : (x: ExtractWithDefault) => void +>x : ExtractWithDefault var y: T = x; >y : T ->x : T +>x : ExtractWithDefault x = y; >x = y : T ->x : T +>x : ExtractWithDefault >y : T } @@ -108,50 +108,50 @@ type TemplatedConditional = TCheck extends TExt >TemplatedConditional : TemplatedConditional const fn9 = ( ->fn9 : (params: Pick) => Params ->( params: Pick>,): Params => params : (params: Pick) => Params +>fn9 : (params: Pick>) => Params +>( params: Pick>,): Params => params : (params: Pick>) => Params params: Pick>, ->params : Pick +>params : Pick> ): Params => params; ->params : Pick +>params : Pick> function fn10(x: TemplatedConditional) { ->fn10 : (x: T) => void ->x : T +>fn10 : (x: TemplatedConditional) => void +>x : TemplatedConditional var y: T = x; >y : T ->x : T +>x : TemplatedConditional x = y; >x = y : T ->x : T +>x : TemplatedConditional >y : T } const fn11 = ( ->fn11 : (params: Pick) => Params ->( params: Pick>,): Params => params : (params: Pick) => Params +>fn11 : (params: Pick>) => Params +>( params: Pick>,): Params => params : (params: Pick>) => Params params: Pick>, ->params : Pick +>params : Pick> ): Params => params; ->params : Pick +>params : Pick> function fn12(x: TemplatedConditional) { ->fn12 : (x: T) => void ->x : T +>fn12 : (x: TemplatedConditional) => void +>x : TemplatedConditional var y: T = x; >y : T ->x : T +>x : TemplatedConditional x = y; >x = y : T ->x : T +>x : TemplatedConditional >y : T } diff --git a/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.types b/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.types index 086aa5c976e..d337fbc718a 100644 --- a/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.types +++ b/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.types @@ -31,7 +31,7 @@ class A { >z : A[] whereRelated< // Works // Type is same as A1, but is not assignable to type A ->whereRelated : () => number +>whereRelated : >() => number RF extends RelationFields = RelationFields, N extends Name = Name, diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt index a480d4f3e4e..8c7e2f57eda 100644 --- a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt @@ -11,22 +11,28 @@ tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts(76,50): Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[Extract>] | (TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. ==== tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts (1 errors) ==== @@ -120,22 +126,28 @@ tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts(76,50): !!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. !!! error TS2344: Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. !!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[Extract>] | (TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. >; declare const connect: { From bb9c5c96c80126a0ff78e1d3524b10adcfd1bed1 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 11 May 2019 11:15:37 -0700 Subject: [PATCH 080/384] Reuse existing type instantiations --- src/compiler/checker.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5d3bc864a50..f016a8d3723 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10379,7 +10379,7 @@ namespace ts { // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`. if (root.falseType.flags & TypeFlags.Never && getActualTypeVariable(root.trueType) === getActualTypeVariable(root.checkType)) { if (checkType.flags & TypeFlags.Any || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true - return instantiateType(root.trueType, mapper); + return checkType; } else if (isIntersectionEmpty(checkType, extendsType)) { // Always false return neverType; @@ -10390,7 +10390,7 @@ namespace ts { return neverType; } else if (checkType.flags & TypeFlags.Any || isIntersectionEmpty(checkType, extendsType)) { // Always false - return instantiateType(root.falseType, mapper); + return checkType; } } const checkTypeInstantiable = maybeTypeOfKind(checkType, TypeFlags.Instantiable | TypeFlags.GenericMappedType); From b7fe99a88c59bd652029bdfe5b6ba8709a677838 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Sat, 11 May 2019 16:40:23 -0700 Subject: [PATCH 081/384] Instantiate constraint with default upon comparison (#31240) --- src/compiler/checker.ts | 2 +- ...tantiatedWithDefaultWhenCheckingDefault.js | 42 +++++++++ ...atedWithDefaultWhenCheckingDefault.symbols | 87 +++++++++++++++++++ ...tiatedWithDefaultWhenCheckingDefault.types | 49 +++++++++++ ...tantiatedWithDefaultWhenCheckingDefault.ts | 24 +++++ 5 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.js create mode 100644 tests/baselines/reference/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.symbols create mode 100644 tests/baselines/reference/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.types create mode 100644 tests/cases/compiler/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cc4c8476de6..64834befee1 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -24441,7 +24441,7 @@ namespace ts { const constraintType = getConstraintOfTypeParameter(typeParameter); const defaultType = getDefaultFromTypeParameter(typeParameter); if (constraintType && defaultType) { - checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, Diagnostics.Type_0_does_not_satisfy_the_constraint_1); } if (produceDiagnostics) { checkTypeNameIsReserved(node.name, Diagnostics.Type_parameter_name_cannot_be_0); diff --git a/tests/baselines/reference/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.js b/tests/baselines/reference/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.js new file mode 100644 index 00000000000..fc3922448e9 --- /dev/null +++ b/tests/baselines/reference/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.js @@ -0,0 +1,42 @@ +//// [typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts] +// tricky interface +interface Settable { + set(value: V): T; +} + +// implement +class Identity implements Settable, V> { + readonly item: V; + constructor(value: V) { + this.item = value; + } + public set(value: V): Identity { + return new Identity(value); + } +} + +// generic parameter default +interface Test1 = Identity> { }; +let test1: Test1; + +// not generic parameter default +interface Test2Base> { }; +type Test2 = Test2Base>; +let test2: Test2; + + +//// [typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.js] +// implement +var Identity = /** @class */ (function () { + function Identity(value) { + this.item = value; + } + Identity.prototype.set = function (value) { + return new Identity(value); + }; + return Identity; +}()); +; +var test1; +; +var test2; diff --git a/tests/baselines/reference/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.symbols b/tests/baselines/reference/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.symbols new file mode 100644 index 00000000000..3462a11d800 --- /dev/null +++ b/tests/baselines/reference/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.symbols @@ -0,0 +1,87 @@ +=== tests/cases/compiler/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts === +// tricky interface +interface Settable { +>Settable : Symbol(Settable, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 0, 0)) +>T : Symbol(T, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 1, 19)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 1, 21)) + + set(value: V): T; +>set : Symbol(Settable.set, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 1, 26)) +>value : Symbol(value, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 2, 8)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 1, 21)) +>T : Symbol(T, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 1, 19)) +} + +// implement +class Identity implements Settable, V> { +>Identity : Symbol(Identity, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 3, 1)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 6, 15)) +>Settable : Symbol(Settable, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 0, 0)) +>Identity : Symbol(Identity, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 3, 1)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 6, 15)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 6, 15)) + + readonly item: V; +>item : Symbol(Identity.item, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 6, 55)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 6, 15)) + + constructor(value: V) { +>value : Symbol(value, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 8, 16)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 6, 15)) + + this.item = value; +>this.item : Symbol(Identity.item, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 6, 55)) +>this : Symbol(Identity, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 3, 1)) +>item : Symbol(Identity.item, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 6, 55)) +>value : Symbol(value, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 8, 16)) + } + public set(value: V): Identity { +>set : Symbol(Identity.set, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 10, 5)) +>value : Symbol(value, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 11, 15)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 6, 15)) +>Identity : Symbol(Identity, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 3, 1)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 6, 15)) + + return new Identity(value); +>Identity : Symbol(Identity, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 3, 1)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 6, 15)) +>value : Symbol(value, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 11, 15)) + } +} + +// generic parameter default +interface Test1 = Identity> { }; +>Test1 : Symbol(Test1, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 14, 1)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 17, 16)) +>T : Symbol(T, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 17, 18)) +>Settable : Symbol(Settable, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 0, 0)) +>T : Symbol(T, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 17, 18)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 17, 16)) +>Identity : Symbol(Identity, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 3, 1)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 17, 16)) + +let test1: Test1; +>test1 : Symbol(test1, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 18, 3)) +>Test1 : Symbol(Test1, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 14, 1)) + +// not generic parameter default +interface Test2Base> { }; +>Test2Base : Symbol(Test2Base, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 18, 25)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 21, 20)) +>T : Symbol(T, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 21, 22)) +>Settable : Symbol(Settable, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 0, 0)) +>T : Symbol(T, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 21, 22)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 21, 20)) + +type Test2 = Test2Base>; +>Test2 : Symbol(Test2, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 21, 53)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 22, 11)) +>Test2Base : Symbol(Test2Base, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 18, 25)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 22, 11)) +>Identity : Symbol(Identity, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 3, 1)) +>V : Symbol(V, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 22, 11)) + +let test2: Test2; +>test2 : Symbol(test2, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 23, 3)) +>Test2 : Symbol(Test2, Decl(typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts, 21, 53)) + diff --git a/tests/baselines/reference/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.types b/tests/baselines/reference/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.types new file mode 100644 index 00000000000..cb3394962c6 --- /dev/null +++ b/tests/baselines/reference/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.types @@ -0,0 +1,49 @@ +=== tests/cases/compiler/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts === +// tricky interface +interface Settable { + set(value: V): T; +>set : (value: V) => T +>value : V +} + +// implement +class Identity implements Settable, V> { +>Identity : Identity + + readonly item: V; +>item : V + + constructor(value: V) { +>value : V + + this.item = value; +>this.item = value : V +>this.item : V +>this : this +>item : V +>value : V + } + public set(value: V): Identity { +>set : (value: V) => Identity +>value : V + + return new Identity(value); +>new Identity(value) : Identity +>Identity : typeof Identity +>value : V + } +} + +// generic parameter default +interface Test1 = Identity> { }; +let test1: Test1; +>test1 : Test1> + +// not generic parameter default +interface Test2Base> { }; +type Test2 = Test2Base>; +>Test2 : Test2Base> + +let test2: Test2; +>test2 : Test2Base> + diff --git a/tests/cases/compiler/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts b/tests/cases/compiler/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts new file mode 100644 index 00000000000..3f4e3e19c8c --- /dev/null +++ b/tests/cases/compiler/typePartameterConstraintInstantiatedWithDefaultWhenCheckingDefault.ts @@ -0,0 +1,24 @@ +// tricky interface +interface Settable { + set(value: V): T; +} + +// implement +class Identity implements Settable, V> { + readonly item: V; + constructor(value: V) { + this.item = value; + } + public set(value: V): Identity { + return new Identity(value); + } +} + +// generic parameter default +interface Test1 = Identity> { }; +let test1: Test1; + +// not generic parameter default +interface Test2Base> { }; +type Test2 = Test2Base>; +let test2: Test2; From c610b98621d3428e9ac4a1c055075de96264f109 Mon Sep 17 00:00:00 2001 From: Anix Date: Mon, 13 May 2019 00:12:52 +0530 Subject: [PATCH 082/384] Moved the badges below the Typescript Header Moved all the badges below the Typescript Heading as its nice to keep all badges together. Earlier it gitter badge was below only. --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 52e35c16f79..04c8c7dbbcc 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ + +# TypeScript + +[![Join the chat at https://gitter.im/Microsoft/TypeScript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript) [![VSTS Build Status](https://dev.azure.com/typescript/TypeScript/_apis/build/status/Typescript/node10)](https://dev.azure.com/typescript/TypeScript/_build/latest?definitionId=4&view=logs) [![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript) [![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript) -# TypeScript -[![Join the chat at https://gitter.im/Microsoft/TypeScript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescript). From 8965650bc332a8b86db77c8183098c9d8b511df1 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 12 May 2019 23:14:18 +0300 Subject: [PATCH 083/384] ignore trigger chars within a string literal --- src/services/completions.ts | 4 ++- .../completionsStringsWithTriggerCharacter.ts | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/completionsStringsWithTriggerCharacter.ts diff --git a/src/services/completions.ts b/src/services/completions.ts index 9d569fbedde..0d69f5951f8 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -40,7 +40,9 @@ namespace ts.Completions { const compilerOptions = program.getCompilerOptions(); const contextToken = findPrecedingToken(position, sourceFile); - if (triggerCharacter && !isValidTrigger(sourceFile, triggerCharacter, contextToken, position)) return undefined; + if (triggerCharacter && !isInString(sourceFile, position, contextToken) && !isValidTrigger(sourceFile, triggerCharacter, contextToken, position)) { + return undefined; + } const stringCompletions = StringCompletions.getStringLiteralCompletions(sourceFile, position, contextToken, typeChecker, compilerOptions, host, log, preferences); if (stringCompletions) { diff --git a/tests/cases/fourslash/completionsStringsWithTriggerCharacter.ts b/tests/cases/fourslash/completionsStringsWithTriggerCharacter.ts new file mode 100644 index 00000000000..277218305f4 --- /dev/null +++ b/tests/cases/fourslash/completionsStringsWithTriggerCharacter.ts @@ -0,0 +1,30 @@ +/// + +//// type A = "a/b" | "b/a"; +//// const a: A = "a/*1*/"; +//// +//// type B = "a@b" | "b@a"; +//// const a: B = "a@/*2*/"; +//// +//// type C = "a.b" | "b.a"; +//// const c: C = "a./*3*/"; +//// +//// type D = "a'b" | "b'a"; +//// const d: D = "a'/*4*/"; +//// +//// type E = "a`b" | "b`a"; +//// const e: E = "a`/*5*/"; +//// +//// type F = 'a"b' | 'b"a'; +//// const f: F = 'a"/*6*/'; +//// +//// type G = "a Date: Mon, 13 May 2019 08:33:12 -0700 Subject: [PATCH 084/384] Update user baselines (#31371) --- tests/baselines/reference/user/uglify-js.log | 52 ++++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/tests/baselines/reference/user/uglify-js.log b/tests/baselines/reference/user/uglify-js.log index 4a98daf3f2a..eccbc070b89 100644 --- a/tests/baselines/reference/user/uglify-js.log +++ b/tests/baselines/reference/user/uglify-js.log @@ -34,33 +34,33 @@ node_modules/uglify-js/lib/compress.js(3525,33): error TS2554: Expected 0 argume node_modules/uglify-js/lib/compress.js(3578,29): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/compress.js(3595,29): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. node_modules/uglify-js/lib/compress.js(3620,75): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3693,63): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3878,38): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3899,24): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. -node_modules/uglify-js/lib/compress.js(3909,28): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. -node_modules/uglify-js/lib/compress.js(4068,21): error TS2403: Subsequent variable declarations must have the same type. Variable 'defs' must be of type 'Dictionary & { set: (key: any, val: any) => Dictionary & { set: ...; add: (key: any, val: any) => Dictionary & { set: ...; add: ...; get: (key: any) => any; del: (key: any) => Dictionary & { set: ...; ... 8 more ...; toObject: () => any; }; ... 5 more ...; toObject: () => any; }; ... 7 more ...; toObject: () => any;...', but here has type 'any'. -node_modules/uglify-js/lib/compress.js(4120,17): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead. -node_modules/uglify-js/lib/compress.js(4181,45): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(4291,33): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(4588,17): error TS2403: Subsequent variable declarations must have the same type. Variable 'body' must be of type 'any[]', but here has type 'any'. -node_modules/uglify-js/lib/compress.js(4672,37): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(4880,57): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[RegExp, (string | undefined)?]'. +node_modules/uglify-js/lib/compress.js(3694,63): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3879,38): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3900,24): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. +node_modules/uglify-js/lib/compress.js(3910,28): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. +node_modules/uglify-js/lib/compress.js(4069,21): error TS2403: Subsequent variable declarations must have the same type. Variable 'defs' must be of type 'Dictionary & { set: (key: any, val: any) => Dictionary & { set: ...; add: (key: any, val: any) => Dictionary & { set: ...; add: ...; get: (key: any) => any; del: (key: any) => Dictionary & { set: ...; ... 8 more ...; toObject: () => any; }; ... 5 more ...; toObject: () => any; }; ... 7 more ...; toObject: () => any;...', but here has type 'any'. +node_modules/uglify-js/lib/compress.js(4121,17): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead. +node_modules/uglify-js/lib/compress.js(4182,45): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(4292,33): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(4589,17): error TS2403: Subsequent variable declarations must have the same type. Variable 'body' must be of type 'any[]', but here has type 'any'. +node_modules/uglify-js/lib/compress.js(4673,37): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(4881,57): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[RegExp, (string | undefined)?]'. Property '0' is missing in type 'any[]' but required in type '[RegExp, (string | undefined)?]'. -node_modules/uglify-js/lib/compress.js(5044,45): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(5051,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'code' must be of type 'string', but here has type '{ get: () => string; toString: () => string; indent: () => void; indentation: () => number; current_width: () => number; should_break: () => boolean; has_parens: () => boolean; newline: () => void; print: (str: any) => void; ... 24 more ...; parent: (n: any) => any; }'. -node_modules/uglify-js/lib/compress.js(5055,36): error TS2532: Object is possibly 'undefined'. -node_modules/uglify-js/lib/compress.js(5060,41): error TS2339: Property 'get' does not exist on type 'string'. -node_modules/uglify-js/lib/compress.js(5563,18): error TS2454: Variable 'is_strict_comparison' is used before being assigned. -node_modules/uglify-js/lib/compress.js(6058,25): error TS2367: This condition will always return 'false' since the types 'boolean' and '"f"' have no overlap. -node_modules/uglify-js/lib/compress.js(6085,47): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(6159,39): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(6231,39): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(6237,41): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(6670,43): error TS2454: Variable 'property' is used before being assigned. -node_modules/uglify-js/lib/compress.js(6685,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'. -node_modules/uglify-js/lib/compress.js(6688,46): error TS2339: Property 'has_side_effects' does not exist on type 'number'. -node_modules/uglify-js/lib/compress.js(6694,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'. -node_modules/uglify-js/lib/compress.js(6722,34): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(5045,45): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(5052,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'code' must be of type 'string', but here has type '{ get: () => string; toString: () => string; indent: () => void; indentation: () => number; current_width: () => number; should_break: () => boolean; has_parens: () => boolean; newline: () => void; print: (str: any) => void; ... 24 more ...; parent: (n: any) => any; }'. +node_modules/uglify-js/lib/compress.js(5056,36): error TS2532: Object is possibly 'undefined'. +node_modules/uglify-js/lib/compress.js(5061,41): error TS2339: Property 'get' does not exist on type 'string'. +node_modules/uglify-js/lib/compress.js(5565,18): error TS2454: Variable 'is_strict_comparison' is used before being assigned. +node_modules/uglify-js/lib/compress.js(6060,25): error TS2367: This condition will always return 'false' since the types 'boolean' and '"f"' have no overlap. +node_modules/uglify-js/lib/compress.js(6087,47): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(6160,39): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(6232,39): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(6238,41): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(6676,43): error TS2454: Variable 'property' is used before being assigned. +node_modules/uglify-js/lib/compress.js(6691,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'. +node_modules/uglify-js/lib/compress.js(6694,46): error TS2339: Property 'has_side_effects' does not exist on type 'number'. +node_modules/uglify-js/lib/compress.js(6700,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'. +node_modules/uglify-js/lib/compress.js(6728,34): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/minify.js(167,75): error TS2339: Property 'compress' does not exist on type 'Compressor'. node_modules/uglify-js/lib/mozilla-ast.js(566,33): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/output.js(235,25): error TS2554: Expected 0 arguments, but got 2. From 8ba53b6fd540a3533fe9e34d2d4f2d2eb0ae969b Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 13 May 2019 11:18:28 -0700 Subject: [PATCH 085/384] Simplify conditionals upon comparison, rather than instantiation --- src/compiler/checker.ts | 36 ++++++- src/compiler/types.ts | 2 + ...nalNoInfiniteInstantiationDepth.errors.txt | 82 +++++++------- ...itionalTypesSimplifyWhenTrivial.errors.txt | 100 ------------------ ...ferredInferenceAllowsAssignment.errors.txt | 82 +++++++------- 5 files changed, 110 insertions(+), 192 deletions(-) delete mode 100644 tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f016a8d3723..ccca2c436da 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9044,7 +9044,7 @@ namespace ts { } function getSubstitutionType(typeVariable: TypeVariable, substitute: Type) { - if (substitute.flags & TypeFlags.AnyOrUnknown) { + if (substitute.flags & TypeFlags.AnyOrUnknown || substitute === typeVariable) { return typeVariable; } const id = `${getTypeId(typeVariable)}>${getTypeId(substitute)}`; @@ -10194,7 +10194,9 @@ namespace ts { } function getSimplifiedType(type: Type, writing: boolean): Type { - return type.flags & TypeFlags.IndexedAccess ? getSimplifiedIndexedAccessType(type, writing) : type; + return type.flags & TypeFlags.IndexedAccess ? getSimplifiedIndexedAccessType(type, writing) : + type.flags & TypeFlags.Conditional ? getSimplifiedConditionalType(type, writing) : + type; } function distributeIndexOverObjectType(objectType: Type, indexType: Type, writing: boolean) { @@ -10257,6 +10259,32 @@ namespace ts { return type[cache] = type; } + function getSimplifiedConditionalType(type: ConditionalType, writing: boolean) { + const falseType = getFalseTypeFromConditionalType(type); + const trueType = getTrueTypeFromConditionalType(type); + const checkType = type.checkType; + const extendsType = type.extendsType; + // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`. + if (falseType.flags & TypeFlags.Never && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) { + if (checkType.flags & TypeFlags.Any || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true + return getSimplifiedType(trueType, writing); + } + else if (isIntersectionEmpty(checkType, extendsType)) { // Always false + return neverType; + } + } + else if (trueType.flags & TypeFlags.Never && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) { + if (!(checkType.flags & TypeFlags.Any) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true + return neverType; + } + else if (checkType.flags & TypeFlags.Any || isIntersectionEmpty(checkType, extendsType)) { // Always false + return getSimplifiedType(falseType, writing); + } + } + + return type; + } + function substituteIndexedMappedType(objectType: MappedType, index: Type) { const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]); const templateMapper = combineTypeMappers(objectType.mapper, mapper); @@ -12431,10 +12459,10 @@ namespace ts { if (target.flags & TypeFlags.Substitution) { target = (target).typeVariable; } - if (source.flags & TypeFlags.IndexedAccess) { + if (source.flags & TypeFlags.Simplifiable) { source = getSimplifiedType(source, /*writing*/ false); } - if (target.flags & TypeFlags.IndexedAccess) { + if (target.flags & TypeFlags.Simplifiable) { target = getSimplifiedType(target, /*writing*/ true); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ecb569bd9b0..db1a62937e6 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3966,6 +3966,8 @@ namespace ts { StructuredOrInstantiable = StructuredType | Instantiable, /* @internal */ ObjectFlagsType = Nullable | Never | Object | Union | Intersection, + /* @internal */ + Simplifiable = IndexedAccess | Conditional, // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never Narrowable = Any | Unknown | StructuredOrInstantiable | StringLike | NumberLike | BigIntLike | BooleanLike | ESSymbol | UniqueESSymbol | NonPrimitive, diff --git a/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt b/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt index 74835c4a55b..e73908f20f4 100644 --- a/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt +++ b/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt @@ -11,28 +11,25 @@ tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfin Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'TInjectedProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'GetProps[Extract>] | (TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. ==== tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.ts (1 errors) ==== @@ -113,26 +110,23 @@ tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfin !!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. !!! error TS2344: Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. !!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'GetProps[Extract>] | (TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. \ No newline at end of file diff --git a/tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.errors.txt b/tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.errors.txt deleted file mode 100644 index ca38e867e4f..00000000000 --- a/tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.errors.txt +++ /dev/null @@ -1,100 +0,0 @@ -tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(27,14): error TS2322: Type 'Pick>' is not assignable to type 'Params'. - 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. -tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(31,5): error TS2322: Type 'T' is not assignable to type 'ExcludeWithDefault'. -tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(36,14): error TS2322: Type 'Pick>' is not assignable to type 'Params'. - 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. -tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(40,5): error TS2322: Type 'T' is not assignable to type 'ExtractWithDefault'. -tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(47,14): error TS2322: Type 'Pick>' is not assignable to type 'Params'. - 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. -tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(51,5): error TS2322: Type 'T' is not assignable to type 'TemplatedConditional'. -tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(56,14): error TS2322: Type 'Pick>' is not assignable to type 'Params'. - 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. -tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts(60,5): error TS2322: Type 'T' is not assignable to type 'TemplatedConditional'. - - -==== tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts (8 errors) ==== - const fn1 = ( - params: Pick>, - ): Params => params; - - function fn2(x: Exclude) { - var y: T = x; - x = y; - } - - const fn3 = ( - params: Pick>, - ): Params => params; - - function fn4(x: Extract) { - var y: T = x; - x = y; - } - - declare var x: Extract; // Should be `numebr | string` and not `any` - - type ExtractWithDefault = T extends U ? T : D; - - type ExcludeWithDefault = T extends U ? D : T; - - const fn5 = ( - params: Pick>, - ): Params => params; - ~~~~~~ -!!! error TS2322: Type 'Pick>' is not assignable to type 'Params'. -!!! error TS2322: 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. - - function fn6(x: ExcludeWithDefault) { - var y: T = x; - x = y; - ~ -!!! error TS2322: Type 'T' is not assignable to type 'ExcludeWithDefault'. - } - - const fn7 = ( - params: Pick>, - ): Params => params; - ~~~~~~ -!!! error TS2322: Type 'Pick>' is not assignable to type 'Params'. -!!! error TS2322: 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. - - function fn8(x: ExtractWithDefault) { - var y: T = x; - x = y; - ~ -!!! error TS2322: Type 'T' is not assignable to type 'ExtractWithDefault'. - } - - type TemplatedConditional = TCheck extends TExtends ? TTrue : TFalse; - - const fn9 = ( - params: Pick>, - ): Params => params; - ~~~~~~ -!!! error TS2322: Type 'Pick>' is not assignable to type 'Params'. -!!! error TS2322: 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. - - function fn10(x: TemplatedConditional) { - var y: T = x; - x = y; - ~ -!!! error TS2322: Type 'T' is not assignable to type 'TemplatedConditional'. - } - - const fn11 = ( - params: Pick>, - ): Params => params; - ~~~~~~ -!!! error TS2322: Type 'Pick>' is not assignable to type 'Params'. -!!! error TS2322: 'Pick>' is assignable to the constraint of type 'Params', but 'Params' could be instantiated with a different subtype of constraint '{}'. - - function fn12(x: TemplatedConditional) { - var y: T = x; - x = y; - ~ -!!! error TS2322: Type 'T' is not assignable to type 'TemplatedConditional'. - } - - declare var z: any; - const zee = z!!!; // since x is `any`, `x extends null | undefined` should be both true and false - and thus yield `any` - \ No newline at end of file diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt index 8c7e2f57eda..61ef3863a15 100644 --- a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt @@ -11,28 +11,25 @@ tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts(76,50): Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'TInjectedProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'GetProps[Extract>] | (TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. ==== tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts (1 errors) ==== @@ -126,28 +123,25 @@ tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts(76,50): !!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. !!! error TS2344: Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. !!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'GetProps[Extract>] | (TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. >; declare const connect: { From 90667e104df18bce0e0457d90393b54f2b9a9730 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 13 May 2019 12:42:33 -0700 Subject: [PATCH 086/384] Remove this-parameter filtering in statement completion --- src/compiler/checker.ts | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 64834befee1..b730f382db3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -20386,25 +20386,7 @@ namespace ts { } function isValidPropertyAccessForCompletions(node: PropertyAccessExpression | ImportTypeNode | QualifiedName, type: Type, property: Symbol): boolean { - return isValidPropertyAccessWithType(node, node.kind === SyntaxKind.PropertyAccessExpression && node.expression.kind === SyntaxKind.SuperKeyword, property.escapedName, type) - && (!(property.flags & SymbolFlags.Method) || isValidMethodAccess(property, type)); - } - function isValidMethodAccess(method: Symbol, actualThisType: Type): boolean { - const propType = getTypeOfPropertyOfType(actualThisType, method.escapedName)!; - const signatures = getSignaturesOfType(getNonNullableType(propType), SignatureKind.Call); - Debug.assert(signatures.length !== 0); - return signatures.some(sig => { - const signatureThisType = getThisTypeOfSignature(sig); - return !signatureThisType || isTypeAssignableTo(actualThisType, getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType)); - }); - } - function getInstantiatedSignatureThisType(sig: Signature, signatureThisType: Type, actualThisType: Type): Type { - if (!sig.typeParameters) { - return signatureThisType; - } - const context = createInferenceContext(sig.typeParameters, sig, InferenceFlags.None); - inferTypes(context.inferences, actualThisType, signatureThisType); - return instantiateType(signatureThisType, createSignatureTypeMapper(sig, getInferredTypes(context))); + return isValidPropertyAccessWithType(node, node.kind === SyntaxKind.PropertyAccessExpression && node.expression.kind === SyntaxKind.SuperKeyword, property.escapedName, type); } function isValidPropertyAccessWithType( From a65f35b5fb4c1bc0d56724258a051b7e6f85bfce Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 13 May 2019 12:42:44 -0700 Subject: [PATCH 087/384] Remove fourslash test --- .../completionsMethodWithThisParameter.ts | 20 ------------------- 1 file changed, 20 deletions(-) delete mode 100644 tests/cases/fourslash/completionsMethodWithThisParameter.ts diff --git a/tests/cases/fourslash/completionsMethodWithThisParameter.ts b/tests/cases/fourslash/completionsMethodWithThisParameter.ts deleted file mode 100644 index d746f3626dc..00000000000 --- a/tests/cases/fourslash/completionsMethodWithThisParameter.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// - -////class A { -//// value: T; // Make the type parameter actually matter -//// ms(this: A) {} -//// mo(this: A<{}>) {} -//// mt(this: A) {} -//// mp

(this: A

) {} -//// mps

(this: A

) {} -////} -//// -////const s = new A(); -////const n = new A(); -////s./*s*/; -////n./*n*/; - -verify.completions( - { marker: "s", exact: ["value", "ms", "mo", "mt", "mp", "mps"] }, - { marker: "n", exact: ["value", "mo", "mt", "mp"] }, -); From f140dfc30b9395a4aa5ee82e752d5012e4b9c7de Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 13 May 2019 14:41:33 -0700 Subject: [PATCH 088/384] Chain RHS narrowing and truthiness narrowing in assignment expression narrowing (#31348) --- src/compiler/checker.ts | 2 +- ...olFlowForCompoundAssignmentToThisMember.js | 36 ++++++++++ ...wForCompoundAssignmentToThisMember.symbols | 57 ++++++++++++++++ ...lowForCompoundAssignmentToThisMember.types | 67 +++++++++++++++++++ .../reference/controlFlowTruthiness.types | 2 +- .../typeGuardsInConditionalExpression.types | 10 +-- ...GuardsInRightOperandOfAndAndOperator.types | 14 ++-- ...peGuardsInRightOperandOfOrOrOperator.types | 2 +- ...olFlowForCompoundAssignmentToThisMember.ts | 19 ++++++ 9 files changed, 194 insertions(+), 15 deletions(-) create mode 100644 tests/baselines/reference/controlFlowForCompoundAssignmentToThisMember.js create mode 100644 tests/baselines/reference/controlFlowForCompoundAssignmentToThisMember.symbols create mode 100644 tests/baselines/reference/controlFlowForCompoundAssignmentToThisMember.types create mode 100644 tests/cases/compiler/controlFlowForCompoundAssignmentToThisMember.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 64834befee1..e07ae989383 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -16773,7 +16773,7 @@ namespace ts { function narrowTypeByBinaryExpression(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type { switch (expr.operatorToken.kind) { case SyntaxKind.EqualsToken: - return narrowTypeByTruthiness(type, expr.left, assumeTrue); + return narrowTypeByTruthiness(narrowType(type, expr.right, assumeTrue), expr.left, assumeTrue); case SyntaxKind.EqualsEqualsToken: case SyntaxKind.ExclamationEqualsToken: case SyntaxKind.EqualsEqualsEqualsToken: diff --git a/tests/baselines/reference/controlFlowForCompoundAssignmentToThisMember.js b/tests/baselines/reference/controlFlowForCompoundAssignmentToThisMember.js new file mode 100644 index 00000000000..cdf74a58996 --- /dev/null +++ b/tests/baselines/reference/controlFlowForCompoundAssignmentToThisMember.js @@ -0,0 +1,36 @@ +//// [controlFlowForCompoundAssignmentToThisMember.ts] +class DatasourceCommandWidgetElement { + _commandBased: boolean; + _commandElement: unknown; + commandElement: unknown; + + constructor(target: unknown) { + if (target instanceof DatasourceCommandWidgetElement) { + this._commandBased = true; + this._commandElement = target.commandElement; + } else { + this._commandBased = false; + } + + if (this._commandBased = (target instanceof DatasourceCommandWidgetElement)) { + this._commandElement = target.commandElement; + } + } +} + +//// [controlFlowForCompoundAssignmentToThisMember.js] +var DatasourceCommandWidgetElement = /** @class */ (function () { + function DatasourceCommandWidgetElement(target) { + if (target instanceof DatasourceCommandWidgetElement) { + this._commandBased = true; + this._commandElement = target.commandElement; + } + else { + this._commandBased = false; + } + if (this._commandBased = (target instanceof DatasourceCommandWidgetElement)) { + this._commandElement = target.commandElement; + } + } + return DatasourceCommandWidgetElement; +}()); diff --git a/tests/baselines/reference/controlFlowForCompoundAssignmentToThisMember.symbols b/tests/baselines/reference/controlFlowForCompoundAssignmentToThisMember.symbols new file mode 100644 index 00000000000..4da7454f312 --- /dev/null +++ b/tests/baselines/reference/controlFlowForCompoundAssignmentToThisMember.symbols @@ -0,0 +1,57 @@ +=== tests/cases/compiler/controlFlowForCompoundAssignmentToThisMember.ts === +class DatasourceCommandWidgetElement { +>DatasourceCommandWidgetElement : Symbol(DatasourceCommandWidgetElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 0, 0)) + + _commandBased: boolean; +>_commandBased : Symbol(DatasourceCommandWidgetElement._commandBased, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 0, 38)) + + _commandElement: unknown; +>_commandElement : Symbol(DatasourceCommandWidgetElement._commandElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 1, 27)) + + commandElement: unknown; +>commandElement : Symbol(DatasourceCommandWidgetElement.commandElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 2, 29)) + + constructor(target: unknown) { +>target : Symbol(target, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 5, 16)) + + if (target instanceof DatasourceCommandWidgetElement) { +>target : Symbol(target, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 5, 16)) +>DatasourceCommandWidgetElement : Symbol(DatasourceCommandWidgetElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 0, 0)) + + this._commandBased = true; +>this._commandBased : Symbol(DatasourceCommandWidgetElement._commandBased, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 0, 38)) +>this : Symbol(DatasourceCommandWidgetElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 0, 0)) +>_commandBased : Symbol(DatasourceCommandWidgetElement._commandBased, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 0, 38)) + + this._commandElement = target.commandElement; +>this._commandElement : Symbol(DatasourceCommandWidgetElement._commandElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 1, 27)) +>this : Symbol(DatasourceCommandWidgetElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 0, 0)) +>_commandElement : Symbol(DatasourceCommandWidgetElement._commandElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 1, 27)) +>target.commandElement : Symbol(DatasourceCommandWidgetElement.commandElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 2, 29)) +>target : Symbol(target, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 5, 16)) +>commandElement : Symbol(DatasourceCommandWidgetElement.commandElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 2, 29)) + + } else { + this._commandBased = false; +>this._commandBased : Symbol(DatasourceCommandWidgetElement._commandBased, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 0, 38)) +>this : Symbol(DatasourceCommandWidgetElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 0, 0)) +>_commandBased : Symbol(DatasourceCommandWidgetElement._commandBased, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 0, 38)) + } + + if (this._commandBased = (target instanceof DatasourceCommandWidgetElement)) { +>this._commandBased : Symbol(DatasourceCommandWidgetElement._commandBased, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 0, 38)) +>this : Symbol(DatasourceCommandWidgetElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 0, 0)) +>_commandBased : Symbol(DatasourceCommandWidgetElement._commandBased, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 0, 38)) +>target : Symbol(target, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 5, 16)) +>DatasourceCommandWidgetElement : Symbol(DatasourceCommandWidgetElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 0, 0)) + + this._commandElement = target.commandElement; +>this._commandElement : Symbol(DatasourceCommandWidgetElement._commandElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 1, 27)) +>this : Symbol(DatasourceCommandWidgetElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 0, 0)) +>_commandElement : Symbol(DatasourceCommandWidgetElement._commandElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 1, 27)) +>target.commandElement : Symbol(DatasourceCommandWidgetElement.commandElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 2, 29)) +>target : Symbol(target, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 5, 16)) +>commandElement : Symbol(DatasourceCommandWidgetElement.commandElement, Decl(controlFlowForCompoundAssignmentToThisMember.ts, 2, 29)) + } + } +} diff --git a/tests/baselines/reference/controlFlowForCompoundAssignmentToThisMember.types b/tests/baselines/reference/controlFlowForCompoundAssignmentToThisMember.types new file mode 100644 index 00000000000..7c289daa2e0 --- /dev/null +++ b/tests/baselines/reference/controlFlowForCompoundAssignmentToThisMember.types @@ -0,0 +1,67 @@ +=== tests/cases/compiler/controlFlowForCompoundAssignmentToThisMember.ts === +class DatasourceCommandWidgetElement { +>DatasourceCommandWidgetElement : DatasourceCommandWidgetElement + + _commandBased: boolean; +>_commandBased : boolean + + _commandElement: unknown; +>_commandElement : unknown + + commandElement: unknown; +>commandElement : unknown + + constructor(target: unknown) { +>target : unknown + + if (target instanceof DatasourceCommandWidgetElement) { +>target instanceof DatasourceCommandWidgetElement : boolean +>target : unknown +>DatasourceCommandWidgetElement : typeof DatasourceCommandWidgetElement + + this._commandBased = true; +>this._commandBased = true : true +>this._commandBased : boolean +>this : this +>_commandBased : boolean +>true : true + + this._commandElement = target.commandElement; +>this._commandElement = target.commandElement : unknown +>this._commandElement : unknown +>this : this +>_commandElement : unknown +>target.commandElement : unknown +>target : DatasourceCommandWidgetElement +>commandElement : unknown + + } else { + this._commandBased = false; +>this._commandBased = false : false +>this._commandBased : boolean +>this : this +>_commandBased : boolean +>false : false + } + + if (this._commandBased = (target instanceof DatasourceCommandWidgetElement)) { +>this._commandBased = (target instanceof DatasourceCommandWidgetElement) : boolean +>this._commandBased : boolean +>this : this +>_commandBased : boolean +>(target instanceof DatasourceCommandWidgetElement) : boolean +>target instanceof DatasourceCommandWidgetElement : boolean +>target : unknown +>DatasourceCommandWidgetElement : typeof DatasourceCommandWidgetElement + + this._commandElement = target.commandElement; +>this._commandElement = target.commandElement : unknown +>this._commandElement : unknown +>this : this +>_commandElement : unknown +>target.commandElement : unknown +>target : DatasourceCommandWidgetElement +>commandElement : unknown + } + } +} diff --git a/tests/baselines/reference/controlFlowTruthiness.types b/tests/baselines/reference/controlFlowTruthiness.types index 454d094f406..17f497267ee 100644 --- a/tests/baselines/reference/controlFlowTruthiness.types +++ b/tests/baselines/reference/controlFlowTruthiness.types @@ -111,7 +111,7 @@ function f5() { >x : string y; // string | undefined ->y : string | undefined +>y : string } else { x; // string | undefined diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.types b/tests/baselines/reference/typeGuardsInConditionalExpression.types index 19e11e2e888..f3b0a045e6b 100644 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.types +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.types @@ -211,11 +211,11 @@ function foo8(x: number | string | boolean) { >typeof x === "boolean" ? x // boolean : x == 10 : boolean >typeof x === "boolean" : boolean >typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" ->x : number | boolean +>x : number | true >"boolean" : "boolean" ? x // boolean ->x : boolean +>x : true : x == 10)); // boolean >x == 10 : boolean @@ -286,7 +286,7 @@ function foo10(x: number | string | boolean) { && typeof x === "number" >typeof x === "number" : boolean >typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" ->x : number | boolean +>x : number | true >"number" : "number" && x.toString()); // x is number @@ -326,7 +326,7 @@ function foo11(x: number | string | boolean) { && typeof x === "number" >typeof x === "number" : boolean >typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" ->x : number | boolean +>x : number | true >"number" : "number" && (x = 10) // assignment to x @@ -379,7 +379,7 @@ function foo12(x: number | string | boolean) { && typeof x === "number" >typeof x === "number" : boolean >typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" ->x : number | boolean +>x : number | true >"number" : "number" && x); // x is number diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types index 166dd9ac0e1..43766b1db12 100644 --- a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types +++ b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types @@ -102,11 +102,11 @@ function foo5(x: number | string | boolean) { >typeof x !== "number" // number | boolean && x : boolean >typeof x !== "number" : boolean >typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" ->x : number | boolean +>x : number | true >"number" : "number" && x)); // boolean ->x : boolean +>x : true } function foo6(x: number | string | boolean) { >foo6 : (x: string | number | boolean) => boolean @@ -167,7 +167,7 @@ function foo7(x: number | string | boolean) { >typeof x === "number" // change value of x ? ((x = 10) && x.toString()) // x is number // do not change value : ((y = x) && x.toString()) : string >typeof x === "number" : boolean >typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" ->x : number | boolean +>x : number | true >"number" : "number" // change value of x @@ -187,13 +187,13 @@ function foo7(x: number | string | boolean) { : ((y = x) && x.toString()))); // x is boolean >((y = x) && x.toString()) : string >(y = x) && x.toString() : string ->(y = x) : boolean ->y = x : boolean +>(y = x) : true +>y = x : true >y : string | number | boolean ->x : boolean +>x : true >x.toString() : string >x.toString : () => string ->x : boolean +>x : true >toString : () => string } diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types index d3335cd75be..8f381e115f5 100644 --- a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types +++ b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types @@ -194,7 +194,7 @@ function foo7(x: number | string | boolean) { >x : boolean >x.toString() : string >x.toString : () => string ->x : boolean +>x : true >toString : () => string } diff --git a/tests/cases/compiler/controlFlowForCompoundAssignmentToThisMember.ts b/tests/cases/compiler/controlFlowForCompoundAssignmentToThisMember.ts new file mode 100644 index 00000000000..2ed77e8ed5f --- /dev/null +++ b/tests/cases/compiler/controlFlowForCompoundAssignmentToThisMember.ts @@ -0,0 +1,19 @@ + +class DatasourceCommandWidgetElement { + _commandBased: boolean; + _commandElement: unknown; + commandElement: unknown; + + constructor(target: unknown) { + if (target instanceof DatasourceCommandWidgetElement) { + this._commandBased = true; + this._commandElement = target.commandElement; + } else { + this._commandBased = false; + } + + if (this._commandBased = (target instanceof DatasourceCommandWidgetElement)) { + this._commandElement = target.commandElement; + } + } +} \ No newline at end of file From 1b3589ba27b90dcf749582395951697d8fb97958 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 13 May 2019 16:23:51 -0700 Subject: [PATCH 089/384] Remove simplification logic from getConditionalType + simplify substitution types --- src/compiler/checker.ts | 47 +++++++++-------------------------------- src/compiler/types.ts | 2 +- 2 files changed, 11 insertions(+), 38 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ccca2c436da..7aa8c0ddd68 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10196,6 +10196,7 @@ namespace ts { function getSimplifiedType(type: Type, writing: boolean): Type { return type.flags & TypeFlags.IndexedAccess ? getSimplifiedIndexedAccessType(type, writing) : type.flags & TypeFlags.Conditional ? getSimplifiedConditionalType(type, writing) : + type.flags & TypeFlags.Substitution ? writing ? (type).typeVariable : (type).substitute : type; } @@ -10260,10 +10261,10 @@ namespace ts { } function getSimplifiedConditionalType(type: ConditionalType, writing: boolean) { - const falseType = getFalseTypeFromConditionalType(type); - const trueType = getTrueTypeFromConditionalType(type); const checkType = type.checkType; const extendsType = type.extendsType; + const trueType = getTrueTypeFromConditionalType(type); + const falseType = getFalseTypeFromConditionalType(type); // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`. if (falseType.flags & TypeFlags.Never && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) { if (checkType.flags & TypeFlags.Any || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true @@ -10281,10 +10282,16 @@ namespace ts { return getSimplifiedType(falseType, writing); } } - return type; } + /** + * Invokes union simplification logic to determine if an intersection is considered empty as a union constituent + */ + function isIntersectionEmpty(type1: Type, type2: Type) { + return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & TypeFlags.Never); + } + function substituteIndexedMappedType(objectType: MappedType, index: Type) { const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]); const templateMapper = combineTypeMappers(objectType.mapper, mapper); @@ -10391,36 +10398,12 @@ namespace ts { return type; } - /** - * Invokes union simplification logic to determine if an intersection is considered empty as a union constituent - */ - function isIntersectionEmpty(type1: Type, type2: Type) { - return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & TypeFlags.Never); - } - function getConditionalType(root: ConditionalRoot, mapper: TypeMapper | undefined): Type { const checkType = instantiateType(root.checkType, mapper); const extendsType = instantiateType(root.extendsType, mapper); if (checkType === wildcardType || extendsType === wildcardType) { return wildcardType; } - // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`. - if (root.falseType.flags & TypeFlags.Never && getActualTypeVariable(root.trueType) === getActualTypeVariable(root.checkType)) { - if (checkType.flags & TypeFlags.Any || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true - return checkType; - } - else if (isIntersectionEmpty(checkType, extendsType)) { // Always false - return neverType; - } - } - else if (root.trueType.flags & TypeFlags.Never && getActualTypeVariable(root.falseType) === getActualTypeVariable(root.checkType)) { - if (!(checkType.flags & TypeFlags.Any) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true - return neverType; - } - else if (checkType.flags & TypeFlags.Any || isIntersectionEmpty(checkType, extendsType)) { // Always false - return checkType; - } - } const checkTypeInstantiable = maybeTypeOfKind(checkType, TypeFlags.Instantiable | TypeFlags.GenericMappedType); let combinedMapper: TypeMapper | undefined; if (root.inferTypeParameters) { @@ -10461,10 +10444,6 @@ namespace ts { } } // Return a deferred type for a check that is neither definitely true nor definitely false - return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType); - } - - function getDeferredConditionalType(root: ConditionalRoot, mapper: TypeMapper | undefined, combinedMapper: TypeMapper | undefined, checkType: Type, extendsType: Type) { const erasedCheckType = getActualTypeVariable(checkType); const result = createType(TypeFlags.Conditional); result.root = root; @@ -12453,12 +12432,6 @@ namespace ts { if (isFreshLiteralType(target)) { target = (target).regularType; } - if (source.flags & TypeFlags.Substitution) { - source = (source).substitute; - } - if (target.flags & TypeFlags.Substitution) { - target = (target).typeVariable; - } if (source.flags & TypeFlags.Simplifiable) { source = getSimplifiedType(source, /*writing*/ false); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index db1a62937e6..75fb702609b 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3967,7 +3967,7 @@ namespace ts { /* @internal */ ObjectFlagsType = Nullable | Never | Object | Union | Intersection, /* @internal */ - Simplifiable = IndexedAccess | Conditional, + Simplifiable = IndexedAccess | Conditional | Substitution, // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never Narrowable = Any | Unknown | StructuredOrInstantiable | StringLike | NumberLike | BigIntLike | BooleanLike | ESSymbol | UniqueESSymbol | NonPrimitive, From 066e4b6f89f6da09629f9d84b9577b14c0fd7d3c Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 13 May 2019 16:24:20 -0700 Subject: [PATCH 090/384] Accept new baselines --- ...nalNoInfiniteInstantiationDepth.errors.txt | 82 ++++++++++--------- .../reference/conditionalTypes2.errors.txt | 28 +++---- .../conditionalTypesSimplifyWhenTrivial.types | 32 ++++---- ...ferredInferenceAllowsAssignment.errors.txt | 82 ++++++++++--------- 4 files changed, 118 insertions(+), 106 deletions(-) diff --git a/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt b/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt index e73908f20f4..74835c4a55b 100644 --- a/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt +++ b/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt @@ -11,25 +11,28 @@ tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfin Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[Extract>] | (TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. ==== tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.ts (1 errors) ==== @@ -110,23 +113,26 @@ tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfin !!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. !!! error TS2344: Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. !!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[Extract>] | (TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. \ No newline at end of file diff --git a/tests/baselines/reference/conditionalTypes2.errors.txt b/tests/baselines/reference/conditionalTypes2.errors.txt index 4093bf46fb0..1cf5b0eca44 100644 --- a/tests/baselines/reference/conditionalTypes2.errors.txt +++ b/tests/baselines/reference/conditionalTypes2.errors.txt @@ -10,13 +10,13 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(24,5): error TS23 Type 'keyof B' is not assignable to type 'keyof A'. Type 'string | number | symbol' is not assignable to type 'keyof A'. Type 'string' is not assignable to type 'keyof A'. - Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. - Type 'keyof B' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. - Type 'string | number | symbol' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. - Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. - Type 'keyof B' is not assignable to type '"valueOf"'. - Type 'string | number | symbol' is not assignable to type '"valueOf"'. - Type 'string' is not assignable to type '"valueOf"'. + Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. + Type 'keyof B' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. + Type 'string | number | symbol' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. + Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. + Type 'keyof B' is not assignable to type 'keyof A'. + Type 'string | number | symbol' is not assignable to type 'keyof A'. + Type 'string' is not assignable to type 'keyof A'. tests/cases/conformance/types/conditional/conditionalTypes2.ts(25,5): error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. Types of property 'foo' are incompatible. Type 'A extends string ? keyof A : A' is not assignable to type 'B extends string ? keyof B : B'. @@ -73,13 +73,13 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(75,12): error TS2 !!! error TS2322: Type 'keyof B' is not assignable to type 'keyof A'. !!! error TS2322: Type 'string | number | symbol' is not assignable to type 'keyof A'. !!! error TS2322: Type 'string' is not assignable to type 'keyof A'. -!!! error TS2322: Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. -!!! error TS2322: Type 'keyof B' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. -!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. -!!! error TS2322: Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. -!!! error TS2322: Type 'keyof B' is not assignable to type '"valueOf"'. -!!! error TS2322: Type 'string | number | symbol' is not assignable to type '"valueOf"'. -!!! error TS2322: Type 'string' is not assignable to type '"valueOf"'. +!!! error TS2322: Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. +!!! error TS2322: Type 'keyof B' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. +!!! error TS2322: Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. +!!! error TS2322: Type 'keyof B' is not assignable to type 'keyof A'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'keyof A'. +!!! error TS2322: Type 'string' is not assignable to type 'keyof A'. b = a; // Error ~ !!! error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. diff --git a/tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.types b/tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.types index 27ac10ff161..27ac357703a 100644 --- a/tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.types +++ b/tests/baselines/reference/conditionalTypesSimplifyWhenTrivial.types @@ -1,49 +1,49 @@ === tests/cases/compiler/conditionalTypesSimplifyWhenTrivial.ts === const fn1 = ( ->fn1 : (params: Pick) => Params ->( params: Pick>,): Params => params : (params: Pick) => Params +>fn1 : (params: Pick>) => Params +>( params: Pick>,): Params => params : (params: Pick>) => Params params: Pick>, ->params : Pick +>params : Pick> ): Params => params; ->params : Pick +>params : Pick> function fn2(x: Exclude) { ->fn2 : (x: T) => void ->x : T +>fn2 : (x: Exclude) => void +>x : Exclude var y: T = x; >y : T ->x : T +>x : Exclude x = y; >x = y : T ->x : T +>x : Exclude >y : T } const fn3 = ( ->fn3 : (params: Pick) => Params ->( params: Pick>,): Params => params : (params: Pick) => Params +>fn3 : (params: Pick>) => Params +>( params: Pick>,): Params => params : (params: Pick>) => Params params: Pick>, ->params : Pick +>params : Pick> ): Params => params; ->params : Pick +>params : Pick> function fn4(x: Extract) { ->fn4 : (x: T) => void ->x : T +>fn4 : (x: Extract) => void +>x : Extract var y: T = x; >y : T ->x : T +>x : Extract x = y; >x = y : T ->x : T +>x : Extract >y : T } diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt index 61ef3863a15..8c7e2f57eda 100644 --- a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt @@ -11,25 +11,28 @@ tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts(76,50): Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[Extract>] | (TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. - Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. - Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. ==== tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts (1 errors) ==== @@ -123,25 +126,28 @@ tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts(76,50): !!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. !!! error TS2344: Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. !!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[Extract>] | (TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. -!!! error TS2344: Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. -!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string] | (TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string] | (TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. >; declare const connect: { From d2923460e967d9bd58057ce1570e24e62c08c62b Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 13 May 2019 16:34:09 -0700 Subject: [PATCH 091/384] Add comment providing context on the change --- src/compiler/checker.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b730f382db3..cdd873cd0bc 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -20387,6 +20387,7 @@ namespace ts { function isValidPropertyAccessForCompletions(node: PropertyAccessExpression | ImportTypeNode | QualifiedName, type: Type, property: Symbol): boolean { return isValidPropertyAccessWithType(node, node.kind === SyntaxKind.PropertyAccessExpression && node.expression.kind === SyntaxKind.SuperKeyword, property.escapedName, type); + // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context. } function isValidPropertyAccessWithType( From 4b5968eb6d8a64794b51d48fd67fd28e7cd34e28 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 14 May 2019 07:45:29 -0700 Subject: [PATCH 092/384] Revert change to substitution type simplification --- src/compiler/checker.ts | 7 ++++++- src/compiler/types.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9a64dce1255..e37da1fd678 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10196,7 +10196,6 @@ namespace ts { function getSimplifiedType(type: Type, writing: boolean): Type { return type.flags & TypeFlags.IndexedAccess ? getSimplifiedIndexedAccessType(type, writing) : type.flags & TypeFlags.Conditional ? getSimplifiedConditionalType(type, writing) : - type.flags & TypeFlags.Substitution ? writing ? (type).typeVariable : (type).substitute : type; } @@ -12432,6 +12431,12 @@ namespace ts { if (isFreshLiteralType(target)) { target = (target).regularType; } + if (source.flags & TypeFlags.Substitution) { + source = (source).substitute; + } + if (target.flags & TypeFlags.Substitution) { + target = (target).typeVariable; + } if (source.flags & TypeFlags.Simplifiable) { source = getSimplifiedType(source, /*writing*/ false); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 75fb702609b..db1a62937e6 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3967,7 +3967,7 @@ namespace ts { /* @internal */ ObjectFlagsType = Nullable | Never | Object | Union | Intersection, /* @internal */ - Simplifiable = IndexedAccess | Conditional | Substitution, + Simplifiable = IndexedAccess | Conditional, // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never Narrowable = Any | Unknown | StructuredOrInstantiable | StringLike | NumberLike | BigIntLike | BooleanLike | ESSymbol | UniqueESSymbol | NonPrimitive, From 92a1547efff8ce62a14e160cb007f4eb653f160d Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 14 May 2019 08:41:29 -0700 Subject: [PATCH 093/384] Accept new baselines --- .../reference/conditionalTypes2.errors.txt | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/baselines/reference/conditionalTypes2.errors.txt b/tests/baselines/reference/conditionalTypes2.errors.txt index 1cf5b0eca44..4093bf46fb0 100644 --- a/tests/baselines/reference/conditionalTypes2.errors.txt +++ b/tests/baselines/reference/conditionalTypes2.errors.txt @@ -10,13 +10,13 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(24,5): error TS23 Type 'keyof B' is not assignable to type 'keyof A'. Type 'string | number | symbol' is not assignable to type 'keyof A'. Type 'string' is not assignable to type 'keyof A'. - Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. - Type 'keyof B' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. - Type 'string | number | symbol' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. - Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. - Type 'keyof B' is not assignable to type 'keyof A'. - Type 'string | number | symbol' is not assignable to type 'keyof A'. - Type 'string' is not assignable to type 'keyof A'. + Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. + Type 'keyof B' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. + Type 'string | number | symbol' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. + Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. + Type 'keyof B' is not assignable to type '"valueOf"'. + Type 'string | number | symbol' is not assignable to type '"valueOf"'. + Type 'string' is not assignable to type '"valueOf"'. tests/cases/conformance/types/conditional/conditionalTypes2.ts(25,5): error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. Types of property 'foo' are incompatible. Type 'A extends string ? keyof A : A' is not assignable to type 'B extends string ? keyof B : B'. @@ -73,13 +73,13 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(75,12): error TS2 !!! error TS2322: Type 'keyof B' is not assignable to type 'keyof A'. !!! error TS2322: Type 'string | number | symbol' is not assignable to type 'keyof A'. !!! error TS2322: Type 'string' is not assignable to type 'keyof A'. -!!! error TS2322: Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. -!!! error TS2322: Type 'keyof B' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. -!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. -!!! error TS2322: Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf" | keyof A'. -!!! error TS2322: Type 'keyof B' is not assignable to type 'keyof A'. -!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'keyof A'. -!!! error TS2322: Type 'string' is not assignable to type 'keyof A'. +!!! error TS2322: Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. +!!! error TS2322: Type 'keyof B' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. +!!! error TS2322: Type 'string' is not assignable to type 'number | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "length" | "substr" | "valueOf"'. +!!! error TS2322: Type 'keyof B' is not assignable to type '"valueOf"'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type '"valueOf"'. +!!! error TS2322: Type 'string' is not assignable to type '"valueOf"'. b = a; // Error ~ !!! error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. From d7c3b5e5d04f2949bb42982fe3a2bdbda60909dc Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 14 May 2019 16:32:46 -0700 Subject: [PATCH 094/384] Add getParsedCommandLine as optional method on SolutionBuilderHost --- src/compiler/tsbuild.ts | 20 +++++++++++++++---- .../reference/api/tsserverlibrary.d.ts | 1 + tests/baselines/reference/api/typescript.d.ts | 1 + 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index f30800c100d..99bb27aba2c 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -245,6 +245,7 @@ namespace ts { getModifiedTime(fileName: string): Date | undefined; setModifiedTime(fileName: string, date: Date): void; deleteFile(fileName: string): void; + getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined; reportDiagnostic: DiagnosticReporter; // Technically we want to move it out and allow steps of actions on Solution, but for now just merge stuff in build host here reportSolutionBuilderStatus: DiagnosticReporter; @@ -493,10 +494,17 @@ namespace ts { } let diagnostic: Diagnostic | undefined; - const { parseConfigFileHost, baseCompilerOptions, extendedConfigCache } = state; - parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = d => diagnostic = d; - const parsed = getParsedCommandLineOfConfigFile(configFileName, baseCompilerOptions, parseConfigFileHost, extendedConfigCache); - parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = noop; + const { parseConfigFileHost, baseCompilerOptions, extendedConfigCache, host } = state; + let parsed: ParsedCommandLine | undefined; + if (host.getParsedCommandLine) { + parsed = host.getParsedCommandLine(configFileName); + if (!parsed) diagnostic = createCompilerDiagnostic(Diagnostics.File_0_not_found, configFileName); + } + else { + parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = d => diagnostic = d; + parsed = getParsedCommandLineOfConfigFile(configFileName, baseCompilerOptions, parseConfigFileHost, extendedConfigCache); + parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = noop; + } configFileCache.set(configFilePath, parsed || diagnostic!); return parsed; } @@ -1730,6 +1738,10 @@ namespace ts { } function invalidateProject(state: SolutionBuilderState, resolved: ResolvedConfigFilePath, reloadLevel: ConfigFileProgramReloadLevel) { + // If host implements getParsedCommandLine, we cant get list of files from parseConfigFileHost + if (state.host.getParsedCommandLine && reloadLevel === ConfigFileProgramReloadLevel.Partial) { + reloadLevel = ConfigFileProgramReloadLevel.Full; + } if (reloadLevel === ConfigFileProgramReloadLevel.Full) { state.configFileCache.delete(resolved); state.buildOrder = undefined; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index b9d1f1ffab7..01cef9552db 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4591,6 +4591,7 @@ declare namespace ts { getModifiedTime(fileName: string): Date | undefined; setModifiedTime(fileName: string, date: Date): void; deleteFile(fileName: string): void; + getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined; reportDiagnostic: DiagnosticReporter; reportSolutionBuilderStatus: DiagnosticReporter; afterProgramEmitAndDiagnostics?(program: T): void; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index a140501c411..ce0e7b81c82 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4591,6 +4591,7 @@ declare namespace ts { getModifiedTime(fileName: string): Date | undefined; setModifiedTime(fileName: string, date: Date): void; deleteFile(fileName: string): void; + getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined; reportDiagnostic: DiagnosticReporter; reportSolutionBuilderStatus: DiagnosticReporter; afterProgramEmitAndDiagnostics?(program: T): void; From 3885e3fcda213ec8c5f21849d6b8ddf8a5357fa7 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 14 May 2019 16:58:06 -0700 Subject: [PATCH 095/384] Fix error message regressed by #30916 (#31276) --- src/compiler/checker.ts | 20 +++++++++++++++---- ...gningFunctionToTupleIssuesError.errors.txt | 8 ++++++++ .../assigningFunctionToTupleIssuesError.js | 6 ++++++ ...ssigningFunctionToTupleIssuesError.symbols | 8 ++++++++ .../assigningFunctionToTupleIssuesError.types | 8 ++++++++ .../assigningFunctionToTupleIssuesError.ts | 2 ++ 6 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 tests/baselines/reference/assigningFunctionToTupleIssuesError.errors.txt create mode 100644 tests/baselines/reference/assigningFunctionToTupleIssuesError.js create mode 100644 tests/baselines/reference/assigningFunctionToTupleIssuesError.symbols create mode 100644 tests/baselines/reference/assigningFunctionToTupleIssuesError.types create mode 100644 tests/cases/compiler/assigningFunctionToTupleIssuesError.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9a64dce1255..0f18afa7741 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12290,7 +12290,7 @@ namespace ts { let depth = 0; let expandingFlags = ExpandingFlags.None; let overflow = false; - let suppressNextError = false; + let overrideNextErrorInfo: DiagnosticMessageChain | undefined; Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); @@ -12571,10 +12571,14 @@ namespace ts { } if (!result && reportErrors) { - const maybeSuppress = suppressNextError; - suppressNextError = false; + let maybeSuppress = overrideNextErrorInfo; + overrideNextErrorInfo = undefined; if (source.flags & TypeFlags.Object && target.flags & TypeFlags.Object) { + const currentError = errorInfo; tryElaborateArrayLikeErrors(source, target, reportErrors); + if (errorInfo !== currentError) { + maybeSuppress = errorInfo; + } } if (source.flags & TypeFlags.Object && target.flags & TypeFlags.Primitive) { tryElaborateErrorsForPrimitivesAndObjects(source, target); @@ -13506,9 +13510,10 @@ namespace ts { if (unmatchedProperty) { if (reportErrors) { const props = arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false)); + let shouldSkipElaboration = false; if (!headMessage || (headMessage.code !== Diagnostics.Class_0_incorrectly_implements_interface_1.code && headMessage.code !== Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) { - suppressNextError = true; // Retain top-level error for interface implementing issues, otherwise omit it + shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it } if (props.length === 1) { const propName = symbolToString(unmatchedProperty); @@ -13516,6 +13521,9 @@ namespace ts { if (length(unmatchedProperty.declarations)) { associateRelatedInfo(createDiagnosticForNode(unmatchedProperty.declarations[0], Diagnostics._0_is_declared_here, propName)); } + if (shouldSkipElaboration) { + overrideNextErrorInfo = errorInfo; + } } else if (tryElaborateArrayLikeErrors(source, target, /*reportErrors*/ false)) { if (props.length > 5) { // arbitrary cutoff for too-long list form @@ -13524,7 +13532,11 @@ namespace ts { else { reportError(Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), map(props, p => symbolToString(p)).join(", ")); } + if (shouldSkipElaboration) { + overrideNextErrorInfo = errorInfo; + } } + // ELSE: No array like or unmatched property error - just issue top level error (errorInfo = undefined) } return Ternary.False; } diff --git a/tests/baselines/reference/assigningFunctionToTupleIssuesError.errors.txt b/tests/baselines/reference/assigningFunctionToTupleIssuesError.errors.txt new file mode 100644 index 00000000000..ca1af66c087 --- /dev/null +++ b/tests/baselines/reference/assigningFunctionToTupleIssuesError.errors.txt @@ -0,0 +1,8 @@ +tests/cases/compiler/assigningFunctionToTupleIssuesError.ts(2,5): error TS2322: Type '() => void' is not assignable to type '[string]'. + + +==== tests/cases/compiler/assigningFunctionToTupleIssuesError.ts (1 errors) ==== + declare let a: () => void; + let b: [string] = a; + ~ +!!! error TS2322: Type '() => void' is not assignable to type '[string]'. \ No newline at end of file diff --git a/tests/baselines/reference/assigningFunctionToTupleIssuesError.js b/tests/baselines/reference/assigningFunctionToTupleIssuesError.js new file mode 100644 index 00000000000..3de3da7b3cc --- /dev/null +++ b/tests/baselines/reference/assigningFunctionToTupleIssuesError.js @@ -0,0 +1,6 @@ +//// [assigningFunctionToTupleIssuesError.ts] +declare let a: () => void; +let b: [string] = a; + +//// [assigningFunctionToTupleIssuesError.js] +var b = a; diff --git a/tests/baselines/reference/assigningFunctionToTupleIssuesError.symbols b/tests/baselines/reference/assigningFunctionToTupleIssuesError.symbols new file mode 100644 index 00000000000..7a499662aef --- /dev/null +++ b/tests/baselines/reference/assigningFunctionToTupleIssuesError.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/assigningFunctionToTupleIssuesError.ts === +declare let a: () => void; +>a : Symbol(a, Decl(assigningFunctionToTupleIssuesError.ts, 0, 11)) + +let b: [string] = a; +>b : Symbol(b, Decl(assigningFunctionToTupleIssuesError.ts, 1, 3)) +>a : Symbol(a, Decl(assigningFunctionToTupleIssuesError.ts, 0, 11)) + diff --git a/tests/baselines/reference/assigningFunctionToTupleIssuesError.types b/tests/baselines/reference/assigningFunctionToTupleIssuesError.types new file mode 100644 index 00000000000..6c7d57f8483 --- /dev/null +++ b/tests/baselines/reference/assigningFunctionToTupleIssuesError.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/assigningFunctionToTupleIssuesError.ts === +declare let a: () => void; +>a : () => void + +let b: [string] = a; +>b : [string] +>a : () => void + diff --git a/tests/cases/compiler/assigningFunctionToTupleIssuesError.ts b/tests/cases/compiler/assigningFunctionToTupleIssuesError.ts new file mode 100644 index 00000000000..befea50f81d --- /dev/null +++ b/tests/cases/compiler/assigningFunctionToTupleIssuesError.ts @@ -0,0 +1,2 @@ +declare let a: () => void; +let b: [string] = a; \ No newline at end of file From 89d1475fde16da386f065e30b5ee7746e383379b Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 15 May 2019 09:14:23 -0700 Subject: [PATCH 096/384] Add writeFileCallbacks to done method and also on host --- src/compiler/tsbuild.ts | 19 +++++++++++++------ .../reference/api/tsserverlibrary.d.ts | 8 +++++++- tests/baselines/reference/api/typescript.d.ts | 8 +++++++- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 99bb27aba2c..77de45bee01 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -242,6 +242,13 @@ namespace ts { export type ReportEmitErrorSummary = (errorCount: number) => void; export interface SolutionBuilderHostBase extends ProgramHost { + createDirectory?(path: string): void; + /** + * Should provide create directory and writeFile if done of invalidatedProjects is not invoked with + * writeFileCallback + */ + writeFile?(path: string, data: string, writeByteOrderMark?: boolean): void; + getModifiedTime(fileName: string): Date | undefined; setModifiedTime(fileName: string, date: Date): void; deleteFile(fileName: string): void; @@ -673,7 +680,7 @@ namespace ts { /** * To dispose this project and ensure that all the necessary actions are taken and state is updated accordingly */ - done(cancellationToken?: CancellationToken): ExitStatus; + done(cancellationToken?: CancellationToken, writeFile?: WriteFileCallback, customTransformers?: CustomTransformers): ExitStatus; getCompilerOptions(): CompilerOptions; getCurrentDirectory(): string; } @@ -861,8 +868,8 @@ namespace ts { done, }; - function done(cancellationToken?: CancellationToken) { - executeSteps(Step.Done, cancellationToken); + function done(cancellationToken?: CancellationToken, writeFile?: WriteFileCallback, customTransformers?: CustomTransformers) { + executeSteps(Step.Done, cancellationToken, writeFile, customTransformers); return doneInvalidatedProject(state, projectPath); } @@ -1127,7 +1134,7 @@ namespace ts { return { emitSkipped: false, diagnostics: emitDiagnostics }; } - function executeSteps(till: Step, cancellationToken?: CancellationToken) { + function executeSteps(till: Step, cancellationToken?: CancellationToken, writeFile?: WriteFileCallback, customTransformers?: CustomTransformers) { while (step <= till && step < Step.Done) { const currentStep = step; switch (step) { @@ -1144,11 +1151,11 @@ namespace ts { break; case Step.Emit: - emit(/*writeFileCallback*/ undefined, cancellationToken); + emit(writeFile, cancellationToken, customTransformers); break; case Step.EmitBundle: - emitBundle(); + emitBundle(writeFile, customTransformers); break; case Step.BuildInvalidatedProjectOfBundle: diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 01cef9552db..05f8195b992 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4588,6 +4588,12 @@ declare namespace ts { } type ReportEmitErrorSummary = (errorCount: number) => void; interface SolutionBuilderHostBase extends ProgramHost { + createDirectory?(path: string): void; + /** + * Should provide create directory and writeFile if done of invalidatedProjects is not invoked with + * writeFileCallback + */ + writeFile?(path: string, data: string, writeByteOrderMark?: boolean): void; getModifiedTime(fileName: string): Date | undefined; setModifiedTime(fileName: string, date: Date): void; deleteFile(fileName: string): void; @@ -4625,7 +4631,7 @@ declare namespace ts { /** * To dispose this project and ensure that all the necessary actions are taken and state is updated accordingly */ - done(cancellationToken?: CancellationToken): ExitStatus; + done(cancellationToken?: CancellationToken, writeFile?: WriteFileCallback, customTransformers?: CustomTransformers): ExitStatus; getCompilerOptions(): CompilerOptions; getCurrentDirectory(): string; } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index ce0e7b81c82..86a37c9f498 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4588,6 +4588,12 @@ declare namespace ts { } type ReportEmitErrorSummary = (errorCount: number) => void; interface SolutionBuilderHostBase extends ProgramHost { + createDirectory?(path: string): void; + /** + * Should provide create directory and writeFile if done of invalidatedProjects is not invoked with + * writeFileCallback + */ + writeFile?(path: string, data: string, writeByteOrderMark?: boolean): void; getModifiedTime(fileName: string): Date | undefined; setModifiedTime(fileName: string, date: Date): void; deleteFile(fileName: string): void; @@ -4625,7 +4631,7 @@ declare namespace ts { /** * To dispose this project and ensure that all the necessary actions are taken and state is updated accordingly */ - done(cancellationToken?: CancellationToken): ExitStatus; + done(cancellationToken?: CancellationToken, writeFile?: WriteFileCallback, customTransformers?: CustomTransformers): ExitStatus; getCompilerOptions(): CompilerOptions; getCurrentDirectory(): string; } From 629bc0c04d7126e3481a23742a9688a422ec69e3 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 15 May 2019 09:51:02 -0700 Subject: [PATCH 097/384] Always emit tsbuild info if path says so (irrespecitive of if there exists bundle and project) --- src/compiler/emitter.ts | 1 - src/compiler/tsbuild.ts | 2 +- src/harness/fakes.ts | 7 ++++- src/testRunner/unittests/tsbuild/sample.ts | 35 ++++++++++++++++++++-- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 6a339e26594..e6e3c44afcd 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -284,7 +284,6 @@ namespace ts { // Write build information if applicable if (!buildInfoPath || targetSourceFile || emitSkipped) return; const program = host.getProgramBuildInfo(); - if (!bundle && !program) return; if (host.isEmitBlocked(buildInfoPath) || compilerOptions.noEmit) { emitSkipped = true; return; diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 77de45bee01..43b1e24a573 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -1524,7 +1524,7 @@ namespace ts { if (buildInfoPath) { const value = state.readFileWithCache(buildInfoPath); const buildInfo = value && getBuildInfo(value); - if (buildInfo && buildInfo.version !== version) { + if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== version) { return { type: UpToDateStatusType.TsVersionOutputOfDate, version: buildInfo.version diff --git a/src/harness/fakes.ts b/src/harness/fakes.ts index c3a3bb621ce..31e64e2c931 100644 --- a/src/harness/fakes.ts +++ b/src/harness/fakes.ts @@ -418,7 +418,12 @@ namespace fakes { export const version = "FakeTSVersion"; export class SolutionBuilderHost extends CompilerHost implements ts.SolutionBuilderHost { - createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram; + createProgram: ts.CreateProgram; + + constructor(sys: System | vfs.FileSystem, options?: ts.CompilerOptions, setParentNodes?: boolean, createProgram?: ts.CreateProgram) { + super(sys, options, setParentNodes); + this.createProgram = createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram; + } readFile(path: string) { const value = super.readFile(path); diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 130ebd9b8eb..25ad761c8f1 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -2,9 +2,9 @@ namespace ts { describe("unittests:: tsbuild:: on 'sample1' project", () => { let projFs: vfs.FileSystem; const { time, tick } = getTime(); - const testsOutputs = ["/src/tests/index.js"]; - const logicOutputs = ["/src/logic/index.js", "/src/logic/index.js.map", "/src/logic/index.d.ts"]; - const coreOutputs = ["/src/core/index.js", "/src/core/index.d.ts", "/src/core/index.d.ts.map"]; + const testsOutputs = ["/src/tests/index.js", "/src/tests/index.d.ts", "/src/tests/tsconfig.tsbuildinfo"]; + const logicOutputs = ["/src/logic/index.js", "/src/logic/index.js.map", "/src/logic/index.d.ts", "/src/logic/tsconfig.tsbuildinfo"]; + const coreOutputs = ["/src/core/index.js", "/src/core/index.d.ts", "/src/core/index.d.ts.map", "/src/core/tsconfig.tsbuildinfo"]; const allExpectedOutputs = [...testsOutputs, ...logicOutputs, ...coreOutputs]; before(() => { @@ -272,6 +272,35 @@ namespace ts { ); }); + it("does not rebuild if there is no program and bundle in the ts build info event if version doesnt match ts version", () => { + const fs = projFs.shadow(); + const host = new fakes.SolutionBuilderHost(fs, /*options*/ undefined, /*setParentNodes*/ undefined, createAbstractBuilder); + let builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); + builder.build(); + host.assertDiagnosticMessages( + getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), + [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], + [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], + [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/index.js"], + [Diagnostics.Building_project_0, "/src/logic/tsconfig.json"], + [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tests/tsconfig.json", "src/tests/index.js"], + [Diagnostics.Building_project_0, "/src/tests/tsconfig.json"] + ); + verifyOutputsPresent(fs, allExpectedOutputs); + + host.clearDiagnostics(); + tick(); + builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); + changeCompilerVersion(host); + builder.build(); + host.assertDiagnosticMessages( + getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"), + [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"], + [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/logic/tsconfig.json", "src/logic/index.ts", "src/logic/index.js"], + [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/tests/tsconfig.json", "src/tests/index.ts", "src/tests/index.js"] + ); + }); + it("rebuilds from start if --f is passed", () => { const { host, builder } = initializeWithBuild({ force: true }); builder.build(); From e9b48e78c7ba51c7722aeef574548e3e0fe7a327 Mon Sep 17 00:00:00 2001 From: Dhruv Rajvanshi Date: Thu, 16 May 2019 01:37:24 +0530 Subject: [PATCH 098/384] Improve error spans on chained method calls --- src/compiler/checker.ts | 20 +++++++++---- .../reference/methodChainError.errors.txt | 16 +++++++++++ tests/baselines/reference/methodChainError.js | 23 +++++++++++++++ .../reference/methodChainError.symbols | 25 +++++++++++++++++ .../reference/methodChainError.types | 28 +++++++++++++++++++ tests/cases/compiler/methodChainError.ts | 9 ++++++ 6 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 tests/baselines/reference/methodChainError.errors.txt create mode 100644 tests/baselines/reference/methodChainError.js create mode 100644 tests/baselines/reference/methodChainError.symbols create mode 100644 tests/baselines/reference/methodChainError.types create mode 100644 tests/cases/compiler/methodChainError.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9f5673af3ee..cfe7a7cdec2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21223,7 +21223,8 @@ namespace ts { reorderCandidates(signatures, candidates); if (!candidates.length) { if (reportErrors) { - diagnostics.add(createDiagnosticForNode(node, Diagnostics.Call_target_does_not_contain_any_signatures)); + const errorNode = getCallErrorNode(node); + diagnostics.add(createDiagnosticForNode(errorNode, Diagnostics.Call_target_does_not_contain_any_signatures)); } return resolveErrorCall(node); } @@ -21301,11 +21302,13 @@ namespace ts { // If candidate is undefined, it means that no candidates had a suitable arity. In that case, // skip the checkApplicableSignature check. if (reportErrors) { + const errorNode = getCallErrorNode(node); + if (candidateForArgumentError) { checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, CheckMode.Normal, /*reportErrors*/ true); } else if (candidateForArgumentArityError) { - diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args)); + diagnostics.add(getArgumentArityError(errorNode, [candidateForArgumentArityError], args)); } else if (candidateForTypeArgumentError) { checkTypeArguments(candidateForTypeArgumentError, (node as CallExpression | TaggedTemplateExpression | JsxOpeningLikeElement).typeArguments!, /*reportErrors*/ true, fallbackError); @@ -21313,19 +21316,26 @@ namespace ts { else { const signaturesWithCorrectTypeArgumentArity = filter(signatures, s => hasCorrectTypeArgumentArity(s, typeArguments)); if (signaturesWithCorrectTypeArgumentArity.length === 0) { - diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments!)); + diagnostics.add(getTypeArgumentArityError(errorNode, signatures, typeArguments!)); } else if (!isDecorator) { - diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args)); + diagnostics.add(getArgumentArityError(errorNode, signaturesWithCorrectTypeArgumentArity, args)); } else if (fallbackError) { - diagnostics.add(createDiagnosticForNode(node, fallbackError)); + diagnostics.add(createDiagnosticForNode(errorNode, fallbackError)); } } } return produceDiagnostics || !args ? resolveErrorCall(node) : getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray); + function getCallErrorNode(node: CallLikeExpression): Node { + if (isCallExpression(node) && isPropertyAccessExpression(node.expression)) { + return node.expression.name; + } + return node; + } + function chooseOverload(candidates: Signature[], relation: Map, signatureHelpTrailingComma = false) { candidateForArgumentError = undefined; candidateForArgumentArityError = undefined; diff --git a/tests/baselines/reference/methodChainError.errors.txt b/tests/baselines/reference/methodChainError.errors.txt new file mode 100644 index 00000000000..7cd4df95d40 --- /dev/null +++ b/tests/baselines/reference/methodChainError.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/methodChainError.ts(9,6): error TS2554: Expected 1 arguments, but got 0. + + +==== tests/cases/compiler/methodChainError.ts (1 errors) ==== + class Builder { + method(param: string): Builder { + return this; + } + } + + new Builder() + .method("a") + .method(); + ~~~~~~ +!!! error TS2554: Expected 1 arguments, but got 0. +!!! related TS6210 tests/cases/compiler/methodChainError.ts:2:12: An argument for 'param' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/methodChainError.js b/tests/baselines/reference/methodChainError.js new file mode 100644 index 00000000000..648ae505c7a --- /dev/null +++ b/tests/baselines/reference/methodChainError.js @@ -0,0 +1,23 @@ +//// [methodChainError.ts] +class Builder { + method(param: string): Builder { + return this; + } +} + +new Builder() + .method("a") + .method(); + +//// [methodChainError.js] +var Builder = /** @class */ (function () { + function Builder() { + } + Builder.prototype.method = function (param) { + return this; + }; + return Builder; +}()); +new Builder() + .method("a") + .method(); diff --git a/tests/baselines/reference/methodChainError.symbols b/tests/baselines/reference/methodChainError.symbols new file mode 100644 index 00000000000..e73024c784d --- /dev/null +++ b/tests/baselines/reference/methodChainError.symbols @@ -0,0 +1,25 @@ +=== tests/cases/compiler/methodChainError.ts === +class Builder { +>Builder : Symbol(Builder, Decl(methodChainError.ts, 0, 0)) + + method(param: string): Builder { +>method : Symbol(Builder.method, Decl(methodChainError.ts, 0, 15)) +>param : Symbol(param, Decl(methodChainError.ts, 1, 11)) +>Builder : Symbol(Builder, Decl(methodChainError.ts, 0, 0)) + + return this; +>this : Symbol(Builder, Decl(methodChainError.ts, 0, 0)) + } +} + +new Builder() +>new Builder() .method("a") .method : Symbol(Builder.method, Decl(methodChainError.ts, 0, 15)) +>new Builder() .method : Symbol(Builder.method, Decl(methodChainError.ts, 0, 15)) +>Builder : Symbol(Builder, Decl(methodChainError.ts, 0, 0)) + + .method("a") +>method : Symbol(Builder.method, Decl(methodChainError.ts, 0, 15)) + + .method(); +>method : Symbol(Builder.method, Decl(methodChainError.ts, 0, 15)) + diff --git a/tests/baselines/reference/methodChainError.types b/tests/baselines/reference/methodChainError.types new file mode 100644 index 00000000000..e66f6c54b45 --- /dev/null +++ b/tests/baselines/reference/methodChainError.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/methodChainError.ts === +class Builder { +>Builder : Builder + + method(param: string): Builder { +>method : (param: string) => Builder +>param : string + + return this; +>this : this + } +} + +new Builder() +>new Builder() .method("a") .method() : Builder +>new Builder() .method("a") .method : (param: string) => Builder +>new Builder() .method("a") : Builder +>new Builder() .method : (param: string) => Builder +>new Builder() : Builder +>Builder : typeof Builder + + .method("a") +>method : (param: string) => Builder +>"a" : "a" + + .method(); +>method : (param: string) => Builder + diff --git a/tests/cases/compiler/methodChainError.ts b/tests/cases/compiler/methodChainError.ts new file mode 100644 index 00000000000..657d9a634a5 --- /dev/null +++ b/tests/cases/compiler/methodChainError.ts @@ -0,0 +1,9 @@ +class Builder { + method(param: string): Builder { + return this; + } +} + +new Builder() + .method("a") + .method(); \ No newline at end of file From 3fa111e6c50da4342aeca05e1bc53f71cef83b6c Mon Sep 17 00:00:00 2001 From: Dhruv Rajvanshi Date: Thu, 16 May 2019 01:47:48 +0530 Subject: [PATCH 099/384] Accept new baselines --- .../reference/callWithMissingVoid.errors.txt | 12 +++++------ ...llingBaseImplWithOptionalParams.errors.txt | 4 ++-- ...unctionsWithOptionalParameters2.errors.txt | 4 ++-- ...ortWithExportPropertyAssignment.errors.txt | 4 ++-- .../optionalParamArgsTest.errors.txt | 16 +++++++-------- .../baselines/reference/overload1.errors.txt | 4 ++-- .../reference/strictBindCallApply1.errors.txt | 12 +++++------ .../thisTypeInFunctionsNegative.errors.txt | 20 +++++++++---------- ...eAssertionToGenericFunctionType.errors.txt | 4 ++-- 9 files changed, 40 insertions(+), 40 deletions(-) diff --git a/tests/baselines/reference/callWithMissingVoid.errors.txt b/tests/baselines/reference/callWithMissingVoid.errors.txt index 7ad2a481f2e..67d380be662 100644 --- a/tests/baselines/reference/callWithMissingVoid.errors.txt +++ b/tests/baselines/reference/callWithMissingVoid.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(16,1): error TS2554: Expected 1 arguments, but got 0. -tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(19,1): error TS2554: Expected 1 arguments, but got 0. -tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(22,1): error TS2554: Expected 1 arguments, but got 0. +tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(16,6): error TS2554: Expected 1 arguments, but got 0. +tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(19,10): error TS2554: Expected 1 arguments, but got 0. +tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(22,8): error TS2554: Expected 1 arguments, but got 0. tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(35,31): error TS2554: Expected 1 arguments, but got 0. tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(36,35): error TS2554: Expected 1 arguments, but got 0. tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(37,33): error TS2554: Expected 1 arguments, but got 0. @@ -28,19 +28,19 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1): declare const xAny: X; xAny.f() // error, any still expects an argument - ~~~~~~~~ + ~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:3:7: An argument for 't' was not provided. declare const xUnknown: X; xUnknown.f() // error, unknown still expects an argument - ~~~~~~~~~~~~ + ~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:3:7: An argument for 't' was not provided. declare const xNever: X; xNever.f() // error, never still expects an argument - ~~~~~~~~~~ + ~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:3:7: An argument for 't' was not provided. diff --git a/tests/baselines/reference/derivedTypeCallingBaseImplWithOptionalParams.errors.txt b/tests/baselines/reference/derivedTypeCallingBaseImplWithOptionalParams.errors.txt index 3dd001eb82c..54c58bd40b5 100644 --- a/tests/baselines/reference/derivedTypeCallingBaseImplWithOptionalParams.errors.txt +++ b/tests/baselines/reference/derivedTypeCallingBaseImplWithOptionalParams.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts(13,1): error TS2554: Expected 1 arguments, but got 0. +tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts(13,3): error TS2554: Expected 1 arguments, but got 0. ==== tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts (1 errors) ==== @@ -15,6 +15,6 @@ tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts(13,1): erro var y: MyClass = new MyClass(); y.myMethod(); // error - ~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/derivedTypeCallingBaseImplWithOptionalParams.ts:5:14: An argument for 'myList' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/genericFunctionsWithOptionalParameters2.errors.txt b/tests/baselines/reference/genericFunctionsWithOptionalParameters2.errors.txt index c4c1ce048c2..9eb49dbf9ba 100644 --- a/tests/baselines/reference/genericFunctionsWithOptionalParameters2.errors.txt +++ b/tests/baselines/reference/genericFunctionsWithOptionalParameters2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/genericFunctionsWithOptionalParameters2.ts(7,1): error TS2554: Expected 1-3 arguments, but got 0. +tests/cases/compiler/genericFunctionsWithOptionalParameters2.ts(7,7): error TS2554: Expected 1-3 arguments, but got 0. ==== tests/cases/compiler/genericFunctionsWithOptionalParameters2.ts (1 errors) ==== @@ -9,7 +9,7 @@ tests/cases/compiler/genericFunctionsWithOptionalParameters2.ts(7,1): error TS25 var utils: Utils; utils.fold(); // error - ~~~~~~~~~~~~ + ~~~~ !!! error TS2554: Expected 1-3 arguments, but got 0. !!! related TS6210 tests/cases/compiler/genericFunctionsWithOptionalParameters2.ts:2:15: An argument for 'c' was not provided. utils.fold(null); // no error diff --git a/tests/baselines/reference/moduleExportWithExportPropertyAssignment.errors.txt b/tests/baselines/reference/moduleExportWithExportPropertyAssignment.errors.txt index e40138407d8..009022bdfe3 100644 --- a/tests/baselines/reference/moduleExportWithExportPropertyAssignment.errors.txt +++ b/tests/baselines/reference/moduleExportWithExportPropertyAssignment.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/salsa/a.js(4,1): error TS2554: Expected 1 arguments, but got 0. +tests/cases/conformance/salsa/a.js(4,6): error TS2554: Expected 1 arguments, but got 0. ==== tests/cases/conformance/salsa/a.js (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/conformance/salsa/a.js(4,1): error TS2554: Expected 1 arguments, but var mod1 = require('./mod1') mod1() mod1.f() // error, not enough arguments - ~~~~~~~~ + ~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 /.src/tests/cases/conformance/salsa/mod1.js:4:30: An argument for 'a' was not provided. diff --git a/tests/baselines/reference/optionalParamArgsTest.errors.txt b/tests/baselines/reference/optionalParamArgsTest.errors.txt index dd53f5eeca1..139c83f7141 100644 --- a/tests/baselines/reference/optionalParamArgsTest.errors.txt +++ b/tests/baselines/reference/optionalParamArgsTest.errors.txt @@ -4,8 +4,8 @@ tests/cases/compiler/optionalParamArgsTest.ts(98,11): error TS2554: Expected 0 a tests/cases/compiler/optionalParamArgsTest.ts(99,11): error TS2554: Expected 0 arguments, but got 1. tests/cases/compiler/optionalParamArgsTest.ts(100,4): error TS2554: Expected 0 arguments, but got 1. tests/cases/compiler/optionalParamArgsTest.ts(101,4): error TS2554: Expected 0 arguments, but got 1. -tests/cases/compiler/optionalParamArgsTest.ts(102,1): error TS2554: Expected 1 arguments, but got 0. -tests/cases/compiler/optionalParamArgsTest.ts(103,1): error TS2554: Expected 1 arguments, but got 0. +tests/cases/compiler/optionalParamArgsTest.ts(102,6): error TS2554: Expected 1 arguments, but got 0. +tests/cases/compiler/optionalParamArgsTest.ts(103,6): error TS2554: Expected 1 arguments, but got 0. tests/cases/compiler/optionalParamArgsTest.ts(104,1): error TS2554: Expected 1 arguments, but got 0. tests/cases/compiler/optionalParamArgsTest.ts(105,1): error TS2554: Expected 1 arguments, but got 0. tests/cases/compiler/optionalParamArgsTest.ts(106,13): error TS2554: Expected 1 arguments, but got 2. @@ -16,8 +16,8 @@ tests/cases/compiler/optionalParamArgsTest.ts(110,15): error TS2554: Expected 0- tests/cases/compiler/optionalParamArgsTest.ts(111,15): error TS2554: Expected 0-2 arguments, but got 3. tests/cases/compiler/optionalParamArgsTest.ts(112,8): error TS2554: Expected 0-2 arguments, but got 3. tests/cases/compiler/optionalParamArgsTest.ts(113,8): error TS2554: Expected 0-2 arguments, but got 3. -tests/cases/compiler/optionalParamArgsTest.ts(114,1): error TS2554: Expected 1-2 arguments, but got 0. -tests/cases/compiler/optionalParamArgsTest.ts(115,1): error TS2554: Expected 1-2 arguments, but got 0. +tests/cases/compiler/optionalParamArgsTest.ts(114,6): error TS2554: Expected 1-2 arguments, but got 0. +tests/cases/compiler/optionalParamArgsTest.ts(115,6): error TS2554: Expected 1-2 arguments, but got 0. tests/cases/compiler/optionalParamArgsTest.ts(116,1): error TS2554: Expected 1-2 arguments, but got 0. tests/cases/compiler/optionalParamArgsTest.ts(117,1): error TS2554: Expected 1-2 arguments, but got 0. @@ -137,11 +137,11 @@ tests/cases/compiler/optionalParamArgsTest.ts(117,1): error TS2554: Expected 1-2 ~ !!! error TS2554: Expected 0 arguments, but got 1. c1o1.C1M2(); - ~~~~~~~~~~~ + ~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:23:17: An argument for 'C1M2A1' was not provided. i1o1.C1M2(); - ~~~~~~~~~~~ + ~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:11:10: An argument for 'C1M2A1' was not provided. F2(); @@ -177,11 +177,11 @@ tests/cases/compiler/optionalParamArgsTest.ts(117,1): error TS2554: Expected 1-2 ~ !!! error TS2554: Expected 0-2 arguments, but got 3. c1o1.C1M4(); - ~~~~~~~~~~~ + ~~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:29:17: An argument for 'C1M4A1' was not provided. i1o1.C1M4(); - ~~~~~~~~~~~ + ~~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:13:10: An argument for 'C1M4A1' was not provided. F4(); diff --git a/tests/baselines/reference/overload1.errors.txt b/tests/baselines/reference/overload1.errors.txt index aa58f23b95a..6adc8b8b579 100644 --- a/tests/baselines/reference/overload1.errors.txt +++ b/tests/baselines/reference/overload1.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/overload1.ts(27,5): error TS2322: Type 'C' is not assignable to type 'string'. tests/cases/compiler/overload1.ts(29,1): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/overload1.ts(31,11): error TS2554: Expected 1-2 arguments, but got 3. -tests/cases/compiler/overload1.ts(32,3): error TS2554: Expected 1-2 arguments, but got 0. +tests/cases/compiler/overload1.ts(32,5): error TS2554: Expected 1-2 arguments, but got 0. tests/cases/compiler/overload1.ts(33,1): error TS2322: Type 'C' is not assignable to type 'string'. tests/cases/compiler/overload1.ts(34,9): error TS2345: Argument of type '2' is not assignable to parameter of type 'string'. @@ -45,7 +45,7 @@ tests/cases/compiler/overload1.ts(34,9): error TS2345: Argument of type '2' is n ~ !!! error TS2554: Expected 1-2 arguments, but got 3. z=x.g(); // no match - ~~~~~ + ~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/compiler/overload1.ts:17:11: An argument for 'n' was not provided. z=x.g(new O.B()); // ambiguous (up and down conversion) diff --git a/tests/baselines/reference/strictBindCallApply1.errors.txt b/tests/baselines/reference/strictBindCallApply1.errors.txt index 7b13d5e3181..98d8a19db06 100644 --- a/tests/baselines/reference/strictBindCallApply1.errors.txt +++ b/tests/baselines/reference/strictBindCallApply1.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(11,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. -tests/cases/conformance/functions/strictBindCallApply1.ts(17,11): error TS2554: Expected 3 arguments, but got 2. +tests/cases/conformance/functions/strictBindCallApply1.ts(17,15): error TS2554: Expected 3 arguments, but got 2. tests/cases/conformance/functions/strictBindCallApply1.ts(18,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(19,44): error TS2554: Expected 3 arguments, but got 4. tests/cases/conformance/functions/strictBindCallApply1.ts(22,32): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. @@ -10,7 +10,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(24,32): error TS2345: Type '3' is not assignable to type '2'. tests/cases/conformance/functions/strictBindCallApply1.ts(41,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(42,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. -tests/cases/conformance/functions/strictBindCallApply1.ts(48,11): error TS2554: Expected 3 arguments, but got 2. +tests/cases/conformance/functions/strictBindCallApply1.ts(48,17): error TS2554: Expected 3 arguments, but got 2. tests/cases/conformance/functions/strictBindCallApply1.ts(49,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(50,38): error TS2554: Expected 3 arguments, but got 4. tests/cases/conformance/functions/strictBindCallApply1.ts(51,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. @@ -19,7 +19,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(55,31): error TS2322: tests/cases/conformance/functions/strictBindCallApply1.ts(56,26): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. tests/cases/conformance/functions/strictBindCallApply1.ts(57,23): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. tests/cases/conformance/functions/strictBindCallApply1.ts(62,33): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. -tests/cases/conformance/functions/strictBindCallApply1.ts(65,1): error TS2554: Expected 3 arguments, but got 2. +tests/cases/conformance/functions/strictBindCallApply1.ts(65,3): error TS2554: Expected 3 arguments, but got 2. tests/cases/conformance/functions/strictBindCallApply1.ts(66,15): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. tests/cases/conformance/functions/strictBindCallApply1.ts(67,24): error TS2554: Expected 3 arguments, but got 4. tests/cases/conformance/functions/strictBindCallApply1.ts(70,12): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. @@ -47,7 +47,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: let c00 = foo.call(undefined, 10, "hello"); let c01 = foo.call(undefined, 10); // Error - ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2554: Expected 3 arguments, but got 2. let c02 = foo.call(undefined, 10, 20); // Error ~~ @@ -97,7 +97,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: let c10 = c.foo.call(c, 10, "hello"); let c11 = c.foo.call(c, 10); // Error - ~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2554: Expected 3 arguments, but got 2. let c12 = c.foo.call(c, 10, 20); // Error ~~ @@ -132,7 +132,7 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(72,12): error TS2345: C.call(c, 10, "hello"); C.call(c, 10); // Error - ~~~~~~~~~~~~~ + ~~~~ !!! error TS2554: Expected 3 arguments, but got 2. C.call(c, 10, 20); // Error ~~ diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt index 0cf86610f80..4720b4556a4 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt @@ -10,7 +10,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(62,97): er Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: string; f: (this: { y: number; }, x: number) => number; }'. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(63,110): error TS2322: Type '{ wrongName: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(65,1): error TS2554: Expected 1 arguments, but got 0. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(65,4): error TS2554: Expected 1 arguments, but got 0. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(66,6): error TS2345: Argument of type '"wrong type"' is not assignable to parameter of type 'number'. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(67,10): error TS2554: Expected 1 arguments, but got 2. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(68,1): error TS2684: The 'this' context of type '{ y: string; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'. @@ -18,16 +18,16 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(68,1): err Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(69,1): error TS2684: The 'this' context of type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'. Property 'y' is missing in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' but required in type '{ y: number; }'. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(72,1): error TS2554: Expected 1 arguments, but got 0. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(72,3): error TS2554: Expected 1 arguments, but got 0. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(73,13): error TS2345: Argument of type '"wrong type"' is not assignable to parameter of type 'number'. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(74,17): error TS2554: Expected 1 arguments, but got 2. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(75,1): error TS2554: Expected 1 arguments, but got 0. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(75,3): error TS2554: Expected 1 arguments, but got 0. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(76,16): error TS2345: Argument of type '"wrong type 2"' is not assignable to parameter of type 'number'. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(77,20): error TS2554: Expected 1 arguments, but got 2. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(78,1): error TS2554: Expected 1 arguments, but got 0. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(78,3): error TS2554: Expected 1 arguments, but got 0. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(79,16): error TS2345: Argument of type '"wrong type 2"' is not assignable to parameter of type 'number'. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(80,20): error TS2554: Expected 1 arguments, but got 2. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(81,1): error TS2554: Expected 1 arguments, but got 0. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(81,3): error TS2554: Expected 1 arguments, but got 0. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(82,20): error TS2345: Argument of type '"wrong type 3"' is not assignable to parameter of type 'number'. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(83,24): error TS2554: Expected 1 arguments, but got 2. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(86,5): error TS2322: Type '(this: { y: number; }, x: number) => number' is not assignable to type '(this: void, x: number) => number'. @@ -182,7 +182,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e !!! error TS2322: Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. ok.f(); // not enough arguments - ~~~~~~ + ~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:61:46: An argument for 'x' was not provided. ok.f('wrong type'); @@ -204,7 +204,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e let c = new C(); c.explicitC(); // not enough arguments - ~~~~~~~~~~~~~ + ~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:9:24: An argument for 'm' was not provided. c.explicitC('wrong type'); @@ -214,7 +214,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e ~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. c.explicitThis(); // not enough arguments - ~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:3:30: An argument for 'm' was not provided. c.explicitThis('wrong type 2'); @@ -224,7 +224,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. c.implicitThis(); // not enough arguments - ~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:6:18: An argument for 'm' was not provided. c.implicitThis('wrong type 2'); @@ -234,7 +234,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. c.explicitProperty(); // not enough arguments - ~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:12:41: An argument for 'm' was not provided. c.explicitProperty('wrong type 3'); diff --git a/tests/baselines/reference/typeAssertionToGenericFunctionType.errors.txt b/tests/baselines/reference/typeAssertionToGenericFunctionType.errors.txt index 551b863c604..ae8a5cb6897 100644 --- a/tests/baselines/reference/typeAssertionToGenericFunctionType.errors.txt +++ b/tests/baselines/reference/typeAssertionToGenericFunctionType.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/typeAssertionToGenericFunctionType.ts(5,13): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. -tests/cases/compiler/typeAssertionToGenericFunctionType.ts(6,1): error TS2554: Expected 1 arguments, but got 0. +tests/cases/compiler/typeAssertionToGenericFunctionType.ts(6,3): error TS2554: Expected 1 arguments, but got 0. ==== tests/cases/compiler/typeAssertionToGenericFunctionType.ts (2 errors) ==== @@ -11,6 +11,6 @@ tests/cases/compiler/typeAssertionToGenericFunctionType.ts(6,1): error TS2554: E ~ !!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. x.b(); // error - ~~~~~~~~~~~~~ + ~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/typeAssertionToGenericFunctionType.ts:3:12: An argument for 'x' was not provided. \ No newline at end of file From 0cb980dd6e009c28de63b79f24bd4f47d4bf33f2 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 15 May 2019 14:56:06 -0700 Subject: [PATCH 100/384] Add api to build referenced projects --- src/compiler/tsbuild.ts | 39 +++++++++++++------ src/testRunner/unittests/tsbuild/sample.ts | 16 ++++++++ .../reference/api/tsserverlibrary.d.ts | 2 + tests/baselines/reference/api/typescript.d.ts | 2 + 4 files changed, 48 insertions(+), 11 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 43b1e24a573..8a43dd446f2 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -275,6 +275,8 @@ namespace ts { export interface SolutionBuilder { build(project?: string, cancellationToken?: CancellationToken): ExitStatus; clean(project?: string): ExitStatus; + buildReferences(project: string, cancellationToken?: CancellationToken): ExitStatus; + cleanReferences(project?: string): ExitStatus; getNextInvalidatedProject(cancellationToken?: CancellationToken): InvalidatedProject | undefined; // Currently used for testing but can be made public if needed: @@ -565,7 +567,7 @@ namespace ts { (state.buildOrder = createBuildOrder(state, state.rootNames.map(f => resolveProjectName(state, f)))); } - function getBuildOrderFor(state: SolutionBuilderState, project: string | undefined) { + function getBuildOrderFor(state: SolutionBuilderState, project: string | undefined, onlyReferences: boolean | undefined) { const resolvedProject = project && resolveProjectName(state, project); if (resolvedProject) { const projectPath = toResolvedConfigFilePath(state, resolvedProject); @@ -575,7 +577,10 @@ namespace ts { ); if (projectIndex === -1) return undefined; } - return resolvedProject ? createBuildOrder(state, [resolvedProject]) : getBuildOrder(state); + const buildOrder = resolvedProject ? createBuildOrder(state, [resolvedProject]) : getBuildOrder(state); + Debug.assert(!onlyReferences || resolvedProject !== undefined); + Debug.assert(!onlyReferences || buildOrder[buildOrder.length - 1] === resolvedProject); + return onlyReferences ? buildOrder.slice(0, buildOrder.length - 1) : buildOrder; } function enableCache(state: SolutionBuilderState) { @@ -653,7 +658,6 @@ namespace ts { if (state.options.watch) { reportWatchStatus(state, Diagnostics.Starting_compilation_in_watch_mode); } enableCache(state); const buildOrder = getBuildOrder(state); - reportBuildQueue(state, buildOrder); buildOrder.forEach(configFileName => state.projectPendingBuild.set( toResolvedConfigFilePath(state, configFileName), @@ -1186,7 +1190,11 @@ namespace ts { !isIncrementalCompilation(config.options); } - function getNextInvalidatedProject(state: SolutionBuilderState, buildOrder: readonly ResolvedConfigFileName[]): InvalidatedProject | undefined { + function getNextInvalidatedProject( + state: SolutionBuilderState, + buildOrder: readonly ResolvedConfigFileName[], + reportQueue: boolean + ): InvalidatedProject | undefined { if (!state.projectPendingBuild.size) return undefined; if (state.currentInvalidatedProject) { // Only if same buildOrder the currentInvalidated project can be sent again @@ -1202,6 +1210,11 @@ namespace ts { const reloadLevel = state.projectPendingBuild.get(projectPath); if (reloadLevel === undefined) continue; + if (reportQueue) { + reportQueue = false; + reportBuildQueue(state, buildOrder); + } + const config = parseConfigFile(state, project, projectPath); if (!config) { reportParseConfigFileDiagnostic(state, projectPath); @@ -1678,17 +1691,19 @@ namespace ts { } } - function build(state: SolutionBuilderState, project?: string, cancellationToken?: CancellationToken): ExitStatus { - const buildOrder = getBuildOrderFor(state, project); + function build(state: SolutionBuilderState, project?: string, cancellationToken?: CancellationToken, onlyReferences?: boolean): ExitStatus { + const buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ExitStatus.InvalidProject_OutputsSkipped; setupInitialBuild(state, cancellationToken); + let reportQueue = true; let successfulProjects = 0; let errorProjects = 0; while (true) { - const invalidatedProject = getNextInvalidatedProject(state, buildOrder); + const invalidatedProject = getNextInvalidatedProject(state, buildOrder, reportQueue); if (!invalidatedProject) break; + reportQueue = false; invalidatedProject.done(cancellationToken); if (state.diagnostics.has(invalidatedProject.projectPath)) { errorProjects++; @@ -1709,8 +1724,8 @@ namespace ts { ExitStatus.Success; } - function clean(state: SolutionBuilderState, project?: string) { - const buildOrder = getBuildOrderFor(state, project); + function clean(state: SolutionBuilderState, project?: string, onlyReferences?: boolean) { + const buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ExitStatus.InvalidProject_OutputsSkipped; const { options, host } = state; @@ -1783,7 +1798,7 @@ namespace ts { state.projectErrorsReported.clear(); reportWatchStatus(state, Diagnostics.File_change_detected_Starting_incremental_compilation); } - const invalidatedProject = getNextInvalidatedProject(state, getBuildOrder(state)); + const invalidatedProject = getNextInvalidatedProject(state, getBuildOrder(state), /*reportQueue*/ false); if (invalidatedProject) { invalidatedProject.done(); if (state.projectPendingBuild.size) { @@ -1923,9 +1938,11 @@ namespace ts { return { build: (project, cancellationToken) => build(state, project, cancellationToken), clean: project => clean(state, project), + buildReferences: (project, cancellationToken) => build(state, project, cancellationToken, /*onlyReferences*/ true), + cleanReferences: project => clean(state, project, /*onlyReferences*/ true), getNextInvalidatedProject: cancellationToken => { setupInitialBuild(state, cancellationToken); - return getNextInvalidatedProject(state, getBuildOrder(state)); + return getNextInvalidatedProject(state, getBuildOrder(state), /*reportQueue*/ false); }, getBuildOrder: () => getBuildOrder(state), getUpToDateStatusOfProject: project => { diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 25ad761c8f1..df2fb62db25 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -417,6 +417,22 @@ namespace ts { verifyOutputsAbsent(fs, absentOutputs); } }); + + it("building using buildReferencedProject", () => { + const fs = projFs.shadow(); + const host = new fakes.SolutionBuilderHost(fs); + const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true }); + builder.buildReferences("/src/tests"); + host.assertDiagnosticMessages( + getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json"), + [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"], + [Diagnostics.Building_project_0, "/src/core/tsconfig.json"], + [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/index.js"], + [Diagnostics.Building_project_0, "/src/logic/tsconfig.json"], + ); + verifyOutputsPresent(fs, [...coreOutputs, ...logicOutputs]); + verifyOutputsAbsent(fs, testsOutputs); + }); }); describe("downstream-blocked compilations", () => { diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 05f8195b992..8e78922e636 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4610,6 +4610,8 @@ declare namespace ts { interface SolutionBuilder { build(project?: string, cancellationToken?: CancellationToken): ExitStatus; clean(project?: string): ExitStatus; + buildReferences(project: string, cancellationToken?: CancellationToken): ExitStatus; + cleanReferences(project?: string): ExitStatus; getNextInvalidatedProject(cancellationToken?: CancellationToken): InvalidatedProject | undefined; } /** diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 86a37c9f498..3d0df0fabec 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4610,6 +4610,8 @@ declare namespace ts { interface SolutionBuilder { build(project?: string, cancellationToken?: CancellationToken): ExitStatus; clean(project?: string): ExitStatus; + buildReferences(project: string, cancellationToken?: CancellationToken): ExitStatus; + cleanReferences(project?: string): ExitStatus; getNextInvalidatedProject(cancellationToken?: CancellationToken): InvalidatedProject | undefined; } /** From ec4ea0e4748930748c8d76f57708f6a44f92e17b Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 16 May 2019 11:21:09 -0700 Subject: [PATCH 101/384] Watch only built projects --- src/compiler/tsbuild.ts | 22 +++++++++++--------- src/testRunner/unittests/tsbuildWatchMode.ts | 22 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 8a43dd446f2..1c1c093bc7a 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -569,15 +569,16 @@ namespace ts { function getBuildOrderFor(state: SolutionBuilderState, project: string | undefined, onlyReferences: boolean | undefined) { const resolvedProject = project && resolveProjectName(state, project); + const buildOrderFromState = getBuildOrder(state); if (resolvedProject) { const projectPath = toResolvedConfigFilePath(state, resolvedProject); const projectIndex = findIndex( - getBuildOrder(state), + buildOrderFromState, configFileName => toResolvedConfigFilePath(state, configFileName) === projectPath ); if (projectIndex === -1) return undefined; } - const buildOrder = resolvedProject ? createBuildOrder(state, [resolvedProject]) : getBuildOrder(state); + const buildOrder = resolvedProject ? createBuildOrder(state, [resolvedProject]) : buildOrderFromState; Debug.assert(!onlyReferences || resolvedProject !== undefined); Debug.assert(!onlyReferences || buildOrder[buildOrder.length - 1] === resolvedProject); return onlyReferences ? buildOrder.slice(0, buildOrder.length - 1) : buildOrder; @@ -1714,8 +1715,8 @@ namespace ts { } disableCache(state); - reportErrorSummary(state); - startWatching(state); + reportErrorSummary(state, buildOrder); + startWatching(state, buildOrder); return errorProjects ? successfulProjects ? @@ -1798,7 +1799,8 @@ namespace ts { state.projectErrorsReported.clear(); reportWatchStatus(state, Diagnostics.File_change_detected_Starting_incremental_compilation); } - const invalidatedProject = getNextInvalidatedProject(state, getBuildOrder(state), /*reportQueue*/ false); + const buildOrder = getBuildOrder(state); + const invalidatedProject = getNextInvalidatedProject(state, buildOrder, /*reportQueue*/ false); if (invalidatedProject) { invalidatedProject.done(); if (state.projectPendingBuild.size) { @@ -1810,7 +1812,7 @@ namespace ts { } } disableCache(state); - reportErrorSummary(state); + reportErrorSummary(state, buildOrder); } function watchConfigFile(state: SolutionBuilderState, resolved: ResolvedConfigFileName, resolvedPath: ResolvedConfigFilePath) { @@ -1908,10 +1910,10 @@ namespace ts { ); } - function startWatching(state: SolutionBuilderState) { + function startWatching(state: SolutionBuilderState, buildOrder: readonly ResolvedConfigFileName[]) { if (!state.watchAllProjectsPending) return; state.watchAllProjectsPending = false; - for (const resolved of getBuildOrder(state)) { + for (const resolved of buildOrder) { const resolvedPath = toResolvedConfigFilePath(state, resolved); // Watch this file watchConfigFile(state, resolved, resolvedPath); @@ -1985,12 +1987,12 @@ namespace ts { reportAndStoreErrors(state, proj, [state.configFileCache.get(proj) as Diagnostic]); } - function reportErrorSummary(state: SolutionBuilderState) { + function reportErrorSummary(state: SolutionBuilderState, buildOrder: readonly ResolvedConfigFileName[]) { if (!state.needsSummary || (!state.watch && !state.host.reportErrorSummary)) return; state.needsSummary = false; const { diagnostics } = state; // Report errors from the other projects - getBuildOrder(state).forEach(project => { + buildOrder.forEach(project => { const projectPath = toResolvedConfigFilePath(state, project); if (!state.projectErrorsReported.has(projectPath)) { reportErrors(state, diagnostics.get(projectPath) || emptyArray); diff --git a/src/testRunner/unittests/tsbuildWatchMode.ts b/src/testRunner/unittests/tsbuildWatchMode.ts index 54f174356b5..a630e28f1d8 100644 --- a/src/testRunner/unittests/tsbuildWatchMode.ts +++ b/src/testRunner/unittests/tsbuildWatchMode.ts @@ -143,6 +143,28 @@ namespace ts.tscWatch { createSolutionInWatchMode(allFiles); }); + it("verify building references watches only those projects", () => { + const system = createTsBuildWatchSystem(allFiles, { currentDirectory: projectsLocation }); + const host = createSolutionBuilderWithWatchHost(system); + const solutionBuilder = ts.createSolutionBuilderWithWatch(host, [`${project}/${SubProject.tests}`], { watch: true }); + solutionBuilder.buildReferences(`${project}/${SubProject.tests}`); + + checkWatchedFiles(system, testProjectExpectedWatchedFiles.slice(0, testProjectExpectedWatchedFiles.length - tests.length)); + checkWatchedDirectories(system, emptyArray, /*recursive*/ false); + checkWatchedDirectories(system, testProjectExpectedWatchedDirectoriesRecursive, /*recursive*/ true); + + checkOutputErrorsInitial(system, emptyArray); + const testOutput = getOutputStamps(system, SubProject.tests, "index"); + const outputFileStamps = getOutputFileStamps(system); + for (const stamp of outputFileStamps.slice(0, outputFileStamps.length - testOutput.length)) { + assert.isDefined(stamp[1], `${stamp[0]} expected to be present`); + } + for (const stamp of testOutput) { + assert.isUndefined(stamp[1], `${stamp[0]} expected to be missing`); + } + return system; + }); + describe("validates the changes and watched files", () => { const newFileWithoutExtension = "newFile"; const newFile: File = { From 138f757709624fbd06a34a97b9d514b0c9f40508 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 16 May 2019 12:50:17 -0700 Subject: [PATCH 102/384] Fix the test since tsbuildinfo is now always emitted (629bc0c) --- src/testRunner/unittests/config/projectReferences.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testRunner/unittests/config/projectReferences.ts b/src/testRunner/unittests/config/projectReferences.ts index 3acffd7a8c6..26ed746d279 100644 --- a/src/testRunner/unittests/config/projectReferences.ts +++ b/src/testRunner/unittests/config/projectReferences.ts @@ -325,7 +325,7 @@ namespace ts { }; testProjectReferences(spec, "/alpha/tsconfig.json", (program, host) => { program.emit(); - assert.deepEqual(host.outputs.map(e => e.file).sort(), ["/alpha/bin/src/a.d.ts", "/alpha/bin/src/a.js"]); + assert.deepEqual(host.outputs.map(e => e.file).sort(), ["/alpha/bin/src/a.d.ts", "/alpha/bin/src/a.js", "/alpha/bin/tsconfig.tsbuildinfo"]); }); }); }); From 098c9008b88b233819d063a93d5190823eb8c6f8 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 16 May 2019 14:49:53 -0700 Subject: [PATCH 103/384] Make more build options internal which correspond to internal compiler options Also fix return type of readBuilderProgram --- src/compiler/builder.ts | 2 +- src/compiler/tsbuild.ts | 8 ++++---- tests/baselines/reference/api/tsserverlibrary.d.ts | 6 +----- tests/baselines/reference/api/typescript.d.ts | 6 +----- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 7190407dd86..d4c2132d36b 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -993,7 +993,7 @@ namespace ts { return map; } - export function createBuildProgramUsingProgramBuildInfo(program: ProgramBuildInfo): EmitAndSemanticDiagnosticsBuilderProgram & SemanticDiagnosticsBuilderProgram { + export function createBuildProgramUsingProgramBuildInfo(program: ProgramBuildInfo): EmitAndSemanticDiagnosticsBuilderProgram { const fileInfos = createMapFromTemplate(program.fileInfos); const state: ReusableBuilderProgramState = { fileInfos, diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 1c1c093bc7a..94718a1b368 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -163,10 +163,10 @@ namespace ts { /*@internal*/ watch?: boolean; /*@internal*/ help?: boolean; - preserveWatchOutput?: boolean; - listEmittedFiles?: boolean; - listFiles?: boolean; - pretty?: boolean; + /*@internal*/ preserveWatchOutput?: boolean; + /*@internal*/ listEmittedFiles?: boolean; + /*@internal*/ listFiles?: boolean; + /*@internal*/ pretty?: boolean; incremental?: boolean; traceResolution?: boolean; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 8e78922e636..0351c6b343a 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4449,7 +4449,7 @@ declare namespace ts { function createAbstractBuilder(rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray, projectReferences?: ReadonlyArray): BuilderProgram; } declare namespace ts { - function readBuilderProgram(compilerOptions: CompilerOptions, readFile: (path: string) => string | undefined): (EmitAndSemanticDiagnosticsBuilderProgram & SemanticDiagnosticsBuilderProgram) | undefined; + function readBuilderProgram(compilerOptions: CompilerOptions, readFile: (path: string) => string | undefined): EmitAndSemanticDiagnosticsBuilderProgram | undefined; function createIncrementalCompilerHost(options: CompilerOptions, system?: System): CompilerHost; interface IncrementalProgramOptions { rootNames: ReadonlyArray; @@ -4578,10 +4578,6 @@ declare namespace ts { dry?: boolean; force?: boolean; verbose?: boolean; - preserveWatchOutput?: boolean; - listEmittedFiles?: boolean; - listFiles?: boolean; - pretty?: boolean; incremental?: boolean; traceResolution?: boolean; [option: string]: CompilerOptionsValue | undefined; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 3d0df0fabec..9becdad6aa0 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4449,7 +4449,7 @@ declare namespace ts { function createAbstractBuilder(rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray, projectReferences?: ReadonlyArray): BuilderProgram; } declare namespace ts { - function readBuilderProgram(compilerOptions: CompilerOptions, readFile: (path: string) => string | undefined): (EmitAndSemanticDiagnosticsBuilderProgram & SemanticDiagnosticsBuilderProgram) | undefined; + function readBuilderProgram(compilerOptions: CompilerOptions, readFile: (path: string) => string | undefined): EmitAndSemanticDiagnosticsBuilderProgram | undefined; function createIncrementalCompilerHost(options: CompilerOptions, system?: System): CompilerHost; interface IncrementalProgramOptions { rootNames: ReadonlyArray; @@ -4578,10 +4578,6 @@ declare namespace ts { dry?: boolean; force?: boolean; verbose?: boolean; - preserveWatchOutput?: boolean; - listEmittedFiles?: boolean; - listFiles?: boolean; - pretty?: boolean; incremental?: boolean; traceResolution?: boolean; [option: string]: CompilerOptionsValue | undefined; From f4b83ef8d38844ea8f6a51599938aa47796b3b6b Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 16 May 2019 20:39:47 -0700 Subject: [PATCH 104/384] Fix newlines in smartSelection baselines to not be platform dependent (#31437) --- src/harness/fourslash.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index e306d2e338b..df7f0051f3f 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1503,7 +1503,7 @@ Actual: ${stringify(fullActual)}`); } public baselineSmartSelection() { - const n = ts.sys.newLine; + const n = "\n"; const baselineFile = this.getBaselineFileName(); const markers = this.getMarkers(); const fileContent = this.activeFile.content; From eeba30afc81e2c7c8a34a2deb0d4d2375a1c21f6 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 17 May 2019 12:50:39 -0700 Subject: [PATCH 105/384] Fix infinite loop: module.exports alias detection (#31436) * Fix infinite loop: module.exports alias detection Previously, module.exports alias detection in the binder could enter an infinite recursion. Now it does not. Notably, there are *two* safeguards: a counter limiter that I set at 100, and an already-seen set. I actually prefer the counter limiter code because it's foolproof and uses less memory. But it takes 100 iterations to escape from loops. * fix space lint * Remove already-seen map --- src/compiler/binder.ts | 38 +++++++++++-------- ...initializedModuleExportsAssignment.symbols | 15 ++++++++ ...UninitializedModuleExportsAssignment.types | 16 ++++++++ ...derUninitializedModuleExportsAssignment.ts | 8 ++++ 4 files changed, 61 insertions(+), 16 deletions(-) create mode 100644 tests/baselines/reference/binderUninitializedModuleExportsAssignment.symbols create mode 100644 tests/baselines/reference/binderUninitializedModuleExportsAssignment.types create mode 100644 tests/cases/conformance/salsa/binderUninitializedModuleExportsAssignment.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 96db98d337a..cb6f67d66b1 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2581,7 +2581,7 @@ namespace ts { // Fix up parent pointers since we're going to use these nodes before we bind into them node.left.parent = node; node.right.parent = node; - if (isIdentifier(lhs.expression) && container === file && isNameOfExportsOrModuleExportsAliasDeclaration(file, lhs.expression)) { + if (isIdentifier(lhs.expression) && container === file && isExportsOrModuleExportsOrAlias(file, lhs.expression)) { // This can be an alias for the 'exports' or 'module.exports' names, e.g. // var util = module.exports; // util.property = function ... @@ -2975,21 +2975,27 @@ namespace ts { } export function isExportsOrModuleExportsOrAlias(sourceFile: SourceFile, node: Expression): boolean { - return isExportsIdentifier(node) || - isModuleExportsPropertyAccessExpression(node) || - isIdentifier(node) && isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node); - } - - function isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile: SourceFile, node: Identifier): boolean { - const symbol = lookupSymbolForNameWorker(sourceFile, node.escapedText); - return !!symbol && !!symbol.valueDeclaration && isVariableDeclaration(symbol.valueDeclaration) && - !!symbol.valueDeclaration.initializer && isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, symbol.valueDeclaration.initializer); - } - - function isExportsOrModuleExportsOrAliasOrAssignment(sourceFile: SourceFile, node: Expression): boolean { - return isExportsOrModuleExportsOrAlias(sourceFile, node) || - (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) && ( - isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.left) || isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.right))); + let i = 0; + const q = [node]; + while (q.length && i < 100) { + i++; + node = q.shift()!; + if (isExportsIdentifier(node) || isModuleExportsPropertyAccessExpression(node)) { + return true; + } + else if (isIdentifier(node)) { + const symbol = lookupSymbolForNameWorker(sourceFile, node.escapedText); + if (!!symbol && !!symbol.valueDeclaration && isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) { + const init = symbol.valueDeclaration.initializer; + q.push(init); + if (isAssignmentExpression(init, /*excludeCompoundAssignment*/ true)) { + q.push(init.left); + q.push(init.right); + } + } + } + } + return false; } function lookupSymbolForNameWorker(container: Node, name: __String): Symbol | undefined { diff --git a/tests/baselines/reference/binderUninitializedModuleExportsAssignment.symbols b/tests/baselines/reference/binderUninitializedModuleExportsAssignment.symbols new file mode 100644 index 00000000000..73777fb2299 --- /dev/null +++ b/tests/baselines/reference/binderUninitializedModuleExportsAssignment.symbols @@ -0,0 +1,15 @@ +=== tests/cases/conformance/salsa/loop.js === +var loop1 = loop2; +>loop1 : Symbol(loop1, Decl(loop.js, 0, 3)) +>loop2 : Symbol(loop2, Decl(loop.js, 1, 3)) + +var loop2 = loop1; +>loop2 : Symbol(loop2, Decl(loop.js, 1, 3)) +>loop1 : Symbol(loop1, Decl(loop.js, 0, 3)) + +module.exports = loop2; +>module.exports : Symbol("tests/cases/conformance/salsa/loop", Decl(loop.js, 0, 0)) +>module : Symbol(export=, Decl(loop.js, 1, 18)) +>exports : Symbol(export=, Decl(loop.js, 1, 18)) +>loop2 : Symbol(loop2, Decl(loop.js, 1, 3)) + diff --git a/tests/baselines/reference/binderUninitializedModuleExportsAssignment.types b/tests/baselines/reference/binderUninitializedModuleExportsAssignment.types new file mode 100644 index 00000000000..c8b8540cc56 --- /dev/null +++ b/tests/baselines/reference/binderUninitializedModuleExportsAssignment.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/salsa/loop.js === +var loop1 = loop2; +>loop1 : any +>loop2 : any + +var loop2 = loop1; +>loop2 : any +>loop1 : any + +module.exports = loop2; +>module.exports = loop2 : any +>module.exports : any +>module : { "tests/cases/conformance/salsa/loop": any; } +>exports : any +>loop2 : any + diff --git a/tests/cases/conformance/salsa/binderUninitializedModuleExportsAssignment.ts b/tests/cases/conformance/salsa/binderUninitializedModuleExportsAssignment.ts new file mode 100644 index 00000000000..ef3ef213d36 --- /dev/null +++ b/tests/cases/conformance/salsa/binderUninitializedModuleExportsAssignment.ts @@ -0,0 +1,8 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @Filename: loop.js +var loop1 = loop2; +var loop2 = loop1; + +module.exports = loop2; From d67fe13e3088dbd78f849ec5595c86551b4a2b00 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 17 May 2019 13:10:09 -0700 Subject: [PATCH 106/384] Don't ignore index signatures in this type constraints --- src/compiler/checker.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9f5673af3ee..18c1f42f838 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3563,7 +3563,7 @@ namespace ts { context.approximateLength += 6; return createKeywordTypeNode(SyntaxKind.ObjectKeyword); } - if (type.flags & TypeFlags.TypeParameter && (type as TypeParameter).isThisType) { + if (isThisTypeParameter(type)) { if (context.flags & NodeBuilderFlags.InObjectTypeLiteral) { if (!context.encounteredError && !(context.flags & NodeBuilderFlags.AllowThisInObjectLiteral)) { context.encounteredError = true; @@ -10193,6 +10193,10 @@ namespace ts { return maybeTypeOfKind(type, TypeFlags.InstantiableNonPrimitive | TypeFlags.Index); } + function isThisTypeParameter(type: Type): boolean { + return !!(type.flags & TypeFlags.TypeParameter && (type).isThisType); + } + function getSimplifiedType(type: Type, writing: boolean): Type { return type.flags & TypeFlags.IndexedAccess ? getSimplifiedIndexedAccessType(type, writing) : type.flags & TypeFlags.Conditional ? getSimplifiedConditionalType(type, writing) : @@ -16772,7 +16776,7 @@ namespace ts { } function narrowByInKeyword(type: Type, literal: LiteralExpression, assumeTrue: boolean) { - if ((type.flags & (TypeFlags.Union | TypeFlags.Object)) || (type.flags & TypeFlags.TypeParameter && (type as TypeParameter).isThisType)) { + if (type.flags & (TypeFlags.Union | TypeFlags.Object) || isThisTypeParameter(type)) { const propName = escapeLeadingUnderscores(literal.text); return filterType(type, t => isTypePresencePossible(t, propName, assumeTrue)); } @@ -20092,7 +20096,7 @@ namespace ts { return anyType; } if (right.escapedText && !checkAndReportErrorForExtendingInterface(node)) { - reportNonexistentProperty(right, leftType.flags & TypeFlags.TypeParameter && (leftType as TypeParameter).isThisType ? apparentType : leftType); + reportNonexistentProperty(right, isThisTypeParameter(leftType) ? apparentType : leftType); } return errorType; } @@ -20496,7 +20500,7 @@ namespace ts { const effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType; const accessFlags = isAssignmentTarget(node) ? - AccessFlags.Writing | (isGenericObjectType(objectType) ? AccessFlags.NoIndexSignatures : 0) : + AccessFlags.Writing | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? AccessFlags.NoIndexSignatures : 0) : AccessFlags.None; const indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, node, accessFlags) || errorType; return checkIndexedAccessIndexType(indexedAccessType, node); From c6a670d26cddfe97790e2f3c2d4c1670860b2b2f Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 17 May 2019 15:59:01 -0700 Subject: [PATCH 107/384] Add regression test --- .../conformance/types/keyof/keyofAndIndexedAccess2.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts index 5251a83bb06..a99c2b0a7a1 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts @@ -138,3 +138,12 @@ function fn4() { let x: Array[K] = 'abc'; let y: ReadonlyArray[K] = 'abc'; } + +// Repro from #31439 + +export class c { + [x: string]: string; + constructor() { + this["a"] = "b"; + } +} From 41a3f83b4e8e4ebbfe77446f08d5c1fadf56eee1 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 17 May 2019 15:59:07 -0700 Subject: [PATCH 108/384] Accept new baselines --- .../keyofAndIndexedAccess2.errors.txt | 9 +++++++++ .../reference/keyofAndIndexedAccess2.js | 15 +++++++++++++++ .../reference/keyofAndIndexedAccess2.symbols | 14 ++++++++++++++ .../reference/keyofAndIndexedAccess2.types | 18 ++++++++++++++++++ 4 files changed, 56 insertions(+) diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt index 5b749df2cab..9ebf28f1857 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt @@ -219,4 +219,13 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 let x: Array[K] = 'abc'; let y: ReadonlyArray[K] = 'abc'; } + + // Repro from #31439 + + export class c { + [x: string]: string; + constructor() { + this["a"] = "b"; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.js b/tests/baselines/reference/keyofAndIndexedAccess2.js index 7bf53b9fba4..374b13b5a64 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.js +++ b/tests/baselines/reference/keyofAndIndexedAccess2.js @@ -136,6 +136,15 @@ function fn4() { let x: Array[K] = 'abc'; let y: ReadonlyArray[K] = 'abc'; } + +// Repro from #31439 + +export class c { + [x: string]: string; + constructor() { + this["a"] = "b"; + } +} //// [keyofAndIndexedAccess2.js] @@ -226,3 +235,9 @@ function fn4() { let x = 'abc'; let y = 'abc'; } +// Repro from #31439 +export class c { + constructor() { + this["a"] = "b"; + } +} diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.symbols b/tests/baselines/reference/keyofAndIndexedAccess2.symbols index 2155451ef74..a3412e8a47d 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess2.symbols @@ -503,3 +503,17 @@ function fn4() { >K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 133, 13)) } +// Repro from #31439 + +export class c { +>c : Symbol(c, Decl(keyofAndIndexedAccess2.ts, 136, 1)) + + [x: string]: string; +>x : Symbol(x, Decl(keyofAndIndexedAccess2.ts, 141, 3)) + + constructor() { + this["a"] = "b"; +>this : Symbol(c, Decl(keyofAndIndexedAccess2.ts, 136, 1)) + } +} + diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.types b/tests/baselines/reference/keyofAndIndexedAccess2.types index af43ed0f4eb..b7b71ba4f9f 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.types +++ b/tests/baselines/reference/keyofAndIndexedAccess2.types @@ -499,3 +499,21 @@ function fn4() { >'abc' : "abc" } +// Repro from #31439 + +export class c { +>c : c + + [x: string]: string; +>x : string + + constructor() { + this["a"] = "b"; +>this["a"] = "b" : "b" +>this["a"] : string +>this : this +>"a" : "a" +>"b" : "b" + } +} + From 309ae224f0cd0c98eb3497b082aa39acd0d796ab Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 20 May 2019 06:23:30 -0700 Subject: [PATCH 109/384] Cache unnormalized intersection types --- src/compiler/checker.ts | 57 ++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 18c1f42f838..4a1089ff114 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -391,7 +391,7 @@ namespace ts { const tupleTypes = createMap(); const unionTypes = createMap(); - const intersectionTypes = createMap(); + const intersectionTypes = createMap(); const literalTypes = createMap(); const indexedAccessTypes = createMap(); const substitutionTypes = createMap(); @@ -9838,6 +9838,15 @@ namespace ts { return true; } + function createIntersectionType(types: Type[], aliasSymbol?: Symbol, aliasTypeArguments?: ReadonlyArray) { + const result = createType(TypeFlags.Intersection); + result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ TypeFlags.Nullable); + result.types = types; + result.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`. + result.aliasTypeArguments = aliasTypeArguments; + return result; + } + // We normalize combinations of intersection and union types based on the distributive property of the '&' // operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection // types with union type constituents into equivalent union types with intersection type constituents and @@ -9875,31 +9884,31 @@ namespace ts { if (typeSet.length === 1) { return typeSet[0]; } - if (includes & TypeFlags.Union) { - if (intersectUnionsOfPrimitiveTypes(typeSet)) { - // When the intersection creates a reduced set (which might mean that *all* union types have - // disappeared), we restart the operation to get a new set of combined flags. Once we have - // reduced we'll never reduce again, so this occurs at most once. - return getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments); - } - // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of - // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. - const unionIndex = findIndex(typeSet, t => (t.flags & TypeFlags.Union) !== 0); - const unionType = typeSet[unionIndex]; - return getUnionType(map(unionType.types, t => getIntersectionType(replaceElement(typeSet, unionIndex, t))), - UnionReduction.Literal, aliasSymbol, aliasTypeArguments); - } const id = getTypeListId(typeSet); - let type = intersectionTypes.get(id); - if (!type) { - type = createType(TypeFlags.Intersection); - intersectionTypes.set(id, type); - type.objectFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ TypeFlags.Nullable); - type.types = typeSet; - type.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`. - type.aliasTypeArguments = aliasTypeArguments; + let result = intersectionTypes.get(id); + if (!result) { + if (includes & TypeFlags.Union) { + if (intersectUnionsOfPrimitiveTypes(typeSet)) { + // When the intersection creates a reduced set (which might mean that *all* union types have + // disappeared), we restart the operation to get a new set of combined flags. Once we have + // reduced we'll never reduce again, so this occurs at most once. + result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments); + } + else { + // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of + // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. + const unionIndex = findIndex(typeSet, t => (t.flags & TypeFlags.Union) !== 0); + const unionType = typeSet[unionIndex]; + result = getUnionType(map(unionType.types, t => getIntersectionType(replaceElement(typeSet, unionIndex, t))), + UnionReduction.Literal, aliasSymbol, aliasTypeArguments); + } + } + else { + result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments); + } + intersectionTypes.set(id, result); } - return type; + return result; } function getTypeFromIntersectionTypeNode(node: IntersectionTypeNode): Type { From 422b5414f1961be252fc7f705b6e2be8143c313f Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 20 May 2019 12:02:52 -0700 Subject: [PATCH 110/384] Allow synthetic identifiers to exist and give them escapedText --- src/services/services.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index 9637b3c5321..6e4889e330e 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -172,10 +172,11 @@ namespace ts { const token = scanner.scan(); const textPos = scanner.getTextPos(); if (textPos <= end) { - if (token === SyntaxKind.Identifier) { - Debug.fail(`Did not expect ${Debug.showSyntaxKind(parent)} to have an Identifier in its trivia`); + const node = createNode(token, pos, textPos, parent); + nodes.push(node); + if (isIdentifier(node)) { + node.escapedText = escapeLeadingUnderscores(scanner.getTokenValue()); } - nodes.push(createNode(token, pos, textPos, parent)); } pos = textPos; if (token === SyntaxKind.EndOfFileToken) { From 0a3c755fc207d8d5843db4f5e059235b0e6dc67a Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 20 May 2019 12:26:12 -0700 Subject: [PATCH 111/384] Add test --- .../jsxExpressionFollowedByIdentifier.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts diff --git a/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts b/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts new file mode 100644 index 00000000000..8d93244e01e --- /dev/null +++ b/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts @@ -0,0 +1,18 @@ +/// + +//@Filename: jsxExpressionFollowedByIdentifier.tsx +////declare var React: any; +////declare var x: string; +////const a =

{
/*1*/x/*2*/}
+ +goTo.marker('1'); +verify.getSyntacticDiagnostics([{ + code: 1005, + message: "'}' expected.", + range: { + fileName: test.marker('1').fileName, + pos: test.marker('1').position, + end: test.marker('2').position, + } +}]); +verify.quickInfoIs('var x: string'); \ No newline at end of file From 9052804576cefbc239df539e3ddad522568cfb71 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 20 May 2019 12:50:29 -0700 Subject: [PATCH 112/384] Test docCommentTemplate for prototype methods (#31477) This works in 3.5, but didn't in 3.2. Adding a test to make sure it stays working. --- .../docCommentTemplatePrototypeMethod.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/cases/fourslash/docCommentTemplatePrototypeMethod.ts diff --git a/tests/cases/fourslash/docCommentTemplatePrototypeMethod.ts b/tests/cases/fourslash/docCommentTemplatePrototypeMethod.ts new file mode 100644 index 00000000000..9031898d52a --- /dev/null +++ b/tests/cases/fourslash/docCommentTemplatePrototypeMethod.ts @@ -0,0 +1,15 @@ +/// +// @Filename: foo.js + +/////** @class */ +////function C() { } +/////*above*/ +////C.prototype.method = /*next*/ function (p) {} + +for (const marker of test.markerNames()) { + verify.docCommentTemplateAt(marker, 8, +`/** + * + * @param {any} p + */`); +} From 0f15bda45fa00f7b0b69305cb4161d2dc4379f1b Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 20 May 2019 13:31:44 -0700 Subject: [PATCH 113/384] Add failing test --- .../unittests/services/organizeImports.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/testRunner/unittests/services/organizeImports.ts b/src/testRunner/unittests/services/organizeImports.ts index 8116b1e268a..9216a7adf88 100644 --- a/src/testRunner/unittests/services/organizeImports.ts +++ b/src/testRunner/unittests/services/organizeImports.ts @@ -343,6 +343,19 @@ import { } from "lib"; }, libFile); + testOrganizeImports("Unused_false_positive_module_augmentation", + { + path: "/test.d.ts", + content: ` +import { Caseless } from 'caseless'; + +declare module 'caseless' { + interface Caseless { + test(name: KeyType): boolean; + } +}` + }); + testOrganizeImports("Unused_false_positive_shorthand_assignment", { path: "/test.ts", From 6faeee449d0395529ff7cddc37cf00b988f3c6bf Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 20 May 2019 14:49:28 -0700 Subject: [PATCH 114/384] =?UTF-8?q?Don=E2=80=99t=20remove=20imports=20that?= =?UTF-8?q?=20are=20used=20for=20module=20augmentation,=20just=20remove=20?= =?UTF-8?q?their=20import=20clauses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/organizeImports.ts | 18 ++++++++++++++- .../unittests/services/organizeImports.ts | 4 +++- ...used_false_positive_module_augmentation.ts | 22 +++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 tests/baselines/reference/organizeImports/Unused_false_positive_module_augmentation.ts diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index 5bfa0c74ab1..b6be92fbf9c 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -89,7 +89,7 @@ namespace ts.OrganizeImports { const usedImports: ImportDeclaration[] = []; for (const importDecl of oldImports) { - const {importClause} = importDecl; + const { importClause, moduleSpecifier } = importDecl; if (!importClause) { // Imports without import clauses are assumed to be included for their side effects and are not removed. @@ -125,6 +125,14 @@ namespace ts.OrganizeImports { if (name || namedBindings) { usedImports.push(updateImportDeclarationAndClause(importDecl, name, namedBindings)); } + // If a module is imported to be augmented, keep the import declaration, but without an import clause + else if (hasModuleDeclarationMatchingSpecifier(sourceFile, moduleSpecifier)) { + usedImports.push(createImportDeclaration( + importDecl.decorators, + importDecl.modifiers, + /*importClause*/ undefined, + moduleSpecifier)); + } } return usedImports; @@ -135,6 +143,14 @@ namespace ts.OrganizeImports { } } + function hasModuleDeclarationMatchingSpecifier(sourceFile: SourceFile, moduleSpecifier: Expression) { + const moduleSpecifierText = isStringLiteral(moduleSpecifier) && moduleSpecifier.text; + return isString(moduleSpecifierText) && some(sourceFile.statements, statement => + isModuleDeclaration(statement) + && isStringLiteral(statement.name) + && statement.name.text === moduleSpecifierText); + } + function getExternalModuleName(specifier: Expression) { return specifier !== undefined && isStringLiteralLike(specifier) ? specifier.text diff --git a/src/testRunner/unittests/services/organizeImports.ts b/src/testRunner/unittests/services/organizeImports.ts index 9216a7adf88..8003e1867cd 100644 --- a/src/testRunner/unittests/services/organizeImports.ts +++ b/src/testRunner/unittests/services/organizeImports.ts @@ -1,5 +1,5 @@ namespace ts { - describe("unittests:: services:: Organize imports", () => { + describe("unittests:: services:: organizeImports", () => { describe("Sort imports", () => { it("Sort - non-relative vs non-relative", () => { assertSortsBefore( @@ -347,8 +347,10 @@ import { } from "lib"; { path: "/test.d.ts", content: ` +import foo from 'foo'; import { Caseless } from 'caseless'; +declare module 'foo' {} declare module 'caseless' { interface Caseless { test(name: KeyType): boolean; diff --git a/tests/baselines/reference/organizeImports/Unused_false_positive_module_augmentation.ts b/tests/baselines/reference/organizeImports/Unused_false_positive_module_augmentation.ts new file mode 100644 index 00000000000..4eaf184d493 --- /dev/null +++ b/tests/baselines/reference/organizeImports/Unused_false_positive_module_augmentation.ts @@ -0,0 +1,22 @@ +// ==ORIGINAL== + +import foo from 'foo'; +import { Caseless } from 'caseless'; + +declare module 'foo' {} +declare module 'caseless' { + interface Caseless { + test(name: KeyType): boolean; + } +} +// ==ORGANIZED== + +import 'caseless'; +import 'foo'; + +declare module 'foo' {} +declare module 'caseless' { + interface Caseless { + test(name: KeyType): boolean; + } +} \ No newline at end of file From 897e10a81e3495c7749977a51cc4b82602f9ba03 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 20 May 2019 14:58:25 -0700 Subject: [PATCH 115/384] Use range instead of two markers --- .../fourslash/jsxExpressionFollowedByIdentifier.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts b/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts index 8d93244e01e..3231ed9cf62 100644 --- a/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts +++ b/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts @@ -3,16 +3,12 @@ //@Filename: jsxExpressionFollowedByIdentifier.tsx ////declare var React: any; ////declare var x: string; -////const a =
{
/*1*/x/*2*/}
+////const a =
{
[|x|]}
-goTo.marker('1'); +const range = test.ranges()[0]; verify.getSyntacticDiagnostics([{ code: 1005, message: "'}' expected.", - range: { - fileName: test.marker('1').fileName, - pos: test.marker('1').position, - end: test.marker('2').position, - } + range, }]); -verify.quickInfoIs('var x: string'); \ No newline at end of file +verify.quickInfoAt(range, 'var x: string'); \ No newline at end of file From 00cea41b6545ef7405bf8a5709fa9275b154c8a4 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 16 May 2019 14:46:10 -0700 Subject: [PATCH 116/384] Add sortText depending scope of symbols Fixes #15024 --- src/harness/fourslash.ts | 112 ++++++++++++---- src/services/completions.ts | 124 ++++++++++++++---- src/services/stringCompletions.ts | 14 +- .../unittests/tsserver/completions.ts | 2 +- .../cases/fourslash/codeCompletionEscaping.ts | 4 +- .../fourslash/completionAfterGlobalThis.ts | 6 +- .../completionEntryForClassMembers.ts | 8 +- .../fourslash/completionEntryInJsFile.ts | 22 +++- .../fourslash/completionInFunctionLikeBody.ts | 4 +- .../fourslash/completionInJSDocFunctionNew.ts | 2 +- .../completionInJSDocFunctionThis.ts | 2 +- tests/cases/fourslash/completionInJsDoc.ts | 2 +- ...pletionListAtEndOfWordInArrowFunction02.ts | 6 +- ...pletionListAtEndOfWordInArrowFunction03.ts | 2 +- ...tInClosedObjectTypeLiteralInSignature04.ts | 6 +- .../completionListInNamedClassExpression.ts | 6 +- ...nUnclosedObjectTypeLiteralInSignature04.ts | 6 +- .../completionListIsGlobalCompletion.ts | 2 +- .../cases/fourslash/completionListKeywords.ts | 9 +- .../fourslash/completionListWithMeanings.ts | 6 +- .../completionListWithModulesFromModule.ts | 12 +- ...pletionListWithModulesInsideModuleScope.ts | 11 +- ...letionListWithModulesOutsideModuleScope.ts | 2 +- .../completionListWithUnresolvedModule.ts | 8 +- .../completionsGeneratorFunctions.ts | 2 +- .../fourslash/completionsImportBaseUrl.ts | 1 + .../completionsImport_augmentation.ts | 2 + ...completionsImport_compilerOptionsModule.ts | 17 ++- .../completionsImport_defaultFalsePositive.ts | 1 + ...letionsImport_default_addToNamedImports.ts | 1 + ...ionsImport_default_addToNamespaceImport.ts | 1 + ...Import_default_alreadyExistedWithRename.ts | 1 + .../completionsImport_default_anonymous.ts | 20 ++- ...letionsImport_default_didNotExistBefore.ts | 1 + ...sImport_default_exportDefaultIdentifier.ts | 10 +- ...nsImport_default_fromMergedDeclarations.ts | 1 + .../completionsImport_exportEquals.ts | 14 +- ...mport_exportEqualsNamespace_noDuplicate.ts | 2 +- ...ompletionsImport_exportEquals_anonymous.ts | 21 ++- .../fourslash/completionsImport_importType.ts | 2 + .../fourslash/completionsImport_keywords.ts | 13 +- .../fourslash/completionsImport_matching.ts | 11 +- .../completionsImport_multipleWithSameName.ts | 14 +- ...mpletionsImport_named_addToNamedImports.ts | 1 + ...mpletionsImport_named_didNotExistBefore.ts | 21 ++- ...tionsImport_named_exportEqualsNamespace.ts | 1 + ...port_named_exportEqualsNamespace_merged.ts | 1 + ...tionsImport_named_namespaceImportExists.ts | 1 + .../completionsImport_notFromIndex.ts | 1 + .../fourslash/completionsImport_ofAlias.ts | 12 +- ...mpletionsImport_ofAlias_preferShortPath.ts | 15 ++- ...pletionsImport_previousTokenIsSemicolon.ts | 1 + .../completionsImport_reExportDefault.ts | 6 +- .../completionsImport_reExport_wrongName.ts | 18 ++- .../fourslash/completionsImport_require.ts | 1 + .../completionsImport_shadowedByLocal.ts | 40 +++--- .../cases/fourslash/completionsImport_tsx.ts | 2 +- .../fourslash/completionsInterfaceElement.ts | 9 +- .../fourslash/completionsJsdocTypeTagCast.ts | 8 +- .../completionsJsxAttributeInitializer.ts | 4 +- .../fourslash/completionsKeywordsExtends.ts | 2 +- .../completionsRecommended_import.ts | 1 + .../completionsRecommended_namespace.ts | 1 + tests/cases/fourslash/completionsThisType.ts | 6 +- .../fourslash/completionsTypeKeywords.ts | 2 +- .../fourslash/doubleUnderscoreCompletions.ts | 4 +- tests/cases/fourslash/fourslash.ts | 10 ++ .../fourslash/getJavaScriptCompletions12.ts | 2 +- .../fourslash/getJavaScriptCompletions13.ts | 21 ++- .../fourslash/getJavaScriptCompletions15.ts | 12 +- .../fourslash/getJavaScriptCompletions20.ts | 9 +- .../getJavaScriptGlobalCompletions1.ts | 2 +- tests/cases/fourslash/importJsNodeModule2.ts | 2 +- .../fourslash/indirectClassInstantiation.ts | 13 +- tests/cases/fourslash/javaScriptClass1.ts | 10 +- tests/cases/fourslash/javaScriptModules12.ts | 44 ++++++- tests/cases/fourslash/javaScriptModules13.ts | 6 +- tests/cases/fourslash/javaScriptModules14.ts | 6 +- tests/cases/fourslash/javaScriptModules16.ts | 2 +- tests/cases/fourslash/javaScriptModules19.ts | 6 +- tests/cases/fourslash/javaScriptPrototype2.ts | 2 +- tests/cases/fourslash/javaScriptPrototype3.ts | 6 +- tests/cases/fourslash/javaScriptPrototype4.ts | 5 +- tests/cases/fourslash/javascriptModules20.ts | 6 +- tests/cases/fourslash/javascriptModules21.ts | 8 +- ...JsdocTypedefTagTypeExpressionCompletion.ts | 2 +- ...sdocTypedefTagTypeExpressionCompletion2.ts | 4 +- ...sdocTypedefTagTypeExpressionCompletion3.ts | 2 +- ...oImportCompletionsInOtherJavaScriptFile.ts | 2 + .../server/jsdocTypedefTagNamespace.ts | 2 +- tests/cases/fourslash/tsxCompletion9.ts | 2 +- .../fourslash/tsxCompletionNonTagLessThan.ts | 19 ++- .../tsxCompletionOnOpeningTagWithoutJSX1.ts | 2 +- 93 files changed, 700 insertions(+), 178 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index df7f0051f3f..8a0a2bffbd4 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -798,8 +798,8 @@ namespace FourSlash { } private verifyCompletionEntry(actual: ts.CompletionEntry, expected: FourSlashInterface.ExpectedCompletionEntry) { - const { insertText, replacementSpan, hasAction, isRecommended, kind, kindModifiers, text, documentation, tags, source, sourceDisplay } = typeof expected === "string" - ? { insertText: undefined, replacementSpan: undefined, hasAction: undefined, isRecommended: undefined, kind: undefined, kindModifiers: undefined, text: undefined, documentation: undefined, tags: undefined, source: undefined, sourceDisplay: undefined } + const { insertText, replacementSpan, hasAction, isRecommended, kind, kindModifiers, text, documentation, tags, source, sourceDisplay, sortText } = typeof expected === "string" + ? { insertText: undefined, replacementSpan: undefined, hasAction: undefined, isRecommended: undefined, kind: undefined, kindModifiers: undefined, text: undefined, documentation: undefined, tags: undefined, source: undefined, sourceDisplay: undefined, sortText: undefined } : expected; if (actual.insertText !== insertText) { @@ -825,6 +825,7 @@ namespace FourSlash { assert.equal(actual.hasAction, hasAction); assert.equal(actual.isRecommended, isRecommended); assert.equal(actual.source, source); + assert.equal(actual.sortText, sortText || ts.Completions.SortText.LocationPriority, this.messageAtLastKnownMarker(`Actual entry: ${JSON.stringify(actual)}`)); if (text !== undefined) { const actualDetails = this.getCompletionEntryDetails(actual.name, actual.source)!; @@ -4434,18 +4435,63 @@ namespace FourSlashInterface { } } export namespace Completion { - const functionEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "function", kindModifiers: "declare" }); - const varEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "var", kindModifiers: "declare" }); - const moduleEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "module", kindModifiers: "declare" }); - const keywordEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "keyword" }); - const methodEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "method", kindModifiers: "declare" }); - const propertyEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "property", kindModifiers: "declare" }); - const interfaceEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "interface", kindModifiers: "declare" }); - const typeEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "type", kindModifiers: "declare" }); + export import SortText = ts.Completions.SortText; + + const functionEntry = (name: string): ExpectedCompletionEntryObject => ({ + name, + kind: "function", + kindModifiers: "declare", + sortText: SortText.GlobalsOrKeywords + }); + const varEntry = (name: string): ExpectedCompletionEntryObject => ({ + name, + kind: "var", + kindModifiers: "declare", + sortText: SortText.GlobalsOrKeywords + }); + const moduleEntry = (name: string): ExpectedCompletionEntryObject => ({ + name, + kind: "module", + kindModifiers: "declare", + sortText: SortText.GlobalsOrKeywords + }); + const keywordEntry = (name: string): ExpectedCompletionEntryObject => ({ + name, + kind: "keyword", + sortText: SortText.GlobalsOrKeywords + }); + const methodEntry = (name: string): ExpectedCompletionEntryObject => ({ + name, + kind: "method", + kindModifiers: "declare", + sortText: SortText.LocationPriority + }); + const propertyEntry = (name: string): ExpectedCompletionEntryObject => ({ + name, + kind: "property", + kindModifiers: "declare", + sortText: SortText.LocationPriority + }); + const interfaceEntry = (name: string): ExpectedCompletionEntryObject => ({ + name, + kind: "interface", + kindModifiers: "declare", + sortText: SortText.GlobalsOrKeywords + }); + const typeEntry = (name: string): ExpectedCompletionEntryObject => ({ + name, + kind: "type", + kindModifiers: "declare", + sortText: SortText.GlobalsOrKeywords + }); const res: ExpectedCompletionEntryObject[] = []; for (let i = ts.SyntaxKind.FirstKeyword; i <= ts.SyntaxKind.LastKeyword; i++) { - res.push({ name: ts.Debug.assertDefined(ts.tokenToString(i)), kind: "keyword" }); + res.push({ + name: ts.Debug.assertDefined(ts.tokenToString(i)), + kind: "keyword", + sortText: SortText.GlobalsOrKeywords + }); } export const keywordsWithUndefined: ReadonlyArray = res; export const keywords: ReadonlyArray = keywordsWithUndefined.filter(k => k.name !== "undefined"); @@ -4552,11 +4598,15 @@ namespace FourSlashInterface { moduleEntry("Intl"), ]; + export const globalThisEntry: ExpectedCompletionEntry = { + name: "globalThis", + kind: "module", + sortText: SortText.GlobalsOrKeywords + }; export const globalTypes = globalTypesPlus([]); - export function globalTypesPlus(plus: ReadonlyArray): ReadonlyArray { return [ - { name: "globalThis", kind: "module" }, + globalThisEntry, ...globalTypeDecls, ...plus, ...typeKeywords, @@ -4605,7 +4655,11 @@ namespace FourSlashInterface { export const classElementInJsKeywords = getInJsKeywords(classElementKeywords); export const constructorParameterKeywords: ReadonlyArray = - ["private", "protected", "public", "readonly"].map((name): ExpectedCompletionEntryObject => ({ name, kind: "keyword" })); + ["private", "protected", "public", "readonly"].map((name): ExpectedCompletionEntryObject => ({ + name, + kind: "keyword", + sortText: SortText.GlobalsOrKeywords + })); export const functionMembers: ReadonlyArray = [ methodEntry("apply"), @@ -4834,13 +4888,18 @@ namespace FourSlashInterface { "await", ].map(keywordEntry); + export const undefinedVarEntry: ExpectedCompletionEntry = { + name: "undefined", + kind: "var", + sortText: SortText.GlobalsOrKeywords + }; // TODO: many of these are inappropriate to always provide export const globalsInsideFunction = (plus: ReadonlyArray): ReadonlyArray => [ { name: "arguments", kind: "local var" }, ...plus, - { name: "globalThis", kind: "module" }, + globalThisEntry, ...globalsVars, - { name: "undefined", kind: "var" }, + undefinedVarEntry, ...globalKeywordsInsideFunction, ]; @@ -4849,10 +4908,10 @@ namespace FourSlashInterface { // TODO: many of these are inappropriate to always provide export const globalsInJsInsideFunction = (plus: ReadonlyArray): ReadonlyArray => [ { name: "arguments", kind: "local var" }, - { name: "globalThis", kind: "module" }, + globalThisEntry, ...globalsVars, ...plus, - { name: "undefined", kind: "var" }, + undefinedVarEntry, ...globalInJsKeywordsInsideFunction, ]; @@ -4990,34 +5049,34 @@ namespace FourSlashInterface { })(); export const globals: ReadonlyArray = [ - { name: "globalThis", kind: "module" }, + globalThisEntry, ...globalsVars, - { name: "undefined", kind: "var" }, + undefinedVarEntry, ...globalKeywords ]; export const globalsInJs: ReadonlyArray = [ - { name: "globalThis", kind: "module" }, + globalThisEntry, ...globalsVars, - { name: "undefined", kind: "var" }, + undefinedVarEntry, ...globalInJsKeywords ]; export function globalsPlus(plus: ReadonlyArray): ReadonlyArray { return [ - { name: "globalThis", kind: "module" }, + globalThisEntry, ...globalsVars, ...plus, - { name: "undefined", kind: "var" }, + undefinedVarEntry, ...globalKeywords]; } export function globalsInJsPlus(plus: ReadonlyArray): ReadonlyArray { return [ - { name: "globalThis", kind: "module" }, + globalThisEntry, ...globalsVars, ...plus, - { name: "undefined", kind: "var" }, + undefinedVarEntry, ...globalInJsKeywords]; } } @@ -5050,6 +5109,7 @@ namespace FourSlashInterface { readonly documentation?: string; readonly sourceDisplay?: string; readonly tags?: ReadonlyArray; + readonly sortText?: ts.Completions.SortText; } export interface VerifyCompletionsOptions { diff --git a/src/services/completions.ts b/src/services/completions.ts index 9d569fbedde..1adfc1e480f 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1,5 +1,12 @@ /* @internal */ namespace ts.Completions { + export enum SortText { + LocationPriority = "0", + SuggestedClassMembers = "1", + GlobalsOrKeywords = "2", + AutoImportSuggestions = "3", + JavascriptIdentifiers = "4" + } export type Log = (message: string) => void; const enum SymbolOriginInfoKind { ThisType, SymbolMemberNoExport, SymbolMemberExport, Export } @@ -22,6 +29,8 @@ namespace ts.Completions { */ type SymbolOriginInfoMap = (SymbolOriginInfo | undefined)[]; + type SymbolSortTextMap = (SortText | undefined)[]; + const enum KeywordCompletionFilters { None, // No keywords All, // Every possible keyword (TODO: This is never appropriate) @@ -78,7 +87,21 @@ namespace ts.Completions { } function completionInfoFromData(sourceFile: SourceFile, typeChecker: TypeChecker, compilerOptions: CompilerOptions, log: Log, completionData: CompletionData, preferences: UserPreferences): CompletionInfo | undefined { - const { symbols, completionKind, isInSnippetScope, isNewIdentifierLocation, location, propertyAccessToConvert, keywordFilters, literals, symbolToOriginInfoMap, recommendedCompletion, isJsxInitializer, insideJsDocTagTypeExpression } = completionData; + const { + symbols, + completionKind, + isInSnippetScope, + isNewIdentifierLocation, + location, + propertyAccessToConvert, + keywordFilters, + literals, + symbolToOriginInfoMap, + recommendedCompletion, + isJsxInitializer, + insideJsDocTagTypeExpression, + symbolToSortTextMap, + } = completionData; if (location && location.parent && isJsxClosingElement(location.parent)) { // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag, @@ -93,7 +116,7 @@ namespace ts.Completions { name: tagName.getFullText(sourceFile) + (hasClosingAngleBracket ? "" : ">"), kind: ScriptElementKind.classElement, kindModifiers: undefined, - sortText: "0", + sortText: SortText.LocationPriority, }; return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: false, entries: [entry] }; } @@ -101,7 +124,22 @@ namespace ts.Completions { const entries: CompletionEntry[] = []; if (isUncheckedFile(sourceFile, compilerOptions)) { - const uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target!, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap); + const uniqueNames = getCompletionEntriesFromSymbols( + symbols, + entries, + location, + sourceFile, + typeChecker, + compilerOptions.target!, + log, + completionKind, + preferences, + propertyAccessToConvert, + isJsxInitializer, + recommendedCompletion, + symbolToOriginInfoMap, + symbolToSortTextMap + ); getJSCompletionEntries(sourceFile, location!.pos, uniqueNames, compilerOptions.target!, entries); // TODO: GH#18217 } else { @@ -109,7 +147,22 @@ namespace ts.Completions { return undefined; } - getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target!, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap); + getCompletionEntriesFromSymbols( + symbols, + entries, + location, + sourceFile, + typeChecker, + compilerOptions.target!, + log, + completionKind, + preferences, + propertyAccessToConvert, + isJsxInitializer, + recommendedCompletion, + symbolToOriginInfoMap, + symbolToSortTextMap + ); } if (keywordFilters !== KeywordCompletionFilters.None) { @@ -160,7 +213,7 @@ namespace ts.Completions { name: realName, kind: ScriptElementKind.warning, kindModifiers: "", - sortText: "1" + sortText: SortText.JavascriptIdentifiers }); } }); @@ -169,28 +222,23 @@ namespace ts.Completions { const completionNameForLiteral = (literal: string | number | PseudoBigInt) => typeof literal === "object" ? pseudoBigIntToString(literal) + "n" : JSON.stringify(literal); function createCompletionEntryForLiteral(literal: string | number | PseudoBigInt): CompletionEntry { - return { name: completionNameForLiteral(literal), kind: ScriptElementKind.string, kindModifiers: ScriptElementKindModifier.none, sortText: "0" }; + return { name: completionNameForLiteral(literal), kind: ScriptElementKind.string, kindModifiers: ScriptElementKindModifier.none, sortText: SortText.LocationPriority }; } function createCompletionEntry( symbol: Symbol, + sortText: SortText, location: Node | undefined, sourceFile: SourceFile, typeChecker: TypeChecker, - target: ScriptTarget, - kind: CompletionKind, + name: string, + needsConvertPropertyAccess: boolean, origin: SymbolOriginInfo | undefined, recommendedCompletion: Symbol | undefined, propertyAccessToConvert: PropertyAccessExpression | undefined, isJsxInitializer: IsJsxInitializer | undefined, preferences: UserPreferences, ): CompletionEntry | undefined { - const info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind); - if (!info) { - return undefined; - } - const { name, needsConvertPropertyAccess } = info; - let insertText: string | undefined; let replacementSpan: TextSpan | undefined; if (origin && origin.kind === SymbolOriginInfoKind.ThisType) { @@ -230,7 +278,7 @@ namespace ts.Completions { name, kind: SymbolDisplay.getSymbolKind(typeChecker, symbol, location!), // TODO: GH#18217 kindModifiers: SymbolDisplay.getSymbolModifiers(symbol), - sortText: "0", + sortText, source: getSourceFromOrigin(origin), hasAction: trueOrUndefined(!!origin && originIsExport(origin)), isRecommended: trueOrUndefined(isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker)), @@ -266,6 +314,7 @@ namespace ts.Completions { isJsxInitializer?: IsJsxInitializer, recommendedCompletion?: Symbol, symbolToOriginInfoMap?: SymbolOriginInfoMap, + symbolToSortTextMap?: SymbolSortTextMap, ): Map { const start = timestamp(); // Tracks unique names. @@ -275,13 +324,30 @@ namespace ts.Completions { const uniques = createMap(); for (const symbol of symbols) { const origin = symbolToOriginInfoMap ? symbolToOriginInfoMap[getSymbolId(symbol)] : undefined; - const entry = createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences); - if (!entry) { + const info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind); + if (!info) { + continue; + } + const { name, needsConvertPropertyAccess } = info; + if (uniques.has(name)) { continue; } - const { name } = entry; - if (uniques.has(name)) { + const entry = createCompletionEntry( + symbol, + symbolToSortTextMap && symbolToSortTextMap[getSymbolId(symbol)] || SortText.LocationPriority, + location, + sourceFile, + typeChecker, + name, + needsConvertPropertyAccess, + origin, + recommendedCompletion, + propertyAccessToConvert, + isJsxInitializer, + preferences + ); + if (!entry) { continue; } @@ -321,7 +387,7 @@ namespace ts.Completions { name, kindModifiers: ScriptElementKindModifier.none, kind: ScriptElementKind.label, - sortText: "0" + sortText: SortText.LocationPriority }); } } @@ -358,7 +424,7 @@ namespace ts.Completions { // We don't need to perform character checks here because we're only comparing the // name against 'entryName' (which is known to be good), not building a new // completion entry. - return firstDefined(symbols, (symbol): SymbolCompletion | undefined => { // TODO: Shouldn't need return type annotation (GH#12632) + return firstDefined(symbols, (symbol): SymbolCompletion | undefined => { const origin = symbolToOriginInfoMap[getSymbolId(symbol)]; const info = getCompletionEntryDisplayNameForSymbol(symbol, compilerOptions.target!, origin, completionKind); return info && info.name === entryId.name && getSourceFromOrigin(origin) === entryId.source @@ -512,6 +578,7 @@ namespace ts.Completions { readonly previousToken: Node | undefined; readonly isJsxInitializer: IsJsxInitializer; readonly insideJsDocTagTypeExpression: boolean; + readonly symbolToSortTextMap: SymbolSortTextMap; } type Request = { readonly kind: CompletionDataKind.JsDocTagName | CompletionDataKind.JsDocTag } | { readonly kind: CompletionDataKind.JsDocParameterName, tag: JSDocParameterTag }; @@ -804,6 +871,7 @@ namespace ts.Completions { let keywordFilters = KeywordCompletionFilters.None; let symbols: Symbol[] = []; const symbolToOriginInfoMap: SymbolOriginInfoMap = []; + const symbolToSortTextMap: SymbolSortTextMap = []; if (isRightOfDot) { getTypeScriptMemberSymbols(); @@ -853,7 +921,8 @@ namespace ts.Completions { recommendedCompletion, previousToken, isJsxInitializer, - insideJsDocTagTypeExpression + insideJsDocTagTypeExpression, + symbolToSortTextMap }; type JSDocTagWithTypeExpression = JSDocParameterTag | JSDocPropertyTag | JSDocReturnTag | JSDocTypeTag | JSDocTypedefTag; @@ -1054,6 +1123,12 @@ namespace ts.Completions { const symbolMeanings = (isTypeOnly ? SymbolFlags.None : SymbolFlags.Value) | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias; symbols = Debug.assertEachDefined(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings), "getSymbolsInScope() should all be defined"); + for (const symbol of symbols) { + if (!typeChecker.isArgumentsSymbol(symbol) && + !some(symbol.declarations, d => d.getSourceFile() === sourceFile)) { + symbolToSortTextMap[getSymbolId(symbol)] = SortText.GlobalsOrKeywords; + } + } // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions` if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== SyntaxKind.SourceFile) { @@ -1062,6 +1137,7 @@ namespace ts.Completions { for (const symbol of getPropertiesForCompletion(thisType, typeChecker)) { symbolToOriginInfoMap[getSymbolId(symbol)] = { kind: SymbolOriginInfoKind.ThisType }; symbols.push(symbol); + symbolToSortTextMap[getSymbolId(symbol)] = SortText.SuggestedClassMembers; } } } @@ -1195,6 +1271,7 @@ namespace ts.Completions { // So in `declare namespace foo {} declare module "foo" { export = foo; }`, there will just be the global completion for `foo`. some(resolvedModuleSymbol.declarations, d => !!d.getSourceFile().externalModuleIndicator)) { symbols.push(resolvedModuleSymbol); + symbolToSortTextMap[getSymbolId(resolvedModuleSymbol)] = SortText.AutoImportSuggestions; symbolToOriginInfoMap[getSymbolId(resolvedModuleSymbol)] = { kind: SymbolOriginInfoKind.Export, moduleSymbol, isDefaultExport: false }; } @@ -1220,6 +1297,7 @@ namespace ts.Completions { const origin: SymbolOriginInfoExport = { kind: SymbolOriginInfoKind.Export, moduleSymbol, isDefaultExport }; if (detailsEntryId || stringContainsCharactersInOrder(getSymbolName(symbol, origin, target).toLowerCase(), tokenTextLowerCase)) { symbols.push(symbol); + symbolToSortTextMap[getSymbolId(symbol)] = SortText.AutoImportSuggestions; symbolToOriginInfoMap[getSymbolId(symbol)] = origin; } } @@ -1941,7 +2019,7 @@ namespace ts.Completions { name: tokenToString(i)!, kind: ScriptElementKind.keyword, kindModifiers: ScriptElementKindModifier.none, - sortText: "0" + sortText: SortText.GlobalsOrKeywords }); } return res; diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts index aafe9076056..b287ebdb406 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -21,7 +21,17 @@ namespace ts.Completions.StringCompletions { return convertPathCompletions(completion.paths); case StringLiteralCompletionKind.Properties: { const entries: CompletionEntry[] = []; - getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, ScriptTarget.ESNext, log, CompletionKind.String, preferences); // Target will not be used, so arbitrary + getCompletionEntriesFromSymbols( + completion.symbols, + entries, + sourceFile, + sourceFile, + checker, + ScriptTarget.ESNext, + log, + CompletionKind.String, + preferences + ); // Target will not be used, so arbitrary return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, entries }; } case StringLiteralCompletionKind.Types: { @@ -60,7 +70,7 @@ namespace ts.Completions.StringCompletions { const isGlobalCompletion = false; // We don't want the editor to offer any other completions, such as snippets, inside a comment. const isNewIdentifierLocation = true; // The user may type in a path that doesn't yet exist, creating a "new identifier" with respect to the collection of identifiers the server is aware of. const entries = pathCompletions.map(({ name, kind, span, extension }): CompletionEntry => - ({ name, kind, kindModifiers: kindModifiersFromExtension(extension), sortText: "0", replacementSpan: span })); + ({ name, kind, kindModifiers: kindModifiersFromExtension(extension), sortText: SortText.LocationPriority, replacementSpan: span })); return { isGlobalCompletion, isMemberCompletion: false, isNewIdentifierLocation, entries }; } function kindModifiersFromExtension(extension: Extension | undefined): ScriptElementKindModifier { diff --git a/src/testRunner/unittests/tsserver/completions.ts b/src/testRunner/unittests/tsserver/completions.ts index 0a62f74dc7d..1cd44539d68 100644 --- a/src/testRunner/unittests/tsserver/completions.ts +++ b/src/testRunner/unittests/tsserver/completions.ts @@ -36,7 +36,7 @@ namespace ts.projectSystem { kindModifiers: ScriptElementKindModifier.exportedModifier, name: "foo", replacementSpan: undefined, - sortText: "0", + sortText: Completions.SortText.AutoImportSuggestions, source: "/a", }; assert.deepEqual(response, { diff --git a/tests/cases/fourslash/codeCompletionEscaping.ts b/tests/cases/fourslash/codeCompletionEscaping.ts index e582171575f..bc1ae9662a0 100644 --- a/tests/cases/fourslash/codeCompletionEscaping.ts +++ b/tests/cases/fourslash/codeCompletionEscaping.ts @@ -7,7 +7,7 @@ verify.completions({ marker: "", includes: [ - { name: "__foo", kind: "warning" }, - { name: "___foo", kind: "warning" }, + { name: "__foo", kind: "warning", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "___foo", kind: "warning", sortText: completion.SortText.JavascriptIdentifiers }, ], }); diff --git a/tests/cases/fourslash/completionAfterGlobalThis.ts b/tests/cases/fourslash/completionAfterGlobalThis.ts index f5241d93c6a..bda57b9e0bd 100644 --- a/tests/cases/fourslash/completionAfterGlobalThis.ts +++ b/tests/cases/fourslash/completionAfterGlobalThis.ts @@ -5,8 +5,8 @@ verify.completions({ marker: "", exact: [ - { name: "globalThis", kind: "module" }, + completion.globalThisEntry, ...completion.globalsVars, - { name: "undefined", kind: "var" } - ] + completion.undefinedVarEntry + ].map(e => ({ ...e, sortText: completion.SortText.LocationPriority })) }); diff --git a/tests/cases/fourslash/completionEntryForClassMembers.ts b/tests/cases/fourslash/completionEntryForClassMembers.ts index 6dcfd059c46..d40a8d273bc 100644 --- a/tests/cases/fourslash/completionEntryForClassMembers.ts +++ b/tests/cases/fourslash/completionEntryForClassMembers.ts @@ -130,9 +130,9 @@ verify.completions( marker: "InsideMethod", exact: [ "arguments", - "globalThis", + completion.globalThisEntry, "B", "C", "D", "D1", "D2", "D3", "D4", "D5", "D6", "E", "F", "F2", "G", "G2", "H", "I", "J", "K", "L", "L2", "M", "N", "O", - "undefined", + completion.undefinedVarEntry, ...completion.insideMethodKeywords, ], }, @@ -146,7 +146,9 @@ verify.completions( "classThatStartedWritingIdentifierAfterPrivateModifier", "classThatStartedWritingIdentifierAfterPrivateStaticModifier", ], - exact: ["private", "protected", "public", "static", "abstract", "async", "constructor", "get", "readonly", "set"], + exact: ["private", "protected", "public", "static", "abstract", "async", "constructor", "get", "readonly", "set"].map( + name => ({ name, sortText: completion.SortText.GlobalsOrKeywords }) + ), isNewIdentifierLocation: true, }, { diff --git a/tests/cases/fourslash/completionEntryInJsFile.ts b/tests/cases/fourslash/completionEntryInJsFile.ts index a3492d9de3e..cf460f6fcc9 100644 --- a/tests/cases/fourslash/completionEntryInJsFile.ts +++ b/tests/cases/fourslash/completionEntryInJsFile.ts @@ -12,9 +12,25 @@ ////function foo() { /////*insideFunction*/ ////} +const warnings = [ + { name: "classA", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "Test7", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "foo", sortText: completion.SortText.JavascriptIdentifiers } +]; verify.completions( { marker: "global", exact: completion.globalsInJsPlus(["foo", "classA", "Test7"]) }, - { marker: "class", isNewIdentifierLocation: true, exact: ["classA", "Test7", "foo", ...completion.classElementInJsKeywords] }, - { marker: "constructorParameter", isNewIdentifierLocation: true, exact: ["classA", "Test7", "foo"] }, + { + marker: "class", + isNewIdentifierLocation: true, + exact: [ + ...warnings, + ...completion.classElementInJsKeywords + ] + }, + { + marker: "constructorParameter", + isNewIdentifierLocation: true, + exact: warnings + }, { marker: "insideFunction", exact: completion.globalsInJsInsideFunction(["foo", "classA", "Test7"]) }, -); +); \ No newline at end of file diff --git a/tests/cases/fourslash/completionInFunctionLikeBody.ts b/tests/cases/fourslash/completionInFunctionLikeBody.ts index 8c163ccb3b0..cf3b32ccb39 100644 --- a/tests/cases/fourslash/completionInFunctionLikeBody.ts +++ b/tests/cases/fourslash/completionInFunctionLikeBody.ts @@ -16,7 +16,9 @@ verify.completions( { marker: ["1", "2"], - includes: ["async", "await"], + includes: ["async", "await"].map( + name => ({ name, sortText: completion.SortText.GlobalsOrKeywords }) + ), excludes: ["public", "private", "protected", "constructor", "readonly", "static", "abstract", "get", "set"], }, { marker: ["3", "4"], exact: completion.classElementKeywords, isNewIdentifierLocation: true }, diff --git a/tests/cases/fourslash/completionInJSDocFunctionNew.ts b/tests/cases/fourslash/completionInJSDocFunctionNew.ts index 8cf8502aa20..b343104c328 100644 --- a/tests/cases/fourslash/completionInJSDocFunctionNew.ts +++ b/tests/cases/fourslash/completionInJSDocFunctionNew.ts @@ -5,4 +5,4 @@ /////** @type {function (new: string, string): string} */ ////var f = function () { return new/**/; } -verify.completions({ marker: "", includes: "new" }); +verify.completions({ marker: "", includes: { name: "new", sortText: completion.SortText.JavascriptIdentifiers } }); diff --git a/tests/cases/fourslash/completionInJSDocFunctionThis.ts b/tests/cases/fourslash/completionInJSDocFunctionThis.ts index 4f732fdcec1..8dd1c545e30 100644 --- a/tests/cases/fourslash/completionInJSDocFunctionThis.ts +++ b/tests/cases/fourslash/completionInJSDocFunctionThis.ts @@ -4,4 +4,4 @@ /////** @type {function (this: string, string): string} */ ////var f = function (s) { return this/**/; } -verify.completions({ marker: "", includes: "this" }); +verify.completions({ marker: "", includes: { name: "this", sortText: completion.SortText.JavascriptIdentifiers } }); diff --git a/tests/cases/fourslash/completionInJsDoc.ts b/tests/cases/fourslash/completionInJsDoc.ts index ef438b8f4be..d30a92fe114 100644 --- a/tests/cases/fourslash/completionInJsDoc.ts +++ b/tests/cases/fourslash/completionInJsDoc.ts @@ -57,7 +57,7 @@ verify.completions( { marker: ["1", "2"], includes: ["constructor", "param", "type", "method", "template"] }, { marker: ["3", "15", "16"], exact: [] }, - { marker: ["4", "5", "8"], includes: "number" }, + { marker: ["4", "5", "8"], includes: { name: "number", sortText: completion.SortText.GlobalsOrKeywords } }, { marker: ["6", "7", "14"], exact: undefined }, { marker: ["9", "10", "11", "12", "13"], includes: ["@argument", "@returns"] }, ); diff --git a/tests/cases/fourslash/completionListAtEndOfWordInArrowFunction02.ts b/tests/cases/fourslash/completionListAtEndOfWordInArrowFunction02.ts index 73cd0c29be9..690f01ab793 100644 --- a/tests/cases/fourslash/completionListAtEndOfWordInArrowFunction02.ts +++ b/tests/cases/fourslash/completionListAtEndOfWordInArrowFunction02.ts @@ -5,5 +5,9 @@ verify.completions({ marker: "1", // TODO: should not include 'default' keyword at an expression location - includes: ["d", "defaultIsAnInvalidParameterName", "default"] + includes: [ + "d", + "defaultIsAnInvalidParameterName", + { name: "default", sortText: completion.SortText.GlobalsOrKeywords } + ] }); diff --git a/tests/cases/fourslash/completionListAtEndOfWordInArrowFunction03.ts b/tests/cases/fourslash/completionListAtEndOfWordInArrowFunction03.ts index 0487107d3af..7aea1a726e2 100644 --- a/tests/cases/fourslash/completionListAtEndOfWordInArrowFunction03.ts +++ b/tests/cases/fourslash/completionListAtEndOfWordInArrowFunction03.ts @@ -7,6 +7,6 @@ verify.completions({ includes: [ "defaultIsAnInvalidParameterName", // This should probably stop working in the future. - { name: "default", text: "default", kind: "keyword" }, + { name: "default", text: "default", kind: "keyword", sortText: completion.SortText.GlobalsOrKeywords }, ], }); diff --git a/tests/cases/fourslash/completionListInClosedObjectTypeLiteralInSignature04.ts b/tests/cases/fourslash/completionListInClosedObjectTypeLiteralInSignature04.ts index 2f07107e057..94f109d787a 100644 --- a/tests/cases/fourslash/completionListInClosedObjectTypeLiteralInSignature04.ts +++ b/tests/cases/fourslash/completionListInClosedObjectTypeLiteralInSignature04.ts @@ -7,4 +7,8 @@ //// ////declare function foo(obj: I): { /*1*/ } -verify.completions({ marker: "1", exact: "readonly", isNewIdentifierLocation: true }); +verify.completions({ + marker: "1", + exact: { name: "readonly", sortText: completion.SortText.GlobalsOrKeywords }, + isNewIdentifierLocation: true +}); diff --git a/tests/cases/fourslash/completionListInNamedClassExpression.ts b/tests/cases/fourslash/completionListInNamedClassExpression.ts index 466342ab630..503051310c9 100644 --- a/tests/cases/fourslash/completionListInNamedClassExpression.ts +++ b/tests/cases/fourslash/completionListInNamedClassExpression.ts @@ -11,7 +11,9 @@ verify.completions( { marker: "0", includes: { name: "myClass", text: "(local class) myClass", kind: "local class" } }, { marker: "1", - exact: ["private", "protected", "public", "static", "abstract", "async", "constructor", "get", "readonly", "set"], + exact: ["private", "protected", "public", "static", "abstract", "async", "constructor", "get", "readonly", "set"].map( + name => ({ name, sortText: completion.SortText.GlobalsOrKeywords }) + ), isNewIdentifierLocation: true, - }, + } ); diff --git a/tests/cases/fourslash/completionListInUnclosedObjectTypeLiteralInSignature04.ts b/tests/cases/fourslash/completionListInUnclosedObjectTypeLiteralInSignature04.ts index 587db09d267..52b73aa1f1e 100644 --- a/tests/cases/fourslash/completionListInUnclosedObjectTypeLiteralInSignature04.ts +++ b/tests/cases/fourslash/completionListInUnclosedObjectTypeLiteralInSignature04.ts @@ -7,4 +7,8 @@ //// ////declare function foo(obj: I): { /*1*/ -verify.completions({ marker: "1", exact: "readonly", isNewIdentifierLocation: true }); +verify.completions({ + marker: "1", + exact: { name: "readonly", sortText: completion.SortText.GlobalsOrKeywords } , + isNewIdentifierLocation: true +}); diff --git a/tests/cases/fourslash/completionListIsGlobalCompletion.ts b/tests/cases/fourslash/completionListIsGlobalCompletion.ts index 2a37849c2b8..ea89155a771 100644 --- a/tests/cases/fourslash/completionListIsGlobalCompletion.ts +++ b/tests/cases/fourslash/completionListIsGlobalCompletion.ts @@ -47,6 +47,6 @@ verify.completions( { marker: "10", exact: completion.classElementKeywords, isGlobalCompletion: false, isNewIdentifierLocation: true }, { marker: "13", exact: globals, isGlobalCompletion: false }, { marker: "15", exact: globals, isGlobalCompletion: true, isNewIdentifierLocation: true }, - { marker: "16", exact: [...x, "globalThis", ...completion.globalsVars, "undefined"], isGlobalCompletion: false }, + { marker: "16", exact: [...x, completion.globalThisEntry, ...completion.globalsVars, completion.undefinedVarEntry], isGlobalCompletion: false }, { marker: "17", exact: completion.globalKeywordsPlusUndefined, isGlobalCompletion: false }, ); diff --git a/tests/cases/fourslash/completionListKeywords.ts b/tests/cases/fourslash/completionListKeywords.ts index ed489487b3c..287e5326a90 100644 --- a/tests/cases/fourslash/completionListKeywords.ts +++ b/tests/cases/fourslash/completionListKeywords.ts @@ -4,4 +4,11 @@ /////**/ -verify.completions({ marker: "", exact: ["globalThis", "undefined", ...completion.statementKeywordsWithTypes] }); +verify.completions({ + marker: "", + exact: [ + completion.globalThisEntry, + completion.undefinedVarEntry, + ...completion.statementKeywordsWithTypes + ] +}); diff --git a/tests/cases/fourslash/completionListWithMeanings.ts b/tests/cases/fourslash/completionListWithMeanings.ts index 41df1ed3816..034607d08c0 100644 --- a/tests/cases/fourslash/completionListWithMeanings.ts +++ b/tests/cases/fourslash/completionListWithMeanings.ts @@ -16,7 +16,7 @@ ////var zz = { x: 4, y: 3 }; const values: ReadonlyArray = [ - "globalThis", + completion.globalThisEntry, { name: "m2", text: "namespace m2" }, // With no type side, allowed only in value { name: "m3", text: "namespace m3" }, { name: "xx", text: "var xx: number" }, @@ -24,12 +24,12 @@ const values: ReadonlyArray = [ { name: "yy", text: "var yy: point" }, { name: "kk", text: "var kk: m3.point3" }, { name: "zz", text: "var zz: point" }, - "undefined", + completion.undefinedVarEntry, ...completion.statementKeywordsWithTypes, ]; const types: ReadonlyArray = [ - "globalThis", + completion.globalThisEntry, { name: "m", text: "namespace m" }, { name: "m3", text: "namespace m3" }, { name: "point", text: "interface point" }, diff --git a/tests/cases/fourslash/completionListWithModulesFromModule.ts b/tests/cases/fourslash/completionListWithModulesFromModule.ts index dbcbdd79783..fb5f49b1abf 100644 --- a/tests/cases/fourslash/completionListWithModulesFromModule.ts +++ b/tests/cases/fourslash/completionListWithModulesFromModule.ts @@ -263,9 +263,9 @@ verify.completions( { name: "shwvar", text: "var shwvar: string" }, { name: "shwcls", text: "class shwcls" }, "tmp", - "globalThis", + completion.globalThisEntry, ...commonValues, - "undefined", + completion.undefinedVarEntry, ...completion.statementKeywordsWithTypes, ], }, { @@ -273,7 +273,7 @@ verify.completions( exact: [ { name: "shwcls", text: "class shwcls" }, { name: "shwint", text: "interface shwint" }, - "globalThis", + completion.globalThisEntry, ...commonTypes, ...completion.typeKeywords, ] @@ -284,12 +284,12 @@ verify.completions( "Mod1", "iMod1", "tmp", - "globalThis", + completion.globalThisEntry, { name: "shwfn", text: "function shwfn(): void" }, ...commonValues, { name: "shwcls", text: "class shwcls" }, { name: "shwvar", text: "var shwvar: number" }, - "undefined", + completion.undefinedVarEntry, ...completion.statementKeywordsWithTypes, ], }, @@ -298,7 +298,7 @@ verify.completions( exact: [ "Mod1", "iMod1", - "globalThis", + completion.globalThisEntry, ...commonTypes, { name: "shwcls", text: "class shwcls" }, { name: "shwint", text: "interface shwint" }, diff --git a/tests/cases/fourslash/completionListWithModulesInsideModuleScope.ts b/tests/cases/fourslash/completionListWithModulesInsideModuleScope.ts index d1bc6233f72..ad0f2531f86 100644 --- a/tests/cases/fourslash/completionListWithModulesInsideModuleScope.ts +++ b/tests/cases/fourslash/completionListWithModulesInsideModuleScope.ts @@ -328,7 +328,7 @@ verifyGeneral('class', { // from interface in mod1 verify.completions({ marker: "interface", - exact: "readonly", + exact: { name: "readonly", sortText: completion.SortText.GlobalsOrKeywords }, isNewIdentifierLocation: true, }); @@ -376,7 +376,14 @@ verifyGeneral('exportedClass', { }); // from exported interface in mod1 -verify.completions({ marker: "exportedInterface", exact: ["readonly"], isNewIdentifierLocation: true }); +verify.completions({ + marker: "exportedInterface", + exact: [{ + name: "readonly", + sortText: completion.SortText.GlobalsOrKeywords + }], + isNewIdentifierLocation: true +}); // from exported namespace in mod1 verifyExportedNamespace('exportedNamespace'); diff --git a/tests/cases/fourslash/completionListWithModulesOutsideModuleScope.ts b/tests/cases/fourslash/completionListWithModulesOutsideModuleScope.ts index 8b9a13fc5b2..c811316ee82 100644 --- a/tests/cases/fourslash/completionListWithModulesOutsideModuleScope.ts +++ b/tests/cases/fourslash/completionListWithModulesOutsideModuleScope.ts @@ -256,7 +256,7 @@ verify.completions( // from interface scope { marker: "interface", - exact: ["readonly"], + exact: [{ name: "readonly", sortText: completion.SortText.GlobalsOrKeywords }], isNewIdentifierLocation: true, } ); diff --git a/tests/cases/fourslash/completionListWithUnresolvedModule.ts b/tests/cases/fourslash/completionListWithUnresolvedModule.ts index 73c6c52a937..1ef421af7f6 100644 --- a/tests/cases/fourslash/completionListWithUnresolvedModule.ts +++ b/tests/cases/fourslash/completionListWithUnresolvedModule.ts @@ -5,4 +5,10 @@ //// var n: num/**/ ////} -verify.completions({ marker: "", includes: "number" }); +verify.completions({ + marker: "", + includes: { + name: "number", + sortText: completion.SortText.GlobalsOrKeywords + } +}); diff --git a/tests/cases/fourslash/completionsGeneratorFunctions.ts b/tests/cases/fourslash/completionsGeneratorFunctions.ts index 1aea1eb6e4d..b2abd148646 100644 --- a/tests/cases/fourslash/completionsGeneratorFunctions.ts +++ b/tests/cases/fourslash/completionsGeneratorFunctions.ts @@ -18,5 +18,5 @@ verify.completions( { marker: ["a", "b"], exact: undefined, isNewIdentifierLocation: true }, { marker: ["c", "d"], exact: ["baseMethod"], isNewIdentifierLocation: true }, { marker: "e", exact: ["baseMethod"] }, - { marker: "f", includes: ["Number"] }, + { marker: "f", includes: [{ name: "Number", sortText: completion.SortText.GlobalsOrKeywords }] }, ); diff --git a/tests/cases/fourslash/completionsImportBaseUrl.ts b/tests/cases/fourslash/completionsImportBaseUrl.ts index d3fa4d7033e..5f67a7d4d63 100644 --- a/tests/cases/fourslash/completionsImportBaseUrl.ts +++ b/tests/cases/fourslash/completionsImportBaseUrl.ts @@ -25,6 +25,7 @@ verify.completions({ kind: "const", kindModifiers: "export", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_augmentation.ts b/tests/cases/fourslash/completionsImport_augmentation.ts index 701af24537f..f01f7f43df1 100644 --- a/tests/cases/fourslash/completionsImport_augmentation.ts +++ b/tests/cases/fourslash/completionsImport_augmentation.ts @@ -21,6 +21,7 @@ verify.completions({ source: "/a", sourceDisplay: "./a", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, { name: "bar", @@ -28,6 +29,7 @@ verify.completions({ source: "/a", sourceDisplay: "./a", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, ], preferences: { diff --git a/tests/cases/fourslash/completionsImport_compilerOptionsModule.ts b/tests/cases/fourslash/completionsImport_compilerOptionsModule.ts index 27ae94d4172..56d4ca9e27d 100644 --- a/tests/cases/fourslash/completionsImport_compilerOptionsModule.ts +++ b/tests/cases/fourslash/completionsImport_compilerOptionsModule.ts @@ -33,9 +33,22 @@ ////const a = import("./a"); // Does not make this an external module ////fo/*dts*/ -verify.completions({ marker: ["b"], excludes: "foo", preferences: { includeCompletionsForModuleExports: true } }); +verify.completions({ + marker: ["b"], + excludes: "foo", + preferences: { includeCompletionsForModuleExports: true } +}); verify.completions({ marker: ["c", "ccheck", "cts", "d", "dcheck", "dts"], - includes: [{ name: "foo", source: "/node_modules/a/index", text: "const foo: 0", kind: "const", kindModifiers: "export,declare", hasAction: true, sourceDisplay: "a" }], + includes: [{ + name: "foo", + source: "/node_modules/a/index", + text: "const foo: 0", + kind: "const", + kindModifiers: "export,declare", + hasAction: true, + sourceDisplay: "a", + sortText: completion.SortText.AutoImportSuggestions + }], preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_defaultFalsePositive.ts b/tests/cases/fourslash/completionsImport_defaultFalsePositive.ts index e077e18105b..28babd929c9 100644 --- a/tests/cases/fourslash/completionsImport_defaultFalsePositive.ts +++ b/tests/cases/fourslash/completionsImport_defaultFalsePositive.ts @@ -22,6 +22,7 @@ verify.completions({ kind: "const", kindModifiers: "export,declare", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_default_addToNamedImports.ts b/tests/cases/fourslash/completionsImport_default_addToNamedImports.ts index 8bd9f194758..c81b93e34b1 100644 --- a/tests/cases/fourslash/completionsImport_default_addToNamedImports.ts +++ b/tests/cases/fourslash/completionsImport_default_addToNamedImports.ts @@ -18,6 +18,7 @@ verify.completions({ kind: "function", kindModifiers: "export", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_default_addToNamespaceImport.ts b/tests/cases/fourslash/completionsImport_default_addToNamespaceImport.ts index 8debd787641..1752d00d1b6 100644 --- a/tests/cases/fourslash/completionsImport_default_addToNamespaceImport.ts +++ b/tests/cases/fourslash/completionsImport_default_addToNamespaceImport.ts @@ -17,6 +17,7 @@ verify.completions({ kind: "function", kindModifiers: "export", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_default_alreadyExistedWithRename.ts b/tests/cases/fourslash/completionsImport_default_alreadyExistedWithRename.ts index b04a7cacffe..2e1fd6003ba 100644 --- a/tests/cases/fourslash/completionsImport_default_alreadyExistedWithRename.ts +++ b/tests/cases/fourslash/completionsImport_default_alreadyExistedWithRename.ts @@ -17,6 +17,7 @@ verify.completions({ kind: "function", kindModifiers: "export", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_default_anonymous.ts b/tests/cases/fourslash/completionsImport_default_anonymous.ts index 720bb3f1c6b..a1eb5da6490 100644 --- a/tests/cases/fourslash/completionsImport_default_anonymous.ts +++ b/tests/cases/fourslash/completionsImport_default_anonymous.ts @@ -14,10 +14,26 @@ goTo.marker("0"); const preferences: FourSlashInterface.UserPreferences = { includeCompletionsForModuleExports: true }; verify.completions( - { marker: "0", exact: ["globalThis", "undefined", ...completion.statementKeywordsWithTypes], preferences }, + { + marker: "0", + exact: [ + completion.globalThisEntry, + completion.undefinedVarEntry, + ...completion.statementKeywordsWithTypes + ], + preferences + }, { marker: "1", - includes: { name: "fooBar", source: "/src/foo-bar", sourceDisplay: "./foo-bar", text: "(property) default: 0", kind: "property", hasAction: true }, + includes: { + name: "fooBar", + source: "/src/foo-bar", + sourceDisplay: "./foo-bar", + text: "(property) default: 0", + kind: "property", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions + }, preferences, }, ); diff --git a/tests/cases/fourslash/completionsImport_default_didNotExistBefore.ts b/tests/cases/fourslash/completionsImport_default_didNotExistBefore.ts index 259a22d637b..333159ae493 100644 --- a/tests/cases/fourslash/completionsImport_default_didNotExistBefore.ts +++ b/tests/cases/fourslash/completionsImport_default_didNotExistBefore.ts @@ -18,6 +18,7 @@ verify.completions({ kind: "function", kindModifiers: "export", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_default_exportDefaultIdentifier.ts b/tests/cases/fourslash/completionsImport_default_exportDefaultIdentifier.ts index 766f50fb9e9..ea332cd7ff7 100644 --- a/tests/cases/fourslash/completionsImport_default_exportDefaultIdentifier.ts +++ b/tests/cases/fourslash/completionsImport_default_exportDefaultIdentifier.ts @@ -14,7 +14,15 @@ goTo.marker(""); verify.completions({ marker: "", - includes: { name: "foo", source: "/a", sourceDisplay: "./a", text: "(alias) const foo: 0\nexport default foo", kind: "alias", hasAction: true }, + includes: { + name: "foo", + source: "/a", + sourceDisplay: "./a", + text: "(alias) const foo: 0\nexport default foo", + kind: "alias", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions + }, preferences: { includeCompletionsForModuleExports: true }, }); verify.applyCodeActionFromCompletion("", { diff --git a/tests/cases/fourslash/completionsImport_default_fromMergedDeclarations.ts b/tests/cases/fourslash/completionsImport_default_fromMergedDeclarations.ts index 551cfb54e75..6c86fc18fa5 100644 --- a/tests/cases/fourslash/completionsImport_default_fromMergedDeclarations.ts +++ b/tests/cases/fourslash/completionsImport_default_fromMergedDeclarations.ts @@ -25,6 +25,7 @@ verify.completions({ kind: "class", kindModifiers: "export,declare", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_exportEquals.ts b/tests/cases/fourslash/completionsImport_exportEquals.ts index 37e78e09f38..1ea3e7e637e 100644 --- a/tests/cases/fourslash/completionsImport_exportEquals.ts +++ b/tests/cases/fourslash/completionsImport_exportEquals.ts @@ -17,12 +17,22 @@ const preferences: FourSlashInterface.UserPreferences = { includeCompletionsForM verify.completions( { marker: "0", - includes: { name: "a", source: "/a", hasAction: true, }, + includes: { + name: "a", + source: "/a", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions + }, preferences, }, { marker: "1", - includes: { name: "b", source: "/a", hasAction: true }, + includes: { + name: "b", + source: "/a", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions + }, preferences, } ); diff --git a/tests/cases/fourslash/completionsImport_exportEqualsNamespace_noDuplicate.ts b/tests/cases/fourslash/completionsImport_exportEqualsNamespace_noDuplicate.ts index 8a687f5a191..798c70b2827 100644 --- a/tests/cases/fourslash/completionsImport_exportEqualsNamespace_noDuplicate.ts +++ b/tests/cases/fourslash/completionsImport_exportEqualsNamespace_noDuplicate.ts @@ -18,7 +18,7 @@ verify.completions({ marker: "", // Tester will assert that it is only included once - includes: [{ name: "foo", source: "a", hasAction: true }], + includes: [{ name: "foo", source: "a", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }], preferences: { includeCompletionsForModuleExports: true, } diff --git a/tests/cases/fourslash/completionsImport_exportEquals_anonymous.ts b/tests/cases/fourslash/completionsImport_exportEquals_anonymous.ts index 8fc73457117..b28de47c69d 100644 --- a/tests/cases/fourslash/completionsImport_exportEquals_anonymous.ts +++ b/tests/cases/fourslash/completionsImport_exportEquals_anonymous.ts @@ -12,9 +12,26 @@ goTo.marker("0"); const preferences: FourSlashInterface.UserPreferences = { includeCompletionsForModuleExports: true }; -const exportEntry: FourSlashInterface.ExpectedCompletionEntryObject = { name: "fooBar", source: "/src/foo-bar", sourceDisplay: "./foo-bar", text: "(property) export=: 0", kind: "property", hasAction: true }; +const exportEntry: FourSlashInterface.ExpectedCompletionEntryObject = { + name: "fooBar", + source: "/src/foo-bar", + sourceDisplay: "./foo-bar", + text: "(property) export=: 0", + kind: "property", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions +}; verify.completions( - { marker: "0", exact: ["globalThis", "undefined", exportEntry, ...completion.statementKeywordsWithTypes], preferences }, + { + marker: "0", + exact: [ + completion.globalThisEntry, + completion.undefinedVarEntry, + exportEntry, + ...completion.statementKeywordsWithTypes + ], + preferences + }, { marker: "1", includes: exportEntry, preferences } ); verify.applyCodeActionFromCompletion("0", { diff --git a/tests/cases/fourslash/completionsImport_importType.ts b/tests/cases/fourslash/completionsImport_importType.ts index 3c371980b90..3f4bfa38c3b 100644 --- a/tests/cases/fourslash/completionsImport_importType.ts +++ b/tests/cases/fourslash/completionsImport_importType.ts @@ -21,6 +21,7 @@ verify.completions({ sourceDisplay: "./a", text: "class C", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, { name: "T", @@ -28,6 +29,7 @@ verify.completions({ sourceDisplay: "./a", text: "type T = number", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, ], excludes: "x", diff --git a/tests/cases/fourslash/completionsImport_keywords.ts b/tests/cases/fourslash/completionsImport_keywords.ts index 64bab64c7a8..31d2e1cc6f3 100644 --- a/tests/cases/fourslash/completionsImport_keywords.ts +++ b/tests/cases/fourslash/completionsImport_keywords.ts @@ -34,8 +34,17 @@ verify.completions( { marker: "unique", exact: [ - "globalThis", ...completion.globalsVars, "undefined", - { name: "unique", source: "/a", sourceDisplay: "./a", text: "(alias) const unique: 0\nexport unique", hasAction: true }, + completion.globalThisEntry, + ...completion.globalsVars, + completion.undefinedVarEntry, + { + name: "unique", + source: "/a", + sourceDisplay: "./a", + text: "(alias) const unique: 0\nexport unique", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions + }, ...completion.globalKeywords.filter(e => e.name !== "unique"), ], preferences, diff --git a/tests/cases/fourslash/completionsImport_matching.ts b/tests/cases/fourslash/completionsImport_matching.ts index c6dbac369b9..5282d5b3d3c 100644 --- a/tests/cases/fourslash/completionsImport_matching.ts +++ b/tests/cases/fourslash/completionsImport_matching.ts @@ -17,7 +17,16 @@ verify.completions({ marker: "", includes: ["bdf", "abcdef", "BDF"].map(name => - ({ name, source: "/a", text: `function ${name}(): void`, hasAction: true, kind: "function", kindModifiers: "export", sourceDisplay: "./a" })), + ({ + name, + source: "/a", + text: `function ${name}(): void`, + hasAction: true, + kind: "function", + kindModifiers: "export", + sourceDisplay: "./a", + sortText: completion.SortText.AutoImportSuggestions + })), excludes: ["abcde", "dbf"], preferences: { includeCompletionsForModuleExports: true }, }) diff --git a/tests/cases/fourslash/completionsImport_multipleWithSameName.ts b/tests/cases/fourslash/completionsImport_multipleWithSameName.ts index 5893f6f0fdc..d00a7e0bebb 100644 --- a/tests/cases/fourslash/completionsImport_multipleWithSameName.ts +++ b/tests/cases/fourslash/completionsImport_multipleWithSameName.ts @@ -20,9 +20,15 @@ goTo.marker(""); verify.completions({ marker: "", exact: [ - "globalThis", - { name: "foo", text: "var foo: number", kind: "var", kindModifiers: "declare" }, - "undefined", + completion.globalThisEntry, + { + name: "foo", + text: "var foo: number", + kind: "var", + kindModifiers: "declare", + sortText: completion.SortText.GlobalsOrKeywords + }, + completion.undefinedVarEntry, { name: "foo", source: "/a", @@ -31,6 +37,7 @@ verify.completions({ kind: "const", kindModifiers: "export", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, { name: "foo", @@ -40,6 +47,7 @@ verify.completions({ kind: "const", kindModifiers: "export", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, ...completion.statementKeywordsWithTypes, ], diff --git a/tests/cases/fourslash/completionsImport_named_addToNamedImports.ts b/tests/cases/fourslash/completionsImport_named_addToNamedImports.ts index 78df2659ade..8e1ec13df79 100644 --- a/tests/cases/fourslash/completionsImport_named_addToNamedImports.ts +++ b/tests/cases/fourslash/completionsImport_named_addToNamedImports.ts @@ -18,6 +18,7 @@ verify.completions({ kind: "function", kindModifiers: "export", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_named_didNotExistBefore.ts b/tests/cases/fourslash/completionsImport_named_didNotExistBefore.ts index 5f21db1e376..cb55f859cca 100644 --- a/tests/cases/fourslash/completionsImport_named_didNotExistBefore.ts +++ b/tests/cases/fourslash/completionsImport_named_didNotExistBefore.ts @@ -13,10 +13,23 @@ verify.completions({ marker: "", exact: [ - { name: "Test2", text: "(alias) function Test2(): void\nimport Test2", kind: "alias" }, - "globalThis", - "undefined", - { name: "Test1", source: "/a", sourceDisplay: "./a", text: "function Test1(): void", kind: "function", kindModifiers: "export", hasAction: true }, + { + name: "Test2", + text: "(alias) function Test2(): void\nimport Test2", + kind: "alias" + }, + completion.globalThisEntry, + completion.undefinedVarEntry, + { + name: "Test1", + source: "/a", + sourceDisplay: "./a", + text: "function Test1(): void", + kind: "function", + kindModifiers: "export", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions + }, ...completion.statementKeywordsWithTypes, ], preferences: { includeCompletionsForModuleExports: true }, diff --git a/tests/cases/fourslash/completionsImport_named_exportEqualsNamespace.ts b/tests/cases/fourslash/completionsImport_named_exportEqualsNamespace.ts index 4f4b579fe49..ca866d838fc 100644 --- a/tests/cases/fourslash/completionsImport_named_exportEqualsNamespace.ts +++ b/tests/cases/fourslash/completionsImport_named_exportEqualsNamespace.ts @@ -21,6 +21,7 @@ verify.completions({ kind: "const", kindModifiers: "export,declare", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_named_exportEqualsNamespace_merged.ts b/tests/cases/fourslash/completionsImport_named_exportEqualsNamespace_merged.ts index ec70d205479..bc1d56cfb6a 100644 --- a/tests/cases/fourslash/completionsImport_named_exportEqualsNamespace_merged.ts +++ b/tests/cases/fourslash/completionsImport_named_exportEqualsNamespace_merged.ts @@ -26,6 +26,7 @@ verify.completions({ kind: "const", kindModifiers: "export,declare", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_named_namespaceImportExists.ts b/tests/cases/fourslash/completionsImport_named_namespaceImportExists.ts index 52c33209ca3..c3e254521de 100644 --- a/tests/cases/fourslash/completionsImport_named_namespaceImportExists.ts +++ b/tests/cases/fourslash/completionsImport_named_namespaceImportExists.ts @@ -17,6 +17,7 @@ verify.completions({ kind: "function", kindModifiers: "export", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_notFromIndex.ts b/tests/cases/fourslash/completionsImport_notFromIndex.ts index e6aa3e680b1..3df542daeb4 100644 --- a/tests/cases/fourslash/completionsImport_notFromIndex.ts +++ b/tests/cases/fourslash/completionsImport_notFromIndex.ts @@ -26,6 +26,7 @@ for (const [marker, sourceDisplay] of [["0", "./src"], ["1", "./a"], ["2", "../a kind: "const", kindModifiers: "export", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_ofAlias.ts b/tests/cases/fourslash/completionsImport_ofAlias.ts index cb6af7910ba..9a9cb4a2b18 100644 --- a/tests/cases/fourslash/completionsImport_ofAlias.ts +++ b/tests/cases/fourslash/completionsImport_ofAlias.ts @@ -22,8 +22,16 @@ verify.completions({ marker: "", includes: [ - "undefined", - { name: "foo", source: "/a", sourceDisplay: "./a", text: "(alias) const foo: 0\nexport foo", kind: "alias", hasAction: true }, + completion.undefinedVarEntry, + { + name: "foo", + source: "/a", + sourceDisplay: "./a", + text: "(alias) const foo: 0\nexport foo", + kind: "alias", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions + }, ...completion.statementKeywordsWithTypes, ], preferences: { includeCompletionsForModuleExports: true }, diff --git a/tests/cases/fourslash/completionsImport_ofAlias_preferShortPath.ts b/tests/cases/fourslash/completionsImport_ofAlias_preferShortPath.ts index 71242bc240a..494b871238f 100644 --- a/tests/cases/fourslash/completionsImport_ofAlias_preferShortPath.ts +++ b/tests/cases/fourslash/completionsImport_ofAlias_preferShortPath.ts @@ -19,9 +19,18 @@ verify.completions({ marker: "", exact: [ - "globalThis", - "undefined", - { name: "foo", source: "/foo/lib/foo", sourceDisplay: "./foo", text: "const foo: 0", kind: "const", kindModifiers: "export", hasAction: true }, + completion.globalThisEntry, + completion.undefinedVarEntry, + { + name: "foo", + source: "/foo/lib/foo", + sourceDisplay: "./foo", + text: "const foo: 0", + kind: "const", + kindModifiers: "export", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions + }, ...completion.statementKeywordsWithTypes, ], preferences: { includeCompletionsForModuleExports: true }, diff --git a/tests/cases/fourslash/completionsImport_previousTokenIsSemicolon.ts b/tests/cases/fourslash/completionsImport_previousTokenIsSemicolon.ts index 7099c4b3072..23924ad3300 100644 --- a/tests/cases/fourslash/completionsImport_previousTokenIsSemicolon.ts +++ b/tests/cases/fourslash/completionsImport_previousTokenIsSemicolon.ts @@ -17,6 +17,7 @@ verify.completions({ kind: "function", kindModifiers: "export", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_reExportDefault.ts b/tests/cases/fourslash/completionsImport_reExportDefault.ts index 7f6639c3f13..b67daf7132e 100644 --- a/tests/cases/fourslash/completionsImport_reExportDefault.ts +++ b/tests/cases/fourslash/completionsImport_reExportDefault.ts @@ -15,9 +15,9 @@ verify.completions({ marker: "", exact: [ - "globalThis", + completion.globalThisEntry, ...completion.globalsVars, - "undefined", + completion.undefinedVarEntry, { name: "foo", source: "/a/b/impl", @@ -26,6 +26,7 @@ verify.completions({ kind: "function", kindModifiers: "export", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, { name: "foo", @@ -34,6 +35,7 @@ verify.completions({ text: "(alias) function foo(): void\nexport foo", kind: "alias", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, ...completion.globalKeywords, ], diff --git a/tests/cases/fourslash/completionsImport_reExport_wrongName.ts b/tests/cases/fourslash/completionsImport_reExport_wrongName.ts index 31de7ef7d8d..4080fe5cdb7 100644 --- a/tests/cases/fourslash/completionsImport_reExport_wrongName.ts +++ b/tests/cases/fourslash/completionsImport_reExport_wrongName.ts @@ -15,8 +15,22 @@ goTo.marker(""); verify.completions({ marker: "", includes: [ - { name: "x", source: "/a", sourceDisplay: "./a", text: "const x: 0", hasAction: true }, - { name: "y", source: "/index", sourceDisplay: ".", text: "(alias) const y: 0\nexport y", hasAction: true }, + { + name: "x", + source: "/a", + sourceDisplay: "./a", + text: "const x: 0", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions + }, + { + name: "y", + source: "/index", + sourceDisplay: ".", + text: "(alias) const y: 0\nexport y", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions + }, ], preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_require.ts b/tests/cases/fourslash/completionsImport_require.ts index 892a2495485..836a0e2439e 100644 --- a/tests/cases/fourslash/completionsImport_require.ts +++ b/tests/cases/fourslash/completionsImport_require.ts @@ -19,6 +19,7 @@ verify.completions({ kind: "const", kindModifiers: "export", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_shadowedByLocal.ts b/tests/cases/fourslash/completionsImport_shadowedByLocal.ts index 711386816c0..504702b6cc3 100644 --- a/tests/cases/fourslash/completionsImport_shadowedByLocal.ts +++ b/tests/cases/fourslash/completionsImport_shadowedByLocal.ts @@ -1,16 +1,24 @@ -/// - -// @noLib: true - -// @Filename: /a.ts -////export const foo = 0; - -// @Filename: /b.ts -////const foo = 1; -////fo/**/ - -verify.completions({ - marker: "", - exact: ["globalThis", { name: "foo", text: "const foo: 1" }, "undefined", ...completion.statementKeywordsWithTypes], - preferences: { includeCompletionsForModuleExports: true }, -}); +/// + +// @noLib: true + +// @Filename: /a.ts +////export const foo = 0; + +// @Filename: /b.ts +////const foo = 1; +////fo/**/ + +verify.completions({ + marker: "", + exact: [ + completion.globalThisEntry, + { + name: "foo", + text: "const foo: 1", + }, + completion.undefinedVarEntry, + ...completion.statementKeywordsWithTypes + ], + preferences: { includeCompletionsForModuleExports: true }, +}); diff --git a/tests/cases/fourslash/completionsImport_tsx.ts b/tests/cases/fourslash/completionsImport_tsx.ts index 9fb4d239223..3a495f1a0ce 100644 --- a/tests/cases/fourslash/completionsImport_tsx.ts +++ b/tests/cases/fourslash/completionsImport_tsx.ts @@ -12,7 +12,7 @@ verify.completions({ marker: "", - includes: { name: "Foo", source: "/a", hasAction: true }, + includes: { name: "Foo", source: "/a", hasAction: true, sortText: completion.SortText.AutoImportSuggestions }, excludes: "Bar", preferences: { includeCompletionsForModuleExports: true, diff --git a/tests/cases/fourslash/completionsInterfaceElement.ts b/tests/cases/fourslash/completionsInterfaceElement.ts index 65b1627c8f3..5a00473ce56 100644 --- a/tests/cases/fourslash/completionsInterfaceElement.ts +++ b/tests/cases/fourslash/completionsInterfaceElement.ts @@ -13,4 +13,11 @@ ////interface EndOfFile { f; /*e*/ -verify.completions({ marker: test.markers(), exact: "readonly", isNewIdentifierLocation: true }); +verify.completions({ + marker: test.markers(), + exact: { + name: "readonly", + sortText: completion.SortText.GlobalsOrKeywords + }, + isNewIdentifierLocation: true +}); diff --git a/tests/cases/fourslash/completionsJsdocTypeTagCast.ts b/tests/cases/fourslash/completionsJsdocTypeTagCast.ts index 5eff16bb278..fe9d8b496e2 100644 --- a/tests/cases/fourslash/completionsJsdocTypeTagCast.ts +++ b/tests/cases/fourslash/completionsJsdocTypeTagCast.ts @@ -4,4 +4,10 @@ // @Filename: /a.js ////const x = /** @type {{ s: string }} */ ({ /**/ }); -verify.completions({ marker: "", exact: ["s", "x"] }); +verify.completions({ + marker: "", + exact: [ + "s", + { name: "x", sortText: completion.SortText.JavascriptIdentifiers } + ] +}); diff --git a/tests/cases/fourslash/completionsJsxAttributeInitializer.ts b/tests/cases/fourslash/completionsJsxAttributeInitializer.ts index 44d79b059a6..0d6c2f25123 100644 --- a/tests/cases/fourslash/completionsJsxAttributeInitializer.ts +++ b/tests/cases/fourslash/completionsJsxAttributeInitializer.ts @@ -9,8 +9,8 @@ verify.completions({ marker: "", includes: [ { name: "x", text: "(parameter) x: number", kind: "parameter", insertText: "{x}" }, - { name: "p", text: "(JSX attribute) p: number", kind: "JSX attribute", insertText: "{this.p}" }, - { name: "a b", text: '(JSX attribute) "a b": number', kind: "JSX attribute", insertText: '{this["a b"]}' }, + { name: "p", text: "(JSX attribute) p: number", kind: "JSX attribute", insertText: "{this.p}", sortText: completion.SortText.SuggestedClassMembers }, + { name: "a b", text: '(JSX attribute) "a b": number', kind: "JSX attribute", insertText: '{this["a b"]}', sortText: completion.SortText.SuggestedClassMembers }, ], preferences: { includeInsertTextCompletions: true, diff --git a/tests/cases/fourslash/completionsKeywordsExtends.ts b/tests/cases/fourslash/completionsKeywordsExtends.ts index bd88311b46c..8f0b97a56ea 100644 --- a/tests/cases/fourslash/completionsKeywordsExtends.ts +++ b/tests/cases/fourslash/completionsKeywordsExtends.ts @@ -7,5 +7,5 @@ verify.completions( { marker: "a", exact: undefined }, - { marker: ["b", "c"], includes: "extends" }, + { marker: ["b", "c"], includes: { name: "extends", sortText: completion.SortText.GlobalsOrKeywords } }, ); diff --git a/tests/cases/fourslash/completionsRecommended_import.ts b/tests/cases/fourslash/completionsRecommended_import.ts index 50e3c7b00aa..ccd77136afc 100644 --- a/tests/cases/fourslash/completionsRecommended_import.ts +++ b/tests/cases/fourslash/completionsRecommended_import.ts @@ -28,6 +28,7 @@ const classEntry = (isConstructor: boolean): FourSlashInterface.ExpectedCompleti text: isConstructor ? "constructor Cls(): Cls" : "class Cls", hasAction: true, isRecommended: true, + sortText: completion.SortText.AutoImportSuggestions }); verify.completions( { marker: "b0", includes: classEntry(true), preferences }, diff --git a/tests/cases/fourslash/completionsRecommended_namespace.ts b/tests/cases/fourslash/completionsRecommended_namespace.ts index 0d6e19e7106..1b3d8c56726 100644 --- a/tests/cases/fourslash/completionsRecommended_namespace.ts +++ b/tests/cases/fourslash/completionsRecommended_namespace.ts @@ -38,6 +38,7 @@ verify.completions( kindModifiers: "export", hasAction: true, isRecommended: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }, diff --git a/tests/cases/fourslash/completionsThisType.ts b/tests/cases/fourslash/completionsThisType.ts index 9923f937afc..ec181335cb7 100644 --- a/tests/cases/fourslash/completionsThisType.ts +++ b/tests/cases/fourslash/completionsThisType.ts @@ -14,15 +14,15 @@ verify.completions( { marker: "", includes: [ - { name: "xyz", text: "(method) C.xyz(): any", kind: "method", insertText: "this.xyz" }, - { name: "foo bar", text: '(property) C["foo bar"]: number', kind: "property", insertText: 'this["foo bar"]' }, + { name: "xyz", text: "(method) C.xyz(): any", kind: "method", insertText: "this.xyz", sortText: completion.SortText.SuggestedClassMembers }, + { name: "foo bar", text: '(property) C["foo bar"]: number', kind: "property", insertText: 'this["foo bar"]', sortText: completion.SortText.SuggestedClassMembers }, ], isNewIdentifierLocation: true, preferences, }, { marker: "f", - includes: { name: "x", text: "(property) x: number", kind: "property", insertText: "this.x" }, + includes: { name: "x", text: "(property) x: number", kind: "property", insertText: "this.x", sortText: completion.SortText.SuggestedClassMembers }, preferences, }, ); diff --git a/tests/cases/fourslash/completionsTypeKeywords.ts b/tests/cases/fourslash/completionsTypeKeywords.ts index 4c26e13932e..6817523bc26 100644 --- a/tests/cases/fourslash/completionsTypeKeywords.ts +++ b/tests/cases/fourslash/completionsTypeKeywords.ts @@ -6,5 +6,5 @@ verify.completions({ marker: "", - exact: ["globalThis", "T", ...completion.typeKeywords], + exact: [completion.globalThisEntry, "T", ...completion.typeKeywords], }); diff --git a/tests/cases/fourslash/doubleUnderscoreCompletions.ts b/tests/cases/fourslash/doubleUnderscoreCompletions.ts index 007842edc1b..8d07cdf333f 100644 --- a/tests/cases/fourslash/doubleUnderscoreCompletions.ts +++ b/tests/cases/fourslash/doubleUnderscoreCompletions.ts @@ -12,7 +12,7 @@ verify.completions({ marker: "1", exact: [ { name: "__property", text: "(property) MyObject.__property: number" }, - "MyObject", - "instance", + { name: "MyObject", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "instance", sortText: completion.SortText.JavascriptIdentifiers }, ], }); diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 4252296d5da..fa9cdd61c2f 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -528,6 +528,7 @@ declare namespace FourSlashInterface { readonly isRecommended?: boolean; readonly kind?: string; readonly kindModifiers?: string; + readonly sortText?: completion.SortText; // details readonly text?: string; @@ -650,6 +651,15 @@ declare var cancellation: FourSlashInterface.cancellation; declare var classification: typeof FourSlashInterface.classification; declare namespace completion { type Entry = FourSlashInterface.ExpectedCompletionEntryObject; + export const enum SortText { + LocationPriority = "0", + SuggestedClassMembers = "1", + GlobalsOrKeywords = "2", + AutoImportSuggestions = "3", + JavascriptIdentifiers = "4" + } + export const globalThisEntry: Entry; + export const undefinedVarEntry: Entry; export const globals: ReadonlyArray; export const globalsInJs: ReadonlyArray; export const globalKeywords: ReadonlyArray; diff --git a/tests/cases/fourslash/getJavaScriptCompletions12.ts b/tests/cases/fourslash/getJavaScriptCompletions12.ts index 5534b20b8ea..2848ee27c54 100644 --- a/tests/cases/fourslash/getJavaScriptCompletions12.ts +++ b/tests/cases/fourslash/getJavaScriptCompletions12.ts @@ -26,5 +26,5 @@ verify.completions( { marker: "1", includes: { name: "charCodeAt", kind: "method", kindModifiers: "declare" } }, { marker: ["2", "3", "4"], includes: { name: "toExponential", kind: "method", kindModifiers: "declare" } }, - { marker: "5", includes: { name: "test1", kind: "warning" } }, + { marker: "5", includes: { name: "test1", kind: "warning", sortText: completion.SortText.JavascriptIdentifiers } }, ); diff --git a/tests/cases/fourslash/getJavaScriptCompletions13.ts b/tests/cases/fourslash/getJavaScriptCompletions13.ts index 8c8b4942779..3b8f984cefe 100644 --- a/tests/cases/fourslash/getJavaScriptCompletions13.ts +++ b/tests/cases/fourslash/getJavaScriptCompletions13.ts @@ -14,6 +14,21 @@ ////file2Identifier2./*2*/ verify.completions( - { marker: "1", includes: ["file2Identifier1", "file2Identifier2", "file1Identifier"], excludes: "FooProp" }, - { marker: "2", includes: ["file2Identifier1", "file2Identifier2"], excludes: ["file1Identifier", "FooProp"] }, -) + { + marker: "1", + includes: [ + "file2Identifier1", + "file2Identifier2", + { name: "file1Identifier", sortText: completion.SortText.GlobalsOrKeywords } + ], + excludes: "FooProp" + }, + { + marker: "2", + includes: [ + { name: "file2Identifier1", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "file2Identifier2", sortText: completion.SortText.JavascriptIdentifiers } + ], + excludes: ["file1Identifier", "FooProp"] + }, +); diff --git a/tests/cases/fourslash/getJavaScriptCompletions15.ts b/tests/cases/fourslash/getJavaScriptCompletions15.ts index e46b0780d42..bcbd6ecbf97 100644 --- a/tests/cases/fourslash/getJavaScriptCompletions15.ts +++ b/tests/cases/fourslash/getJavaScriptCompletions15.ts @@ -22,6 +22,16 @@ verify.completions( { marker: "1", includes: "toExponential" }, { marker: "2", includes: "toLowerCase" }, - { marker: "3", exact: ["V", "ref1", "ref2", "require", "v", "x"] }, + { + marker: "3", + exact: [ + "V", + { name: "ref1", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "ref2", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "require", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "v", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "x", sortText: completion.SortText.JavascriptIdentifiers } + ] + }, { marker: "4", includes: "toLowerCase" }, ); diff --git a/tests/cases/fourslash/getJavaScriptCompletions20.ts b/tests/cases/fourslash/getJavaScriptCompletions20.ts index cbe74a4b392..901ac4522c5 100644 --- a/tests/cases/fourslash/getJavaScriptCompletions20.ts +++ b/tests/cases/fourslash/getJavaScriptCompletions20.ts @@ -19,5 +19,12 @@ verify.completions({ marker: "", - exact: ["getName", "getNa", ...completion.functionMembersWithPrototype, "Person", "name", "age"], + exact: [ + "getName", + "getNa", + ...completion.functionMembersWithPrototype, + { name: "Person", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "name", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "age", sortText: completion.SortText.JavascriptIdentifiers } + ], }); diff --git a/tests/cases/fourslash/getJavaScriptGlobalCompletions1.ts b/tests/cases/fourslash/getJavaScriptGlobalCompletions1.ts index 478d472217e..118ca30faeb 100644 --- a/tests/cases/fourslash/getJavaScriptGlobalCompletions1.ts +++ b/tests/cases/fourslash/getJavaScriptGlobalCompletions1.ts @@ -12,4 +12,4 @@ //// //// hello/**/ -verify.completions({ includes: "helloWorld" }); +verify.completions({ includes: { name: "helloWorld", sortText: completion.SortText.JavascriptIdentifiers } }); diff --git a/tests/cases/fourslash/importJsNodeModule2.ts b/tests/cases/fourslash/importJsNodeModule2.ts index 0ceae59b215..1c4cf77926a 100644 --- a/tests/cases/fourslash/importJsNodeModule2.ts +++ b/tests/cases/fourslash/importJsNodeModule2.ts @@ -19,7 +19,7 @@ edit.insert('.'); verify.completions({ exact: [ ...["n", "s", "b"].map(name => ({ name, kind: "property" })), - ...["x", "require"].map(name => ({ name, kind: "warning" })), + ...["x", "require"].map(name => ({ name, kind: "warning", sortText: completion.SortText.JavascriptIdentifiers })), ], }); edit.insert('n.'); diff --git a/tests/cases/fourslash/indirectClassInstantiation.ts b/tests/cases/fourslash/indirectClassInstantiation.ts index 198515dd806..5a871364465 100644 --- a/tests/cases/fourslash/indirectClassInstantiation.ts +++ b/tests/cases/fourslash/indirectClassInstantiation.ts @@ -14,7 +14,18 @@ //// inst2.blah/*b*/; goTo.marker('a'); -verify.completions({ exact: ["property", "TestObj", "constructor", "instance", "class2", "prototype", "blah", "inst2"] }); +verify.completions({ + exact: [ + "property", + { name: "TestObj", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "constructor", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "instance", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "class2", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "prototype", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "blah", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "inst2", sortText: completion.SortText.JavascriptIdentifiers } + ] +}); edit.backspace(); goTo.marker('b'); diff --git a/tests/cases/fourslash/javaScriptClass1.ts b/tests/cases/fourslash/javaScriptClass1.ts index dd4ed33f718..ec3bc3b5ea6 100644 --- a/tests/cases/fourslash/javaScriptClass1.ts +++ b/tests/cases/fourslash/javaScriptClass1.ts @@ -19,7 +19,15 @@ goTo.marker(); edit.insert('.'); -verify.completions({ exact: ["bar", "thing", "union", "Foo", "x"] }); +verify.completions({ + exact: [ + "bar", + "thing", + "union", + { name: "Foo", sortText: completion.SortText.JavascriptIdentifiers }, + { name: "x", sortText: completion.SortText.JavascriptIdentifiers } + ] +}); edit.insert('bar.'); verify.completions({ includes: ["substr"] }); diff --git a/tests/cases/fourslash/javaScriptModules12.ts b/tests/cases/fourslash/javaScriptModules12.ts index 5ca58bc4dc7..0ae594f77c5 100644 --- a/tests/cases/fourslash/javaScriptModules12.ts +++ b/tests/cases/fourslash/javaScriptModules12.ts @@ -27,7 +27,45 @@ //// /*5*/ verify.completions( - { marker: "1", includes: ["x", "a", "b"], excludes: "y" }, - { marker: "2", includes: ["y", "a", "b"], excludes: "x" }, - { marker: ["3", "4", "5"], includes: ["a", "b"], excludes: ["x", "y"] }, + { + marker: "1", + includes: [ + "x", + { name: "a", sortText: completion.SortText.GlobalsOrKeywords }, + { name: "b", sortText: completion.SortText.GlobalsOrKeywords } + ], excludes: "y" + }, + { + marker: "2", + includes: [ + "y", + { name: "a", sortText: completion.SortText.GlobalsOrKeywords }, + { name: "b", sortText: completion.SortText.GlobalsOrKeywords } + ], + excludes: "x" + }, + { + marker: "3", + includes: [ + "a", + { name: "b", sortText: completion.SortText.GlobalsOrKeywords } + ], + excludes: ["x", "y"] + }, + { + marker: "4", + includes: [ + { name: "a", sortText: completion.SortText.GlobalsOrKeywords }, + "b" + ], + excludes: ["x", "y"] + }, + { + marker: ["5"], + includes: [ + { name: "a", sortText: completion.SortText.GlobalsOrKeywords }, + { name: "b", sortText: completion.SortText.GlobalsOrKeywords } + ], + excludes: ["x", "y"] + }, ); diff --git a/tests/cases/fourslash/javaScriptModules13.ts b/tests/cases/fourslash/javaScriptModules13.ts index 62987047862..69fa87157c8 100644 --- a/tests/cases/fourslash/javaScriptModules13.ts +++ b/tests/cases/fourslash/javaScriptModules13.ts @@ -19,7 +19,11 @@ goTo.file('consumer.js'); goTo.marker(); -verify.completions({ marker: "", includes: "y", excludes: "invisible" }); +verify.completions({ + marker: "", + includes: { name: "y", sortText: completion.SortText.GlobalsOrKeywords }, + excludes: "invisible" +}); edit.insert('x.'); verify.completions({ includes: { name: "a", kind: "property" } }); diff --git a/tests/cases/fourslash/javaScriptModules14.ts b/tests/cases/fourslash/javaScriptModules14.ts index 1b564c09636..9f3546625b3 100644 --- a/tests/cases/fourslash/javaScriptModules14.ts +++ b/tests/cases/fourslash/javaScriptModules14.ts @@ -21,4 +21,8 @@ //// var x = require('myMod'); //// /**/; -verify.completions({ marker: "", includes: "y", excludes: "invisible" }); +verify.completions({ + marker: "", + includes: { name: "y", sortText: completion.SortText.GlobalsOrKeywords }, + excludes: "invisible" +}); diff --git a/tests/cases/fourslash/javaScriptModules16.ts b/tests/cases/fourslash/javaScriptModules16.ts index 7c3bb31436d..51107934fb1 100644 --- a/tests/cases/fourslash/javaScriptModules16.ts +++ b/tests/cases/fourslash/javaScriptModules16.ts @@ -18,7 +18,7 @@ edit.insert('.'); verify.completions({ exact: [ ...["n", "s", "b"].map(name => ({ name, kind: "property" })), - ...["x", "require"].map(name => ({ name, kind: "warning" })), + ...["x", "require"].map(name => ({ name, kind: "warning", sortText: completion.SortText.JavascriptIdentifiers })), ], }); edit.insert('n.'); diff --git a/tests/cases/fourslash/javaScriptModules19.ts b/tests/cases/fourslash/javaScriptModules19.ts index 1fe4ae3cfd1..85735b1f092 100644 --- a/tests/cases/fourslash/javaScriptModules19.ts +++ b/tests/cases/fourslash/javaScriptModules19.ts @@ -17,7 +17,11 @@ goTo.file('consumer.js'); goTo.marker(); -verify.completions({ marker: "", includes: "y", excludes: "invisible" }); +verify.completions({ + marker: "", + includes: { name: "y", sortText: completion.SortText.GlobalsOrKeywords }, + excludes: "invisible" +}); edit.insert('x.'); verify.completions({ includes: { name: "a", kind: "property" } }); diff --git a/tests/cases/fourslash/javaScriptPrototype2.ts b/tests/cases/fourslash/javaScriptPrototype2.ts index f8c2e56e1a9..17afc1ed0aa 100644 --- a/tests/cases/fourslash/javaScriptPrototype2.ts +++ b/tests/cases/fourslash/javaScriptPrototype2.ts @@ -31,4 +31,4 @@ verify.completions({ includes: { name: "toFixed", kind: "method", kindModifiers: goTo.marker('3'); edit.insert('.'); // Make sure symbols don't leak out into the constructor -verify.completions({ includes: ["qua", "foo", "bar"].map(name => ({ name, kind: "warning" })) }); +verify.completions({ includes: ["qua", "foo", "bar"].map(name => ({ name, kind: "warning", sortText: completion.SortText.JavascriptIdentifiers })) }); diff --git a/tests/cases/fourslash/javaScriptPrototype3.ts b/tests/cases/fourslash/javaScriptPrototype3.ts index 627f5c39977..72d22b969b2 100644 --- a/tests/cases/fourslash/javaScriptPrototype3.ts +++ b/tests/cases/fourslash/javaScriptPrototype3.ts @@ -22,6 +22,10 @@ verify.completions({ { name: "qua", kind: "property" }, { name: "foo", kind: "method" }, { name: "bar", kind: "method" }, - ...["myCtor", "x", "prototype"].map(name => ({ name, kind: "warning" })), + ...["myCtor", "x", "prototype"].map(name => ({ + name, + kind: "warning", + sortText: completion.SortText.JavascriptIdentifiers + })), ], }); diff --git a/tests/cases/fourslash/javaScriptPrototype4.ts b/tests/cases/fourslash/javaScriptPrototype4.ts index 98deee4f22a..783cea8b9dd 100644 --- a/tests/cases/fourslash/javaScriptPrototype4.ts +++ b/tests/cases/fourslash/javaScriptPrototype4.ts @@ -16,4 +16,7 @@ goTo.marker('1'); edit.insert('.'); // Check members of the function -verify.completions({ includes: ["foo", "bar", "qua"].map(name => ({ name, kind: "warning" })) }); +verify.completions({ + includes: ["foo", "bar", "qua"].map( + name => ({ name, kind: "warning", sortText: completion.SortText.JavascriptIdentifiers })) +}); diff --git a/tests/cases/fourslash/javascriptModules20.ts b/tests/cases/fourslash/javascriptModules20.ts index 8b8f0095959..0135ccea758 100644 --- a/tests/cases/fourslash/javascriptModules20.ts +++ b/tests/cases/fourslash/javascriptModules20.ts @@ -9,4 +9,8 @@ //// import * as mod from "./mod" //// mod./**/ -verify.completions({ marker: "", exact: [{ name: "a", kind: "property" }, { name: "mod", kind: "warning" }] }); +verify.completions({ + marker: "", exact: [ + { name: "a", kind: "property" }, + { name: "mod", kind: "warning", sortText: completion.SortText.JavascriptIdentifiers }] +}); diff --git a/tests/cases/fourslash/javascriptModules21.ts b/tests/cases/fourslash/javascriptModules21.ts index 5a8dd6b872b..9788f3e3ed7 100644 --- a/tests/cases/fourslash/javascriptModules21.ts +++ b/tests/cases/fourslash/javascriptModules21.ts @@ -10,4 +10,10 @@ //// import mod from "./mod" //// mod./**/ -verify.completions({ marker: "", exact: [{ name: "a", kind: "property" }, { name: "mod", kind: "warning" }] }); +verify.completions({ + marker: "", + exact: [ + { name: "a", kind: "property" }, + { name: "mod", kind: "warning", sortText: completion.SortText.JavascriptIdentifiers } + ] +}); diff --git a/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion.ts b/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion.ts index a117bae1b11..5e0247b64a5 100644 --- a/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion.ts +++ b/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion.ts @@ -29,7 +29,7 @@ const typeMembers: ReadonlyArray): ReadonlyArray { - return entries.map(e => ({ ...e, kind: "warning", kindModifiers: undefined })); + return entries.map(e => ({ ...e, kind: "warning", kindModifiers: undefined, sortText: completion.SortText.JavascriptIdentifiers })); } verify.completions( diff --git a/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion2.ts b/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion2.ts index 9cb94689b76..57802d84b44 100644 --- a/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion2.ts +++ b/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion2.ts @@ -28,10 +28,10 @@ function getCompletions(nonWarnings: ReadonlyArray): ReadonlyArray entry.name === name)); - return withKinds.map(entry => nonWarnings.includes(entry.name) ? entry : ({ name: entry.name, kind: "warning" })); + return withKinds.map(entry => nonWarnings.includes(entry.name) ? entry : ({ name: entry.name, kind: "warning", sortText: completion.SortText.JavascriptIdentifiers })); } verify.completions( diff --git a/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion3.ts b/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion3.ts index efe73d9c023..82b0dd9f5e3 100644 --- a/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion3.ts +++ b/tests/cases/fourslash/jsFileJsdocTypedefTagTypeExpressionCompletion3.ts @@ -31,7 +31,7 @@ ////Foo./*valueMemberOfFoo*/; const warnings = (names: ReadonlyArray): ReadonlyArray => - names.map(name => ({ name, kind: "warning" })); + names.map(name => ({ name, kind: "warning", sortText: completion.SortText.JavascriptIdentifiers })); verify.completions( { diff --git a/tests/cases/fourslash/noImportCompletionsInOtherJavaScriptFile.ts b/tests/cases/fourslash/noImportCompletionsInOtherJavaScriptFile.ts index 0848b3e7cc2..6051a5d80fc 100644 --- a/tests/cases/fourslash/noImportCompletionsInOtherJavaScriptFile.ts +++ b/tests/cases/fourslash/noImportCompletionsInOtherJavaScriptFile.ts @@ -32,6 +32,7 @@ goTo.eachMarker(() => { kind: "const", kindModifiers: "export,declare", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); @@ -45,6 +46,7 @@ goTo.eachMarker(() => { kind: "const", kindModifiers: "export,declare", hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/server/jsdocTypedefTagNamespace.ts b/tests/cases/fourslash/server/jsdocTypedefTagNamespace.ts index 0d04b58606f..297238530f0 100644 --- a/tests/cases/fourslash/server/jsdocTypedefTagNamespace.ts +++ b/tests/cases/fourslash/server/jsdocTypedefTagNamespace.ts @@ -17,5 +17,5 @@ verify.completions( { marker: ["1", "3"], includes: ["charAt", "toExponential"] }, - { marker: "2", includes: "age" }, + { marker: "2", includes: { name: "age", sortText: completion.SortText.JavascriptIdentifiers } }, ); diff --git a/tests/cases/fourslash/tsxCompletion9.ts b/tests/cases/fourslash/tsxCompletion9.ts index 21d2c43f676..21261090b4e 100644 --- a/tests/cases/fourslash/tsxCompletion9.ts +++ b/tests/cases/fourslash/tsxCompletion9.ts @@ -18,4 +18,4 @@ for (var i = 1; i <= 10; i++) { verify.completions({ marker: String(i), exact: undefined }); } -verify.completions({ marker: "end", includes: "null" }); +verify.completions({ marker: "end", includes: { name: "null", sortText: completion.SortText.GlobalsOrKeywords } }); diff --git a/tests/cases/fourslash/tsxCompletionNonTagLessThan.ts b/tests/cases/fourslash/tsxCompletionNonTagLessThan.ts index b2b6a046e6b..a0b1f8ffdc3 100644 --- a/tests/cases/fourslash/tsxCompletionNonTagLessThan.ts +++ b/tests/cases/fourslash/tsxCompletionNonTagLessThan.ts @@ -5,7 +5,20 @@ ////[].map Date: Mon, 20 May 2019 16:43:55 -0700 Subject: [PATCH 117/384] Prevent type parameter printing from recuring on the same symbol (#31453) --- src/compiler/checker.ts | 6 ++++++ ...amespaceMergeWithClassConstrainedToSelf.ts | 21 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/cases/fourslash/quickinfoForNamespaceMergeWithClassConstrainedToSelf.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 18c1f42f838..e47855ca63c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4302,6 +4302,11 @@ namespace ts { function lookupTypeParameterNodes(chain: Symbol[], index: number, context: NodeBuilderContext) { Debug.assert(chain && 0 <= index && index < chain.length); const symbol = chain[index]; + const symbolId = "" + getSymbolId(symbol); + if (context.typeParameterSymbolList && context.typeParameterSymbolList.get(symbolId)) { + return undefined; + } + (context.typeParameterSymbolList || (context.typeParameterSymbolList = createMap())).set(symbolId, true); let typeParameterNodes: ReadonlyArray | ReadonlyArray | undefined; if (context.flags & NodeBuilderFlags.WriteTypeParametersInQualifiedName && index < (chain.length - 1)) { const parentSymbol = symbol; @@ -4628,6 +4633,7 @@ namespace ts { inferTypeParameters: TypeParameter[] | undefined; approximateLength: number; truncating?: boolean; + typeParameterSymbolList?: Map; } function isDefaultBindingContext(location: Node) { diff --git a/tests/cases/fourslash/quickinfoForNamespaceMergeWithClassConstrainedToSelf.ts b/tests/cases/fourslash/quickinfoForNamespaceMergeWithClassConstrainedToSelf.ts new file mode 100644 index 00000000000..e3c982a1203 --- /dev/null +++ b/tests/cases/fourslash/quickinfoForNamespaceMergeWithClassConstrainedToSelf.ts @@ -0,0 +1,21 @@ +/// + + +//// declare namespace AMap { +//// namespace MassMarks { +//// interface Data { +//// style?: number; +//// } +//// } +//// class MassMarks { +//// constructor(data: D[] | string); +//// clear(): void; +//// } +//// } +//// +//// interface MassMarksCustomData extends AMap.MassMarks./*1*/Data { +//// name: string; +//// id: string; +//// } + +verify.quickInfoAt("1", "interface AMap.MassMarks.Data"); From db150517d7fa6261ee9362ba58fec42dd5a2f816 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 21 May 2019 09:32:17 -0700 Subject: [PATCH 118/384] Ignore drive letters when comparing casings of the files with forceConsistentCasingInFileNames Fixes #31327 --- src/compiler/program.ts | 5 ++++- src/compiler/utilities.ts | 8 ++++++++ src/testRunner/unittests/moduleResolution.ts | 18 +++++++++++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 2fda6ea49a5..6313cc19902 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2232,7 +2232,10 @@ namespace ts { if (isRedirect) { inputName = getProjectReferenceRedirect(fileName) || fileName; } - if (getNormalizedAbsolutePath(checkedName, currentDirectory) !== getNormalizedAbsolutePath(inputName, currentDirectory)) { + // Check if it differs only in drive letters its ok to ignore that error: + const checkedAbsolutePath = getNormalizedAbsolutePathWithoutRoot(checkedName, currentDirectory); + const inputAbsolutePath = getNormalizedAbsolutePathWithoutRoot(inputName, currentDirectory); + if (checkedAbsolutePath !== inputAbsolutePath) { reportFileNamesDifferOnlyInCasingError(inputName, checkedName, refFile, refPos, refEnd); } } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 45dc980296b..ac3be6d434b 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -7646,6 +7646,14 @@ namespace ts { return root + pathComponents.slice(1).join(directorySeparator); } + export function getNormalizedAbsolutePathWithoutRoot(fileName: string, currentDirectory: string | undefined) { + return getPathWithoutRoot(getNormalizedPathComponents(fileName, currentDirectory)); + } + + function getPathWithoutRoot(pathComponents: ReadonlyArray) { + if (pathComponents.length === 0) return ""; + return pathComponents.slice(1).join(directorySeparator); + } } /* @internal */ diff --git a/src/testRunner/unittests/moduleResolution.ts b/src/testRunner/unittests/moduleResolution.ts index 69560e5449c..4fecc6c09f3 100644 --- a/src/testRunner/unittests/moduleResolution.ts +++ b/src/testRunner/unittests/moduleResolution.ts @@ -530,7 +530,7 @@ export = C; }); }); - describe("unittests:: moduleResolution:: Files with different casing", () => { + describe("unittests:: moduleResolution:: Files with different casing with forceConsistentCasingInFileNames", () => { let library: SourceFile; function test(files: Map, options: CompilerOptions, currentDirectory: string, useCaseSensitiveFileNames: boolean, rootFiles: string[], diagnosticCodes: number[]): void { const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames); @@ -649,6 +649,22 @@ import b = require("./moduleB"); }); test(files, { module: ModuleKind.CommonJS, forceConsistentCasingInFileNames: true }, "/a/B/c", /*useCaseSensitiveFileNames*/ false, ["moduleD.ts"], []); }); + + it("should succeed when the two files in program differ only in drive letter in their names", () => { + const files = createMapFromTemplate({ + "d:/someFolder/moduleA.ts": `import a = require("D:/someFolder/moduleC")`, + "d:/someFolder/moduleB.ts": `import a = require("./moduleC")`, + "D:/someFolder/moduleC.ts": "export const x = 10", + }); + test( + files, + { module: ModuleKind.CommonJS, forceConsistentCasingInFileNames: true }, + "d:/someFolder", + /*useCaseSensitiveFileNames*/ false, + ["d:/someFolder/moduleA.ts", "d:/someFolder/moduleB.ts"], + [] + ); + }); }); describe("unittests:: moduleResolution:: baseUrl augmented module resolution", () => { From 43c7eb77e17e738958bee7b7b9d6fd82c2108655 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 21 May 2019 09:38:14 -0700 Subject: [PATCH 119/384] Switch to using File not found message instead of trace message file does not exit Fixes #30872 --- src/compiler/commandLineParser.ts | 4 ++-- .../unittests/config/configurationExtension.ts | 14 +++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index fbc6d8d6fea..3aaa217fbd0 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -2361,7 +2361,7 @@ namespace ts { if (!host.fileExists(extendedConfigPath) && !endsWith(extendedConfigPath, Extension.Json)) { extendedConfigPath = `${extendedConfigPath}.json`; if (!host.fileExists(extendedConfigPath)) { - errors.push(createDiagnostic(Diagnostics.File_0_does_not_exist, extendedConfig)); + errors.push(createDiagnostic(Diagnostics.File_0_not_found, extendedConfig)); return undefined; } } @@ -2372,7 +2372,7 @@ namespace ts { if (resolved.resolvedModule) { return resolved.resolvedModule.resolvedFileName; } - errors.push(createDiagnostic(Diagnostics.File_0_does_not_exist, extendedConfig)); + errors.push(createDiagnostic(Diagnostics.File_0_not_found, extendedConfig)); return undefined; } diff --git a/src/testRunner/unittests/config/configurationExtension.ts b/src/testRunner/unittests/config/configurationExtension.ts index 25e975c0fb2..6c1fc952295 100644 --- a/src/testRunner/unittests/config/configurationExtension.ts +++ b/src/testRunner/unittests/config/configurationExtension.ts @@ -197,13 +197,13 @@ namespace ts { const caseSensitiveBasePath = "/dev/"; const caseSensitiveHost = new fakes.ParseConfigHost(createFileSystem(/*ignoreCase*/ false, caseSensitiveBasePath, "/")); - function verifyDiagnostics(actual: Diagnostic[], expected: {code: number, category: DiagnosticCategory, messageText: string}[]) { + function verifyDiagnostics(actual: Diagnostic[], expected: { code: number; messageText: string; }[]) { assert.isTrue(expected.length === actual.length, `Expected error: ${JSON.stringify(expected)}. Actual error: ${JSON.stringify(actual)}.`); for (let i = 0; i < actual.length; i++) { const actualError = actual[i]; const expectedError = expected[i]; assert.equal(actualError.code, expectedError.code, "Error code mismatch"); - assert.equal(actualError.category, expectedError.category, "Category mismatch"); + assert.equal(actualError.category, DiagnosticCategory.Error, "Category mismatch"); // Should always be error assert.equal(flattenDiagnosticMessageText(actualError.messageText, "\n"), expectedError.messageText); } } @@ -246,7 +246,7 @@ namespace ts { }); } - function testFailure(name: string, entry: string, expectedDiagnostics: { code: number, category: DiagnosticCategory, messageText: string }[]) { + function testFailure(name: string, entry: string, expectedDiagnostics: { code: number; messageText: string; }[]) { it(name, () => { const parsed = getParseCommandLine(entry); verifyDiagnostics(parsed.errors, expectedDiagnostics); @@ -280,26 +280,22 @@ namespace ts { testFailure("can report errors on circular imports", "circular.json", [ { code: 18000, - category: DiagnosticCategory.Error, messageText: `Circularity detected while resolving configuration: ${[combinePaths(basePath, "circular.json"), combinePaths(basePath, "circular2.json"), combinePaths(basePath, "circular.json")].join(" -> ")}` } ]); testFailure("can report missing configurations", "missing.json", [{ - code: 6096, - category: DiagnosticCategory.Message, - messageText: `File './missing2' does not exist.` + code: 6053, + messageText: `File './missing2' not found.` }]); testFailure("can report errors in extended configs", "failure.json", [{ code: 6114, - category: DiagnosticCategory.Error, messageText: `Unknown option 'excludes'. Did you mean 'exclude'?` }]); testFailure("can error when 'extends' is not a string", "extends.json", [{ code: 5024, - category: DiagnosticCategory.Error, messageText: `Compiler option 'extends' requires a value of type string.` }]); From 77a76c157bf65a7589791ebd689f695172f04f4c Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 21 May 2019 09:45:08 -0700 Subject: [PATCH 120/384] Revert "Allow synthetic identifiers to exist and give them escapedText" This reverts commit 422b5414f1961be252fc7f705b6e2be8143c313f. --- src/services/services.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index 6e4889e330e..9637b3c5321 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -172,11 +172,10 @@ namespace ts { const token = scanner.scan(); const textPos = scanner.getTextPos(); if (textPos <= end) { - const node = createNode(token, pos, textPos, parent); - nodes.push(node); - if (isIdentifier(node)) { - node.escapedText = escapeLeadingUnderscores(scanner.getTokenValue()); + if (token === SyntaxKind.Identifier) { + Debug.fail(`Did not expect ${Debug.showSyntaxKind(parent)} to have an Identifier in its trivia`); } + nodes.push(createNode(token, pos, textPos, parent)); } pos = textPos; if (token === SyntaxKind.EndOfFileToken) { From c71423edd6dfc7bf357c9c16f7ef4eae2184d9b7 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Tue, 21 May 2019 13:22:02 -0700 Subject: [PATCH 121/384] Update user baselines (#31496) --- .../user/chrome-devtools-frontend.log | 4 +- tests/baselines/reference/user/uglify-js.log | 113 +++++++++--------- 2 files changed, 58 insertions(+), 59 deletions(-) diff --git a/tests/baselines/reference/user/chrome-devtools-frontend.log b/tests/baselines/reference/user/chrome-devtools-frontend.log index 4fd3354a2bb..bdde6b918c0 100644 --- a/tests/baselines/reference/user/chrome-devtools-frontend.log +++ b/tests/baselines/reference/user/chrome-devtools-frontend.log @@ -4484,9 +4484,7 @@ node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(175,64 node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(190,48): error TS2694: Namespace 'Coverage' has no exported member 'RangeUseCount'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(191,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'entry' must be of type '[CSSStyleSheetHeader, any[]]', but here has type 'CoverageInfo'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(197,5): error TS2322: Type '[CSSStyleSheetHeader, any[]][]' is not assignable to type 'CoverageInfo[]'. - Types of property 'pop' are incompatible. - Type '() => [CSSStyleSheetHeader, any[]]' is not assignable to type '() => CoverageInfo'. - Type '[CSSStyleSheetHeader, any[]]' is not assignable to type 'CoverageInfo'. + Type '[CSSStyleSheetHeader, any[]]' is not assignable to type 'CoverageInfo'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(201,31): error TS2694: Namespace 'Coverage' has no exported member 'RangeUseCount'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(202,32): error TS2694: Namespace 'Coverage' has no exported member 'CoverageSegment'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(210,23): error TS2339: Property 'peekLast' does not exist on type 'any[]'. diff --git a/tests/baselines/reference/user/uglify-js.log b/tests/baselines/reference/user/uglify-js.log index eccbc070b89..3c98006c52f 100644 --- a/tests/baselines/reference/user/uglify-js.log +++ b/tests/baselines/reference/user/uglify-js.log @@ -1,66 +1,67 @@ Exit Code: 1 Standard output: node_modules/uglify-js/lib/ast.js(223,38): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/ast.js(894,5): error TS2322: Type '{ _visit: (node: any, descend: any) => any; parent: (n: any) => any; push: typeof push; pop: typeof pop; self: () => any; find_parent: (type: any) => any; has_directive: (type: any) => any; loopcontrol_target: (node: any) => any; in_boolean_context: () => boolean | undefined; }' is not assignable to type 'TreeWalker'. +node_modules/uglify-js/lib/ast.js(906,5): error TS2322: Type '{ _visit: (node: any, descend: any) => any; parent: (n: any) => any; push: typeof push; pop: typeof pop; self: () => any; find_parent: (type: any) => any; has_directive: (type: any) => any; loopcontrol_target: (node: any) => any; in_boolean_context: () => boolean | undefined; }' is not assignable to type 'TreeWalker'. Object literal may only specify known properties, but '_visit' does not exist in type 'TreeWalker'. Did you mean to write 'visit'? -node_modules/uglify-js/lib/ast.js(895,14): error TS2339: Property 'push' does not exist on type 'TreeWalker'. -node_modules/uglify-js/lib/ast.js(902,14): error TS2339: Property 'pop' does not exist on type 'TreeWalker'. -node_modules/uglify-js/lib/ast.js(957,25): error TS2339: Property 'self' does not exist on type 'TreeWalker'. -node_modules/uglify-js/lib/ast.js(958,37): error TS2339: Property 'parent' does not exist on type 'TreeWalker'. -node_modules/uglify-js/lib/compress.js(173,42): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(512,41): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(838,33): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(1094,38): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. -node_modules/uglify-js/lib/compress.js(1108,51): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'true | ((node: any) => any)' has no compatible call signatures. -node_modules/uglify-js/lib/compress.js(1172,53): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. -node_modules/uglify-js/lib/compress.js(1213,112): error TS2454: Variable 'args' is used before being assigned. -node_modules/uglify-js/lib/compress.js(1214,29): error TS2532: Object is possibly 'undefined'. -node_modules/uglify-js/lib/compress.js(1223,87): error TS2322: Type 'false' is not assignable to type 'number'. -node_modules/uglify-js/lib/compress.js(1231,29): error TS2322: Type 'false' is not assignable to type 'never'. -node_modules/uglify-js/lib/compress.js(1339,53): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(1440,38): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. -node_modules/uglify-js/lib/compress.js(1550,42): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(1582,41): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(1694,49): error TS2345: Argument of type 'number[]' is not assignable to parameter of type '[number, number, ...never[]]'. +node_modules/uglify-js/lib/ast.js(907,14): error TS2339: Property 'push' does not exist on type 'TreeWalker'. +node_modules/uglify-js/lib/ast.js(914,14): error TS2339: Property 'pop' does not exist on type 'TreeWalker'. +node_modules/uglify-js/lib/ast.js(969,25): error TS2339: Property 'self' does not exist on type 'TreeWalker'. +node_modules/uglify-js/lib/ast.js(970,37): error TS2339: Property 'parent' does not exist on type 'TreeWalker'. +node_modules/uglify-js/lib/compress.js(184,42): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(535,41): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(861,33): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(1121,38): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. +node_modules/uglify-js/lib/compress.js(1135,51): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'true | ((node: any) => any)' has no compatible call signatures. +node_modules/uglify-js/lib/compress.js(1199,53): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. +node_modules/uglify-js/lib/compress.js(1240,112): error TS2454: Variable 'args' is used before being assigned. +node_modules/uglify-js/lib/compress.js(1241,29): error TS2532: Object is possibly 'undefined'. +node_modules/uglify-js/lib/compress.js(1250,87): error TS2322: Type 'false' is not assignable to type 'number'. +node_modules/uglify-js/lib/compress.js(1258,29): error TS2322: Type 'false' is not assignable to type 'never'. +node_modules/uglify-js/lib/compress.js(1366,53): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(1467,38): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. +node_modules/uglify-js/lib/compress.js(1577,42): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(1609,41): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(1721,49): error TS2345: Argument of type 'number[]' is not assignable to parameter of type '[number, number, ...never[]]'. Type 'number[]' is missing the following properties from type '[number, number, ...never[]]': 0, 1 -node_modules/uglify-js/lib/compress.js(2017,59): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(2055,53): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[number, number, ...never[]]'. +node_modules/uglify-js/lib/compress.js(2044,59): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(2082,53): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[number, number, ...never[]]'. Type 'any[]' is missing the following properties from type '[number, number, ...never[]]': 0, 1 -node_modules/uglify-js/lib/compress.js(2203,34): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(2925,42): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3378,38): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3391,33): error TS2322: Type '"f"' is not assignable to type 'boolean'. -node_modules/uglify-js/lib/compress.js(3525,33): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3578,29): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3595,29): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. -node_modules/uglify-js/lib/compress.js(3620,75): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3694,63): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3879,38): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3900,24): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. -node_modules/uglify-js/lib/compress.js(3910,28): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. -node_modules/uglify-js/lib/compress.js(4069,21): error TS2403: Subsequent variable declarations must have the same type. Variable 'defs' must be of type 'Dictionary & { set: (key: any, val: any) => Dictionary & { set: ...; add: (key: any, val: any) => Dictionary & { set: ...; add: ...; get: (key: any) => any; del: (key: any) => Dictionary & { set: ...; ... 8 more ...; toObject: () => any; }; ... 5 more ...; toObject: () => any; }; ... 7 more ...; toObject: () => any;...', but here has type 'any'. -node_modules/uglify-js/lib/compress.js(4121,17): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead. -node_modules/uglify-js/lib/compress.js(4182,45): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(4292,33): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(4589,17): error TS2403: Subsequent variable declarations must have the same type. Variable 'body' must be of type 'any[]', but here has type 'any'. -node_modules/uglify-js/lib/compress.js(4673,37): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(4881,57): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[RegExp, (string | undefined)?]'. +node_modules/uglify-js/lib/compress.js(2230,34): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(2942,42): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3395,38): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3408,33): error TS2322: Type '"f"' is not assignable to type 'boolean'. +node_modules/uglify-js/lib/compress.js(3542,33): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3595,29): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3612,29): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. +node_modules/uglify-js/lib/compress.js(3637,75): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3711,63): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3832,12): error TS2339: Property 'push' does not exist on type 'TreeTransformer'. +node_modules/uglify-js/lib/compress.js(3897,38): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3918,24): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. +node_modules/uglify-js/lib/compress.js(3928,28): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. +node_modules/uglify-js/lib/compress.js(4097,21): error TS2403: Subsequent variable declarations must have the same type. Variable 'defs' must be of type 'Dictionary & { set: (key: any, val: any) => Dictionary & { set: ...; add: (key: any, val: any) => Dictionary & { set: ...; add: ...; get: (key: any) => any; del: (key: any) => Dictionary & { set: ...; ... 8 more ...; toObject: () => any; }; ... 5 more ...; toObject: () => any; }; ... 7 more ...; toObject: () => any;...', but here has type 'any'. +node_modules/uglify-js/lib/compress.js(4149,17): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead. +node_modules/uglify-js/lib/compress.js(4210,45): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(4320,33): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(4618,17): error TS2403: Subsequent variable declarations must have the same type. Variable 'body' must be of type 'any[]', but here has type 'any'. +node_modules/uglify-js/lib/compress.js(4702,37): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(4910,57): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[RegExp, (string | undefined)?]'. Property '0' is missing in type 'any[]' but required in type '[RegExp, (string | undefined)?]'. -node_modules/uglify-js/lib/compress.js(5045,45): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(5052,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'code' must be of type 'string', but here has type '{ get: () => string; toString: () => string; indent: () => void; indentation: () => number; current_width: () => number; should_break: () => boolean; has_parens: () => boolean; newline: () => void; print: (str: any) => void; ... 24 more ...; parent: (n: any) => any; }'. -node_modules/uglify-js/lib/compress.js(5056,36): error TS2532: Object is possibly 'undefined'. -node_modules/uglify-js/lib/compress.js(5061,41): error TS2339: Property 'get' does not exist on type 'string'. -node_modules/uglify-js/lib/compress.js(5565,18): error TS2454: Variable 'is_strict_comparison' is used before being assigned. -node_modules/uglify-js/lib/compress.js(6060,25): error TS2367: This condition will always return 'false' since the types 'boolean' and '"f"' have no overlap. -node_modules/uglify-js/lib/compress.js(6087,47): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(6160,39): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(6232,39): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(6238,41): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(6676,43): error TS2454: Variable 'property' is used before being assigned. -node_modules/uglify-js/lib/compress.js(6691,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'. -node_modules/uglify-js/lib/compress.js(6694,46): error TS2339: Property 'has_side_effects' does not exist on type 'number'. -node_modules/uglify-js/lib/compress.js(6700,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'. -node_modules/uglify-js/lib/compress.js(6728,34): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(5074,45): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(5081,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'code' must be of type 'string', but here has type '{ get: () => string; toString: () => string; indent: () => void; indentation: () => number; current_width: () => number; should_break: () => boolean; has_parens: () => boolean; newline: () => void; print: (str: any) => void; ... 24 more ...; parent: (n: any) => any; }'. +node_modules/uglify-js/lib/compress.js(5085,36): error TS2532: Object is possibly 'undefined'. +node_modules/uglify-js/lib/compress.js(5090,41): error TS2339: Property 'get' does not exist on type 'string'. +node_modules/uglify-js/lib/compress.js(5594,18): error TS2454: Variable 'is_strict_comparison' is used before being assigned. +node_modules/uglify-js/lib/compress.js(6105,25): error TS2367: This condition will always return 'false' since the types 'boolean' and '"f"' have no overlap. +node_modules/uglify-js/lib/compress.js(6132,47): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(6205,39): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(6277,39): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(6283,41): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(6728,43): error TS2454: Variable 'property' is used before being assigned. +node_modules/uglify-js/lib/compress.js(6743,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'. +node_modules/uglify-js/lib/compress.js(6746,46): error TS2339: Property 'has_side_effects' does not exist on type 'number'. +node_modules/uglify-js/lib/compress.js(6752,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'. +node_modules/uglify-js/lib/compress.js(6790,34): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/minify.js(167,75): error TS2339: Property 'compress' does not exist on type 'Compressor'. node_modules/uglify-js/lib/mozilla-ast.js(566,33): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/output.js(235,25): error TS2554: Expected 0 arguments, but got 2. From feaef9c8297e89a0df44f4e0e2d3d5e5aa9fead2 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 21 May 2019 14:21:44 -0700 Subject: [PATCH 122/384] Improve error message for JSXExpressions that are comma expressions --- src/compiler/checker.ts | 7 +++++++ src/compiler/diagnosticMessages.json | 4 ++++ src/compiler/parser.ts | 5 ++++- src/harness/fourslash.ts | 18 ++++++++++++++++++ tests/cases/fourslash/fourslash.ts | 1 + .../jsxExpressionFollowedByIdentifier.ts | 1 + .../jsxExpressionWithCommaExpression.ts | 11 +++++++++++ 7 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/jsxExpressionWithCommaExpression.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 18c1f42f838..d0efd490816 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -19850,6 +19850,7 @@ namespace ts { } function checkJsxExpression(node: JsxExpression, checkMode?: CheckMode) { + checkGrammarJsxExpression(node); if (node.expression) { const type = checkExpression(node.expression, checkMode); if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) { @@ -31658,6 +31659,12 @@ namespace ts { } } + function checkGrammarJsxExpression(node: JsxExpression) { + if (node.expression && isCommaSequence(node.expression)) { + return grammarErrorOnNode(node.expression, Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array); + } + } + function checkGrammarForInOrForOfStatement(forInOrOfStatement: ForInOrOfStatement): boolean { if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 87101781ead..97e80f69b11 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4986,5 +4986,9 @@ "Classes may not have a field named 'constructor'.": { "category": "Error", "code": 18006 + }, + "JSX expressions may not use the comma operator. Did you mean to write an array?": { + "category": "Error", + "code": 18007 } } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index c38e4f67fe2..f3b0c2c06e6 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4430,7 +4430,10 @@ namespace ts { if (token() !== SyntaxKind.CloseBraceToken) { node.dotDotDotToken = parseOptionalToken(SyntaxKind.DotDotDotToken); - node.expression = parseAssignmentExpressionOrHigher(); + // Only an AssignmentExpression is valid here per the JSX spec, + // but we can unambiguously parse a comma sequence and provide + // a better error message in grammar checking. + node.expression = parseExpression(); } if (inExpressionContext) { parseExpected(SyntaxKind.CloseBraceToken); diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index df7f0051f3f..a2e2c0f29af 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -582,6 +582,20 @@ namespace FourSlash { }); } + public verifyErrorExistsAtRange(range: Range, code: number) { + const span = ts.createTextSpanFromRange(range); + const hasMatchingError = ts.some( + this.getDiagnostics(range.fileName), + ({ code, start, length }) => + code === code && + ts.isNumber(start) && ts.isNumber(length) && + ts.textSpansEqual(span, { start, length })); + + if (!hasMatchingError) { + this.raiseError(`No error with code ${code} found at provided range.`); + } + } + public verifyNumberOfErrorsInCurrentFile(expected: number) { const errors = this.getDiagnostics(this.activeFile.fileName); const actual = errors.length; @@ -3968,6 +3982,10 @@ namespace FourSlashInterface { this.state.verifyNoErrors(); } + public errorExistsAtRange(range: FourSlash.Range, code: number) { + this.state.verifyErrorExistsAtRange(range, code); + } + public numberOfErrorsInCurrentFile(expected: number) { this.state.verifyNumberOfErrorsInCurrentFile(expected); } diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 4252296d5da..427a3558b31 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -238,6 +238,7 @@ declare namespace FourSlashInterface { signatureHelp(...options: VerifySignatureHelpOptions[], ): void; // Checks that there are no compile errors. noErrors(): void; + errorExistsAtRange(range: Range, code: number): void; numberOfErrorsInCurrentFile(expected: number): void; baselineCurrentFileBreakpointLocations(): void; baselineCurrentFileNameOrDottedNameSpans(): void; diff --git a/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts b/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts index 3231ed9cf62..d040bacd546 100644 --- a/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts +++ b/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts @@ -4,6 +4,7 @@ ////declare var React: any; ////declare var x: string; ////const a =
{
[|x|]}
+////const b =
[|x|]} /> const range = test.ranges()[0]; verify.getSyntacticDiagnostics([{ diff --git a/tests/cases/fourslash/jsxExpressionWithCommaExpression.ts b/tests/cases/fourslash/jsxExpressionWithCommaExpression.ts new file mode 100644 index 00000000000..829a2172364 --- /dev/null +++ b/tests/cases/fourslash/jsxExpressionWithCommaExpression.ts @@ -0,0 +1,11 @@ +/// + +//@Filename: jsxExpressionWithCommaExpression.tsx +//@jsx: react +////declare var React: any; +////declare var x: string; +////const a =
+////const b =
{[|x, x|]}
+ +verify.getSyntacticDiagnostics([]); +test.ranges().forEach(range => verify.errorExistsAtRange(range, 18006)); From 3f5912995b4fb845ff7ec436dcb40ebfe3816b42 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 21 May 2019 14:38:34 -0700 Subject: [PATCH 123/384] Add related span to original declaration on disagreeing variable/property types. --- src/compiler/checker.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e9dddff64af..9e5c864f6b9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5352,7 +5352,7 @@ namespace ts { return type; } else if (declaredType !== errorType && type !== errorType && !isTypeIdenticalTo(declaredType, type)) { - errorNextVariableOrPropertyDeclarationMustHaveSameType(declaredType, declaration, type); + errorNextVariableOrPropertyDeclarationMustHaveSameType(/*firstDeclaration*/ undefined, declaredType, declaration, type); } } return declaredType; @@ -26839,7 +26839,7 @@ namespace ts { if (type !== errorType && declarationType !== errorType && !isTypeIdenticalTo(type, declarationType) && !(symbol.flags & SymbolFlags.Assignment)) { - errorNextVariableOrPropertyDeclarationMustHaveSameType(type, node, declarationType); + errorNextVariableOrPropertyDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType); } if (node.initializer) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(node.initializer), declarationType, node, node.initializer, /*headMessage*/ undefined); @@ -26859,17 +26859,24 @@ namespace ts { } } - function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstType: Type, nextDeclaration: Declaration, nextType: Type): void { + function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration: Declaration | undefined, firstType: Type, nextDeclaration: Declaration, nextType: Type): void { const nextDeclarationName = getNameOfDeclaration(nextDeclaration); const message = nextDeclaration.kind === SyntaxKind.PropertyDeclaration || nextDeclaration.kind === SyntaxKind.PropertySignature ? Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; - error( + const declName = declarationNameToString(nextDeclarationName); + const err = error( nextDeclarationName, message, - declarationNameToString(nextDeclarationName), + declName, typeToString(firstType), - typeToString(nextType)); + typeToString(nextType) + ); + if (firstDeclaration) { + addRelatedInfo(err, + createDiagnosticForNode(firstDeclaration, Diagnostics._0_was_also_declared_here, declName) + ); + } } function areDeclarationFlagsIdentical(left: Declaration, right: Declaration) { From 81d3595058be3ff808ebdc8417f1d206881f7fae Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 21 May 2019 14:39:11 -0700 Subject: [PATCH 124/384] Accepted baselines. --- tests/baselines/reference/ES5For-of7.errors.txt | 1 + ...onAndModuleWithSameNameAndCommonRoot.errors.txt | 2 ++ .../asyncArrowFunction5_es2017.errors.txt | 1 + .../reference/asyncArrowFunction5_es5.errors.txt | 1 + .../reference/asyncArrowFunction5_es6.errors.txt | 1 + .../asyncArrowFunction9_es2017.errors.txt | 1 + .../reference/asyncArrowFunction9_es5.errors.txt | 1 + .../reference/asyncArrowFunction9_es6.errors.txt | 1 + .../reference/augmentedTypesVar.errors.txt | 1 + tests/baselines/reference/castingTuple.errors.txt | 1 + .../checkMergedGlobalUMDSymbol.errors.txt | 1 + .../classWithDuplicateIdentifier.errors.txt | 2 ++ .../reference/conditionalTypes1.errors.txt | 1 + .../declarationsAndAssignments.errors.txt | 1 + .../reference/duplicateClassElements.errors.txt | 1 + .../duplicateIdentifierInCatchBlock.errors.txt | 1 + .../reference/duplicateLocalVariable1.errors.txt | 1 + .../reference/duplicateLocalVariable2.errors.txt | 1 + .../reference/duplicateLocalVariable3.errors.txt | 1 + .../reference/duplicateLocalVariable4.errors.txt | 3 ++- .../reference/duplicateVariablesWithAny.errors.txt | 4 ++++ .../duplicateVarsAcrossFileBoundaries.errors.txt | 4 ++++ .../reference/dynamicNamesErrors.errors.txt | 1 + .../enumAssignabilityInInheritance.errors.txt | 4 +++- .../reference/for-inStatements.errors.txt | 2 ++ .../for-inStatementsArrayErrors.errors.txt | 2 ++ .../reference/for-inStatementsInvalid.errors.txt | 2 ++ .../forStatementsMultipleInvalidDecl.errors.txt | 14 +++++++++++++- .../reference/functionArgShadowing.errors.txt | 2 ++ .../reference/gettersAndSettersErrors.errors.txt | 1 + ...orSignaturesWithTypeParametersAndAny.errors.txt | 6 +++++- .../reference/interfaceDeclaration1.errors.txt | 1 + .../invalidMultipleVariableDeclarations.errors.txt | 14 +++++++++++++- ...lationDuplicateVariableErrorReported.errors.txt | 3 ++- .../reference/mappedTypeErrors.errors.txt | 4 ++++ ...terfacesWithConflictingPropertyNames.errors.txt | 3 +++ ...atureHandledDeclarationKindForSymbol.errors.txt | 1 + .../missingAndExcessProperties.errors.txt | 4 ++++ .../negateOperatorInvalidOperations.errors.txt | 1 + ...umericStringNamedPropertyEquivalence.errors.txt | 1 + .../objectLiteralContextualTyping.errors.txt | 1 + tests/baselines/reference/objectRest.errors.txt | 1 + ...ionalParamterAndVariableDeclaration2.errors.txt | 1 + ...rderMattersForSignatureGroupIdentity.errors.txt | 1 + .../reference/overloadResolution.errors.txt | 1 + .../overloadResolutionConstructors.errors.txt | 1 + .../parserCastVersusArrowFunction1.errors.txt | 3 +++ .../reference/promiseIdentity2.errors.txt | 3 ++- .../reference/promiseIdentityWithAny2.errors.txt | 4 +++- .../baselines/reference/propertyAccess.errors.txt | 1 + .../propertyIdentityWithPrivacyMismatch.errors.txt | 2 ++ .../reference/reassignStaticProp.errors.txt | 1 + tests/baselines/reference/spreadUnion2.errors.txt | 6 ++++++ .../reference/strictTupleLength.errors.txt | 2 ++ ...TemplateStringsTypeArgumentInference.errors.txt | 1 + ...plateStringsTypeArgumentInferenceES6.errors.txt | 1 + tests/baselines/reference/tupleTypes.errors.txt | 2 ++ .../reference/typeArgumentInference.errors.txt | 1 + ...ArgumentInferenceConstructSignatures.errors.txt | 1 + ...typeArgumentInferenceWithConstraints.errors.txt | 1 + ...ardOfFormTypeOfEqualEqualHasNoEffect.errors.txt | 4 ++++ ...GuardOfFormTypeOfNotEqualHasNoEffect.errors.txt | 4 ++++ .../typeOfEnumAndVarRedeclarations.errors.txt | 2 ++ tests/baselines/reference/typeOfThis.errors.txt | 10 ++++++++++ .../reference/unionTypeEquivalence.errors.txt | 1 + .../reference/unionTypeIdentity.errors.txt | 5 ++++- .../reference/unionTypeLiterals.errors.txt | 4 +++- tests/baselines/reference/varBlock.errors.txt | 1 + tests/baselines/reference/witness.errors.txt | 7 +++++++ 69 files changed, 161 insertions(+), 10 deletions(-) diff --git a/tests/baselines/reference/ES5For-of7.errors.txt b/tests/baselines/reference/ES5For-of7.errors.txt index a3d40f38814..460c7bf4680 100644 --- a/tests/baselines/reference/ES5For-of7.errors.txt +++ b/tests/baselines/reference/ES5For-of7.errors.txt @@ -10,4 +10,5 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts(6,9): error TS var x = [w, v]; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'any[]'. +!!! related TS6203 tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts:2:9: 'x' was also declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt index 20f8e09248a..0a72e6b641d 100644 --- a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt +++ b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt @@ -24,6 +24,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error T var fn = A.Point; ~~ !!! 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'. +!!! related TS6203 tests/cases/conformance/internalModules/DeclarationMerging/test.ts:1:5: 'fn' was also declared here. var cl: { x: number; y: number; } var cl = A.Point(); @@ -46,6 +47,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error T var fn = B.Point; // not expected to be an error. bug 840000: [corelang] Function of fundule not assignalbe as expected ~~ !!! 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'. +!!! related TS6203 tests/cases/conformance/internalModules/DeclarationMerging/test.ts:1:5: 'fn' was also declared here. var cl: { x: number; y: number; } var cl = B.Point(); diff --git a/tests/baselines/reference/asyncArrowFunction5_es2017.errors.txt b/tests/baselines/reference/asyncArrowFunction5_es2017.errors.txt index 28ddb3bb9b9..26601467324 100644 --- a/tests/baselines/reference/asyncArrowFunction5_es2017.errors.txt +++ b/tests/baselines/reference/asyncArrowFunction5_es2017.errors.txt @@ -16,6 +16,7 @@ tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es20 !!! error TS1005: ',' expected. ~~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'. +!!! related TS6203 /.ts/lib.es2015.promise.d.ts:152:13: 'Promise' was also declared here. ~ !!! error TS1005: ',' expected. ~~ diff --git a/tests/baselines/reference/asyncArrowFunction5_es5.errors.txt b/tests/baselines/reference/asyncArrowFunction5_es5.errors.txt index f132abff235..cf82d765a56 100644 --- a/tests/baselines/reference/asyncArrowFunction5_es5.errors.txt +++ b/tests/baselines/reference/asyncArrowFunction5_es5.errors.txt @@ -16,6 +16,7 @@ tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts( !!! error TS1005: ',' expected. ~~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'. +!!! related TS6203 /.ts/lib.es2015.promise.d.ts:152:13: 'Promise' was also declared here. ~ !!! error TS1005: ',' expected. ~~ diff --git a/tests/baselines/reference/asyncArrowFunction5_es6.errors.txt b/tests/baselines/reference/asyncArrowFunction5_es6.errors.txt index a2f6f441252..909efc3c97e 100644 --- a/tests/baselines/reference/asyncArrowFunction5_es6.errors.txt +++ b/tests/baselines/reference/asyncArrowFunction5_es6.errors.txt @@ -16,6 +16,7 @@ tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts( !!! error TS1005: ',' expected. ~~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'. +!!! related TS6203 /.ts/lib.es2015.promise.d.ts:152:13: 'Promise' was also declared here. ~ !!! error TS1005: ',' expected. ~~ diff --git a/tests/baselines/reference/asyncArrowFunction9_es2017.errors.txt b/tests/baselines/reference/asyncArrowFunction9_es2017.errors.txt index cd2bb9c8858..0be88de2868 100644 --- a/tests/baselines/reference/asyncArrowFunction9_es2017.errors.txt +++ b/tests/baselines/reference/asyncArrowFunction9_es2017.errors.txt @@ -16,6 +16,7 @@ tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es20 !!! error TS1005: ',' expected. ~~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'. +!!! related TS6203 /.ts/lib.es2015.promise.d.ts:152:13: 'Promise' was also declared here. ~ !!! error TS1005: ',' expected. ~~ diff --git a/tests/baselines/reference/asyncArrowFunction9_es5.errors.txt b/tests/baselines/reference/asyncArrowFunction9_es5.errors.txt index be561eab72c..085b3b50884 100644 --- a/tests/baselines/reference/asyncArrowFunction9_es5.errors.txt +++ b/tests/baselines/reference/asyncArrowFunction9_es5.errors.txt @@ -16,6 +16,7 @@ tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts( !!! error TS1005: ',' expected. ~~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'. +!!! related TS6203 /.ts/lib.es2015.promise.d.ts:152:13: 'Promise' was also declared here. ~ !!! error TS1005: ',' expected. ~~ diff --git a/tests/baselines/reference/asyncArrowFunction9_es6.errors.txt b/tests/baselines/reference/asyncArrowFunction9_es6.errors.txt index 84177f28292..6949aad5cea 100644 --- a/tests/baselines/reference/asyncArrowFunction9_es6.errors.txt +++ b/tests/baselines/reference/asyncArrowFunction9_es6.errors.txt @@ -16,6 +16,7 @@ tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts( !!! error TS1005: ',' expected. ~~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'any'. +!!! related TS6203 /.ts/lib.es2015.promise.d.ts:152:13: 'Promise' was also declared here. ~ !!! error TS1005: ',' expected. ~~ diff --git a/tests/baselines/reference/augmentedTypesVar.errors.txt b/tests/baselines/reference/augmentedTypesVar.errors.txt index 261686f3659..ae910b4f5be 100644 --- a/tests/baselines/reference/augmentedTypesVar.errors.txt +++ b/tests/baselines/reference/augmentedTypesVar.errors.txt @@ -30,6 +30,7 @@ tests/cases/compiler/augmentedTypesVar.ts(31,8): error TS2300: Duplicate identif var x3 = () => { } // error ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'number', but here has type '() => void'. +!!! related TS6203 tests/cases/compiler/augmentedTypesVar.ts:9:5: 'x3' was also declared here. // var then class var x4 = 1; // error diff --git a/tests/baselines/reference/castingTuple.errors.txt b/tests/baselines/reference/castingTuple.errors.txt index 4ddb42ed2d9..0a1d592e8b1 100644 --- a/tests/baselines/reference/castingTuple.errors.txt +++ b/tests/baselines/reference/castingTuple.errors.txt @@ -71,6 +71,7 @@ tests/cases/conformance/types/tuple/castingTuple.ts(33,1): error TS2304: Cannot var array1 = numStrTuple; ~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. +!!! related TS6203 tests/cases/conformance/types/tuple/castingTuple.ts:23:5: 'array1' was also declared here. t4[2] = 10; ~~ !!! error TS2304: Cannot find name 't4'. diff --git a/tests/baselines/reference/checkMergedGlobalUMDSymbol.errors.txt b/tests/baselines/reference/checkMergedGlobalUMDSymbol.errors.txt index f3d21e26b6e..f4b889131f1 100644 --- a/tests/baselines/reference/checkMergedGlobalUMDSymbol.errors.txt +++ b/tests/baselines/reference/checkMergedGlobalUMDSymbol.errors.txt @@ -15,6 +15,7 @@ tests/cases/compiler/global.d.ts(6,16): error TS2403: Subsequent variable declar export const THREE: typeof _three; ~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'THREE' must be of type 'typeof import("tests/cases/compiler/global")', but here has type 'typeof import("tests/cases/compiler/three")'. +!!! related TS6203 tests/cases/compiler/global.d.ts:1:1: 'THREE' was also declared here. } ==== tests/cases/compiler/test.ts (0 errors) ==== diff --git a/tests/baselines/reference/classWithDuplicateIdentifier.errors.txt b/tests/baselines/reference/classWithDuplicateIdentifier.errors.txt index db48c48078c..60390e8a843 100644 --- a/tests/baselines/reference/classWithDuplicateIdentifier.errors.txt +++ b/tests/baselines/reference/classWithDuplicateIdentifier.errors.txt @@ -14,6 +14,7 @@ tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2717: Subseq !!! error TS2300: Duplicate identifier 'a'. ~ !!! error TS2717: Subsequent property declarations must have the same type. Property 'a' must be of type '() => number', but here has type 'number'. +!!! related TS6203 tests/cases/compiler/classWithDuplicateIdentifier.ts:2:5: 'a' was also declared here. } class K { b: number; // error: duplicate identifier @@ -30,5 +31,6 @@ tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2717: Subseq !!! error TS2300: Duplicate identifier 'c'. ~ !!! error TS2717: Subsequent property declarations must have the same type. Property 'c' must be of type 'number', but here has type 'string'. +!!! related TS6203 tests/cases/compiler/classWithDuplicateIdentifier.ts:10:5: 'c' was also declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index 7abcf55b8e7..45d3b1f99cb 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -391,6 +391,7 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS var z: T2; // Error, T2 is distributive, T1 isn't ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'T1', but here has type 'Foo'. +!!! related TS6203 tests/cases/conformance/types/conditional/conditionalTypes1.ts:262:9: 'z' was also declared here. } function f33() { diff --git a/tests/baselines/reference/declarationsAndAssignments.errors.txt b/tests/baselines/reference/declarationsAndAssignments.errors.txt index 312a0ed626c..b13aacbfbc3 100644 --- a/tests/baselines/reference/declarationsAndAssignments.errors.txt +++ b/tests/baselines/reference/declarationsAndAssignments.errors.txt @@ -97,6 +97,7 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9): var y: string; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string | number', but here has type 'string'. +!!! related TS6203 tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts:56:17: 'y' was also declared here. } function f8() { diff --git a/tests/baselines/reference/duplicateClassElements.errors.txt b/tests/baselines/reference/duplicateClassElements.errors.txt index 4ac91767768..397ee445459 100644 --- a/tests/baselines/reference/duplicateClassElements.errors.txt +++ b/tests/baselines/reference/duplicateClassElements.errors.txt @@ -97,6 +97,7 @@ tests/cases/compiler/duplicateClassElements.ts(41,12): error TS2300: Duplicate i !!! error TS2300: Duplicate identifier 'x2'. ~~ !!! error TS2717: Subsequent property declarations must have the same type. Property 'x2' must be of type 'number', but here has type 'any'. +!!! related TS6203 tests/cases/compiler/duplicateClassElements.ts:29:9: 'x2' was also declared here. get z2() { ~~ diff --git a/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt b/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt index d8065df27c8..d2216efc6e6 100644 --- a/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt +++ b/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt @@ -38,4 +38,5 @@ tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(16,9): error TS2403: Sub var p: number; // error ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'string', but here has type 'number'. +!!! related TS6203 tests/cases/compiler/duplicateIdentifierInCatchBlock.ts:15:9: 'p' was also declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateLocalVariable1.errors.txt b/tests/baselines/reference/duplicateLocalVariable1.errors.txt index 6f521565862..a31ca844a86 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable1.errors.txt @@ -201,6 +201,7 @@ tests/cases/compiler/duplicateLocalVariable1.ts(186,37): error TS2356: An arithm for (var i = 0; i < 14; i++) { ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'. +!!! related TS6203 tests/cases/compiler/duplicateLocalVariable1.ts:181:22: 'i' was also declared here. ~~~~~~ !!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. ~ diff --git a/tests/baselines/reference/duplicateLocalVariable2.errors.txt b/tests/baselines/reference/duplicateLocalVariable2.errors.txt index 0258e7e8460..f25de4a7047 100644 --- a/tests/baselines/reference/duplicateLocalVariable2.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable2.errors.txt @@ -33,6 +33,7 @@ tests/cases/compiler/duplicateLocalVariable2.ts(27,37): error TS2356: An arithme for (var i = 0; i < 14; i++) { ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'. +!!! related TS6203 tests/cases/compiler/duplicateLocalVariable2.ts:22:22: 'i' was also declared here. ~~~~~~ !!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. ~ diff --git a/tests/baselines/reference/duplicateLocalVariable3.errors.txt b/tests/baselines/reference/duplicateLocalVariable3.errors.txt index 5dda5872da0..2255776c75c 100644 --- a/tests/baselines/reference/duplicateLocalVariable3.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable3.errors.txt @@ -15,4 +15,5 @@ tests/cases/compiler/duplicateLocalVariable3.ts(11,9): error TS2403: Subsequent var z = ""; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'string'. +!!! related TS6203 tests/cases/compiler/duplicateLocalVariable3.ts:10:9: 'z' was also declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateLocalVariable4.errors.txt b/tests/baselines/reference/duplicateLocalVariable4.errors.txt index 3209c23e39e..67da21962b1 100644 --- a/tests/baselines/reference/duplicateLocalVariable4.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable4.errors.txt @@ -9,4 +9,5 @@ tests/cases/compiler/duplicateLocalVariable4.ts(6,5): error TS2403: Subsequent v var x = E; var x = E.a; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'typeof E', but here has type 'E'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'typeof E', but here has type 'E'. +!!! related TS6203 tests/cases/compiler/duplicateLocalVariable4.ts:5:5: 'x' was also declared here. \ No newline at end of file diff --git a/tests/baselines/reference/duplicateVariablesWithAny.errors.txt b/tests/baselines/reference/duplicateVariablesWithAny.errors.txt index 787e118ca37..0d71fde12e2 100644 --- a/tests/baselines/reference/duplicateVariablesWithAny.errors.txt +++ b/tests/baselines/reference/duplicateVariablesWithAny.errors.txt @@ -10,22 +10,26 @@ tests/cases/compiler/duplicateVariablesWithAny.ts(13,9): error TS2403: Subsequen var x = 2; //error ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/compiler/duplicateVariablesWithAny.ts:2:5: 'x' was also declared here. var y = ""; var y; //error ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'. +!!! related TS6203 tests/cases/compiler/duplicateVariablesWithAny.ts:5:5: 'y' was also declared here. module N { var x: any; var x = 2; //error ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/compiler/duplicateVariablesWithAny.ts:9:9: 'x' was also declared here. var y = ""; var y; //error ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'. +!!! related TS6203 tests/cases/compiler/duplicateVariablesWithAny.ts:12:9: 'y' was also declared here. } var z: any; diff --git a/tests/baselines/reference/duplicateVarsAcrossFileBoundaries.errors.txt b/tests/baselines/reference/duplicateVarsAcrossFileBoundaries.errors.txt index d4222483212..2f5e9f09634 100644 --- a/tests/baselines/reference/duplicateVarsAcrossFileBoundaries.errors.txt +++ b/tests/baselines/reference/duplicateVarsAcrossFileBoundaries.errors.txt @@ -12,18 +12,22 @@ tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(3,5): error TS2403: var x = true; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'boolean'. +!!! related TS6203 tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts:1:5: 'x' was also declared here. var z = 3; ==== tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts (3 errors) ==== var x = ""; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'string'. +!!! related TS6203 tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts:1:5: 'x' was also declared here. var y = 3; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'number'. +!!! related TS6203 tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts:2:5: 'y' was also declared here. var z = false; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'boolean'. +!!! related TS6203 tests/cases/compiler/duplicateVarsAcrossFileBoundaries_1.ts:2:5: 'z' was also declared here. ==== tests/cases/compiler/duplicateVarsAcrossFileBoundaries_3.ts (0 errors) ==== var x = 0; diff --git a/tests/baselines/reference/dynamicNamesErrors.errors.txt b/tests/baselines/reference/dynamicNamesErrors.errors.txt index c39140dbd52..43ca55db4ea 100644 --- a/tests/baselines/reference/dynamicNamesErrors.errors.txt +++ b/tests/baselines/reference/dynamicNamesErrors.errors.txt @@ -35,6 +35,7 @@ tests/cases/compiler/dynamicNamesErrors.ts(25,1): error TS2322: Type 'T1' is not [c1]: string; ~~~~ !!! error TS2717: Subsequent property declarations must have the same type. Property '[c1]' must be of type 'number', but here has type 'string'. +!!! related TS6203 tests/cases/compiler/dynamicNamesErrors.ts:18:5: '[c1]' was also declared here. } let t1: T1; diff --git a/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt b/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt index e7c1297e1fd..e76c053a0af 100644 --- a/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt +++ b/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt @@ -109,10 +109,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi var r4 = foo16(E.A); ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'. +!!! related TS6203 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts:22:5: 'r4' was also declared here. declare function foo17(x: {}): {}; declare function foo17(x: E): E; var r4 = foo16(E.A); ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'. +!!! related TS6203 tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts:22:5: 'r4' was also declared here. \ No newline at end of file diff --git a/tests/baselines/reference/for-inStatements.errors.txt b/tests/baselines/reference/for-inStatements.errors.txt index 50f31d669cd..03e11ff1115 100644 --- a/tests/baselines/reference/for-inStatements.errors.txt +++ b/tests/baselines/reference/for-inStatements.errors.txt @@ -39,6 +39,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(79,15): for (var x in this) { } ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'Extract'. +!!! related TS6203 tests/cases/conformance/statements/for-inStatements/for-inStatements.ts:31:18: 'x' was also declared here. return null; } @@ -58,6 +59,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(79,15): for (var x in this) { } ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'Extract'. +!!! related TS6203 tests/cases/conformance/statements/for-inStatements/for-inStatements.ts:48:18: 'x' was also declared here. for (var x in super.biz) { } for (var x in super.biz()) { } diff --git a/tests/baselines/reference/for-inStatementsArrayErrors.errors.txt b/tests/baselines/reference/for-inStatementsArrayErrors.errors.txt index 3ba7a73367f..2eb08a8b1f3 100644 --- a/tests/baselines/reference/for-inStatementsArrayErrors.errors.txt +++ b/tests/baselines/reference/for-inStatementsArrayErrors.errors.txt @@ -29,11 +29,13 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors. for (var i in a ) { ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'number', but here has type 'string'. +!!! related TS6203 tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts:11:5: 'i' was also declared here. } var j: any; for (var j in a ) { ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type 'any', but here has type 'string'. +!!! related TS6203 tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts:15:5: 'j' was also declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/for-inStatementsInvalid.errors.txt b/tests/baselines/reference/for-inStatementsInvalid.errors.txt index 8e1bb29d083..e8e29b37c4e 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.errors.txt +++ b/tests/baselines/reference/for-inStatementsInvalid.errors.txt @@ -73,6 +73,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(6 for (var x in this) { } ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'Extract'. +!!! related TS6203 tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts:29:18: 'x' was also declared here. return null; } @@ -96,6 +97,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(6 for (var x in this) { } ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'Extract'. +!!! related TS6203 tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts:46:18: 'x' was also declared here. for (var x in super.biz) { } for (var x in super.biz()) { } diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt b/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt index 53ecb88363d..f0de0ce954b 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt @@ -47,46 +47,58 @@ tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDec for( var a = 1;;){} ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts:31:10: 'a' was also declared here. for( var a = 'a string';;){} ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. +!!! related TS6203 tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts:31:10: 'a' was also declared here. for( var a = new C();;){} ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'. +!!! related TS6203 tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts:31:10: 'a' was also declared here. for( var a = new D();;){} ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D'. +!!! related TS6203 tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts:31:10: 'a' was also declared here. for( var a = M;;){} ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'. +!!! related TS6203 tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts:31:10: 'a' was also declared here. for( var b: I;;){} for( var b = new C();;){} ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'. +!!! related TS6203 tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts:38:10: 'b' was also declared here. for( var b = new C2();;){} ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. +!!! related TS6203 tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts:38:10: 'b' was also declared here. for(var f = F;;){} for( var f = (x: number) => '';;){} ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. +!!! related TS6203 tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts:42:9: 'f' was also declared here. for(var arr: string[];;){} for( var arr = [1, 2, 3, 4];;){} ~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. +!!! related TS6203 tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts:45:9: 'arr' was also declared here. for( var arr = [new C(), new C2(), new D()];;){} ~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. +!!! related TS6203 tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts:45:9: 'arr' was also declared here. for(var arr2 = [new D()];;){} for( var arr2 = new Array>();;){} ~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. +!!! related TS6203 tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts:49:9: 'arr2' was also declared here. for(var m: typeof M;;){} for( var m = M.A;;){} ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. +!!! related TS6203 tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts:52:9: 'm' was also declared here. \ No newline at end of file diff --git a/tests/baselines/reference/functionArgShadowing.errors.txt b/tests/baselines/reference/functionArgShadowing.errors.txt index 93022178452..c3ba60a80cd 100644 --- a/tests/baselines/reference/functionArgShadowing.errors.txt +++ b/tests/baselines/reference/functionArgShadowing.errors.txt @@ -10,6 +10,7 @@ tests/cases/compiler/functionArgShadowing.ts(10,7): error TS2403: Subsequent var var x: B = new B(); ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'A', but here has type 'B'. +!!! related TS6203 tests/cases/compiler/functionArgShadowing.ts:3:14: 'x' was also declared here. x.bar(); // the property bar does not exist on a value of type A ~~~ !!! error TS2339: Property 'bar' does not exist on type 'A'. @@ -20,6 +21,7 @@ tests/cases/compiler/functionArgShadowing.ts(10,7): error TS2403: Subsequent var var p: string; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'number', but here has type 'string'. +!!! related TS6203 tests/cases/compiler/functionArgShadowing.ts:9:14: 'p' was also declared here. var n: number = p; } diff --git a/tests/baselines/reference/gettersAndSettersErrors.errors.txt b/tests/baselines/reference/gettersAndSettersErrors.errors.txt index e2a4bb3a146..013e195876e 100644 --- a/tests/baselines/reference/gettersAndSettersErrors.errors.txt +++ b/tests/baselines/reference/gettersAndSettersErrors.errors.txt @@ -24,6 +24,7 @@ tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS2379: Getter and !!! error TS2300: Duplicate identifier 'Foo'. ~~~ !!! error TS2717: Subsequent property declarations must have the same type. Property 'Foo' must be of type 'string', but here has type 'number'. +!!! related TS6203 tests/cases/compiler/gettersAndSettersErrors.ts:2:16: 'Foo' was also declared here. public get Goo(v:string):string {return null;} // error - getters must not have a parameter ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. diff --git a/tests/baselines/reference/identityForSignaturesWithTypeParametersAndAny.errors.txt b/tests/baselines/reference/identityForSignaturesWithTypeParametersAndAny.errors.txt index 60239280226..092bfaaeeb3 100644 --- a/tests/baselines/reference/identityForSignaturesWithTypeParametersAndAny.errors.txt +++ b/tests/baselines/reference/identityForSignaturesWithTypeParametersAndAny.errors.txt @@ -12,18 +12,22 @@ tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(14,5): err var g: (x: any, y: any) => any; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'g' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => any'. +!!! related TS6203 tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts:4:5: 'g' was also declared here. var h: (x: T, y: U) => T; var h: (x: any, y: any) => any; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'h' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => any'. +!!! related TS6203 tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts:7:5: 'h' was also declared here. var i: (x: T, y: U) => T; var i: (x: any, y: string) => any; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: string) => any'. +!!! related TS6203 tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts:10:5: 'i' was also declared here. var j: (x: T, y: U) => T; var j: (x: any, y: any) => string; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => string'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => string'. +!!! related TS6203 tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts:13:5: 'j' was also declared here. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceDeclaration1.errors.txt b/tests/baselines/reference/interfaceDeclaration1.errors.txt index 64410b44c55..b4c41ca350e 100644 --- a/tests/baselines/reference/interfaceDeclaration1.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration1.errors.txt @@ -30,6 +30,7 @@ tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i !!! error TS2300: Duplicate identifier 'item'. ~~~~ !!! error TS2717: Subsequent property declarations must have the same type. Property 'item' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/compiler/interfaceDeclaration1.ts:7:5: 'item' was also declared here. } interface I3 { diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt b/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt index 3ec718f3b25..a43b9b0c271 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt @@ -47,46 +47,58 @@ tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDec var a = 1; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts:31:5: 'a' was also declared here. var a = 'a string'; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. +!!! related TS6203 tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts:31:5: 'a' was also declared here. var a = new C(); ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'. +!!! related TS6203 tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts:31:5: 'a' was also declared here. var a = new D(); ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D'. +!!! related TS6203 tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts:31:5: 'a' was also declared here. var a = M; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'. +!!! related TS6203 tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts:31:5: 'a' was also declared here. var b: I; var b = new C(); ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'. +!!! related TS6203 tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts:38:5: 'b' was also declared here. var b = new C2(); ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. +!!! related TS6203 tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts:38:5: 'b' was also declared here. var f = F; var f = (x: number) => ''; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. +!!! related TS6203 tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts:42:5: 'f' was also declared here. var arr: string[]; var arr = [1, 2, 3, 4]; ~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. +!!! related TS6203 tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts:45:5: 'arr' was also declared here. var arr = [new C(), new C2(), new D()]; ~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. +!!! related TS6203 tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts:45:5: 'arr' was also declared here. var arr2 = [new D()]; var arr2 = new Array>(); ~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. +!!! related TS6203 tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts:49:5: 'arr2' was also declared here. var m: typeof M; var m = M.A; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. +!!! related TS6203 tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts:52:5: 'm' was also declared here. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationDuplicateVariableErrorReported.errors.txt b/tests/baselines/reference/jsFileCompilationDuplicateVariableErrorReported.errors.txt index f1374d95767..9e46d6225a2 100644 --- a/tests/baselines/reference/jsFileCompilationDuplicateVariableErrorReported.errors.txt +++ b/tests/baselines/reference/jsFileCompilationDuplicateVariableErrorReported.errors.txt @@ -9,4 +9,5 @@ tests/cases/compiler/a.ts(1,5): error TS2403: Subsequent variable declarations m ==== tests/cases/compiler/a.ts (1 errors) ==== var x = 10; // Error reported so no declaration file generated? ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'number'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'number'. +!!! related TS6203 tests/cases/compiler/b.js:1:5: 'x' was also declared here. \ No newline at end of file diff --git a/tests/baselines/reference/mappedTypeErrors.errors.txt b/tests/baselines/reference/mappedTypeErrors.errors.txt index 254d1cca1a8..0dc68732e81 100644 --- a/tests/baselines/reference/mappedTypeErrors.errors.txt +++ b/tests/baselines/reference/mappedTypeErrors.errors.txt @@ -133,12 +133,15 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(152,17): error TS2339: var x: { [P in keyof T]?: T[P] }; // Error ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]?: T[P] | undefined; }'. +!!! related TS6203 tests/cases/conformance/types/mapped/mappedTypeErrors.ts:58:9: 'x' was also declared here. var x: { readonly [P in keyof T]: T[P] }; // Error ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]: T[P]; }'. +!!! related TS6203 tests/cases/conformance/types/mapped/mappedTypeErrors.ts:58:9: 'x' was also declared here. var x: { readonly [P in keyof T]?: T[P] }; // Error ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]?: T[P] | undefined; }'. +!!! related TS6203 tests/cases/conformance/types/mapped/mappedTypeErrors.ts:58:9: 'x' was also declared here. } function f12() { @@ -146,6 +149,7 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(152,17): error TS2339: var x: { [P in keyof T]: T[P][] }; // Error ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]: T[P][]; }'. +!!! related TS6203 tests/cases/conformance/types/mapped/mappedTypeErrors.ts:65:9: 'x' was also declared here. } // Check that inferences to mapped types are secondary diff --git a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt index 523cad05465..6bb0e02f4eb 100644 --- a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt @@ -12,6 +12,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli x: number; ~ !!! error TS2717: Subsequent property declarations must have the same type. Property 'x' must be of type 'string', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts:2:5: 'x' was also declared here. } module M { @@ -23,6 +24,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli x: number; // error ~ !!! error TS2717: Subsequent property declarations must have the same type. Property 'x' must be of type 'T', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts:11:9: 'x' was also declared here. } } @@ -49,5 +51,6 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli x: number; // error ~ !!! error TS2717: Subsequent property declarations must have the same type. Property 'x' must be of type 'T', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts:33:9: 'x' was also declared here. } } \ No newline at end of file diff --git a/tests/baselines/reference/methodSignatureHandledDeclarationKindForSymbol.errors.txt b/tests/baselines/reference/methodSignatureHandledDeclarationKindForSymbol.errors.txt index 99fd038bbb9..edb66f56dd3 100644 --- a/tests/baselines/reference/methodSignatureHandledDeclarationKindForSymbol.errors.txt +++ b/tests/baselines/reference/methodSignatureHandledDeclarationKindForSymbol.errors.txt @@ -10,6 +10,7 @@ tests/cases/compiler/methodSignatureHandledDeclarationKindForSymbol.ts(6,5): err bold: string; ~~~~ !!! error TS2717: Subsequent property declarations must have the same type. Property 'bold' must be of type '() => string', but here has type 'string'. +!!! related TS6203 tests/cases/compiler/methodSignatureHandledDeclarationKindForSymbol.ts:2:5: 'bold' was also declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/missingAndExcessProperties.errors.txt b/tests/baselines/reference/missingAndExcessProperties.errors.txt index 0ee69d9af30..7972d770320 100644 --- a/tests/baselines/reference/missingAndExcessProperties.errors.txt +++ b/tests/baselines/reference/missingAndExcessProperties.errors.txt @@ -31,6 +31,7 @@ tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(31,16): var { x = 1, y } = {}; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts:3:11: 'x' was also declared here. ~ !!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. var { x, y = 1 } = {}; @@ -38,11 +39,14 @@ tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(31,16): !!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts:3:14: 'y' was also declared here. var { x = 1, y = 1 } = {}; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts:3:11: 'x' was also declared here. ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts:3:14: 'y' was also declared here. } // Missing properties diff --git a/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt b/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt index 105a1af9efe..0792565f063 100644 --- a/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt +++ b/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt @@ -44,5 +44,6 @@ tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperator var NUMBER =-; ~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'NUMBER' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts:4:19: 'NUMBER' was also declared here. ~ !!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt b/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt index 8f0a27e03d9..7d3ff163300 100644 --- a/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt +++ b/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt @@ -37,6 +37,7 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericString !!! error TS2300: Duplicate identifier '1'. ~~~ !!! error TS2717: Subsequent property declarations must have the same type. Property '1.0' must be of type 'number', but here has type 'string'. +!!! related TS6203 tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts:16:5: '1.0' was also declared here. } var b = { diff --git a/tests/baselines/reference/objectLiteralContextualTyping.errors.txt b/tests/baselines/reference/objectLiteralContextualTyping.errors.txt index b73b7b43a89..2ff2a7287f8 100644 --- a/tests/baselines/reference/objectLiteralContextualTyping.errors.txt +++ b/tests/baselines/reference/objectLiteralContextualTyping.errors.txt @@ -33,4 +33,5 @@ tests/cases/conformance/expressions/contextualTyping/objectLiteralContextualTypi var b: {}; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'unknown', but here has type '{}'. +!!! related TS6203 tests/cases/conformance/expressions/contextualTyping/objectLiteralContextualTyping.ts:28:5: 'b' was also declared here. \ No newline at end of file diff --git a/tests/baselines/reference/objectRest.errors.txt b/tests/baselines/reference/objectRest.errors.txt index 02f64fbd4e2..f6fd179d28d 100644 --- a/tests/baselines/reference/objectRest.errors.txt +++ b/tests/baselines/reference/objectRest.errors.txt @@ -62,6 +62,7 @@ tests/cases/conformance/types/rest/objectRest.ts(44,53): error TS2739: Type '{}' !!! error TS2537: Type '{ a: number; b: string; }' has no matching index signature for type 'string'. ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o' must be of type '{ a: number; b: string; }', but here has type '{}'. +!!! related TS6203 tests/cases/conformance/types/rest/objectRest.ts:1:5: 'o' was also declared here. ({ [computed]: stillNotGreat, [computed2]: soSo, ...o } = o); ~~~~~~~~ !!! error TS2537: Type '{ a: number; b: string; }' has no matching index signature for type 'string'. diff --git a/tests/baselines/reference/optionalParamterAndVariableDeclaration2.errors.txt b/tests/baselines/reference/optionalParamterAndVariableDeclaration2.errors.txt index 982318d2f25..df38f7d2051 100644 --- a/tests/baselines/reference/optionalParamterAndVariableDeclaration2.errors.txt +++ b/tests/baselines/reference/optionalParamterAndVariableDeclaration2.errors.txt @@ -7,6 +7,7 @@ tests/cases/compiler/optionalParamterAndVariableDeclaration2.ts(3,13): error TS2 var options = (options || 0); ~~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'options' must be of type 'number | undefined', but here has type 'number'. +!!! related TS6203 tests/cases/compiler/optionalParamterAndVariableDeclaration2.ts:2:17: 'options' was also declared here. } } \ No newline at end of file diff --git a/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt b/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt index f108f0ea92d..fc8d68f1af8 100644 --- a/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt +++ b/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt @@ -33,6 +33,7 @@ tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(24,5): error TS234 var w: C; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'w' must be of type 'A', but here has type 'C'. +!!! related TS6203 tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts:21:5: 'w' was also declared here. w({ s: "", n: 0 }).toLowerCase(); ~~~~~ diff --git a/tests/baselines/reference/overloadResolution.errors.txt b/tests/baselines/reference/overloadResolution.errors.txt index 27d0392ca8d..fde241d62cc 100644 --- a/tests/baselines/reference/overloadResolution.errors.txt +++ b/tests/baselines/reference/overloadResolution.errors.txt @@ -120,6 +120,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): var n = fn5((n) => n.toFixed()); ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. +!!! related TS6203 tests/cases/conformance/expressions/functionCalls/overloadResolution.ts:54:5: 'n' was also declared here. ~~~~~~~ !!! error TS2339: Property 'toFixed' does not exist on type 'string'. var s = fn5((n) => n.substr(0)); diff --git a/tests/baselines/reference/overloadResolutionConstructors.errors.txt b/tests/baselines/reference/overloadResolutionConstructors.errors.txt index 2e09a84d138..40b660c7eaf 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.errors.txt +++ b/tests/baselines/reference/overloadResolutionConstructors.errors.txt @@ -129,6 +129,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors var n = new fn5((n) => n.toFixed()); ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. +!!! related TS6203 tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts:58:5: 'n' was also declared here. ~~~~~~~ !!! error TS2339: Property 'toFixed' does not exist on type 'string'. var s = new fn5((n) => n.substr(0)); diff --git a/tests/baselines/reference/parserCastVersusArrowFunction1.errors.txt b/tests/baselines/reference/parserCastVersusArrowFunction1.errors.txt index e2d90538b8c..9a34f75ce40 100644 --- a/tests/baselines/reference/parserCastVersusArrowFunction1.errors.txt +++ b/tests/baselines/reference/parserCastVersusArrowFunction1.errors.txt @@ -25,12 +25,15 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunctio var v = (a) => 1; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type '() => number', but here has type '(a: any) => number'. +!!! related TS6203 tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts:1:5: 'v' was also declared here. var v = (a, b) => 1; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type '() => number', but here has type '(a: any, b: any) => number'. +!!! related TS6203 tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts:1:5: 'v' was also declared here. var v = (a = 1, b = 2) => 1; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type '() => number', but here has type '(a?: number, b?: number) => number'. +!!! related TS6203 tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts:1:5: 'v' was also declared here. var v = (a); ~ diff --git a/tests/baselines/reference/promiseIdentity2.errors.txt b/tests/baselines/reference/promiseIdentity2.errors.txt index edfba2f42bc..0b5ba8d0ff0 100644 --- a/tests/baselines/reference/promiseIdentity2.errors.txt +++ b/tests/baselines/reference/promiseIdentity2.errors.txt @@ -14,4 +14,5 @@ tests/cases/compiler/promiseIdentity2.ts(11,5): error TS2403: Subsequent variabl var x: IPromise; var x: Promise; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'IPromise', but here has type 'Promise'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'IPromise', but here has type 'Promise'. +!!! related TS6203 tests/cases/compiler/promiseIdentity2.ts:10:5: 'x' was also declared here. \ No newline at end of file diff --git a/tests/baselines/reference/promiseIdentityWithAny2.errors.txt b/tests/baselines/reference/promiseIdentityWithAny2.errors.txt index 9d01438b88c..bedb948b078 100644 --- a/tests/baselines/reference/promiseIdentityWithAny2.errors.txt +++ b/tests/baselines/reference/promiseIdentityWithAny2.errors.txt @@ -15,6 +15,7 @@ tests/cases/compiler/promiseIdentityWithAny2.ts(22,5): error TS2403: Subsequent var x: Promise; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'IPromise', but here has type 'Promise'. +!!! related TS6203 tests/cases/compiler/promiseIdentityWithAny2.ts:9:5: 'x' was also declared here. interface IPromise2 { @@ -28,4 +29,5 @@ tests/cases/compiler/promiseIdentityWithAny2.ts(22,5): error TS2403: Subsequent var y: IPromise2; var y: Promise2; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'IPromise2', but here has type 'Promise2'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'IPromise2', but here has type 'Promise2'. +!!! related TS6203 tests/cases/compiler/promiseIdentityWithAny2.ts:21:5: 'y' was also declared here. \ No newline at end of file diff --git a/tests/baselines/reference/propertyAccess.errors.txt b/tests/baselines/reference/propertyAccess.errors.txt index a183ad79c11..1351a46e099 100644 --- a/tests/baselines/reference/propertyAccess.errors.txt +++ b/tests/baselines/reference/propertyAccess.errors.txt @@ -170,4 +170,5 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(149,5): err var x3: A; ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'A | B', but here has type 'A'. +!!! related TS6203 tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts:148:5: 'x3' was also declared here. \ No newline at end of file diff --git a/tests/baselines/reference/propertyIdentityWithPrivacyMismatch.errors.txt b/tests/baselines/reference/propertyIdentityWithPrivacyMismatch.errors.txt index 4c5644f6b76..f2ac54f6e7c 100644 --- a/tests/baselines/reference/propertyIdentityWithPrivacyMismatch.errors.txt +++ b/tests/baselines/reference/propertyIdentityWithPrivacyMismatch.errors.txt @@ -10,6 +10,7 @@ tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts(13,5): error TS240 var x: m2.Foo; // Should be error (mod1.Foo !== mod2.Foo) ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'Foo', but here has type 'Foo'. +!!! related TS6203 tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts:4:5: 'x' was also declared here. class Foo1 { private n; } @@ -20,6 +21,7 @@ tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts(13,5): error TS240 var y: Foo2; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'Foo1', but here has type 'Foo2'. +!!! related TS6203 tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts:12:5: 'y' was also declared here. ==== tests/cases/compiler/propertyIdentityWithPrivacyMismatch_0.ts (0 errors) ==== declare module 'mod1' { class Foo { diff --git a/tests/baselines/reference/reassignStaticProp.errors.txt b/tests/baselines/reference/reassignStaticProp.errors.txt index b1bfb869d68..bd62f1aa80d 100644 --- a/tests/baselines/reference/reassignStaticProp.errors.txt +++ b/tests/baselines/reference/reassignStaticProp.errors.txt @@ -12,6 +12,7 @@ tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2717: Subsequent prope !!! error TS2300: Duplicate identifier 'bar'. ~~~ !!! error TS2717: Subsequent property declarations must have the same type. Property 'bar' must be of type 'number', but here has type 'string'. +!!! related TS6203 tests/cases/compiler/reassignStaticProp.ts:3:12: 'bar' was also declared here. } diff --git a/tests/baselines/reference/spreadUnion2.errors.txt b/tests/baselines/reference/spreadUnion2.errors.txt index 0115c449930..f2c1bc75778 100644 --- a/tests/baselines/reference/spreadUnion2.errors.txt +++ b/tests/baselines/reference/spreadUnion2.errors.txt @@ -14,28 +14,34 @@ tests/cases/conformance/types/spread/spreadUnion2.ts(18,5): error TS2403: Subseq var o1 = { ...undefinedUnion }; ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o1' must be of type '{} | { a: number; }', but here has type '{}'. +!!! related TS6203 tests/cases/conformance/types/spread/spreadUnion2.ts:4:5: 'o1' was also declared here. var o2: {} | { b: number }; var o2 = { ...nullUnion }; ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o2' must be of type '{} | { b: number; }', but here has type '{}'. +!!! related TS6203 tests/cases/conformance/types/spread/spreadUnion2.ts:7:5: 'o2' was also declared here. var o3: {} | { a: number } | { b: number } | { a: number, b: number }; var o3 = { ...undefinedUnion, ...nullUnion }; ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o3' must be of type '{} | { a: number; } | { b: number; } | { a: number; b: number; }', but here has type '{}'. +!!! related TS6203 tests/cases/conformance/types/spread/spreadUnion2.ts:10:5: 'o3' was also declared here. var o3 = { ...nullUnion, ...undefinedUnion }; ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o3' must be of type '{} | { a: number; } | { b: number; } | { a: number; b: number; }', but here has type '{}'. +!!! related TS6203 tests/cases/conformance/types/spread/spreadUnion2.ts:10:5: 'o3' was also declared here. var o4: {} | { a: number }; var o4 = { ...undefinedUnion, ...undefinedUnion }; ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o4' must be of type '{} | { a: number; }', but here has type '{}'. +!!! related TS6203 tests/cases/conformance/types/spread/spreadUnion2.ts:14:5: 'o4' was also declared here. var o5: {} | { b: number }; var o5 = { ...nullUnion, ...nullUnion }; ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'o5' must be of type '{} | { b: number; }', but here has type '{}'. +!!! related TS6203 tests/cases/conformance/types/spread/spreadUnion2.ts:17:5: 'o5' was also declared here. \ No newline at end of file diff --git a/tests/baselines/reference/strictTupleLength.errors.txt b/tests/baselines/reference/strictTupleLength.errors.txt index 933c6e4dcdb..78cf7b47e97 100644 --- a/tests/baselines/reference/strictTupleLength.errors.txt +++ b/tests/baselines/reference/strictTupleLength.errors.txt @@ -17,9 +17,11 @@ tests/cases/conformance/types/tuple/strictTupleLength.ts(18,1): error TS2741: Pr var t1 = t2; // error ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 't1' must be of type '[number]', but here has type '[number, number]'. +!!! related TS6203 tests/cases/conformance/types/tuple/strictTupleLength.ts:2:5: 't1' was also declared here. var t2 = t1; // error ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 't2' must be of type '[number, number]', but here has type '[number]'. +!!! related TS6203 tests/cases/conformance/types/tuple/strictTupleLength.ts:3:5: 't2' was also declared here. type A = T['length']; var b: A<[boolean]>; diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt index b7018031a69..c678337cfc9 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt @@ -83,6 +83,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference var a9e: {}; ~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' must be of type '{ x: number; z: Date; y?: undefined; } | { x: number; y: string; z?: undefined; }', but here has type '{}'. +!!! related TS6203 tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts:75:5: 'a9e' was also declared here. // Generic tag with multiple parameters of generic type passed arguments with a single best common type var a9d = someGenerics9 `${ { x: 3 }}${ { x: 6 }}${ { x: 6 } }`; diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.errors.txt b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.errors.txt index ae63e6fd04d..e03b06d72e0 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.errors.txt @@ -83,6 +83,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference var a9e: {}; ~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' must be of type '{ x: number; z: Date; y?: undefined; } | { x: number; y: string; z?: undefined; }', but here has type '{}'. +!!! related TS6203 tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInferenceES6.ts:75:5: 'a9e' was also declared here. // Generic tag with multiple parameters of generic type passed arguments with a single best common type var a9d = someGenerics9 `${ { x: 3 }}${ { x: 6 }}${ { x: 6 } }`; diff --git a/tests/baselines/reference/tupleTypes.errors.txt b/tests/baselines/reference/tupleTypes.errors.txt index 1cf2f113d14..af76c872a6f 100644 --- a/tests/baselines/reference/tupleTypes.errors.txt +++ b/tests/baselines/reference/tupleTypes.errors.txt @@ -39,6 +39,7 @@ tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is n var t2: number|string; ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 't2' must be of type 'undefined', but here has type 'string | number'. +!!! related TS6203 tests/cases/compiler/tupleTypes.ts:11:5: 't2' was also declared here. t = []; // Error ~ @@ -79,6 +80,7 @@ tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is n var tt2: number | string; ~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'tt2' must be of type 'undefined', but here has type 'string | number'. +!!! related TS6203 tests/cases/compiler/tupleTypes.ts:35:5: 'tt2' was also declared here. tt = tuple2(1, undefined); tt = [1, undefined]; diff --git a/tests/baselines/reference/typeArgumentInference.errors.txt b/tests/baselines/reference/typeArgumentInference.errors.txt index 95e47ab583f..fd4bd90771e 100644 --- a/tests/baselines/reference/typeArgumentInference.errors.txt +++ b/tests/baselines/reference/typeArgumentInference.errors.txt @@ -92,6 +92,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(84,74 var a9e: {}; ~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' must be of type '{ x: number; z: Date; y?: undefined; } | { x: number; y: string; z?: undefined; }', but here has type '{}'. +!!! related TS6203 tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts:82:5: 'a9e' was also declared here. var a9f = someGenerics9(undefined, { x: 6, z: new Date() }, { x: 6, y: '' }); ~~~~~ !!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'. diff --git a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt index 8707ff26ef0..e40f1210487 100644 --- a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt @@ -154,6 +154,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct var a9e: {}; ~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' must be of type '{ x: number; z: Window; y?: undefined; } | { x: number; y: string; z?: undefined; }', but here has type '{}'. +!!! related TS6203 tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts:120:5: 'a9e' was also declared here. var a9f = new someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' }); ~~~~~ !!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'. diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt index 3b7750f23f0..e07a0be74cb 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt @@ -140,6 +140,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst var a9e: {}; ~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a9e' must be of type '{ x: number; z: Window; y?: undefined; } | { x: number; y: string; z?: undefined; }', but here has type '{}'. +!!! related TS6203 tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts:87:5: 'a9e' was also declared here. var a9f = someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' }); ~~~~~ !!! error TS2345: Argument of type '{ x: number; y: string; }' is not assignable to parameter of type 'A92'. diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.errors.txt b/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.errors.txt index e10cf2d1a78..52c312ae7c0 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.errors.txt +++ b/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.errors.txt @@ -21,6 +21,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHa var r1 = strOrNum; // string | number ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'string', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts:10:9: 'r1' was also declared here. } if (typeof strOrBool == "boolean") { @@ -30,6 +31,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHa var r2 = strOrBool; // string | boolean ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'boolean', but here has type 'string'. +!!! related TS6203 tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts:17:9: 'r2' was also declared here. } if (typeof numOrBool == "number") { @@ -39,6 +41,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHa var r3 = numOrBool; // number | boolean ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'number', but here has type 'boolean'. +!!! related TS6203 tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts:24:9: 'r3' was also declared here. } if (typeof strOrC == "Object") { @@ -50,4 +53,5 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHa var r4 = strOrC; // string | C ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'C', but here has type 'string'. +!!! related TS6203 tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts:31:9: 'r4' was also declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.errors.txt b/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.errors.txt index a0e9cd0f7bf..46b10e75b87 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.errors.txt +++ b/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.errors.txt @@ -21,6 +21,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasN var r1 = strOrNum; // string | number ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'number', but here has type 'string'. +!!! related TS6203 tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts:10:9: 'r1' was also declared here. } if (typeof strOrBool != "boolean") { @@ -30,6 +31,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasN var r2 = strOrBool; // string | boolean ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'string', but here has type 'boolean'. +!!! related TS6203 tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts:17:9: 'r2' was also declared here. } if (typeof numOrBool != "number") { @@ -39,6 +41,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasN var r3 = numOrBool; // number | boolean ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'boolean', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts:24:9: 'r3' was also declared here. } if (typeof strOrC != "Object") { @@ -50,4 +53,5 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasN var r4 = strOrC; // string | C ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'string', but here has type 'C'. +!!! related TS6203 tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts:31:9: 'r4' was also declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/typeOfEnumAndVarRedeclarations.errors.txt b/tests/baselines/reference/typeOfEnumAndVarRedeclarations.errors.txt index 89849d3a614..43035121212 100644 --- a/tests/baselines/reference/typeOfEnumAndVarRedeclarations.errors.txt +++ b/tests/baselines/reference/typeOfEnumAndVarRedeclarations.errors.txt @@ -14,9 +14,11 @@ tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(10,70): error TS2375: Dup var x: { readonly a: E; readonly b: E; readonly [x: number]: string; }; // Shouldnt error ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'typeof E', but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'. +!!! related TS6203 tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts:7:5: 'x' was also declared here. var y = E; var y: { readonly a: E; readonly b: E; readonly [x: number]: string; readonly [x: number]: string } // two errors: the types are not identical and duplicate signatures ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'typeof E', but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'. +!!! related TS6203 tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts:9:5: 'y' was also declared here. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2375: Duplicate number index signature. \ No newline at end of file diff --git a/tests/baselines/reference/typeOfThis.errors.txt b/tests/baselines/reference/typeOfThis.errors.txt index b47207670cc..adba7ba2f9f 100644 --- a/tests/baselines/reference/typeOfThis.errors.txt +++ b/tests/baselines/reference/typeOfThis.errors.txt @@ -27,12 +27,14 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(106,13): error TS2 var t: MyTestClass; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyTestClass'. +!!! related TS6203 tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts:13:16: 't' was also declared here. //type of 'this' in member function body is the class instance type var p = this; var p: MyTestClass; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyTestClass'. +!!! related TS6203 tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts:17:13: 'p' was also declared here. } //type of 'this' in member accessor(get and set) body is the class instance type @@ -41,6 +43,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(106,13): error TS2 var p: MyTestClass; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyTestClass'. +!!! related TS6203 tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts:23:13: 'p' was also declared here. return this; } set prop(v) { @@ -48,6 +51,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(106,13): error TS2 var p: MyTestClass; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyTestClass'. +!!! related TS6203 tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts:28:13: 'p' was also declared here. p = v; v = p; } @@ -58,6 +62,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(106,13): error TS2 var t: MyTestClass; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyTestClass'. +!!! related TS6203 tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts:36:13: 't' was also declared here. }; //type of 'this' in static function param list is constructor function type @@ -106,12 +111,14 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(106,13): error TS2 var t: MyGenericTestClass; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyGenericTestClass'. +!!! related TS6203 tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts:82:16: 't' was also declared here. //type of 'this' in member function body is the class instance type var p = this; var p: MyGenericTestClass; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyGenericTestClass'. +!!! related TS6203 tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts:86:13: 'p' was also declared here. } //type of 'this' in member accessor(get and set) body is the class instance type @@ -120,6 +127,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(106,13): error TS2 var p: MyGenericTestClass; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyGenericTestClass'. +!!! related TS6203 tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts:92:13: 'p' was also declared here. return this; } set prop(v) { @@ -127,6 +135,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(106,13): error TS2 var p: MyGenericTestClass; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyGenericTestClass'. +!!! related TS6203 tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts:97:13: 'p' was also declared here. p = v; v = p; } @@ -137,6 +146,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(106,13): error TS2 var t: MyGenericTestClass; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyGenericTestClass'. +!!! related TS6203 tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts:105:13: 't' was also declared here. }; //type of 'this' in static function param list is constructor function type diff --git a/tests/baselines/reference/unionTypeEquivalence.errors.txt b/tests/baselines/reference/unionTypeEquivalence.errors.txt index d561a96f97e..3a50459e925 100644 --- a/tests/baselines/reference/unionTypeEquivalence.errors.txt +++ b/tests/baselines/reference/unionTypeEquivalence.errors.txt @@ -9,6 +9,7 @@ tests/cases/conformance/types/union/unionTypeEquivalence.ts(5,5): error TS2403: var x : C | D; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'C', but here has type 'C | D'. +!!! related TS6203 tests/cases/conformance/types/union/unionTypeEquivalence.ts:4:5: 'x' was also declared here. // A | B is equivalent to B | A. var y: string | number; diff --git a/tests/baselines/reference/unionTypeIdentity.errors.txt b/tests/baselines/reference/unionTypeIdentity.errors.txt index 77d25bd78d1..4acb5895d41 100644 --- a/tests/baselines/reference/unionTypeIdentity.errors.txt +++ b/tests/baselines/reference/unionTypeIdentity.errors.txt @@ -12,9 +12,12 @@ tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeI var strOrNum: string; // error ~~~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'string'. +!!! related TS6203 tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts:3:5: 'strOrNum' was also declared here. var strOrNum: boolean; // error ~~~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'boolean'. +!!! related TS6203 tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts:3:5: 'strOrNum' was also declared here. var strOrNum: number; // error ~~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'number'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts:3:5: 'strOrNum' was also declared here. \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeLiterals.errors.txt b/tests/baselines/reference/unionTypeLiterals.errors.txt index d976d769f59..197f4e23647 100644 --- a/tests/baselines/reference/unionTypeLiterals.errors.txt +++ b/tests/baselines/reference/unionTypeLiterals.errors.txt @@ -16,9 +16,11 @@ tests/cases/conformance/types/specifyingTypes/typeLiterals/unionTypeLiterals.ts( var unionOfFunctionType: () => string | number; ~~~~~~~~~~~~~~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'unionOfFunctionType' must be of type '(() => string) | (() => number)', but here has type '() => string | number'. +!!! related TS6203 tests/cases/conformance/types/specifyingTypes/typeLiterals/unionTypeLiterals.ts:9:5: 'unionOfFunctionType' was also declared here. var unionOfConstructorType: (new () => string) | (new () => number); var unionOfConstructorType: { new (): string } | { new (): number }; var unionOfConstructorType: new () => string | number; ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'unionOfConstructorType' must be of type '(new () => string) | (new () => number)', but here has type 'new () => string | number'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'unionOfConstructorType' must be of type '(new () => string) | (new () => number)', but here has type 'new () => string | number'. +!!! related TS6203 tests/cases/conformance/types/specifyingTypes/typeLiterals/unionTypeLiterals.ts:13:5: 'unionOfConstructorType' was also declared here. \ No newline at end of file diff --git a/tests/baselines/reference/varBlock.errors.txt b/tests/baselines/reference/varBlock.errors.txt index 12e3fc6a629..bcdb58f5979 100644 --- a/tests/baselines/reference/varBlock.errors.txt +++ b/tests/baselines/reference/varBlock.errors.txt @@ -98,5 +98,6 @@ tests/cases/compiler/varBlock.ts(39,17): error TS1039: Initializers are not allo declare var c = 10; ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'c' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/compiler/varBlock.ts:38:13: 'c' was also declared here. ~~ !!! error TS1039: Initializers are not allowed in ambient contexts. \ No newline at end of file diff --git a/tests/baselines/reference/witness.errors.txt b/tests/baselines/reference/witness.errors.txt index cf21a8b2ed2..efaed3cc43c 100644 --- a/tests/baselines/reference/witness.errors.txt +++ b/tests/baselines/reference/witness.errors.txt @@ -56,6 +56,7 @@ tests/cases/conformance/types/witness/witness.ts(128,19): error TS2729: Property var co1: number; ~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'co1' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/types/witness/witness.ts:28:5: 'co1' was also declared here. var co2 = (3, 4, co2); ~ !!! error TS2695: Left side of comma operator is unused and has no side effects. @@ -72,22 +73,26 @@ tests/cases/conformance/types/witness/witness.ts(128,19): error TS2729: Property var co3: number; ~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'co3' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/types/witness/witness.ts:32:5: 'co3' was also declared here. // Assignment var as1 = (as1 = 2); var as1: number; ~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'as1' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/types/witness/witness.ts:36:5: 'as1' was also declared here. var as2 = (as2 = as2 = 2); var as2: number; ~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'as2' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/types/witness/witness.ts:38:5: 'as2' was also declared here. // Conditional var cnd1 = cnd1 ? 0 : 1; var cnd1: number; ~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'cnd1' must be of type 'any', but here has type 'number'. +!!! related TS6203 tests/cases/conformance/types/witness/witness.ts:42:5: 'cnd1' was also declared here. var cnd2 = cnd1 ? cnd1 ? '' : "" : ''; var cnd2: string; @@ -104,6 +109,7 @@ tests/cases/conformance/types/witness/witness.ts(128,19): error TS2729: Property var and1: string; ~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'and1' must be of type 'any', but here has type 'string'. +!!! related TS6203 tests/cases/conformance/types/witness/witness.ts:56:5: 'and1' was also declared here. var and2 = '' && and2; var and2: any; var and3 = and3 && and3; @@ -159,6 +165,7 @@ tests/cases/conformance/types/witness/witness.ts(128,19): error TS2729: Property var propAcc1: { m: any; } ~~~~~~~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'propAcc1' must be of type 'any', but here has type '{ m: any; }'. +!!! related TS6203 tests/cases/conformance/types/witness/witness.ts:107:5: 'propAcc1' was also declared here. // Property access of module member module M2 { From 2856aabd70463e320ccc0afc9a0d813187d17d9d Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 21 May 2019 15:28:16 -0700 Subject: [PATCH 125/384] Parse stray identifier-ish as JSXText instead of trivia --- src/compiler/parser.ts | 5 +++-- src/harness/fourslash.ts | 9 +++++---- tests/cases/fourslash/fourslash.ts | 2 +- .../fourslash/jsxExpressionFollowedByIdentifier.ts | 13 +++++-------- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index f3b0c2c06e6..e56ff98846e 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4439,8 +4439,9 @@ namespace ts { parseExpected(SyntaxKind.CloseBraceToken); } else { - parseExpected(SyntaxKind.CloseBraceToken, /*message*/ undefined, /*shouldAdvance*/ false); - scanJsxText(); + if (parseExpected(SyntaxKind.CloseBraceToken, /*message*/ undefined, /*shouldAdvance*/ false)) { + scanJsxText(); + } } return finishNode(node); diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index a2e2c0f29af..5d0725ea106 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -582,12 +582,13 @@ namespace FourSlash { }); } - public verifyErrorExistsAtRange(range: Range, code: number) { + public verifyErrorExistsAtRange(range: Range, code: number, expectedMessage?: string) { const span = ts.createTextSpanFromRange(range); const hasMatchingError = ts.some( this.getDiagnostics(range.fileName), - ({ code, start, length }) => + ({ code, messageText, start, length }) => code === code && + (!expectedMessage || expectedMessage === messageText) && ts.isNumber(start) && ts.isNumber(length) && ts.textSpansEqual(span, { start, length })); @@ -3982,8 +3983,8 @@ namespace FourSlashInterface { this.state.verifyNoErrors(); } - public errorExistsAtRange(range: FourSlash.Range, code: number) { - this.state.verifyErrorExistsAtRange(range, code); + public errorExistsAtRange(range: FourSlash.Range, code: number, message?: string) { + this.state.verifyErrorExistsAtRange(range, code, message); } public numberOfErrorsInCurrentFile(expected: number) { diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 427a3558b31..e6f2a08f002 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -238,7 +238,7 @@ declare namespace FourSlashInterface { signatureHelp(...options: VerifySignatureHelpOptions[], ): void; // Checks that there are no compile errors. noErrors(): void; - errorExistsAtRange(range: Range, code: number): void; + errorExistsAtRange(range: Range, code: number, message?: string): void; numberOfErrorsInCurrentFile(expected: number): void; baselineCurrentFileBreakpointLocations(): void; baselineCurrentFileNameOrDottedNameSpans(): void; diff --git a/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts b/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts index d040bacd546..501a325b989 100644 --- a/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts +++ b/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts @@ -2,14 +2,11 @@ //@Filename: jsxExpressionFollowedByIdentifier.tsx ////declare var React: any; -////declare var x: string; ////const a =
{
[|x|]}
////const b =
[|x|]} /> -const range = test.ranges()[0]; -verify.getSyntacticDiagnostics([{ - code: 1005, - message: "'}' expected.", - range, -}]); -verify.quickInfoAt(range, 'var x: string'); \ No newline at end of file +test.ranges().forEach(range => { + verify.errorExistsAtRange(range, 1005, "'}' expected."); + // This is just to ensure getting quick info doesn’t crash + verify.not.quickInfoExists(); +}); From 52894cf8500ec9b1b864d2118bb79d7b86cfe772 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 21 May 2019 15:39:07 -0700 Subject: [PATCH 126/384] Accept baselines, I guess --- .../baselines/reference/jsxAndTypeAssertion.js | 11 +++++++---- .../reference/jsxInvalidEsprimaTestSuite.js | 2 +- .../reference/jsxParsingError1.errors.txt | 17 +++++++---------- tests/baselines/reference/jsxParsingError1.js | 3 +-- .../reference/jsxParsingError1.symbols | 2 +- .../baselines/reference/jsxParsingError1.types | 6 +++--- .../reference/tsxErrorRecovery1.errors.txt | 16 ++-------------- tests/baselines/reference/tsxErrorRecovery1.js | 8 +++----- .../reference/tsxErrorRecovery1.symbols | 2 ++ .../baselines/reference/tsxErrorRecovery1.types | 10 ++++++---- 10 files changed, 33 insertions(+), 44 deletions(-) diff --git a/tests/baselines/reference/jsxAndTypeAssertion.js b/tests/baselines/reference/jsxAndTypeAssertion.js index cf4033f4c57..fb51acd6fd4 100644 --- a/tests/baselines/reference/jsxAndTypeAssertion.js +++ b/tests/baselines/reference/jsxAndTypeAssertion.js @@ -28,18 +28,21 @@ var foo = /** @class */ (function () { return foo; }()); var x; -x = {test} }; +x = {test}: }; x = ; -x = hello {} } +x = hello {} }; x = }>hello}/> -x = }>hello{}} +x = }>hello{}}; x = x, x = ; {{/foo/.test(x) ? : }} : -}}}/>; +} + + +}}/>; diff --git a/tests/baselines/reference/jsxInvalidEsprimaTestSuite.js b/tests/baselines/reference/jsxInvalidEsprimaTestSuite.js index bf17ca57c0d..b04a03079b7 100644 --- a/tests/baselines/reference/jsxInvalidEsprimaTestSuite.js +++ b/tests/baselines/reference/jsxInvalidEsprimaTestSuite.js @@ -123,7 +123,7 @@ var x =
one
,
two
; var x =
one
/* intervening comment */, /* intervening comment */
two
; ; //// [20.jsx] -
{"str"}}; +{"str"};}; //// [21.jsx] ; //// [22.jsx] diff --git a/tests/baselines/reference/jsxParsingError1.errors.txt b/tests/baselines/reference/jsxParsingError1.errors.txt index dec1228fd72..a3e4e0b4f25 100644 --- a/tests/baselines/reference/jsxParsingError1.errors.txt +++ b/tests/baselines/reference/jsxParsingError1.errors.txt @@ -1,9 +1,8 @@ -tests/cases/conformance/jsx/file.tsx(11,36): error TS1005: '}' expected. -tests/cases/conformance/jsx/file.tsx(11,44): error TS1003: Identifier expected. -tests/cases/conformance/jsx/file.tsx(11,46): error TS1161: Unterminated regular expression literal. +tests/cases/conformance/jsx/file.tsx(11,30): error TS2695: Left side of comma operator is unused and has no side effects. +tests/cases/conformance/jsx/file.tsx(11,30): error TS18007: JSX expressions may not use the comma operator. Did you mean to write an array? -==== tests/cases/conformance/jsx/file.tsx (3 errors) ==== +==== tests/cases/conformance/jsx/file.tsx (2 errors) ==== declare module JSX { interface Element { } interface IntrinsicElements { @@ -15,10 +14,8 @@ tests/cases/conformance/jsx/file.tsx(11,46): error TS1161: Unterminated regular const class1 = "foo"; const class2 = "bar"; const elem =
; - ~ -!!! error TS1005: '}' expected. - ~ -!!! error TS1003: Identifier expected. - -!!! error TS1161: Unterminated regular expression literal. + ~~~~~~ +!!! error TS2695: Left side of comma operator is unused and has no side effects. + ~~~~~~~~~~~~~~ +!!! error TS18007: JSX expressions may not use the comma operator. Did you mean to write an array? \ No newline at end of file diff --git a/tests/baselines/reference/jsxParsingError1.js b/tests/baselines/reference/jsxParsingError1.js index bf2d48b0491..09bb9c113c1 100644 --- a/tests/baselines/reference/jsxParsingError1.js +++ b/tests/baselines/reference/jsxParsingError1.js @@ -16,5 +16,4 @@ const elem =
; // This should be a parse error var class1 = "foo"; var class2 = "bar"; -var elem =
; -/>;; +var elem =
; diff --git a/tests/baselines/reference/jsxParsingError1.symbols b/tests/baselines/reference/jsxParsingError1.symbols index 35d1ba6c290..535f39f5927 100644 --- a/tests/baselines/reference/jsxParsingError1.symbols +++ b/tests/baselines/reference/jsxParsingError1.symbols @@ -25,5 +25,5 @@ const elem =
; >div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22)) >className : Symbol(className, Decl(file.tsx, 10, 17)) >class1 : Symbol(class1, Decl(file.tsx, 8, 5)) ->class2 : Symbol(class2, Decl(file.tsx, 10, 36)) +>class2 : Symbol(class2, Decl(file.tsx, 9, 5)) diff --git a/tests/baselines/reference/jsxParsingError1.types b/tests/baselines/reference/jsxParsingError1.types index 3278c28c724..2d4c65b91d0 100644 --- a/tests/baselines/reference/jsxParsingError1.types +++ b/tests/baselines/reference/jsxParsingError1.types @@ -18,10 +18,10 @@ const class2 = "bar"; const elem =
; >elem : JSX.Element ->
: JSX.Element >div : any >className : string +>class1, class2 : "bar" >class1 : "foo" ->class2 : true ->/>; : RegExp +>class2 : "bar" diff --git a/tests/baselines/reference/tsxErrorRecovery1.errors.txt b/tests/baselines/reference/tsxErrorRecovery1.errors.txt index d7e4f5c55df..34c2a3fc879 100644 --- a/tests/baselines/reference/tsxErrorRecovery1.errors.txt +++ b/tests/baselines/reference/tsxErrorRecovery1.errors.txt @@ -1,26 +1,14 @@ -tests/cases/conformance/jsx/file.tsx(4,11): error TS17008: JSX element 'div' has no corresponding closing tag. tests/cases/conformance/jsx/file.tsx(4,19): error TS1109: Expression expected. -tests/cases/conformance/jsx/file.tsx(7,11): error TS2304: Cannot find name 'a'. -tests/cases/conformance/jsx/file.tsx(7,12): error TS1005: '}' expected. -tests/cases/conformance/jsx/file.tsx(8,1): error TS1005: ' {
- ~~~ -!!! error TS17008: JSX element 'div' has no corresponding closing tag. ~~ !!! error TS1109: Expression expected. } // Shouldn't see any errors down here var y = { a: 1 }; - ~ -!!! error TS2304: Cannot find name 'a'. - ~ -!!! error TS1005: '}' expected. - - -!!! error TS1005: ' {}div> -} -// Shouldn't see any errors down here -var y = {a} 1 }; - ; + var x =
{}
; } +// Shouldn't see any errors down here +var y = { a: 1 }; diff --git a/tests/baselines/reference/tsxErrorRecovery1.symbols b/tests/baselines/reference/tsxErrorRecovery1.symbols index de6bce7d278..2b39f9bbce7 100644 --- a/tests/baselines/reference/tsxErrorRecovery1.symbols +++ b/tests/baselines/reference/tsxErrorRecovery1.symbols @@ -11,4 +11,6 @@ function foo() { } // Shouldn't see any errors down here var y = { a: 1 }; +>y : Symbol(y, Decl(file.tsx, 6, 3)) +>a : Symbol(a, Decl(file.tsx, 6, 9)) diff --git a/tests/baselines/reference/tsxErrorRecovery1.types b/tests/baselines/reference/tsxErrorRecovery1.types index d75b4ab89ae..010097d4166 100644 --- a/tests/baselines/reference/tsxErrorRecovery1.types +++ b/tests/baselines/reference/tsxErrorRecovery1.types @@ -6,13 +6,15 @@ function foo() { var x =
{
>x : JSX.Element ->
{
}// Shouldn't see any errors down herevar y = { a: 1 }; : JSX.Element +>
{
: JSX.Element >div : any > : any +>div : any } // Shouldn't see any errors down here var y = { a: 1 }; ->a : any - -> : any +>y : { a: number; } +>{ a: 1 } : { a: number; } +>a : number +>1 : 1 From 8120094c81236651da967c33d7bd5ca185188faf Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 22 May 2019 06:49:49 -0700 Subject: [PATCH 127/384] Simplify index and object types when obtaining indexed access constraint --- src/compiler/checker.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e9dddff64af..bd8d4c05901 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7657,15 +7657,20 @@ namespace ts { return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : undefined; } + function getSimplifiedTypeOrConstraint(type: Type) { + const simplified = getSimplifiedType(type, /*writing*/ false); + return simplified !== type ? simplified : getConstraintOfType(type); + } + function getConstraintFromIndexedAccess(type: IndexedAccessType) { - const indexConstraint = getConstraintOfType(type.indexType); + const indexConstraint = getSimplifiedTypeOrConstraint(type.indexType); if (indexConstraint && indexConstraint !== type.indexType) { const indexedAccess = getIndexedAccessTypeOrUndefined(type.objectType, indexConstraint); if (indexedAccess) { return indexedAccess; } } - const objectConstraint = getConstraintOfType(type.objectType); + const objectConstraint = getSimplifiedTypeOrConstraint(type.objectType); if (objectConstraint && objectConstraint !== type.objectType) { return getIndexedAccessTypeOrUndefined(objectConstraint, type.indexType); } From 2fd4aaee92a17318ad1c45c6f6590bbb8b82d33d Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 22 May 2019 06:54:16 -0700 Subject: [PATCH 128/384] Add regression test --- .../conformance/types/keyof/keyofAndIndexedAccess2.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts index a99c2b0a7a1..898648cea44 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts @@ -147,3 +147,13 @@ export class c { this["a"] = "b"; } } + +// Repro from #31385 + +type Foo = { [key: string]: { [K in keyof T]: K }[keyof T] }; + +type Bar = { [key: string]: { [K in keyof T]: [K] }[keyof T] }; + +type Baz> = { [K in keyof Q]: T[Q[K]] }; + +type Qux> = { [K in keyof Q]: T[Q[K]["0"]] }; From b7012b577a6e755215f80d3166e90f60aa50b98e Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 22 May 2019 06:54:23 -0700 Subject: [PATCH 129/384] Accept new baselines --- .../keyofAndIndexedAccess2.errors.txt | 10 +++++ .../reference/keyofAndIndexedAccess2.js | 10 +++++ .../reference/keyofAndIndexedAccess2.symbols | 44 +++++++++++++++++++ .../reference/keyofAndIndexedAccess2.types | 16 +++++++ 4 files changed, 80 insertions(+) diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt index 9ebf28f1857..1cad297c52d 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt @@ -228,4 +228,14 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 this["a"] = "b"; } } + + // Repro from #31385 + + type Foo = { [key: string]: { [K in keyof T]: K }[keyof T] }; + + type Bar = { [key: string]: { [K in keyof T]: [K] }[keyof T] }; + + type Baz> = { [K in keyof Q]: T[Q[K]] }; + + type Qux> = { [K in keyof Q]: T[Q[K]["0"]] }; \ No newline at end of file diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.js b/tests/baselines/reference/keyofAndIndexedAccess2.js index 374b13b5a64..7547a3f84c5 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.js +++ b/tests/baselines/reference/keyofAndIndexedAccess2.js @@ -145,6 +145,16 @@ export class c { this["a"] = "b"; } } + +// Repro from #31385 + +type Foo = { [key: string]: { [K in keyof T]: K }[keyof T] }; + +type Bar = { [key: string]: { [K in keyof T]: [K] }[keyof T] }; + +type Baz> = { [K in keyof Q]: T[Q[K]] }; + +type Qux> = { [K in keyof Q]: T[Q[K]["0"]] }; //// [keyofAndIndexedAccess2.js] diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.symbols b/tests/baselines/reference/keyofAndIndexedAccess2.symbols index a3412e8a47d..91602f93e1d 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess2.symbols @@ -517,3 +517,47 @@ export class c { } } +// Repro from #31385 + +type Foo = { [key: string]: { [K in keyof T]: K }[keyof T] }; +>Foo : Symbol(Foo, Decl(keyofAndIndexedAccess2.ts, 145, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 149, 9)) +>key : Symbol(key, Decl(keyofAndIndexedAccess2.ts, 149, 17)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 149, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 149, 9)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 149, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 149, 9)) + +type Bar = { [key: string]: { [K in keyof T]: [K] }[keyof T] }; +>Bar : Symbol(Bar, Decl(keyofAndIndexedAccess2.ts, 149, 64)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 151, 9)) +>key : Symbol(key, Decl(keyofAndIndexedAccess2.ts, 151, 17)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 151, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 151, 9)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 151, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 151, 9)) + +type Baz> = { [K in keyof Q]: T[Q[K]] }; +>Baz : Symbol(Baz, Decl(keyofAndIndexedAccess2.ts, 151, 66)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 153, 9)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 153, 11)) +>Foo : Symbol(Foo, Decl(keyofAndIndexedAccess2.ts, 145, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 153, 9)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 153, 35)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 153, 11)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 153, 9)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 153, 11)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 153, 35)) + +type Qux> = { [K in keyof Q]: T[Q[K]["0"]] }; +>Qux : Symbol(Qux, Decl(keyofAndIndexedAccess2.ts, 153, 60)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 155, 9)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 155, 11)) +>Bar : Symbol(Bar, Decl(keyofAndIndexedAccess2.ts, 149, 64)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 155, 9)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 155, 35)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 155, 11)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 155, 9)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 155, 11)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 155, 35)) + diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.types b/tests/baselines/reference/keyofAndIndexedAccess2.types index b7b71ba4f9f..45cf1d4bad5 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.types +++ b/tests/baselines/reference/keyofAndIndexedAccess2.types @@ -517,3 +517,19 @@ export class c { } } +// Repro from #31385 + +type Foo = { [key: string]: { [K in keyof T]: K }[keyof T] }; +>Foo : Foo +>key : string + +type Bar = { [key: string]: { [K in keyof T]: [K] }[keyof T] }; +>Bar : Bar +>key : string + +type Baz> = { [K in keyof Q]: T[Q[K]] }; +>Baz : Baz + +type Qux> = { [K in keyof Q]: T[Q[K]["0"]] }; +>Qux : Qux + From b36c8a06902ca47da1568167991bd0bc28ced80e Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 22 May 2019 09:45:41 -0700 Subject: [PATCH 130/384] Make anyArray.filter(Boolean) return any[], not unknown[] (#31515) * Add this-parameter workaround to Array.filter Allows anys.filter(Boolean) to once again return any[], not unknown[]. * Add any constraint to Boolean factory function I want to test how well this works. * Remove Boolean factory type guard * Remove typeGuardBoolean test --- src/lib/es5.d.ts | 2 +- .../reference/booleanFilterAnyArray.js | 37 ++++++ .../reference/booleanFilterAnyArray.symbols | 108 ++++++++++++++++++ .../reference/booleanFilterAnyArray.types | 94 +++++++++++++++ tests/baselines/reference/typeGuardBoolean.js | 30 ----- .../reference/typeGuardBoolean.symbols | 35 ------ .../reference/typeGuardBoolean.types | 44 ------- tests/cases/compiler/booleanFilterAnyArray.ts | 24 ++++ .../typeGuards/typeGuardBoolean.ts | 14 --- 9 files changed, 264 insertions(+), 124 deletions(-) create mode 100644 tests/baselines/reference/booleanFilterAnyArray.js create mode 100644 tests/baselines/reference/booleanFilterAnyArray.symbols create mode 100644 tests/baselines/reference/booleanFilterAnyArray.types delete mode 100644 tests/baselines/reference/typeGuardBoolean.js delete mode 100644 tests/baselines/reference/typeGuardBoolean.symbols delete mode 100644 tests/baselines/reference/typeGuardBoolean.types create mode 100644 tests/cases/compiler/booleanFilterAnyArray.ts delete mode 100644 tests/cases/conformance/expressions/typeGuards/typeGuardBoolean.ts diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index f2be6716c72..0d1481dd7d2 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -513,7 +513,7 @@ interface Boolean { interface BooleanConstructor { new(value?: any): Boolean; - (value?: T): value is Exclude; + (value?: T): boolean; readonly prototype: Boolean; } diff --git a/tests/baselines/reference/booleanFilterAnyArray.js b/tests/baselines/reference/booleanFilterAnyArray.js new file mode 100644 index 00000000000..2cd319ca440 --- /dev/null +++ b/tests/baselines/reference/booleanFilterAnyArray.js @@ -0,0 +1,37 @@ +//// [booleanFilterAnyArray.ts] +interface Bullean { } +interface BulleanConstructor { + new(v1?: any): Bullean; + (v2?: T): v2 is T; +} + +interface Ari { + filter(cb1: (value: T) => value is S): T extends any ? Ari : Ari; + filter(cb2: (value: T) => unknown): Ari; +} +declare var Bullean: BulleanConstructor; +declare let anys: Ari; +var xs: Ari; +var xs = anys.filter(Bullean) + +declare let realanys: any[]; +var ys: any[]; +var ys = realanys.filter(Boolean) + +var foo = [{ name: 'x' }] +var foor: Array<{name: string}> +var foor = foo.filter(x => x.name) +var foos: Array +var foos = [true, true, false, null].filter((thing): thing is boolean => thing !== null) + + +//// [booleanFilterAnyArray.js] +var xs; +var xs = anys.filter(Bullean); +var ys; +var ys = realanys.filter(Boolean); +var foo = [{ name: 'x' }]; +var foor; +var foor = foo.filter(function (x) { return x.name; }); +var foos; +var foos = [true, true, false, null].filter(function (thing) { return thing !== null; }); diff --git a/tests/baselines/reference/booleanFilterAnyArray.symbols b/tests/baselines/reference/booleanFilterAnyArray.symbols new file mode 100644 index 00000000000..1e0207fdf80 --- /dev/null +++ b/tests/baselines/reference/booleanFilterAnyArray.symbols @@ -0,0 +1,108 @@ +=== tests/cases/compiler/booleanFilterAnyArray.ts === +interface Bullean { } +>Bullean : Symbol(Bullean, Decl(booleanFilterAnyArray.ts, 0, 0), Decl(booleanFilterAnyArray.ts, 10, 11)) + +interface BulleanConstructor { +>BulleanConstructor : Symbol(BulleanConstructor, Decl(booleanFilterAnyArray.ts, 0, 21)) + + new(v1?: any): Bullean; +>v1 : Symbol(v1, Decl(booleanFilterAnyArray.ts, 2, 8)) +>Bullean : Symbol(Bullean, Decl(booleanFilterAnyArray.ts, 0, 0), Decl(booleanFilterAnyArray.ts, 10, 11)) + + (v2?: T): v2 is T; +>T : Symbol(T, Decl(booleanFilterAnyArray.ts, 3, 5)) +>v2 : Symbol(v2, Decl(booleanFilterAnyArray.ts, 3, 8)) +>T : Symbol(T, Decl(booleanFilterAnyArray.ts, 3, 5)) +>v2 : Symbol(v2, Decl(booleanFilterAnyArray.ts, 3, 8)) +>T : Symbol(T, Decl(booleanFilterAnyArray.ts, 3, 5)) +} + +interface Ari { +>Ari : Symbol(Ari, Decl(booleanFilterAnyArray.ts, 4, 1)) +>T : Symbol(T, Decl(booleanFilterAnyArray.ts, 6, 14)) + + filter(cb1: (value: T) => value is S): T extends any ? Ari : Ari; +>filter : Symbol(Ari.filter, Decl(booleanFilterAnyArray.ts, 6, 18), Decl(booleanFilterAnyArray.ts, 7, 90)) +>S : Symbol(S, Decl(booleanFilterAnyArray.ts, 7, 11)) +>T : Symbol(T, Decl(booleanFilterAnyArray.ts, 6, 14)) +>cb1 : Symbol(cb1, Decl(booleanFilterAnyArray.ts, 7, 24)) +>value : Symbol(value, Decl(booleanFilterAnyArray.ts, 7, 30)) +>T : Symbol(T, Decl(booleanFilterAnyArray.ts, 6, 14)) +>value : Symbol(value, Decl(booleanFilterAnyArray.ts, 7, 30)) +>S : Symbol(S, Decl(booleanFilterAnyArray.ts, 7, 11)) +>T : Symbol(T, Decl(booleanFilterAnyArray.ts, 6, 14)) +>Ari : Symbol(Ari, Decl(booleanFilterAnyArray.ts, 4, 1)) +>Ari : Symbol(Ari, Decl(booleanFilterAnyArray.ts, 4, 1)) +>S : Symbol(S, Decl(booleanFilterAnyArray.ts, 7, 11)) + + filter(cb2: (value: T) => unknown): Ari; +>filter : Symbol(Ari.filter, Decl(booleanFilterAnyArray.ts, 6, 18), Decl(booleanFilterAnyArray.ts, 7, 90)) +>cb2 : Symbol(cb2, Decl(booleanFilterAnyArray.ts, 8, 11)) +>value : Symbol(value, Decl(booleanFilterAnyArray.ts, 8, 17)) +>T : Symbol(T, Decl(booleanFilterAnyArray.ts, 6, 14)) +>Ari : Symbol(Ari, Decl(booleanFilterAnyArray.ts, 4, 1)) +>T : Symbol(T, Decl(booleanFilterAnyArray.ts, 6, 14)) +} +declare var Bullean: BulleanConstructor; +>Bullean : Symbol(Bullean, Decl(booleanFilterAnyArray.ts, 0, 0), Decl(booleanFilterAnyArray.ts, 10, 11)) +>BulleanConstructor : Symbol(BulleanConstructor, Decl(booleanFilterAnyArray.ts, 0, 21)) + +declare let anys: Ari; +>anys : Symbol(anys, Decl(booleanFilterAnyArray.ts, 11, 11)) +>Ari : Symbol(Ari, Decl(booleanFilterAnyArray.ts, 4, 1)) + +var xs: Ari; +>xs : Symbol(xs, Decl(booleanFilterAnyArray.ts, 12, 3), Decl(booleanFilterAnyArray.ts, 13, 3)) +>Ari : Symbol(Ari, Decl(booleanFilterAnyArray.ts, 4, 1)) + +var xs = anys.filter(Bullean) +>xs : Symbol(xs, Decl(booleanFilterAnyArray.ts, 12, 3), Decl(booleanFilterAnyArray.ts, 13, 3)) +>anys.filter : Symbol(Ari.filter, Decl(booleanFilterAnyArray.ts, 6, 18), Decl(booleanFilterAnyArray.ts, 7, 90)) +>anys : Symbol(anys, Decl(booleanFilterAnyArray.ts, 11, 11)) +>filter : Symbol(Ari.filter, Decl(booleanFilterAnyArray.ts, 6, 18), Decl(booleanFilterAnyArray.ts, 7, 90)) +>Bullean : Symbol(Bullean, Decl(booleanFilterAnyArray.ts, 0, 0), Decl(booleanFilterAnyArray.ts, 10, 11)) + +declare let realanys: any[]; +>realanys : Symbol(realanys, Decl(booleanFilterAnyArray.ts, 15, 11)) + +var ys: any[]; +>ys : Symbol(ys, Decl(booleanFilterAnyArray.ts, 16, 3), Decl(booleanFilterAnyArray.ts, 17, 3)) + +var ys = realanys.filter(Boolean) +>ys : Symbol(ys, Decl(booleanFilterAnyArray.ts, 16, 3), Decl(booleanFilterAnyArray.ts, 17, 3)) +>realanys.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>realanys : Symbol(realanys, Decl(booleanFilterAnyArray.ts, 15, 11)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +var foo = [{ name: 'x' }] +>foo : Symbol(foo, Decl(booleanFilterAnyArray.ts, 19, 3)) +>name : Symbol(name, Decl(booleanFilterAnyArray.ts, 19, 12)) + +var foor: Array<{name: string}> +>foor : Symbol(foor, Decl(booleanFilterAnyArray.ts, 20, 3), Decl(booleanFilterAnyArray.ts, 21, 3)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>name : Symbol(name, Decl(booleanFilterAnyArray.ts, 20, 17)) + +var foor = foo.filter(x => x.name) +>foor : Symbol(foor, Decl(booleanFilterAnyArray.ts, 20, 3), Decl(booleanFilterAnyArray.ts, 21, 3)) +>foo.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(booleanFilterAnyArray.ts, 19, 3)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(booleanFilterAnyArray.ts, 21, 22)) +>x.name : Symbol(name, Decl(booleanFilterAnyArray.ts, 19, 12)) +>x : Symbol(x, Decl(booleanFilterAnyArray.ts, 21, 22)) +>name : Symbol(name, Decl(booleanFilterAnyArray.ts, 19, 12)) + +var foos: Array +>foos : Symbol(foos, Decl(booleanFilterAnyArray.ts, 22, 3), Decl(booleanFilterAnyArray.ts, 23, 3)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +var foos = [true, true, false, null].filter((thing): thing is boolean => thing !== null) +>foos : Symbol(foos, Decl(booleanFilterAnyArray.ts, 22, 3), Decl(booleanFilterAnyArray.ts, 23, 3)) +>[true, true, false, null].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>thing : Symbol(thing, Decl(booleanFilterAnyArray.ts, 23, 45)) +>thing : Symbol(thing, Decl(booleanFilterAnyArray.ts, 23, 45)) +>thing : Symbol(thing, Decl(booleanFilterAnyArray.ts, 23, 45)) + diff --git a/tests/baselines/reference/booleanFilterAnyArray.types b/tests/baselines/reference/booleanFilterAnyArray.types new file mode 100644 index 00000000000..a1d4303ef8e --- /dev/null +++ b/tests/baselines/reference/booleanFilterAnyArray.types @@ -0,0 +1,94 @@ +=== tests/cases/compiler/booleanFilterAnyArray.ts === +interface Bullean { } +interface BulleanConstructor { + new(v1?: any): Bullean; +>v1 : any + + (v2?: T): v2 is T; +>v2 : T +} + +interface Ari { + filter(cb1: (value: T) => value is S): T extends any ? Ari : Ari; +>filter : { (cb1: (value: T) => value is S): T extends any ? Ari : Ari; (cb2: (value: T) => unknown): Ari; } +>cb1 : (value: T) => value is S +>value : T + + filter(cb2: (value: T) => unknown): Ari; +>filter : { (cb1: (value: T) => value is S): T extends any ? Ari : Ari; (cb2: (value: T) => unknown): Ari; } +>cb2 : (value: T) => unknown +>value : T +} +declare var Bullean: BulleanConstructor; +>Bullean : BulleanConstructor + +declare let anys: Ari; +>anys : Ari + +var xs: Ari; +>xs : Ari + +var xs = anys.filter(Bullean) +>xs : Ari +>anys.filter(Bullean) : Ari +>anys.filter : { (cb1: (value: any) => value is S): Ari; (cb2: (value: any) => unknown): Ari; } +>anys : Ari +>filter : { (cb1: (value: any) => value is S): Ari; (cb2: (value: any) => unknown): Ari; } +>Bullean : BulleanConstructor + +declare let realanys: any[]; +>realanys : any[] + +var ys: any[]; +>ys : any[] + +var ys = realanys.filter(Boolean) +>ys : any[] +>realanys.filter(Boolean) : any[] +>realanys.filter : { (callbackfn: (value: any, index: number, array: any[]) => value is S, thisArg?: any): S[]; (callbackfn: (value: any, index: number, array: any[]) => unknown, thisArg?: any): any[]; } +>realanys : any[] +>filter : { (callbackfn: (value: any, index: number, array: any[]) => value is S, thisArg?: any): S[]; (callbackfn: (value: any, index: number, array: any[]) => unknown, thisArg?: any): any[]; } +>Boolean : BooleanConstructor + +var foo = [{ name: 'x' }] +>foo : { name: string; }[] +>[{ name: 'x' }] : { name: string; }[] +>{ name: 'x' } : { name: string; } +>name : string +>'x' : "x" + +var foor: Array<{name: string}> +>foor : { name: string; }[] +>name : string + +var foor = foo.filter(x => x.name) +>foor : { name: string; }[] +>foo.filter(x => x.name) : { name: string; }[] +>foo.filter : { (callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg?: any): S[]; (callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => unknown, thisArg?: any): { name: string; }[]; } +>foo : { name: string; }[] +>filter : { (callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg?: any): S[]; (callbackfn: (value: { name: string; }, index: number, array: { name: string; }[]) => unknown, thisArg?: any): { name: string; }[]; } +>x => x.name : (x: { name: string; }) => string +>x : { name: string; } +>x.name : string +>x : { name: string; } +>name : string + +var foos: Array +>foos : boolean[] + +var foos = [true, true, false, null].filter((thing): thing is boolean => thing !== null) +>foos : boolean[] +>[true, true, false, null].filter((thing): thing is boolean => thing !== null) : boolean[] +>[true, true, false, null].filter : { (callbackfn: (value: boolean, index: number, array: boolean[]) => value is S, thisArg?: any): S[]; (callbackfn: (value: boolean, index: number, array: boolean[]) => unknown, thisArg?: any): boolean[]; } +>[true, true, false, null] : boolean[] +>true : true +>true : true +>false : false +>null : null +>filter : { (callbackfn: (value: boolean, index: number, array: boolean[]) => value is S, thisArg?: any): S[]; (callbackfn: (value: boolean, index: number, array: boolean[]) => unknown, thisArg?: any): boolean[]; } +>(thing): thing is boolean => thing !== null : (thing: boolean) => thing is boolean +>thing : boolean +>thing !== null : boolean +>thing : boolean +>null : null + diff --git a/tests/baselines/reference/typeGuardBoolean.js b/tests/baselines/reference/typeGuardBoolean.js deleted file mode 100644 index 1bfe41983d8..00000000000 --- a/tests/baselines/reference/typeGuardBoolean.js +++ /dev/null @@ -1,30 +0,0 @@ -//// [typeGuardBoolean.ts] -function test(strOrNull: string | null, strOrUndefined: string | undefined) { - var str: string = "original"; - var nil: null; - if (!Boolean(strOrNull)) { - nil = strOrNull; - } - else { - str = strOrNull; - } - if (Boolean(strOrUndefined)) { - str = strOrUndefined; - } -} - - -//// [typeGuardBoolean.js] -function test(strOrNull, strOrUndefined) { - var str = "original"; - var nil; - if (!Boolean(strOrNull)) { - nil = strOrNull; - } - else { - str = strOrNull; - } - if (Boolean(strOrUndefined)) { - str = strOrUndefined; - } -} diff --git a/tests/baselines/reference/typeGuardBoolean.symbols b/tests/baselines/reference/typeGuardBoolean.symbols deleted file mode 100644 index 6a08dcbda8a..00000000000 --- a/tests/baselines/reference/typeGuardBoolean.symbols +++ /dev/null @@ -1,35 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardBoolean.ts === -function test(strOrNull: string | null, strOrUndefined: string | undefined) { ->test : Symbol(test, Decl(typeGuardBoolean.ts, 0, 0)) ->strOrNull : Symbol(strOrNull, Decl(typeGuardBoolean.ts, 0, 14)) ->strOrUndefined : Symbol(strOrUndefined, Decl(typeGuardBoolean.ts, 0, 39)) - - var str: string = "original"; ->str : Symbol(str, Decl(typeGuardBoolean.ts, 1, 5)) - - var nil: null; ->nil : Symbol(nil, Decl(typeGuardBoolean.ts, 2, 5)) - - if (!Boolean(strOrNull)) { ->Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->strOrNull : Symbol(strOrNull, Decl(typeGuardBoolean.ts, 0, 14)) - - nil = strOrNull; ->nil : Symbol(nil, Decl(typeGuardBoolean.ts, 2, 5)) ->strOrNull : Symbol(strOrNull, Decl(typeGuardBoolean.ts, 0, 14)) - } - else { - str = strOrNull; ->str : Symbol(str, Decl(typeGuardBoolean.ts, 1, 5)) ->strOrNull : Symbol(strOrNull, Decl(typeGuardBoolean.ts, 0, 14)) - } - if (Boolean(strOrUndefined)) { ->Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->strOrUndefined : Symbol(strOrUndefined, Decl(typeGuardBoolean.ts, 0, 39)) - - str = strOrUndefined; ->str : Symbol(str, Decl(typeGuardBoolean.ts, 1, 5)) ->strOrUndefined : Symbol(strOrUndefined, Decl(typeGuardBoolean.ts, 0, 39)) - } -} - diff --git a/tests/baselines/reference/typeGuardBoolean.types b/tests/baselines/reference/typeGuardBoolean.types deleted file mode 100644 index db3d6f39cd8..00000000000 --- a/tests/baselines/reference/typeGuardBoolean.types +++ /dev/null @@ -1,44 +0,0 @@ -=== tests/cases/conformance/expressions/typeGuards/typeGuardBoolean.ts === -function test(strOrNull: string | null, strOrUndefined: string | undefined) { ->test : (strOrNull: string | null, strOrUndefined: string | undefined) => void ->strOrNull : string | null ->null : null ->strOrUndefined : string | undefined - - var str: string = "original"; ->str : string ->"original" : "original" - - var nil: null; ->nil : null ->null : null - - if (!Boolean(strOrNull)) { ->!Boolean(strOrNull) : boolean ->Boolean(strOrNull) : boolean ->Boolean : BooleanConstructor ->strOrNull : string | null - - nil = strOrNull; ->nil = strOrNull : null ->nil : null ->strOrNull : null - } - else { - str = strOrNull; ->str = strOrNull : string ->str : string ->strOrNull : string - } - if (Boolean(strOrUndefined)) { ->Boolean(strOrUndefined) : boolean ->Boolean : BooleanConstructor ->strOrUndefined : string | undefined - - str = strOrUndefined; ->str = strOrUndefined : string ->str : string ->strOrUndefined : string - } -} - diff --git a/tests/cases/compiler/booleanFilterAnyArray.ts b/tests/cases/compiler/booleanFilterAnyArray.ts new file mode 100644 index 00000000000..db5f38e78f9 --- /dev/null +++ b/tests/cases/compiler/booleanFilterAnyArray.ts @@ -0,0 +1,24 @@ +interface Bullean { } +interface BulleanConstructor { + new(v1?: any): Bullean; + (v2?: T): v2 is T; +} + +interface Ari { + filter(cb1: (value: T) => value is S): T extends any ? Ari : Ari; + filter(cb2: (value: T) => unknown): Ari; +} +declare var Bullean: BulleanConstructor; +declare let anys: Ari; +var xs: Ari; +var xs = anys.filter(Bullean) + +declare let realanys: any[]; +var ys: any[]; +var ys = realanys.filter(Boolean) + +var foo = [{ name: 'x' }] +var foor: Array<{name: string}> +var foor = foo.filter(x => x.name) +var foos: Array +var foos = [true, true, false, null].filter((thing): thing is boolean => thing !== null) diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardBoolean.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardBoolean.ts deleted file mode 100644 index 3f2dde227ba..00000000000 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardBoolean.ts +++ /dev/null @@ -1,14 +0,0 @@ -// @strictNullChecks: true -function test(strOrNull: string | null, strOrUndefined: string | undefined) { - var str: string = "original"; - var nil: null; - if (!Boolean(strOrNull)) { - nil = strOrNull; - } - else { - str = strOrNull; - } - if (Boolean(strOrUndefined)) { - str = strOrUndefined; - } -} From ad9c36e0ecae1be0532b1e87db59ecc4f80c96bc Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 22 May 2019 10:00:09 -0700 Subject: [PATCH 131/384] Expose ts.Diagnostics to fourslash --- tests/cases/fourslash/fourslash.ts | 17 +++++++++++++++++ .../jsxExpressionFollowedByIdentifier.ts | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index e6f2a08f002..29bfe9acade 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -42,6 +42,8 @@ // // TODO: figure out a better solution to the API exposure problem. +/// + declare module ts { export type MapKey = string | number; export interface Map { @@ -70,6 +72,21 @@ declare module ts { text: string; } + enum DiagnosticCategory { + Warning, + Error, + Suggestion, + Message + } + + interface DiagnosticMessage { + key: string; + category: DiagnosticCategory; + code: number; + message: string; + reportsUnnecessary?: {}; + } + function flatMap(array: ReadonlyArray, mapfn: (x: T, i: number) => U | ReadonlyArray | undefined): U[]; } diff --git a/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts b/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts index 501a325b989..16dcb7f6560 100644 --- a/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts +++ b/tests/cases/fourslash/jsxExpressionFollowedByIdentifier.ts @@ -6,7 +6,7 @@ ////const b =
[|x|]} /> test.ranges().forEach(range => { - verify.errorExistsAtRange(range, 1005, "'}' expected."); + verify.errorExistsAtRange(range, ts.Diagnostics._0_expected.code, "'}' expected."); // This is just to ensure getting quick info doesn’t crash verify.not.quickInfoExists(); }); From 7611c5b9315b56c665121ae85ed5b20163399658 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 22 May 2019 11:17:54 -0700 Subject: [PATCH 132/384] Fix for computed properties in instance initializers (#31517) --- src/compiler/emitter.ts | 2 ++ .../instanceMemberWithComputedPropertyName.js | 22 ++++++++++++++++ ...anceMemberWithComputedPropertyName.symbols | 20 +++++++++++++++ ...stanceMemberWithComputedPropertyName.types | 25 +++++++++++++++++++ .../instanceMemberWithComputedPropertyName.ts | 8 ++++++ 5 files changed, 77 insertions(+) create mode 100644 tests/baselines/reference/instanceMemberWithComputedPropertyName.js create mode 100644 tests/baselines/reference/instanceMemberWithComputedPropertyName.symbols create mode 100644 tests/baselines/reference/instanceMemberWithComputedPropertyName.types create mode 100644 tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberWithComputedPropertyName.ts diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index d335ceb1b60..07b1208688f 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -4527,6 +4527,8 @@ namespace ts { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: return generateNameForMethodOrAccessor(node); + case SyntaxKind.ComputedPropertyName: + return makeTempVariableName(TempFlags.Auto, /*reserveInNestedScopes*/ true); default: return makeTempVariableName(TempFlags.Auto); } diff --git a/tests/baselines/reference/instanceMemberWithComputedPropertyName.js b/tests/baselines/reference/instanceMemberWithComputedPropertyName.js new file mode 100644 index 00000000000..eba55c9899e --- /dev/null +++ b/tests/baselines/reference/instanceMemberWithComputedPropertyName.js @@ -0,0 +1,22 @@ +//// [instanceMemberWithComputedPropertyName.ts] +// https://github.com/microsoft/TypeScript/issues/30953 +const x = 1; +class C { + [x] = true; + constructor() { + const { a, b } = { a: 1, b: 2 }; + } +} + +//// [instanceMemberWithComputedPropertyName.js] +var _a; +// https://github.com/microsoft/TypeScript/issues/30953 +var x = 1; +var C = /** @class */ (function () { + function C() { + this[_a] = true; + var _b = { a: 1, b: 2 }, a = _b.a, b = _b.b; + } + return C; +}()); +_a = x; diff --git a/tests/baselines/reference/instanceMemberWithComputedPropertyName.symbols b/tests/baselines/reference/instanceMemberWithComputedPropertyName.symbols new file mode 100644 index 00000000000..3d405c89cc8 --- /dev/null +++ b/tests/baselines/reference/instanceMemberWithComputedPropertyName.symbols @@ -0,0 +1,20 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberWithComputedPropertyName.ts === +// https://github.com/microsoft/TypeScript/issues/30953 +const x = 1; +>x : Symbol(x, Decl(instanceMemberWithComputedPropertyName.ts, 1, 5)) + +class C { +>C : Symbol(C, Decl(instanceMemberWithComputedPropertyName.ts, 1, 12)) + + [x] = true; +>[x] : Symbol(C[x], Decl(instanceMemberWithComputedPropertyName.ts, 2, 9)) +>x : Symbol(x, Decl(instanceMemberWithComputedPropertyName.ts, 1, 5)) + + constructor() { + const { a, b } = { a: 1, b: 2 }; +>a : Symbol(a, Decl(instanceMemberWithComputedPropertyName.ts, 5, 15)) +>b : Symbol(b, Decl(instanceMemberWithComputedPropertyName.ts, 5, 18)) +>a : Symbol(a, Decl(instanceMemberWithComputedPropertyName.ts, 5, 26)) +>b : Symbol(b, Decl(instanceMemberWithComputedPropertyName.ts, 5, 32)) + } +} diff --git a/tests/baselines/reference/instanceMemberWithComputedPropertyName.types b/tests/baselines/reference/instanceMemberWithComputedPropertyName.types new file mode 100644 index 00000000000..f98cc7bb80a --- /dev/null +++ b/tests/baselines/reference/instanceMemberWithComputedPropertyName.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberWithComputedPropertyName.ts === +// https://github.com/microsoft/TypeScript/issues/30953 +const x = 1; +>x : 1 +>1 : 1 + +class C { +>C : C + + [x] = true; +>[x] : boolean +>x : 1 +>true : true + + constructor() { + const { a, b } = { a: 1, b: 2 }; +>a : number +>b : number +>{ a: 1, b: 2 } : { a: number; b: number; } +>a : number +>1 : 1 +>b : number +>2 : 2 + } +} diff --git a/tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberWithComputedPropertyName.ts b/tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberWithComputedPropertyName.ts new file mode 100644 index 00000000000..31aec681445 --- /dev/null +++ b/tests/cases/conformance/classes/propertyMemberDeclarations/instanceMemberWithComputedPropertyName.ts @@ -0,0 +1,8 @@ +// https://github.com/microsoft/TypeScript/issues/30953 +const x = 1; +class C { + [x] = true; + constructor() { + const { a, b } = { a: 1, b: 2 }; + } +} \ No newline at end of file From b3dc32fec7ebc2ed3bd6dc88f28be26f1479e854 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 22 May 2019 11:18:07 -0700 Subject: [PATCH 133/384] Reset error record in downlevel for-of (#31519) --- src/compiler/transformers/es2015.ts | 42 ++++++------ tests/baselines/reference/ES5For-of37.js | 64 +++++++++++++++++++ tests/baselines/reference/ES5For-of37.symbols | 35 ++++++++++ tests/baselines/reference/ES5For-of37.types | 52 +++++++++++++++ .../for-ofStatements/ES5For-of37.ts | 16 +++++ 5 files changed, 191 insertions(+), 18 deletions(-) create mode 100644 tests/baselines/reference/ES5For-of37.js create mode 100644 tests/baselines/reference/ES5For-of37.symbols create mode 100644 tests/baselines/reference/ES5For-of37.types create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of37.ts diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index cdeae5dbf54..9849d72f14a 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -145,7 +145,7 @@ namespace ts { loopOutParameters: LoopOutParameter[]; } - type LoopConverter = (node: IterationStatement, outermostLabeledStatement: LabeledStatement | undefined, convertedLoopBodyStatements: Statement[] | undefined) => Statement; + type LoopConverter = (node: IterationStatement, outermostLabeledStatement: LabeledStatement | undefined, convertedLoopBodyStatements: Statement[] | undefined, ancestorFacts: HierarchyFacts) => Statement; // Facts we track as we traverse the tree const enum HierarchyFacts { @@ -163,11 +163,12 @@ namespace ts { ExportedVariableStatement = 1 << 5, // Enclosed in an exported variable statement in the current scope TopLevel = 1 << 6, // Enclosing block-scoped container is a top-level container Block = 1 << 7, // Enclosing block-scoped container is a Block - IterationStatement = 1 << 8, // Enclosed in an IterationStatement + IterationStatement = 1 << 8, // Immediately enclosed in an IterationStatement IterationStatementBlock = 1 << 9, // Enclosing Block is enclosed in an IterationStatement - ForStatement = 1 << 10, // Enclosing block-scoped container is a ForStatement - ForInOrForOfStatement = 1 << 11, // Enclosing block-scoped container is a ForInStatement or ForOfStatement - ConstructorWithCapturedSuper = 1 << 12, // Enclosed in a constructor that captures 'this' for use with 'super' + IterationContainer = 1 << 10, // Enclosed in an outer IterationStatement + ForStatement = 1 << 11, // Enclosing block-scoped container is a ForStatement + ForInOrForOfStatement = 1 << 12, // Enclosing block-scoped container is a ForInStatement or ForOfStatement + ConstructorWithCapturedSuper = 1 << 13, // Enclosed in a constructor that captures 'this' for use with 'super' // NOTE: do not add more ancestor flags without also updating AncestorFactsMask below. // NOTE: when adding a new ancestor flag, be sure to update the subtree flags below. @@ -184,11 +185,11 @@ namespace ts { // A source file is a top-level block scope. SourceFileIncludes = TopLevel, - SourceFileExcludes = BlockScopeExcludes & ~TopLevel, + SourceFileExcludes = BlockScopeExcludes & ~TopLevel | IterationContainer, // Functions, methods, and accessors are both new lexical scopes and new block scopes. FunctionIncludes = Function | TopLevel, - FunctionExcludes = BlockScopeExcludes & ~TopLevel | ArrowFunction | AsyncFunctionBody | CapturesThis | NonStaticClassElement | ConstructorWithCapturedSuper, + FunctionExcludes = BlockScopeExcludes & ~TopLevel | ArrowFunction | AsyncFunctionBody | CapturesThis | NonStaticClassElement | ConstructorWithCapturedSuper | IterationContainer, AsyncFunctionBodyIncludes = FunctionIncludes | AsyncFunctionBody, AsyncFunctionBodyExcludes = FunctionExcludes & ~NonStaticClassElement, @@ -205,16 +206,16 @@ namespace ts { // 'do' and 'while' statements are not block scopes. We track that the subtree is contained // within an IterationStatement to indicate whether the embedded statement is an // IterationStatementBlock. - DoOrWhileStatementIncludes = IterationStatement, + DoOrWhileStatementIncludes = IterationStatement | IterationContainer, DoOrWhileStatementExcludes = None, // 'for' statements are new block scopes and have special handling for 'let' declarations. - ForStatementIncludes = IterationStatement | ForStatement, + ForStatementIncludes = IterationStatement | ForStatement | IterationContainer, ForStatementExcludes = BlockScopeExcludes & ~ForStatement, // 'for-in' and 'for-of' statements are new block scopes and have special handling for // 'let' declarations. - ForInOrForOfStatementIncludes = IterationStatement | ForInOrForOfStatement, + ForInOrForOfStatementIncludes = IterationStatement | ForInOrForOfStatement | IterationContainer, ForInOrForOfStatementExcludes = BlockScopeExcludes & ~ForInOrForOfStatement, // Blocks (other than function bodies) are new block scopes. @@ -228,8 +229,8 @@ namespace ts { // Subtree facts // - NewTarget = 1 << 13, // Contains a 'new.target' meta-property - CapturedLexicalThis = 1 << 14, // Contains a lexical `this` reference captured by an arrow function. + NewTarget = 1 << 14, // Contains a 'new.target' meta-property + CapturedLexicalThis = 1 << 15, // Contains a lexical `this` reference captured by an arrow function. // // Subtree masks @@ -2227,7 +2228,7 @@ namespace ts { function visitIterationStatementWithFacts(excludeFacts: HierarchyFacts, includeFacts: HierarchyFacts, node: IterationStatement, outermostLabeledStatement: LabeledStatement | undefined, convert?: LoopConverter) { const ancestorFacts = enterSubtree(excludeFacts, includeFacts); - const updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); + const updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert); exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return updated; } @@ -2434,7 +2435,7 @@ namespace ts { return restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); } - function convertForOfStatementForIterable(node: ForOfStatement, outermostLabeledStatement: LabeledStatement, convertedLoopBodyStatements: Statement[]): Statement { + function convertForOfStatementForIterable(node: ForOfStatement, outermostLabeledStatement: LabeledStatement, convertedLoopBodyStatements: Statement[], ancestorFacts: HierarchyFacts): 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); @@ -2447,13 +2448,18 @@ namespace ts { hoistVariableDeclaration(errorRecord); hoistVariableDeclaration(returnMethod); + // if we are enclosed in an outer loop ensure we reset 'errorRecord' per each iteration + const initializer = ancestorFacts & HierarchyFacts.IterationContainer + ? inlineExpressions([createAssignment(errorRecord, createVoidZero()), values]) + : values; + const forStatement = setEmitFlags( setTextRange( createFor( /*initializer*/ setEmitFlags( setTextRange( createVariableDeclarationList([ - setTextRange(createVariableDeclaration(iterator, /*type*/ undefined, values), node.expression), + setTextRange(createVariableDeclaration(iterator, /*type*/ undefined, initializer), node.expression), createVariableDeclaration(result, /*type*/ undefined, next) ]), node.expression @@ -2665,7 +2671,7 @@ namespace ts { } } - function convertIterationStatementBodyIfNecessary(node: IterationStatement, outermostLabeledStatement: LabeledStatement | undefined, convert?: LoopConverter): VisitResult { + function convertIterationStatementBodyIfNecessary(node: IterationStatement, outermostLabeledStatement: LabeledStatement | undefined, ancestorFacts: HierarchyFacts, convert?: LoopConverter): VisitResult { if (!shouldConvertIterationStatement(node)) { let saveAllowedNonLabeledJumps: Jump | undefined; if (convertedLoopState) { @@ -2676,7 +2682,7 @@ namespace ts { } const result = convert - ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined) + ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined, ancestorFacts) : restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); if (convertedLoopState) { @@ -2708,7 +2714,7 @@ namespace ts { let loop: Statement; if (bodyFunction) { if (convert) { - loop = convert(node, outermostLabeledStatement, bodyFunction.part); + loop = convert(node, outermostLabeledStatement, bodyFunction.part, ancestorFacts); } else { const clone = convertIterationStatementCore(node, initializerFunction, createBlock(bodyFunction.part, /*multiLine*/ true)); diff --git a/tests/baselines/reference/ES5For-of37.js b/tests/baselines/reference/ES5For-of37.js new file mode 100644 index 00000000000..c9ea0236187 --- /dev/null +++ b/tests/baselines/reference/ES5For-of37.js @@ -0,0 +1,64 @@ +//// [ES5For-of37.ts] +// https://github.com/microsoft/TypeScript/issues/30083 + +for (const i of [0, 1, 2, 3, 4]) { + try { + // Ensure catch binding for the following loop is reset per iteration: + for (const j of [1, 2, 3]) { + if (i === 2) { + throw new Error('ERR'); + } + } + console.log(i); + } catch (err) { + console.log('E %s %s', i, err); + } +} + +//// [ES5For-of37.js] +// https://github.com/microsoft/TypeScript/issues/30083 +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 e_1, _a, e_2, _b; +try { + for (var _c = __values([0, 1, 2, 3, 4]), _d = _c.next(); !_d.done; _d = _c.next()) { + var i = _d.value; + try { + try { + // Ensure catch binding for the following loop is reset per iteration: + for (var _e = (e_2 = void 0, __values([1, 2, 3])), _f = _e.next(); !_f.done; _f = _e.next()) { + var j = _f.value; + if (i === 2) { + throw new Error('ERR'); + } + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_f && !_f.done && (_b = _e["return"])) _b.call(_e); + } + finally { if (e_2) throw e_2.error; } + } + console.log(i); + } + catch (err) { + console.log('E %s %s', i, err); + } + } +} +catch (e_1_1) { e_1 = { error: e_1_1 }; } +finally { + try { + if (_d && !_d.done && (_a = _c["return"])) _a.call(_c); + } + finally { if (e_1) throw e_1.error; } +} diff --git a/tests/baselines/reference/ES5For-of37.symbols b/tests/baselines/reference/ES5For-of37.symbols new file mode 100644 index 00000000000..5c36b441706 --- /dev/null +++ b/tests/baselines/reference/ES5For-of37.symbols @@ -0,0 +1,35 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of37.ts === +// https://github.com/microsoft/TypeScript/issues/30083 + +for (const i of [0, 1, 2, 3, 4]) { +>i : Symbol(i, Decl(ES5For-of37.ts, 2, 10)) + + try { + // Ensure catch binding for the following loop is reset per iteration: + for (const j of [1, 2, 3]) { +>j : Symbol(j, Decl(ES5For-of37.ts, 5, 18)) + + if (i === 2) { +>i : Symbol(i, Decl(ES5For-of37.ts, 2, 10)) + + throw new Error('ERR'); +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + } + } + console.log(i); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>i : Symbol(i, Decl(ES5For-of37.ts, 2, 10)) + + } catch (err) { +>err : Symbol(err, Decl(ES5For-of37.ts, 11, 13)) + + console.log('E %s %s', i, err); +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>i : Symbol(i, Decl(ES5For-of37.ts, 2, 10)) +>err : Symbol(err, Decl(ES5For-of37.ts, 11, 13)) + } +} diff --git a/tests/baselines/reference/ES5For-of37.types b/tests/baselines/reference/ES5For-of37.types new file mode 100644 index 00000000000..2488857382e --- /dev/null +++ b/tests/baselines/reference/ES5For-of37.types @@ -0,0 +1,52 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of37.ts === +// https://github.com/microsoft/TypeScript/issues/30083 + +for (const i of [0, 1, 2, 3, 4]) { +>i : number +>[0, 1, 2, 3, 4] : number[] +>0 : 0 +>1 : 1 +>2 : 2 +>3 : 3 +>4 : 4 + + try { + // Ensure catch binding for the following loop is reset per iteration: + for (const j of [1, 2, 3]) { +>j : number +>[1, 2, 3] : number[] +>1 : 1 +>2 : 2 +>3 : 3 + + if (i === 2) { +>i === 2 : boolean +>i : number +>2 : 2 + + throw new Error('ERR'); +>new Error('ERR') : Error +>Error : ErrorConstructor +>'ERR' : "ERR" + } + } + console.log(i); +>console.log(i) : void +>console.log : (message?: any, ...optionalParams: any[]) => void +>console : Console +>log : (message?: any, ...optionalParams: any[]) => void +>i : number + + } catch (err) { +>err : any + + console.log('E %s %s', i, err); +>console.log('E %s %s', i, err) : void +>console.log : (message?: any, ...optionalParams: any[]) => void +>console : Console +>log : (message?: any, ...optionalParams: any[]) => void +>'E %s %s' : "E %s %s" +>i : number +>err : any + } +} diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of37.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of37.ts new file mode 100644 index 00000000000..6ac37924016 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of37.ts @@ -0,0 +1,16 @@ +// @downlevelIteration: true +// https://github.com/microsoft/TypeScript/issues/30083 + +for (const i of [0, 1, 2, 3, 4]) { + try { + // Ensure catch binding for the following loop is reset per iteration: + for (const j of [1, 2, 3]) { + if (i === 2) { + throw new Error('ERR'); + } + } + console.log(i); + } catch (err) { + console.log('E %s %s', i, err); + } +} \ No newline at end of file From c3055e585d014a65319a548b52a0b01c0cfbbe83 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 22 May 2019 11:20:07 -0700 Subject: [PATCH 134/384] Fix compiler crash with object rest in catch binding (#31522) --- src/compiler/checker.ts | 7 +++++- src/compiler/transformers/es2018.ts | 24 +++++++++++++++++++ .../baselines/reference/objectRestCatchES5.js | 21 ++++++++++++++++ .../reference/objectRestCatchES5.symbols | 9 +++++++ .../reference/objectRestCatchES5.types | 11 +++++++++ .../types/rest/objectRestCatchES5.ts | 2 ++ 6 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/objectRestCatchES5.js create mode 100644 tests/baselines/reference/objectRestCatchES5.symbols create mode 100644 tests/baselines/reference/objectRestCatchES5.types create mode 100644 tests/cases/conformance/types/rest/objectRestCatchES5.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9e5c864f6b9..fe17a6fbfed 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -30169,12 +30169,17 @@ namespace ts { return undefined; } + function isSymbolOfDestructuredElementOfCatchBinding(symbol: Symbol) { + return isBindingElement(symbol.valueDeclaration) + && walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === SyntaxKind.CatchClause; + } + function isSymbolOfDeclarationWithCollidingName(symbol: Symbol): boolean { if (symbol.flags & SymbolFlags.BlockScoped && !isSourceFile(symbol.valueDeclaration)) { const links = getSymbolLinks(symbol); if (links.isDeclarationWithCollidingName === undefined) { const container = getEnclosingBlockScopeContainer(symbol.valueDeclaration); - if (isStatementWithLocals(container)) { + if (isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) { const nodeLinks = getNodeLinks(symbol.valueDeclaration); if (resolveName(container.parent, symbol.escapedName, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) { // redeclaration - always should be renamed diff --git a/src/compiler/transformers/es2018.ts b/src/compiler/transformers/es2018.ts index 504870b4ff7..89c43dcf599 100644 --- a/src/compiler/transformers/es2018.ts +++ b/src/compiler/transformers/es2018.ts @@ -77,6 +77,8 @@ namespace ts { return visitObjectLiteralExpression(node as ObjectLiteralExpression); case SyntaxKind.BinaryExpression: return visitBinaryExpression(node as BinaryExpression, noDestructuringValue); + case SyntaxKind.CatchClause: + return visitCatchClause(node as CatchClause); case SyntaxKind.VariableDeclaration: return visitVariableDeclaration(node as VariableDeclaration); case SyntaxKind.ForOfStatement: @@ -272,6 +274,28 @@ namespace ts { return visitEachChild(node, visitor, context); } + function visitCatchClause(node: CatchClause) { + if (node.variableDeclaration && + isBindingPattern(node.variableDeclaration.name) && + node.variableDeclaration.name.transformFlags & TransformFlags.ContainsObjectRestOrSpread) { + const name = getGeneratedNameForNode(node.variableDeclaration.name); + const updatedDecl = updateVariableDeclaration(node.variableDeclaration, node.variableDeclaration.name, /*type*/ undefined, name); + const visitedBindings = flattenDestructuringBinding(updatedDecl, visitor, context, FlattenLevel.ObjectRest); + let block = visitNode(node.block, visitor, isBlock); + if (some(visitedBindings)) { + block = updateBlock(block, [ + createVariableStatement(/*modifiers*/ undefined, visitedBindings), + ...block.statements, + ]); + } + return updateCatchClause( + node, + updateVariableDeclaration(node.variableDeclaration, name, /*type*/ undefined, /*initializer*/ undefined), + block); + } + return visitEachChild(node, visitor, context); + } + /** * Visits a VariableDeclaration node with a binding pattern. * diff --git a/tests/baselines/reference/objectRestCatchES5.js b/tests/baselines/reference/objectRestCatchES5.js new file mode 100644 index 00000000000..210e8cec3bf --- /dev/null +++ b/tests/baselines/reference/objectRestCatchES5.js @@ -0,0 +1,21 @@ +//// [objectRestCatchES5.ts] +let a = 1, b = 2; +try {} catch ({ a, ...b }) {} + +//// [objectRestCatchES5.js] +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +}; +var a = 1, b = 2; +try { } +catch (_a) { + var a_1 = _a.a, b_1 = __rest(_a, ["a"]); +} diff --git a/tests/baselines/reference/objectRestCatchES5.symbols b/tests/baselines/reference/objectRestCatchES5.symbols new file mode 100644 index 00000000000..007424bd6c3 --- /dev/null +++ b/tests/baselines/reference/objectRestCatchES5.symbols @@ -0,0 +1,9 @@ +=== tests/cases/conformance/types/rest/objectRestCatchES5.ts === +let a = 1, b = 2; +>a : Symbol(a, Decl(objectRestCatchES5.ts, 0, 3)) +>b : Symbol(b, Decl(objectRestCatchES5.ts, 0, 10)) + +try {} catch ({ a, ...b }) {} +>a : Symbol(a, Decl(objectRestCatchES5.ts, 1, 15)) +>b : Symbol(b, Decl(objectRestCatchES5.ts, 1, 18)) + diff --git a/tests/baselines/reference/objectRestCatchES5.types b/tests/baselines/reference/objectRestCatchES5.types new file mode 100644 index 00000000000..3d6b0a3e695 --- /dev/null +++ b/tests/baselines/reference/objectRestCatchES5.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/types/rest/objectRestCatchES5.ts === +let a = 1, b = 2; +>a : number +>1 : 1 +>b : number +>2 : 2 + +try {} catch ({ a, ...b }) {} +>a : any +>b : any + diff --git a/tests/cases/conformance/types/rest/objectRestCatchES5.ts b/tests/cases/conformance/types/rest/objectRestCatchES5.ts new file mode 100644 index 00000000000..0e568d32b58 --- /dev/null +++ b/tests/cases/conformance/types/rest/objectRestCatchES5.ts @@ -0,0 +1,2 @@ +let a = 1, b = 2; +try {} catch ({ a, ...b }) {} \ No newline at end of file From 3d2af9ff332fca6c5db2390be0b1f08bba8402a1 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 22 May 2019 11:20:29 -0700 Subject: [PATCH 135/384] Relocate Debug namespace to reduce duplication (#31524) --- src/compiler/binder.ts | 2 +- src/compiler/checker.ts | 4 +- src/compiler/core.ts | 83 ------ src/compiler/debug.ts | 261 ++++++++++++++++++ src/compiler/tsconfig.json | 1 + src/compiler/utilities.ts | 97 +------ src/compiler/visitor.ts | 96 ------- .../codefixes/addNameToNamelessParameter.ts | 4 +- src/services/findAllReferences.ts | 2 +- src/services/importTracker.ts | 4 +- src/services/services.ts | 2 +- src/services/signatureHelp.ts | 2 +- src/testRunner/unittests/factory.ts | 2 +- 13 files changed, 274 insertions(+), 286 deletions(-) create mode 100644 src/compiler/debug.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index cb6f67d66b1..4540a4409d6 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2515,7 +2515,7 @@ namespace ts { break; default: - Debug.fail(Debug.showSyntaxKind(thisContainer)); + Debug.failBadSyntaxKind(thisContainer); } } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fe17a6fbfed..129a79a7c11 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5695,7 +5695,7 @@ namespace ts { type = getTypeOfEnumMember(symbol); } else { - return Debug.fail("Unhandled declaration kind! " + Debug.showSyntaxKind(declaration) + " for " + Debug.showSymbol(symbol)); + return Debug.fail("Unhandled declaration kind! " + Debug.formatSyntaxKind(declaration.kind) + " for " + Debug.formatSymbol(symbol)); } if (!popTypeResolution()) { @@ -25536,7 +25536,7 @@ namespace ts { case SyntaxKind.ImportSpecifier: // https://github.com/Microsoft/TypeScript/pull/7591 return DeclarationSpaces.ExportValue; default: - return Debug.fail(Debug.showSyntaxKind(d)); + return Debug.failBadSyntaxKind(d); } } } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 2dfc7acf188..0034c275999 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1686,89 +1686,6 @@ namespace ts { export type AnyFunction = (...args: never[]) => void; export type AnyConstructor = new (...args: unknown[]) => unknown; - export namespace Debug { - export let currentAssertionLevel = AssertionLevel.None; - export let isDebugging = false; - - export function shouldAssert(level: AssertionLevel): boolean { - return currentAssertionLevel >= level; - } - - export function assert(expression: boolean, message?: string, verboseDebugInfo?: string | (() => string), stackCrawlMark?: AnyFunction): void { - if (!expression) { - if (verboseDebugInfo) { - message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo()); - } - fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert); - } - } - - export function assertEqual(a: T, b: T, msg?: string, msg2?: string): void { - if (a !== b) { - const message = msg ? msg2 ? `${msg} ${msg2}` : msg : ""; - fail(`Expected ${a} === ${b}. ${message}`); - } - } - - export function assertLessThan(a: number, b: number, msg?: string): void { - if (a >= b) { - fail(`Expected ${a} < ${b}. ${msg || ""}`); - } - } - - export function assertLessThanOrEqual(a: number, b: number): void { - if (a > b) { - fail(`Expected ${a} <= ${b}`); - } - } - - export function assertGreaterThanOrEqual(a: number, b: number): void { - if (a < b) { - fail(`Expected ${a} >= ${b}`); - } - } - - export function fail(message?: string, stackCrawlMark?: AnyFunction): never { - debugger; - const e = new Error(message ? `Debug Failure. ${message}` : "Debug Failure."); - if ((Error).captureStackTrace) { - (Error).captureStackTrace(e, stackCrawlMark || fail); - } - throw e; - } - - export function assertDefined(value: T | null | undefined, message?: string): T { - if (value === undefined || value === null) return fail(message); - return value; - } - - export function assertEachDefined>(value: A, message?: string): A { - for (const v of value) { - assertDefined(v, message); - } - return value; - } - - export function assertNever(member: never, message = "Illegal value:", stackCrawlMark?: AnyFunction): never { - const detail = typeof member === "object" && "kind" in member && "pos" in member ? "SyntaxKind: " + showSyntaxKind(member as Node) : JSON.stringify(member); - return fail(`${message} ${detail}`, stackCrawlMark || assertNever); - } - - export function getFunctionName(func: AnyFunction) { - if (typeof func !== "function") { - return ""; - } - else if (func.hasOwnProperty("name")) { - return (func).name; - } - else { - const text = Function.prototype.toString.call(func); - const match = /^function\s+([\w\$]+)\s*\(/.exec(text); - return match ? match[1] : ""; - } - } - } - export function equateValues(a: T, b: T) { return a === b; } diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts new file mode 100644 index 00000000000..ee6847133c1 --- /dev/null +++ b/src/compiler/debug.ts @@ -0,0 +1,261 @@ +/* @internal */ +namespace ts { + export namespace Debug { + export let currentAssertionLevel = AssertionLevel.None; + export let isDebugging = false; + + export function shouldAssert(level: AssertionLevel): boolean { + return currentAssertionLevel >= level; + } + + export function assert(expression: boolean, message?: string, verboseDebugInfo?: string | (() => string), stackCrawlMark?: AnyFunction): void { + if (!expression) { + if (verboseDebugInfo) { + message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo()); + } + fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert); + } + } + + export function assertEqual(a: T, b: T, msg?: string, msg2?: string): void { + if (a !== b) { + const message = msg ? msg2 ? `${msg} ${msg2}` : msg : ""; + fail(`Expected ${a} === ${b}. ${message}`); + } + } + + export function assertLessThan(a: number, b: number, msg?: string): void { + if (a >= b) { + fail(`Expected ${a} < ${b}. ${msg || ""}`); + } + } + + export function assertLessThanOrEqual(a: number, b: number): void { + if (a > b) { + fail(`Expected ${a} <= ${b}`); + } + } + + export function assertGreaterThanOrEqual(a: number, b: number): void { + if (a < b) { + fail(`Expected ${a} >= ${b}`); + } + } + + export function fail(message?: string, stackCrawlMark?: AnyFunction): never { + debugger; + const e = new Error(message ? `Debug Failure. ${message}` : "Debug Failure."); + if ((Error).captureStackTrace) { + (Error).captureStackTrace(e, stackCrawlMark || fail); + } + throw e; + } + + export function assertDefined(value: T | null | undefined, message?: string): T { + if (value === undefined || value === null) return fail(message); + return value; + } + + export function assertEachDefined>(value: A, message?: string): A { + for (const v of value) { + assertDefined(v, message); + } + return value; + } + + export function assertNever(member: never, message = "Illegal value:", stackCrawlMark?: AnyFunction): never { + const detail = typeof member === "object" && "kind" in member && "pos" in member && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind((member as Node).kind) : JSON.stringify(member); + return fail(`${message} ${detail}`, stackCrawlMark || assertNever); + } + + export function getFunctionName(func: AnyFunction) { + if (typeof func !== "function") { + return ""; + } + else if (func.hasOwnProperty("name")) { + return (func).name; + } + else { + const text = Function.prototype.toString.call(func); + const match = /^function\s+([\w\$]+)\s*\(/.exec(text); + return match ? match[1] : ""; + } + } + + export function formatSymbol(symbol: Symbol): string { + return `{ name: ${unescapeLeadingUnderscores(symbol.escapedName)}; flags: ${formatSymbolFlags(symbol.flags)}; declarations: ${map(symbol.declarations, node => formatSyntaxKind(node.kind))} }`; + } + + /** + * Formats an enum value as a string for debugging and debug assertions. + */ + export function formatEnum(value = 0, enumObject: any, isFlags?: boolean) { + const members = getEnumMembers(enumObject); + if (value === 0) { + return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0"; + } + if (isFlags) { + let result = ""; + let remainingFlags = value; + for (let i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) { + const [enumValue, enumName] = members[i]; + if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) { + remainingFlags &= ~enumValue; + result = `${enumName}${result ? "|" : ""}${result}`; + } + } + if (remainingFlags === 0) { + return result; + } + } + else { + for (const [enumValue, enumName] of members) { + if (enumValue === value) { + return enumName; + } + } + } + return value.toString(); + } + + function getEnumMembers(enumObject: any) { + const result: [number, string][] = []; + for (const name in enumObject) { + const value = enumObject[name]; + if (typeof value === "number") { + result.push([value, name]); + } + } + + return stableSort<[number, string]>(result, (x, y) => compareValues(x[0], y[0])); + } + + export function formatSyntaxKind(kind: SyntaxKind | undefined): string { + return formatEnum(kind, (ts).SyntaxKind, /*isFlags*/ false); + } + + export function formatNodeFlags(flags: NodeFlags | undefined): string { + return formatEnum(flags, (ts).NodeFlags, /*isFlags*/ true); + } + + export function formatModifierFlags(flags: ModifierFlags | undefined): string { + return formatEnum(flags, (ts).ModifierFlags, /*isFlags*/ true); + } + + export function formatTransformFlags(flags: TransformFlags | undefined): string { + return formatEnum(flags, (ts).TransformFlags, /*isFlags*/ true); + } + + export function formatEmitFlags(flags: EmitFlags | undefined): string { + return formatEnum(flags, (ts).EmitFlags, /*isFlags*/ true); + } + + export function formatSymbolFlags(flags: SymbolFlags | undefined): string { + return formatEnum(flags, (ts).SymbolFlags, /*isFlags*/ true); + } + + export function formatTypeFlags(flags: TypeFlags | undefined): string { + return formatEnum(flags, (ts).TypeFlags, /*isFlags*/ true); + } + + export function formatObjectFlags(flags: ObjectFlags | undefined): string { + return formatEnum(flags, (ts).ObjectFlags, /*isFlags*/ true); + } + + export function failBadSyntaxKind(node: Node, message?: string): never { + return fail( + `${message || "Unexpected node."}\r\nNode ${formatSyntaxKind(node.kind)} was unexpected.`, + failBadSyntaxKind); + } + + export const assertEachNode = shouldAssert(AssertionLevel.Normal) + ? (nodes: Node[], test: (node: Node) => boolean, message?: string): void => assert( + test === undefined || every(nodes, test), + message || "Unexpected node.", + () => `Node array did not pass test '${getFunctionName(test)}'.`, + assertEachNode) + : noop; + + export const assertNode = shouldAssert(AssertionLevel.Normal) + ? (node: Node | undefined, test: ((node: Node | undefined) => boolean) | undefined, message?: string): void => assert( + test === undefined || test(node), + message || "Unexpected node.", + () => `Node ${formatSyntaxKind(node!.kind)} did not pass test '${getFunctionName(test!)}'.`, + assertNode) + : noop; + + export const assertOptionalNode = shouldAssert(AssertionLevel.Normal) + ? (node: Node, test: (node: Node) => boolean, message?: string): void => assert( + test === undefined || node === undefined || test(node), + message || "Unexpected node.", + () => `Node ${formatSyntaxKind(node.kind)} did not pass test '${getFunctionName(test)}'.`, + assertOptionalNode) + : noop; + + export const assertOptionalToken = shouldAssert(AssertionLevel.Normal) + ? (node: Node, kind: SyntaxKind, message?: string): void => assert( + kind === undefined || node === undefined || node.kind === kind, + message || "Unexpected node.", + () => `Node ${formatSyntaxKind(node.kind)} was not a '${formatSyntaxKind(kind)}' token.`, + assertOptionalToken) + : noop; + + export const assertMissingNode = shouldAssert(AssertionLevel.Normal) + ? (node: Node, message?: string): void => assert( + node === undefined, + message || "Unexpected node.", + () => `Node ${formatSyntaxKind(node.kind)} was unexpected'.`, + assertMissingNode) + : noop; + + let isDebugInfoEnabled = false; + + /** + * Injects debug information into frequently used types. + */ + export function enableDebugInfo() { + if (isDebugInfoEnabled) return; + + // Add additional properties in debug mode to assist with debugging. + Object.defineProperties(objectAllocator.getSymbolConstructor().prototype, { + __debugFlags: { get(this: Symbol) { return formatSymbolFlags(this.flags); } } + }); + + Object.defineProperties(objectAllocator.getTypeConstructor().prototype, { + __debugFlags: { get(this: Type) { return formatTypeFlags(this.flags); } }, + __debugObjectFlags: { get(this: Type) { return this.flags & TypeFlags.Object ? formatObjectFlags((this).objectFlags) : ""; } }, + __debugTypeToString: { value(this: Type) { return this.checker.typeToString(this); } }, + }); + + const nodeConstructors = [ + objectAllocator.getNodeConstructor(), + objectAllocator.getIdentifierConstructor(), + objectAllocator.getTokenConstructor(), + objectAllocator.getSourceFileConstructor() + ]; + + for (const ctor of nodeConstructors) { + if (!ctor.prototype.hasOwnProperty("__debugKind")) { + Object.defineProperties(ctor.prototype, { + __debugKind: { get(this: Node) { return formatSyntaxKind(this.kind); } }, + __debugNodeFlags: { get(this: Node) { return formatNodeFlags(this.flags); } }, + __debugModifierFlags: { get(this: Node) { return formatModifierFlags(getModifierFlagsNoCache(this)); } }, + __debugTransformFlags: { get(this: Node) { return formatTransformFlags(this.transformFlags); } }, + __debugIsParseTreeNode: { get(this: Node) { return isParseTreeNode(this); } }, + __debugEmitFlags: { get(this: Node) { return formatEmitFlags(getEmitFlags(this)); } }, + __debugGetText: { + value(this: Node, includeTrivia?: boolean) { + if (nodeIsSynthesized(this)) return ""; + const parseNode = getParseTreeNode(this); + const sourceFile = parseNode && getSourceFileOfNode(parseNode); + return sourceFile ? getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : ""; + } + } + }); + } + } + + isDebugInfoEnabled = true; + } + } +} \ No newline at end of file diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json index 18934aa9bb1..fdc0ff2969f 100644 --- a/src/compiler/tsconfig.json +++ b/src/compiler/tsconfig.json @@ -8,6 +8,7 @@ "files": [ "core.ts", + "debug.ts", "performance.ts", "semver.ts", diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index ac3be6d434b..0ec81502cf7 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -2073,7 +2073,7 @@ namespace ts { } export function importFromModuleSpecifier(node: StringLiteralLike): AnyValidImportOrReExport { - return tryGetImportFromModuleSpecifier(node) || Debug.fail(Debug.showSyntaxKind(node.parent)); + return tryGetImportFromModuleSpecifier(node) || Debug.failBadSyntaxKind(node.parent); } export function tryGetImportFromModuleSpecifier(node: StringLiteralLike): AnyValidImportOrReExport | undefined { @@ -4186,78 +4186,6 @@ namespace ts { return getNewLine ? getNewLine() : sys ? sys.newLine : carriageReturnLineFeed; } - /** - * Formats an enum value as a string for debugging and debug assertions. - */ - function formatEnum(value = 0, enumObject: any, isFlags?: boolean) { - const members = getEnumMembers(enumObject); - if (value === 0) { - return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0"; - } - if (isFlags) { - let result = ""; - let remainingFlags = value; - for (let i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) { - const [enumValue, enumName] = members[i]; - if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) { - remainingFlags &= ~enumValue; - result = `${enumName}${result ? ", " : ""}${result}`; - } - } - if (remainingFlags === 0) { - return result; - } - } - else { - for (const [enumValue, enumName] of members) { - if (enumValue === value) { - return enumName; - } - } - } - return value.toString(); - } - - function getEnumMembers(enumObject: any) { - const result: [number, string][] = []; - for (const name in enumObject) { - const value = enumObject[name]; - if (typeof value === "number") { - result.push([value, name]); - } - } - - return stableSort<[number, string]>(result, (x, y) => compareValues(x[0], y[0])); - } - - export function formatSyntaxKind(kind: SyntaxKind | undefined): string { - return formatEnum(kind, (ts).SyntaxKind, /*isFlags*/ false); - } - - export function formatModifierFlags(flags: ModifierFlags | undefined): string { - return formatEnum(flags, (ts).ModifierFlags, /*isFlags*/ true); - } - - export function formatTransformFlags(flags: TransformFlags | undefined): string { - return formatEnum(flags, (ts).TransformFlags, /*isFlags*/ true); - } - - export function formatEmitFlags(flags: EmitFlags | undefined): string { - return formatEnum(flags, (ts).EmitFlags, /*isFlags*/ true); - } - - export function formatSymbolFlags(flags: SymbolFlags | undefined): string { - return formatEnum(flags, (ts).SymbolFlags, /*isFlags*/ true); - } - - export function formatTypeFlags(flags: TypeFlags | undefined): string { - return formatEnum(flags, (ts).TypeFlags, /*isFlags*/ true); - } - - export function formatObjectFlags(flags: ObjectFlags | undefined): string { - return formatEnum(flags, (ts).ObjectFlags, /*isFlags*/ true); - } - /** * Creates a new TextRange from the provided pos and end. * @@ -8428,29 +8356,6 @@ namespace ts { return pathext ? path.slice(0, path.length - pathext.length) + (startsWith(ext, ".") ? ext : "." + ext) : path; } - export namespace Debug { - export function showSymbol(symbol: Symbol): string { - const symbolFlags = (ts as any).SymbolFlags; - return `{ flags: ${symbolFlags ? showFlags(symbol.flags, symbolFlags) : symbol.flags}; declarations: ${map(symbol.declarations, showSyntaxKind)} }`; - } - - function showFlags(flags: number, flagsEnum: { [flag: number]: string }): string { - const out: string[] = []; - for (let pow = 0; pow <= 30; pow++) { - const n = 1 << pow; - if (flags & n) { - out.push(flagsEnum[n]); - } - } - return out.join("|"); - } - - export function showSyntaxKind(node: Node): string { - const syntaxKind = (ts as any).SyntaxKind; - return syntaxKind ? syntaxKind[node.kind] : node.kind.toString(); - } - } - export function tryParsePattern(pattern: string): Pattern | undefined { // This should be verified outside of here and a proper error thrown. Debug.assert(hasZeroOrOneAsteriskCharacter(pattern)); diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts index 0cb3b269105..53ccd81f7a6 100644 --- a/src/compiler/visitor.ts +++ b/src/compiler/visitor.ts @@ -1558,100 +1558,4 @@ namespace ts { function aggregateTransformFlagsForChildNodes(transformFlags: TransformFlags, nodes: NodeArray): TransformFlags { return transformFlags | aggregateTransformFlagsForNodeArray(nodes); } - - export namespace Debug { - let isDebugInfoEnabled = false; - - export function failBadSyntaxKind(node: Node, message?: string): never { - return fail( - `${message || "Unexpected node."}\r\nNode ${formatSyntaxKind(node.kind)} was unexpected.`, - failBadSyntaxKind); - } - - export const assertEachNode = shouldAssert(AssertionLevel.Normal) - ? (nodes: Node[], test: (node: Node) => boolean, message?: string): void => assert( - test === undefined || every(nodes, test), - message || "Unexpected node.", - () => `Node array did not pass test '${getFunctionName(test)}'.`, - assertEachNode) - : noop; - - export const assertNode = shouldAssert(AssertionLevel.Normal) - ? (node: Node | undefined, test: ((node: Node | undefined) => boolean) | undefined, message?: string): void => assert( - test === undefined || test(node), - message || "Unexpected node.", - () => `Node ${formatSyntaxKind(node!.kind)} did not pass test '${getFunctionName(test!)}'.`, - assertNode) - : noop; - - export const assertOptionalNode = shouldAssert(AssertionLevel.Normal) - ? (node: Node, test: (node: Node) => boolean, message?: string): void => assert( - test === undefined || node === undefined || test(node), - message || "Unexpected node.", - () => `Node ${formatSyntaxKind(node.kind)} did not pass test '${getFunctionName(test)}'.`, - assertOptionalNode) - : noop; - - export const assertOptionalToken = shouldAssert(AssertionLevel.Normal) - ? (node: Node, kind: SyntaxKind, message?: string): void => assert( - kind === undefined || node === undefined || node.kind === kind, - message || "Unexpected node.", - () => `Node ${formatSyntaxKind(node.kind)} was not a '${formatSyntaxKind(kind)}' token.`, - assertOptionalToken) - : noop; - - export const assertMissingNode = shouldAssert(AssertionLevel.Normal) - ? (node: Node, message?: string): void => assert( - node === undefined, - message || "Unexpected node.", - () => `Node ${formatSyntaxKind(node.kind)} was unexpected'.`, - assertMissingNode) - : noop; - - /** - * Injects debug information into frequently used types. - */ - export function enableDebugInfo() { - if (isDebugInfoEnabled) return; - - // Add additional properties in debug mode to assist with debugging. - Object.defineProperties(objectAllocator.getSymbolConstructor().prototype, { - __debugFlags: { get(this: Symbol) { return formatSymbolFlags(this.flags); } } - }); - - Object.defineProperties(objectAllocator.getTypeConstructor().prototype, { - __debugFlags: { get(this: Type) { return formatTypeFlags(this.flags); } }, - __debugObjectFlags: { get(this: Type) { return this.flags & TypeFlags.Object ? formatObjectFlags((this).objectFlags) : ""; } }, - __debugTypeToString: { value(this: Type) { return this.checker.typeToString(this); } }, - }); - - const nodeConstructors = [ - objectAllocator.getNodeConstructor(), - objectAllocator.getIdentifierConstructor(), - objectAllocator.getTokenConstructor(), - objectAllocator.getSourceFileConstructor() - ]; - - for (const ctor of nodeConstructors) { - if (!ctor.prototype.hasOwnProperty("__debugKind")) { - Object.defineProperties(ctor.prototype, { - __debugKind: { get(this: Node) { return formatSyntaxKind(this.kind); } }, - __debugModifierFlags: { get(this: Node) { return formatModifierFlags(getModifierFlagsNoCache(this)); } }, - __debugTransformFlags: { get(this: Node) { return formatTransformFlags(this.transformFlags); } }, - __debugEmitFlags: { get(this: Node) { return formatEmitFlags(getEmitFlags(this)); } }, - __debugGetText: { - value(this: Node, includeTrivia?: boolean) { - if (nodeIsSynthesized(this)) return ""; - const parseNode = getParseTreeNode(this); - const sourceFile = parseNode && getSourceFileOfNode(parseNode); - return sourceFile ? getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : ""; - } - } - }); - } - } - - isDebugInfoEnabled = true; - } - } } diff --git a/src/services/codefixes/addNameToNamelessParameter.ts b/src/services/codefixes/addNameToNamelessParameter.ts index f87816ab228..3339f719008 100644 --- a/src/services/codefixes/addNameToNamelessParameter.ts +++ b/src/services/codefixes/addNameToNamelessParameter.ts @@ -15,11 +15,11 @@ namespace ts.codefix { function makeChange(changeTracker: textChanges.ChangeTracker, sourceFile: SourceFile, pos: number) { const token = getTokenAtPosition(sourceFile, pos); if (!isIdentifier(token)) { - return Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + formatSyntaxKind(token.kind)); + return Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + Debug.formatSyntaxKind(token.kind)); } const param = token.parent; if (!isParameter(param)) { - return Debug.fail("Tried to add a parameter name to a non-parameter: " + formatSyntaxKind(token.kind)); + return Debug.fail("Tried to add a parameter name to a non-parameter: " + Debug.formatSyntaxKind(token.kind)); } const i = param.parent.parameters.indexOf(param); Debug.assert(!param.type, "Tried to add a parameter name to a parameter that already had one."); diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 147fee53393..cf0046d2688 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -635,7 +635,7 @@ namespace ts.FindAllReferences.Core { // Ignore UMD module and global merge if (symbol.flags & SymbolFlags.Transient) return undefined; // Assertions for GH#21814. We should be handling SourceFile symbols in `getReferencedSymbolsForModule` instead of getting here. - Debug.fail(`Unexpected symbol at ${Debug.showSyntaxKind(node)}: ${Debug.showSymbol(symbol)}`); + Debug.fail(`Unexpected symbol at ${Debug.formatSyntaxKind(node.kind)}: ${Debug.formatSymbol(symbol)}`); } return isTypeLiteralNode(decl.parent) && isUnionTypeNode(decl.parent.parent) ? checker.getPropertyOfType(checker.getTypeFromTypeNode(decl.parent.parent), symbol.name) diff --git a/src/services/importTracker.ts b/src/services/importTracker.ts index e8512528af9..2734d059000 100644 --- a/src/services/importTracker.ts +++ b/src/services/importTracker.ts @@ -133,7 +133,7 @@ namespace ts.FindAllReferences { break; default: - Debug.assertNever(direct, `Unexpected import kind: ${Debug.showSyntaxKind(direct)}`); + Debug.failBadSyntaxKind(direct, "Unexpected import kind."); } } } @@ -515,7 +515,7 @@ namespace ts.FindAllReferences { const sym = useLhsSymbol ? checker.getSymbolAtLocation(cast(node.left, isPropertyAccessExpression).name) : symbol; // Better detection for GH#20803 if (sym && !(checker.getMergedSymbol(sym.parent!).flags & SymbolFlags.Module)) { - Debug.fail(`Special property assignment kind does not have a module as its parent. Assignment is ${Debug.showSymbol(sym)}, parent is ${Debug.showSymbol(sym.parent!)}`); + Debug.fail(`Special property assignment kind does not have a module as its parent. Assignment is ${Debug.formatSymbol(sym)}, parent is ${Debug.formatSymbol(sym.parent!)}`); } return sym && exportInfo(sym, kind); } diff --git a/src/services/services.ts b/src/services/services.ts index 9637b3c5321..6c882bbb28f 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -173,7 +173,7 @@ namespace ts { const textPos = scanner.getTextPos(); if (textPos <= end) { if (token === SyntaxKind.Identifier) { - Debug.fail(`Did not expect ${Debug.showSyntaxKind(parent)} to have an Identifier in its trivia`); + Debug.fail(`Did not expect ${Debug.formatSyntaxKind(parent.kind)} to have an Identifier in its trivia`); } nodes.push(createNode(token, pos, textPos, parent)); } diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 0c9f76acacb..25f958dfc6a 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -455,7 +455,7 @@ namespace ts.SignatureHelp { for (let n = node; !isSourceFile(n) && (isManuallyInvoked || !isBlock(n)); n = n.parent) { // If the node is not a subspan of its parent, this is a big problem. // There have been crashes that might be caused by this violation. - Debug.assert(rangeContainsRange(n.parent, n), "Not a subspan", () => `Child: ${Debug.showSyntaxKind(n)}, parent: ${Debug.showSyntaxKind(n.parent)}`); + Debug.assert(rangeContainsRange(n.parent, n), "Not a subspan", () => `Child: ${Debug.formatSyntaxKind(n.kind)}, parent: ${Debug.formatSyntaxKind(n.parent.kind)}`); const argumentInfo = getImmediatelyContainingArgumentOrContextualParameterInfo(n, position, sourceFile, checker); if (argumentInfo) { return argumentInfo; diff --git a/src/testRunner/unittests/factory.ts b/src/testRunner/unittests/factory.ts index cc760059c19..5593b392567 100644 --- a/src/testRunner/unittests/factory.ts +++ b/src/testRunner/unittests/factory.ts @@ -1,7 +1,7 @@ namespace ts { describe("unittests:: FactoryAPI", () => { function assertSyntaxKind(node: Node, expected: SyntaxKind) { - assert.strictEqual(node.kind, expected, `Actual: ${Debug.showSyntaxKind(node)} Expected: ${(ts as any).SyntaxKind[expected]}`); + assert.strictEqual(node.kind, expected, `Actual: ${Debug.formatSyntaxKind(node.kind)} Expected: ${Debug.formatSyntaxKind(expected)}`); } describe("createExportAssignment", () => { it("parenthesizes default export if necessary", () => { From 6a559e37ee0d660fcc94f086a34370e79e94b17a Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 22 May 2019 11:20:57 -0700 Subject: [PATCH 136/384] Fix crash when checking invalid object rest (#31530) --- src/compiler/checker.ts | 39 ++++++++++++------- .../objectRestPropertyMustBeLast.errors.txt | 21 ++++++++++ .../reference/objectRestPropertyMustBeLast.js | 25 ++++++++++++ .../objectRestPropertyMustBeLast.symbols | 23 +++++++++++ .../objectRestPropertyMustBeLast.types | 37 ++++++++++++++++++ .../rest/objectRestPropertyMustBeLast.ts | 5 +++ 6 files changed, 136 insertions(+), 14 deletions(-) create mode 100644 tests/baselines/reference/objectRestPropertyMustBeLast.errors.txt create mode 100644 tests/baselines/reference/objectRestPropertyMustBeLast.js create mode 100644 tests/baselines/reference/objectRestPropertyMustBeLast.symbols create mode 100644 tests/baselines/reference/objectRestPropertyMustBeLast.types create mode 100644 tests/cases/conformance/types/rest/objectRestPropertyMustBeLast.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 129a79a7c11..05b1015b124 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -23370,14 +23370,16 @@ namespace ts { if (strictNullChecks && properties.length === 0) { return checkNonNullType(sourceType, node); } - for (const p of properties) { - checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties, rightIsThis); + for (let i = 0; i < properties.length; i++) { + checkObjectLiteralDestructuringPropertyAssignment(node, sourceType, i, properties, rightIsThis); } return sourceType; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ - function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType: Type, property: ObjectLiteralElementLike, allProperties?: NodeArray, rightIsThis = false) { + function checkObjectLiteralDestructuringPropertyAssignment(node: ObjectLiteralExpression, objectLiteralType: Type, propertyIndex: number, allProperties?: NodeArray, rightIsThis = false) { + const properties = node.properties; + const property = properties[propertyIndex]; if (property.kind === SyntaxKind.PropertyAssignment || property.kind === SyntaxKind.ShorthandPropertyAssignment) { const name = property.name; const exprType = getLiteralTypeFromPropertyName(name); @@ -23394,18 +23396,25 @@ namespace ts { return checkDestructuringAssignment(property.kind === SyntaxKind.ShorthandPropertyAssignment ? property : property.initializer, type); } else if (property.kind === SyntaxKind.SpreadAssignment) { - if (languageVersion < ScriptTarget.ESNext) { - checkExternalEmitHelpers(property, ExternalEmitHelpers.Rest); + if (propertyIndex < properties.length - 1) { + error(property, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - const nonRestNames: PropertyName[] = []; - if (allProperties) { - for (let i = 0; i < allProperties.length - 1; i++) { - nonRestNames.push(allProperties[i].name!); + else { + if (languageVersion < ScriptTarget.ESNext) { + checkExternalEmitHelpers(property, ExternalEmitHelpers.Rest); } + const nonRestNames: PropertyName[] = []; + if (allProperties) { + for (const otherProperty of allProperties) { + if (!isSpreadAssignment(otherProperty)) { + nonRestNames.push(otherProperty.name); + } + } + } + const type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol); + checkGrammarForDisallowedTrailingComma(allProperties, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + return checkDestructuringAssignment(property.expression, type); } - const type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol); - checkGrammarForDisallowedTrailingComma(allProperties, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); - return checkDestructuringAssignment(property.expression, type); } else { error(property, Diagnostics.Property_assignment_expected); @@ -29964,8 +29973,10 @@ namespace ts { // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { if (expr.parent.kind === SyntaxKind.PropertyAssignment) { - const typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); - return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || errorType, expr.parent)!; // TODO: GH#18217 + const node = cast(expr.parent.parent, isObjectLiteralExpression); + const typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(node); + const propertyIndex = indexOfNode(node.properties, expr.parent); + return checkObjectLiteralDestructuringPropertyAssignment(node, typeOfParentObjectLiteral || errorType, propertyIndex)!; // TODO: GH#18217 } // Array literal assignment - array destructuring pattern Debug.assert(expr.parent.kind === SyntaxKind.ArrayLiteralExpression); diff --git a/tests/baselines/reference/objectRestPropertyMustBeLast.errors.txt b/tests/baselines/reference/objectRestPropertyMustBeLast.errors.txt new file mode 100644 index 00000000000..bdcb420dc83 --- /dev/null +++ b/tests/baselines/reference/objectRestPropertyMustBeLast.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/types/rest/objectRestPropertyMustBeLast.ts(1,9): error TS2462: A rest element must be last in a destructuring pattern. +tests/cases/conformance/types/rest/objectRestPropertyMustBeLast.ts(2,3): error TS2462: A rest element must be last in a destructuring pattern. +tests/cases/conformance/types/rest/objectRestPropertyMustBeLast.ts(4,9): error TS2462: A rest element must be last in a destructuring pattern. +tests/cases/conformance/types/rest/objectRestPropertyMustBeLast.ts(5,3): error TS2462: A rest element must be last in a destructuring pattern. + + +==== tests/cases/conformance/types/rest/objectRestPropertyMustBeLast.ts (4 errors) ==== + var {...a, x } = { x: 1 }; // Error, rest must be last property + ~ +!!! error TS2462: A rest element must be last in a destructuring pattern. + ({...a, x } = { x: 1 }); // Error, rest must be last property + ~~~~ +!!! error TS2462: A rest element must be last in a destructuring pattern. + + var {...a, x, ...b } = { x: 1 }; // Error, rest must be last property + ~ +!!! error TS2462: A rest element must be last in a destructuring pattern. + ({...a, x, ...b } = { x: 1 }); // Error, rest must be last property + ~~~~ +!!! error TS2462: A rest element must be last in a destructuring pattern. + \ No newline at end of file diff --git a/tests/baselines/reference/objectRestPropertyMustBeLast.js b/tests/baselines/reference/objectRestPropertyMustBeLast.js new file mode 100644 index 00000000000..dc91f72dbc7 --- /dev/null +++ b/tests/baselines/reference/objectRestPropertyMustBeLast.js @@ -0,0 +1,25 @@ +//// [objectRestPropertyMustBeLast.ts] +var {...a, x } = { x: 1 }; // Error, rest must be last property +({...a, x } = { x: 1 }); // Error, rest must be last property + +var {...a, x, ...b } = { x: 1 }; // Error, rest must be last property +({...a, x, ...b } = { x: 1 }); // Error, rest must be last property + + +//// [objectRestPropertyMustBeLast.js] +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +}; +var _a, _b; +var _c = { x: 1 }, x = _c.x; // Error, rest must be last property +(_a = { x: 1 }, (x = _a.x, _a)); // Error, rest must be last property +var _d = { x: 1 }, x = _d.x, b = __rest(_d, ["a", "x"]); // Error, rest must be last property +(_b = { x: 1 }, (x = _b.x, _b), b = __rest(_b, ["x"])); // Error, rest must be last property diff --git a/tests/baselines/reference/objectRestPropertyMustBeLast.symbols b/tests/baselines/reference/objectRestPropertyMustBeLast.symbols new file mode 100644 index 00000000000..7163f2a98c9 --- /dev/null +++ b/tests/baselines/reference/objectRestPropertyMustBeLast.symbols @@ -0,0 +1,23 @@ +=== tests/cases/conformance/types/rest/objectRestPropertyMustBeLast.ts === +var {...a, x } = { x: 1 }; // Error, rest must be last property +>a : Symbol(a, Decl(objectRestPropertyMustBeLast.ts, 0, 5), Decl(objectRestPropertyMustBeLast.ts, 3, 5)) +>x : Symbol(x, Decl(objectRestPropertyMustBeLast.ts, 0, 10), Decl(objectRestPropertyMustBeLast.ts, 3, 10)) +>x : Symbol(x, Decl(objectRestPropertyMustBeLast.ts, 0, 18)) + +({...a, x } = { x: 1 }); // Error, rest must be last property +>a : Symbol(a, Decl(objectRestPropertyMustBeLast.ts, 0, 5), Decl(objectRestPropertyMustBeLast.ts, 3, 5)) +>x : Symbol(x, Decl(objectRestPropertyMustBeLast.ts, 1, 7)) +>x : Symbol(x, Decl(objectRestPropertyMustBeLast.ts, 1, 15)) + +var {...a, x, ...b } = { x: 1 }; // Error, rest must be last property +>a : Symbol(a, Decl(objectRestPropertyMustBeLast.ts, 0, 5), Decl(objectRestPropertyMustBeLast.ts, 3, 5)) +>x : Symbol(x, Decl(objectRestPropertyMustBeLast.ts, 0, 10), Decl(objectRestPropertyMustBeLast.ts, 3, 10)) +>b : Symbol(b, Decl(objectRestPropertyMustBeLast.ts, 3, 13)) +>x : Symbol(x, Decl(objectRestPropertyMustBeLast.ts, 3, 24)) + +({...a, x, ...b } = { x: 1 }); // Error, rest must be last property +>a : Symbol(a, Decl(objectRestPropertyMustBeLast.ts, 0, 5), Decl(objectRestPropertyMustBeLast.ts, 3, 5)) +>x : Symbol(x, Decl(objectRestPropertyMustBeLast.ts, 4, 7)) +>b : Symbol(b, Decl(objectRestPropertyMustBeLast.ts, 3, 13)) +>x : Symbol(x, Decl(objectRestPropertyMustBeLast.ts, 4, 21)) + diff --git a/tests/baselines/reference/objectRestPropertyMustBeLast.types b/tests/baselines/reference/objectRestPropertyMustBeLast.types new file mode 100644 index 00000000000..8f8aafe6e0f --- /dev/null +++ b/tests/baselines/reference/objectRestPropertyMustBeLast.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/types/rest/objectRestPropertyMustBeLast.ts === +var {...a, x } = { x: 1 }; // Error, rest must be last property +>a : {} +>x : number +>{ x: 1 } : { x: number; } +>x : number +>1 : 1 + +({...a, x } = { x: 1 }); // Error, rest must be last property +>({...a, x } = { x: 1 }) : { x: number; } +>{...a, x } = { x: 1 } : { x: number; } +>{...a, x } : { x: number; } +>a : {} +>x : number +>{ x: 1 } : { x: number; } +>x : number +>1 : 1 + +var {...a, x, ...b } = { x: 1 }; // Error, rest must be last property +>a : {} +>x : number +>b : {} +>{ x: 1 } : { x: number; } +>x : number +>1 : 1 + +({...a, x, ...b } = { x: 1 }); // Error, rest must be last property +>({...a, x, ...b } = { x: 1 }) : { x: number; } +>{...a, x, ...b } = { x: 1 } : { x: number; } +>{...a, x, ...b } : { x: number; } +>a : {} +>x : number +>b : {} +>{ x: 1 } : { x: number; } +>x : number +>1 : 1 + diff --git a/tests/cases/conformance/types/rest/objectRestPropertyMustBeLast.ts b/tests/cases/conformance/types/rest/objectRestPropertyMustBeLast.ts new file mode 100644 index 00000000000..2e4e17dc302 --- /dev/null +++ b/tests/cases/conformance/types/rest/objectRestPropertyMustBeLast.ts @@ -0,0 +1,5 @@ +var {...a, x } = { x: 1 }; // Error, rest must be last property +({...a, x } = { x: 1 }); // Error, rest must be last property + +var {...a, x, ...b } = { x: 1 }; // Error, rest must be last property +({...a, x, ...b } = { x: 1 }); // Error, rest must be last property From 431f0d6d8c1f803ace4edaf7e0036afcddfd6a11 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 21 May 2019 12:47:36 -0700 Subject: [PATCH 137/384] Add test case for #30429 --- ...ionPackageIdWithRelativeAndAbsolutePath.js | 44 +++++++++++ ...ckageIdWithRelativeAndAbsolutePath.symbols | 48 ++++++++++++ ...geIdWithRelativeAndAbsolutePath.trace.json | 76 +++++++++++++++++++ ...PackageIdWithRelativeAndAbsolutePath.types | 46 +++++++++++ ...ionPackageIdWithRelativeAndAbsolutePath.ts | 51 +++++++++++++ 5 files changed, 265 insertions(+) create mode 100644 tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.js create mode 100644 tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.symbols create mode 100644 tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.trace.json create mode 100644 tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.types create mode 100644 tests/cases/compiler/moduleResolutionPackageIdWithRelativeAndAbsolutePath.ts diff --git a/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.js b/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.js new file mode 100644 index 00000000000..9f09bea10cf --- /dev/null +++ b/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.js @@ -0,0 +1,44 @@ +//// [tests/cases/compiler/moduleResolutionPackageIdWithRelativeAndAbsolutePath.ts] //// + +//// [package.json] +{ + "name": "troublesome-lib", + "version": "1.17.1" +} +//// [Compactable.d.ts] +import { Option } from './Option'; +export class Compactable { + option: Option; +} +//// [Option.d.ts] +export class Option { + someProperty: string; +} +//// [app.d.ts] +import { Option } from "troublesome-lib/lib/Option"; +export class SharedOption extends Option { } +export const makeSharedOption: () => SharedOption; +//// [index.d.ts] +import { Compactable } from "troublesome-lib/lib/Compactable"; // Including this will resolve Option as relative through the imports of compactable +//// [package.json] +{ + "name": "troublesome-lib", + "version": "1.17.1" +} +//// [Compactable.d.ts] +import { Option } from './Option'; +export class Compactable { + option: Option; +} +//// [Option.d.ts] +export class Option { + someProperty: string; +} +//// [app.ts] +import * as t from "anotherLib"; // Include the lib that recursively includes option as relative module resolution in this directory +import { makeSharedOption } from "@shared/lib/app"; // Includes option as module in shared folder but as module in node_modules folder + + +//// [/project/src/app.js] +"use strict"; +exports.__esModule = true; diff --git a/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.symbols b/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.symbols new file mode 100644 index 00000000000..1e4d65e10b3 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.symbols @@ -0,0 +1,48 @@ +=== /project/src/app.ts === +import * as t from "anotherLib"; // Include the lib that recursively includes option as relative module resolution in this directory +>t : Symbol(t, Decl(app.ts, 0, 6)) + +import { makeSharedOption } from "@shared/lib/app"; // Includes option as module in shared folder but as module in node_modules folder +>makeSharedOption : Symbol(makeSharedOption, Decl(app.ts, 1, 8)) + +=== /shared/node_modules/troublesome-lib/lib/Option.d.ts === +export class Option { +>Option : Symbol(Option, Decl(Option.d.ts, 0, 0)) + + someProperty: string; +>someProperty : Symbol(Option.someProperty, Decl(Option.d.ts, 0, 21)) +} +=== /shared/lib/app.d.ts === +import { Option } from "troublesome-lib/lib/Option"; +>Option : Symbol(Option, Decl(app.d.ts, 0, 8)) + +export class SharedOption extends Option { } +>SharedOption : Symbol(SharedOption, Decl(app.d.ts, 0, 52)) +>Option : Symbol(Option, Decl(app.d.ts, 0, 8)) + +export const makeSharedOption: () => SharedOption; +>makeSharedOption : Symbol(makeSharedOption, Decl(app.d.ts, 2, 12)) +>SharedOption : Symbol(SharedOption, Decl(app.d.ts, 0, 52)) + +=== /project/node_modules/anotherLib/index.d.ts === +import { Compactable } from "troublesome-lib/lib/Compactable"; // Including this will resolve Option as relative through the imports of compactable +>Compactable : Symbol(Compactable, Decl(index.d.ts, 0, 8)) + +=== /project/node_modules/troublesome-lib/lib/Compactable.d.ts === +import { Option } from './Option'; +>Option : Symbol(Option, Decl(Compactable.d.ts, 0, 8)) + +export class Compactable { +>Compactable : Symbol(Compactable, Decl(Compactable.d.ts, 0, 34)) + + option: Option; +>option : Symbol(Compactable.option, Decl(Compactable.d.ts, 1, 26)) +>Option : Symbol(Option, Decl(Compactable.d.ts, 0, 8)) +} +=== /project/node_modules/troublesome-lib/lib/Option.d.ts === +export class Option { +>Option : Symbol(Option, Decl(Option.d.ts, 0, 0)) + + someProperty: string; +>someProperty : Symbol(Option.someProperty, Decl(Option.d.ts, 0, 21)) +} diff --git a/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.trace.json b/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.trace.json new file mode 100644 index 00000000000..b08a0f12456 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.trace.json @@ -0,0 +1,76 @@ +[ + "======== Resolving module 'anotherLib' from '/project/src/app.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'baseUrl' option is set to '/project', using this value to resolve non-relative module name 'anotherLib'.", + "'paths' option is specified, looking for a pattern to match module name 'anotherLib'.", + "'baseUrl' option is set to '/project', using this value to resolve non-relative module name 'anotherLib'.", + "Resolving module name 'anotherLib' relative to base url '/project' - '/project/anotherLib'.", + "Loading module as file / folder, candidate module location '/project/anotherLib', target file type 'TypeScript'.", + "File '/project/anotherLib.ts' does not exist.", + "File '/project/anotherLib.tsx' does not exist.", + "File '/project/anotherLib.d.ts' does not exist.", + "Directory '/project/anotherLib' does not exist, skipping all lookups in it.", + "Loading module 'anotherLib' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/project/src/node_modules' does not exist, skipping all lookups in it.", + "File '/project/node_modules/anotherLib/package.json' does not exist.", + "File '/project/node_modules/anotherLib.ts' does not exist.", + "File '/project/node_modules/anotherLib.tsx' does not exist.", + "File '/project/node_modules/anotherLib.d.ts' does not exist.", + "File '/project/node_modules/anotherLib/index.ts' does not exist.", + "File '/project/node_modules/anotherLib/index.tsx' does not exist.", + "File '/project/node_modules/anotherLib/index.d.ts' exist - use it as a name resolution result.", + "Resolving real path for '/project/node_modules/anotherLib/index.d.ts', result '/project/node_modules/anotherLib/index.d.ts'.", + "======== Module name 'anotherLib' was successfully resolved to '/project/node_modules/anotherLib/index.d.ts'. ========", + "======== Resolving module '@shared/lib/app' from '/project/src/app.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'baseUrl' option is set to '/project', using this value to resolve non-relative module name '@shared/lib/app'.", + "'paths' option is specified, looking for a pattern to match module name '@shared/lib/app'.", + "Module name '@shared/lib/app', matched pattern '@shared/*'.", + "Trying substitution '../shared/*', candidate module location: '../shared/lib/app'.", + "Loading module as file / folder, candidate module location '/shared/lib/app', target file type 'TypeScript'.", + "File '/shared/lib/app.ts' does not exist.", + "File '/shared/lib/app.tsx' does not exist.", + "File '/shared/lib/app.d.ts' exist - use it as a name resolution result.", + "======== Module name '@shared/lib/app' was successfully resolved to '/shared/lib/app.d.ts'. ========", + "======== Resolving module 'troublesome-lib/lib/Compactable' from '/project/node_modules/anotherLib/index.d.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'baseUrl' option is set to '/project', using this value to resolve non-relative module name 'troublesome-lib/lib/Compactable'.", + "'paths' option is specified, looking for a pattern to match module name 'troublesome-lib/lib/Compactable'.", + "'baseUrl' option is set to '/project', using this value to resolve non-relative module name 'troublesome-lib/lib/Compactable'.", + "Resolving module name 'troublesome-lib/lib/Compactable' relative to base url '/project' - '/project/troublesome-lib/lib/Compactable'.", + "Loading module as file / folder, candidate module location '/project/troublesome-lib/lib/Compactable', target file type 'TypeScript'.", + "Loading module 'troublesome-lib/lib/Compactable' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/project/node_modules/anotherLib/node_modules' does not exist, skipping all lookups in it.", + "'package.json' does not have a 'typesVersions' field.", + "Found 'package.json' at '/project/node_modules/troublesome-lib/package.json'. Package ID is 'troublesome-lib/lib/Compactable/index.d.ts@1.17.1'.", + "File '/project/node_modules/troublesome-lib/lib/Compactable.ts' does not exist.", + "File '/project/node_modules/troublesome-lib/lib/Compactable.tsx' does not exist.", + "File '/project/node_modules/troublesome-lib/lib/Compactable.d.ts' exist - use it as a name resolution result.", + "Resolving real path for '/project/node_modules/troublesome-lib/lib/Compactable.d.ts', result '/project/node_modules/troublesome-lib/lib/Compactable.d.ts'.", + "======== Module name 'troublesome-lib/lib/Compactable' was successfully resolved to '/project/node_modules/troublesome-lib/lib/Compactable.d.ts'. ========", + "======== Resolving module './Option' from '/project/node_modules/troublesome-lib/lib/Compactable.d.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/project/node_modules/troublesome-lib/lib/Option', target file type 'TypeScript'.", + "File '/project/node_modules/troublesome-lib/lib/Option.ts' does not exist.", + "File '/project/node_modules/troublesome-lib/lib/Option.tsx' does not exist.", + "File '/project/node_modules/troublesome-lib/lib/Option.d.ts' exist - use it as a name resolution result.", + "'package.json' does not have a 'typesVersions' field.", + "Found 'package.json' at '/project/node_modules/troublesome-lib/package.json'. Package ID is 'troublesome-lib/lib/Option.d.ts@1.17.1'.", + "======== Module name './Option' was successfully resolved to '/project/node_modules/troublesome-lib/lib/Option.d.ts'. ========", + "======== Resolving module 'troublesome-lib/lib/Option' from '/shared/lib/app.d.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'baseUrl' option is set to '/project', using this value to resolve non-relative module name 'troublesome-lib/lib/Option'.", + "'paths' option is specified, looking for a pattern to match module name 'troublesome-lib/lib/Option'.", + "'baseUrl' option is set to '/project', using this value to resolve non-relative module name 'troublesome-lib/lib/Option'.", + "Resolving module name 'troublesome-lib/lib/Option' relative to base url '/project' - '/project/troublesome-lib/lib/Option'.", + "Loading module as file / folder, candidate module location '/project/troublesome-lib/lib/Option', target file type 'TypeScript'.", + "Loading module 'troublesome-lib/lib/Option' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/shared/lib/node_modules' does not exist, skipping all lookups in it.", + "'package.json' does not have a 'typesVersions' field.", + "Found 'package.json' at '/shared/node_modules/troublesome-lib/package.json'. Package ID is 'troublesome-lib/lib/Option/index.d.ts@1.17.1'.", + "File '/shared/node_modules/troublesome-lib/lib/Option.ts' does not exist.", + "File '/shared/node_modules/troublesome-lib/lib/Option.tsx' does not exist.", + "File '/shared/node_modules/troublesome-lib/lib/Option.d.ts' exist - use it as a name resolution result.", + "Resolving real path for '/shared/node_modules/troublesome-lib/lib/Option.d.ts', result '/shared/node_modules/troublesome-lib/lib/Option.d.ts'.", + "======== Module name 'troublesome-lib/lib/Option' was successfully resolved to '/shared/node_modules/troublesome-lib/lib/Option.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.types b/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.types new file mode 100644 index 00000000000..f3aa22e7df2 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.types @@ -0,0 +1,46 @@ +=== /project/src/app.ts === +import * as t from "anotherLib"; // Include the lib that recursively includes option as relative module resolution in this directory +>t : typeof t + +import { makeSharedOption } from "@shared/lib/app"; // Includes option as module in shared folder but as module in node_modules folder +>makeSharedOption : () => import("/shared/lib/app").SharedOption + +=== /shared/node_modules/troublesome-lib/lib/Option.d.ts === +export class Option { +>Option : Option + + someProperty: string; +>someProperty : string +} +=== /shared/lib/app.d.ts === +import { Option } from "troublesome-lib/lib/Option"; +>Option : typeof Option + +export class SharedOption extends Option { } +>SharedOption : SharedOption +>Option : Option + +export const makeSharedOption: () => SharedOption; +>makeSharedOption : () => SharedOption + +=== /project/node_modules/anotherLib/index.d.ts === +import { Compactable } from "troublesome-lib/lib/Compactable"; // Including this will resolve Option as relative through the imports of compactable +>Compactable : typeof Compactable + +=== /project/node_modules/troublesome-lib/lib/Compactable.d.ts === +import { Option } from './Option'; +>Option : typeof Option + +export class Compactable { +>Compactable : Compactable + + option: Option; +>option : Option +} +=== /project/node_modules/troublesome-lib/lib/Option.d.ts === +export class Option { +>Option : Option + + someProperty: string; +>someProperty : string +} diff --git a/tests/cases/compiler/moduleResolutionPackageIdWithRelativeAndAbsolutePath.ts b/tests/cases/compiler/moduleResolutionPackageIdWithRelativeAndAbsolutePath.ts new file mode 100644 index 00000000000..acbde7b1c7b --- /dev/null +++ b/tests/cases/compiler/moduleResolutionPackageIdWithRelativeAndAbsolutePath.ts @@ -0,0 +1,51 @@ +// @noImplicitReferences: true +// @fullEmitPaths: true +// @traceResolution: true +// @filename: /shared/node_modules/troublesome-lib/package.json +{ + "name": "troublesome-lib", + "version": "1.17.1" +} +// @filename: /shared/node_modules/troublesome-lib/lib/Compactable.d.ts +import { Option } from './Option'; +export class Compactable { + option: Option; +} +// @filename: /shared/node_modules/troublesome-lib/lib/Option.d.ts +export class Option { + someProperty: string; +} +// @filename: /shared/lib/app.d.ts +import { Option } from "troublesome-lib/lib/Option"; +export class SharedOption extends Option { } +export const makeSharedOption: () => SharedOption; +// @filename: /project/node_modules/anotherLib/index.d.ts +import { Compactable } from "troublesome-lib/lib/Compactable"; // Including this will resolve Option as relative through the imports of compactable +// @filename: /project/node_modules/troublesome-lib/package.json +{ + "name": "troublesome-lib", + "version": "1.17.1" +} +// @filename: /project/node_modules/troublesome-lib/lib/Compactable.d.ts +import { Option } from './Option'; +export class Compactable { + option: Option; +} +// @filename: /project/node_modules/troublesome-lib/lib/Option.d.ts +export class Option { + someProperty: string; +} +// @filename: /project/src/app.ts +import * as t from "anotherLib"; // Include the lib that recursively includes option as relative module resolution in this directory +import { makeSharedOption } from "@shared/lib/app"; // Includes option as module in shared folder but as module in node_modules folder + +// @filename: /project/tsconfig.json +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@shared/*": ["../shared/*"] + } + }, + //"files": ["src/app.ts"] +} \ No newline at end of file From 60d0bb9b199e76974cdc65647663267e9fcf75b1 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 22 May 2019 11:37:35 -0700 Subject: [PATCH 138/384] =?UTF-8?q?Don=E2=80=99t=20touch=20imports=20used?= =?UTF-8?q?=20for=20module=20augmentation=20in=20non-declaration=20files?= =?UTF-8?q?=20since=20it=20could=20change=20JS=20emit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/organizeImports.ts | 28 ++++++++++++------- .../unittests/services/organizeImports.ts | 15 ++++++++++ ...le_augmentation_in_non_declaration_file.ts | 22 +++++++++++++++ 3 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 tests/baselines/reference/organizeImports/Unused_preserve_imports_for_module_augmentation_in_non_declaration_file.ts diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index b6be92fbf9c..81c9108749f 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -125,13 +125,22 @@ namespace ts.OrganizeImports { if (name || namedBindings) { usedImports.push(updateImportDeclarationAndClause(importDecl, name, namedBindings)); } - // If a module is imported to be augmented, keep the import declaration, but without an import clause + // If a module is imported to be augmented, it’s used else if (hasModuleDeclarationMatchingSpecifier(sourceFile, moduleSpecifier)) { - usedImports.push(createImportDeclaration( - importDecl.decorators, - importDecl.modifiers, - /*importClause*/ undefined, - moduleSpecifier)); + // If we’re in a declaration file, it’s safe to remove the import clause from it + if (sourceFile.isDeclarationFile) { + usedImports.push(createImportDeclaration( + importDecl.decorators, + importDecl.modifiers, + /*importClause*/ undefined, + moduleSpecifier)); + } + // If we’re not in a declaration file, we can’t remove the import clause even though + // the imported symbols are unused, because removing them makes it look like the import + // declaration has side effects, which will cause it to be preserved in the JS emit. + else { + usedImports.push(importDecl); + } } } @@ -145,10 +154,9 @@ namespace ts.OrganizeImports { function hasModuleDeclarationMatchingSpecifier(sourceFile: SourceFile, moduleSpecifier: Expression) { const moduleSpecifierText = isStringLiteral(moduleSpecifier) && moduleSpecifier.text; - return isString(moduleSpecifierText) && some(sourceFile.statements, statement => - isModuleDeclaration(statement) - && isStringLiteral(statement.name) - && statement.name.text === moduleSpecifierText); + return isString(moduleSpecifierText) && some(sourceFile.moduleAugmentations, moduleName => + isStringLiteral(moduleName) + && moduleName.text === moduleSpecifierText); } function getExternalModuleName(specifier: Expression) { diff --git a/src/testRunner/unittests/services/organizeImports.ts b/src/testRunner/unittests/services/organizeImports.ts index 8003e1867cd..c119aadb34e 100644 --- a/src/testRunner/unittests/services/organizeImports.ts +++ b/src/testRunner/unittests/services/organizeImports.ts @@ -350,6 +350,21 @@ import { } from "lib"; import foo from 'foo'; import { Caseless } from 'caseless'; +declare module 'foo' {} +declare module 'caseless' { + interface Caseless { + test(name: KeyType): boolean; + } +}` + }); + + testOrganizeImports("Unused_preserve_imports_for_module_augmentation_in_non_declaration_file", + { + path: "/test.ts", + content: ` +import foo from 'foo'; +import { Caseless } from 'caseless'; + declare module 'foo' {} declare module 'caseless' { interface Caseless { diff --git a/tests/baselines/reference/organizeImports/Unused_preserve_imports_for_module_augmentation_in_non_declaration_file.ts b/tests/baselines/reference/organizeImports/Unused_preserve_imports_for_module_augmentation_in_non_declaration_file.ts new file mode 100644 index 00000000000..6d28f89903a --- /dev/null +++ b/tests/baselines/reference/organizeImports/Unused_preserve_imports_for_module_augmentation_in_non_declaration_file.ts @@ -0,0 +1,22 @@ +// ==ORIGINAL== + +import foo from 'foo'; +import { Caseless } from 'caseless'; + +declare module 'foo' {} +declare module 'caseless' { + interface Caseless { + test(name: KeyType): boolean; + } +} +// ==ORGANIZED== + +import { Caseless } from 'caseless'; +import foo from 'foo'; + +declare module 'foo' {} +declare module 'caseless' { + interface Caseless { + test(name: KeyType): boolean; + } +} \ No newline at end of file From 85d3c5d7a1b755c7c0ce3de59c961cb4a86a783d Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 22 May 2019 11:06:49 -0700 Subject: [PATCH 139/384] Trace Package id at the module resolution site --- src/compiler/diagnosticMessages.json | 14 ++++++++----- src/compiler/moduleNameResolver.ts | 21 ++++++++++++------- ...age_relativeImportWithinPackage.trace.json | 12 +++++------ ...ativeImportWithinPackage_scoped.trace.json | 12 +++++------ ...geIdWithRelativeAndAbsolutePath.trace.json | 12 +++++------ ...on_packageJson_yesAtPackageRoot.trace.json | 6 +++--- ...AtPackageRoot_fakeScopedPackage.trace.json | 6 +++--- ...ageRoot_mainFieldInSubDirectory.trace.json | 4 ++-- .../typesVersions.ambientModules.trace.json | 8 +++---- .../typesVersions.multiFile.trace.json | 8 +++---- ...VersionsDeclarationEmit.ambient.trace.json | 8 +++---- ...rsionsDeclarationEmit.multiFile.trace.json | 8 +++---- ...it.multiFileBackReferenceToSelf.trace.json | 16 +++++++------- ...ultiFileBackReferenceToUnmapped.trace.json | 12 +++++------ 14 files changed, 78 insertions(+), 69 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 87101781ead..e8784e7d1f2 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3811,10 +3811,6 @@ "category": "Error", "code": 6189 }, - "Found 'package.json' at '{0}'. Package ID is '{1}'.": { - "category": "Message", - "code": 6190 - }, "Whether to keep outdated console output in watch mode instead of clearing the screen.": { "category": "Message", "code": 6191 @@ -3923,6 +3919,14 @@ "category": "Message", "code": 6217 }, + "======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========": { + "category": "Message", + "code": 6218 + }, + "======== Type reference directive '{0}' was successfully resolved to '{1}' with Package ID '{2}', primary: {3}. ========": { + "category": "Message", + "code": 6219 + }, "Projects to reference": { "category": "Message", @@ -4975,7 +4979,7 @@ "code": 95079 }, - "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer." :{ + "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer.": { "category": "Error", "code": 18004 }, diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 8761cc0a087..0cd9160ac42 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -307,7 +307,12 @@ namespace ts { const { fileName, packageId } = resolved; const resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled); if (traceEnabled) { - trace(host, Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFileName, primary); + if (packageId) { + trace(host, Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3, typeReferenceDirectiveName, resolvedFileName, packageIdToString(packageId), primary); + } + else { + trace(host, Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFileName, primary); + } } resolvedTypeReferenceDirective = { primary, resolvedFileName, packageId, isExternalLibraryImport: pathContainsNodeModules(fileName) }; } @@ -663,7 +668,12 @@ namespace ts { if (traceEnabled) { if (result.resolvedModule) { - trace(host, Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); + if (result.resolvedModule.packageId) { + trace(host, Diagnostics.Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2, moduleName, result.resolvedModule.resolvedFileName, packageIdToString(result.resolvedModule.packageId)); + } + else { + trace(host, Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); + } } else { trace(host, Diagnostics.Module_name_0_was_not_resolved, moduleName); @@ -1165,12 +1175,7 @@ namespace ts { ? { name: packageJsonContent.name, subModuleName, version: packageJsonContent.version } : undefined; if (traceEnabled) { - if (packageId) { - trace(host, Diagnostics.Found_package_json_at_0_Package_ID_is_1, packageJsonPath, packageIdToString(packageId)); - } - else { - trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath); - } + trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath); } return { packageJsonContent, packageId, versionPaths }; diff --git a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.trace.json b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.trace.json index c4421e45579..eccaee3a379 100644 --- a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.trace.json +++ b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.trace.json @@ -3,12 +3,12 @@ "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'foo/use' from 'node_modules' folder, target file type 'TypeScript'.", "'package.json' does not have a 'typesVersions' field.", - "Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/use/index.d.ts@1.2.3'.", + "Found 'package.json' at '/node_modules/foo/package.json'.", "File '/node_modules/foo/use.ts' does not exist.", "File '/node_modules/foo/use.tsx' does not exist.", "File '/node_modules/foo/use.d.ts' exist - use it as a name resolution result.", "Resolving real path for '/node_modules/foo/use.d.ts', result '/node_modules/foo/use.d.ts'.", - "======== Module name 'foo/use' was successfully resolved to '/node_modules/foo/use.d.ts'. ========", + "======== Module name 'foo/use' was successfully resolved to '/node_modules/foo/use.d.ts' with Package ID 'foo/use/index.d.ts@1.2.3'. ========", "======== Resolving module 'a' from '/index.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'a' from 'node_modules' folder, target file type 'TypeScript'.", @@ -28,8 +28,8 @@ "File '/node_modules/foo/index.tsx' does not exist.", "File '/node_modules/foo/index.d.ts' exist - use it as a name resolution result.", "'package.json' does not have a 'typesVersions' field.", - "Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/index.d.ts@1.2.3'.", - "======== Module name './index' was successfully resolved to '/node_modules/foo/index.d.ts'. ========", + "Found 'package.json' at '/node_modules/foo/package.json'.", + "======== Module name './index' was successfully resolved to '/node_modules/foo/index.d.ts' with Package ID 'foo/index.d.ts@1.2.3'. ========", "======== Resolving module 'foo' from '/node_modules/a/index.d.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", @@ -37,7 +37,7 @@ "'package.json' does not have a 'types' field.", "'package.json' does not have a 'main' field.", "'package.json' does not have a 'typesVersions' field.", - "Found 'package.json' at '/node_modules/a/node_modules/foo/package.json'. Package ID is 'foo/index.d.ts@1.2.3'.", + "Found 'package.json' at '/node_modules/a/node_modules/foo/package.json'.", "File '/node_modules/a/node_modules/foo.ts' does not exist.", "File '/node_modules/a/node_modules/foo.tsx' does not exist.", "File '/node_modules/a/node_modules/foo.d.ts' does not exist.", @@ -48,5 +48,5 @@ "File '/node_modules/a/node_modules/foo/index.tsx' does not exist.", "File '/node_modules/a/node_modules/foo/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for '/node_modules/a/node_modules/foo/index.d.ts', result '/node_modules/a/node_modules/foo/index.d.ts'.", - "======== Module name 'foo' was successfully resolved to '/node_modules/a/node_modules/foo/index.d.ts'. ========" + "======== Module name 'foo' was successfully resolved to '/node_modules/a/node_modules/foo/index.d.ts' with Package ID 'foo/index.d.ts@1.2.3'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.trace.json b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.trace.json index 97340de57ca..d08d6e074f5 100644 --- a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.trace.json +++ b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.trace.json @@ -3,12 +3,12 @@ "Module resolution kind is not specified, using 'NodeJs'.", "Loading module '@foo/bar/use' from 'node_modules' folder, target file type 'TypeScript'.", "'package.json' does not have a 'typesVersions' field.", - "Found 'package.json' at '/node_modules/@foo/bar/package.json'. Package ID is '@foo/bar/use/index.d.ts@1.2.3'.", + "Found 'package.json' at '/node_modules/@foo/bar/package.json'.", "File '/node_modules/@foo/bar/use.ts' does not exist.", "File '/node_modules/@foo/bar/use.tsx' does not exist.", "File '/node_modules/@foo/bar/use.d.ts' exist - use it as a name resolution result.", "Resolving real path for '/node_modules/@foo/bar/use.d.ts', result '/node_modules/@foo/bar/use.d.ts'.", - "======== Module name '@foo/bar/use' was successfully resolved to '/node_modules/@foo/bar/use.d.ts'. ========", + "======== Module name '@foo/bar/use' was successfully resolved to '/node_modules/@foo/bar/use.d.ts' with Package ID '@foo/bar/use/index.d.ts@1.2.3'. ========", "======== Resolving module 'a' from '/index.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'a' from 'node_modules' folder, target file type 'TypeScript'.", @@ -28,8 +28,8 @@ "File '/node_modules/@foo/bar/index.tsx' does not exist.", "File '/node_modules/@foo/bar/index.d.ts' exist - use it as a name resolution result.", "'package.json' does not have a 'typesVersions' field.", - "Found 'package.json' at '/node_modules/@foo/bar/package.json'. Package ID is '@foo/bar/index.d.ts@1.2.3'.", - "======== Module name './index' was successfully resolved to '/node_modules/@foo/bar/index.d.ts'. ========", + "Found 'package.json' at '/node_modules/@foo/bar/package.json'.", + "======== Module name './index' was successfully resolved to '/node_modules/@foo/bar/index.d.ts' with Package ID '@foo/bar/index.d.ts@1.2.3'. ========", "======== Resolving module '@foo/bar' from '/node_modules/a/index.d.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module '@foo/bar' from 'node_modules' folder, target file type 'TypeScript'.", @@ -37,7 +37,7 @@ "'package.json' does not have a 'types' field.", "'package.json' does not have a 'main' field.", "'package.json' does not have a 'typesVersions' field.", - "Found 'package.json' at '/node_modules/a/node_modules/@foo/bar/package.json'. Package ID is '@foo/bar/index.d.ts@1.2.3'.", + "Found 'package.json' at '/node_modules/a/node_modules/@foo/bar/package.json'.", "File '/node_modules/a/node_modules/@foo/bar.ts' does not exist.", "File '/node_modules/a/node_modules/@foo/bar.tsx' does not exist.", "File '/node_modules/a/node_modules/@foo/bar.d.ts' does not exist.", @@ -48,5 +48,5 @@ "File '/node_modules/a/node_modules/@foo/bar/index.tsx' does not exist.", "File '/node_modules/a/node_modules/@foo/bar/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for '/node_modules/a/node_modules/@foo/bar/index.d.ts', result '/node_modules/a/node_modules/@foo/bar/index.d.ts'.", - "======== Module name '@foo/bar' was successfully resolved to '/node_modules/a/node_modules/@foo/bar/index.d.ts'. ========" + "======== Module name '@foo/bar' was successfully resolved to '/node_modules/a/node_modules/@foo/bar/index.d.ts' with Package ID '@foo/bar/index.d.ts@1.2.3'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.trace.json b/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.trace.json index b08a0f12456..9f514de9f25 100644 --- a/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.trace.json +++ b/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.trace.json @@ -42,12 +42,12 @@ "Loading module 'troublesome-lib/lib/Compactable' from 'node_modules' folder, target file type 'TypeScript'.", "Directory '/project/node_modules/anotherLib/node_modules' does not exist, skipping all lookups in it.", "'package.json' does not have a 'typesVersions' field.", - "Found 'package.json' at '/project/node_modules/troublesome-lib/package.json'. Package ID is 'troublesome-lib/lib/Compactable/index.d.ts@1.17.1'.", + "Found 'package.json' at '/project/node_modules/troublesome-lib/package.json'.", "File '/project/node_modules/troublesome-lib/lib/Compactable.ts' does not exist.", "File '/project/node_modules/troublesome-lib/lib/Compactable.tsx' does not exist.", "File '/project/node_modules/troublesome-lib/lib/Compactable.d.ts' exist - use it as a name resolution result.", "Resolving real path for '/project/node_modules/troublesome-lib/lib/Compactable.d.ts', result '/project/node_modules/troublesome-lib/lib/Compactable.d.ts'.", - "======== Module name 'troublesome-lib/lib/Compactable' was successfully resolved to '/project/node_modules/troublesome-lib/lib/Compactable.d.ts'. ========", + "======== Module name 'troublesome-lib/lib/Compactable' was successfully resolved to '/project/node_modules/troublesome-lib/lib/Compactable.d.ts' with Package ID 'troublesome-lib/lib/Compactable/index.d.ts@1.17.1'. ========", "======== Resolving module './Option' from '/project/node_modules/troublesome-lib/lib/Compactable.d.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module as file / folder, candidate module location '/project/node_modules/troublesome-lib/lib/Option', target file type 'TypeScript'.", @@ -55,8 +55,8 @@ "File '/project/node_modules/troublesome-lib/lib/Option.tsx' does not exist.", "File '/project/node_modules/troublesome-lib/lib/Option.d.ts' exist - use it as a name resolution result.", "'package.json' does not have a 'typesVersions' field.", - "Found 'package.json' at '/project/node_modules/troublesome-lib/package.json'. Package ID is 'troublesome-lib/lib/Option.d.ts@1.17.1'.", - "======== Module name './Option' was successfully resolved to '/project/node_modules/troublesome-lib/lib/Option.d.ts'. ========", + "Found 'package.json' at '/project/node_modules/troublesome-lib/package.json'.", + "======== Module name './Option' was successfully resolved to '/project/node_modules/troublesome-lib/lib/Option.d.ts' with Package ID 'troublesome-lib/lib/Option.d.ts@1.17.1'. ========", "======== Resolving module 'troublesome-lib/lib/Option' from '/shared/lib/app.d.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "'baseUrl' option is set to '/project', using this value to resolve non-relative module name 'troublesome-lib/lib/Option'.", @@ -67,10 +67,10 @@ "Loading module 'troublesome-lib/lib/Option' from 'node_modules' folder, target file type 'TypeScript'.", "Directory '/shared/lib/node_modules' does not exist, skipping all lookups in it.", "'package.json' does not have a 'typesVersions' field.", - "Found 'package.json' at '/shared/node_modules/troublesome-lib/package.json'. Package ID is 'troublesome-lib/lib/Option/index.d.ts@1.17.1'.", + "Found 'package.json' at '/shared/node_modules/troublesome-lib/package.json'.", "File '/shared/node_modules/troublesome-lib/lib/Option.ts' does not exist.", "File '/shared/node_modules/troublesome-lib/lib/Option.tsx' does not exist.", "File '/shared/node_modules/troublesome-lib/lib/Option.d.ts' exist - use it as a name resolution result.", "Resolving real path for '/shared/node_modules/troublesome-lib/lib/Option.d.ts', result '/shared/node_modules/troublesome-lib/lib/Option.d.ts'.", - "======== Module name 'troublesome-lib/lib/Option' was successfully resolved to '/shared/node_modules/troublesome-lib/lib/Option.d.ts'. ========" + "======== Module name 'troublesome-lib/lib/Option' was successfully resolved to '/shared/node_modules/troublesome-lib/lib/Option.d.ts' with Package ID 'troublesome-lib/lib/Option/index.d.ts@1.17.1'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot.trace.json b/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot.trace.json index 873805b8b57..4a2e60d9c7f 100644 --- a/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot.trace.json +++ b/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot.trace.json @@ -4,7 +4,7 @@ "Loading module 'foo/bar' from 'node_modules' folder, target file type 'TypeScript'.", "File '/node_modules/foo/bar/package.json' does not exist.", "'package.json' does not have a 'typesVersions' field.", - "Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/bar/index.d.ts@1.2.3'.", + "Found 'package.json' at '/node_modules/foo/package.json'.", "File '/node_modules/foo/bar.ts' does not exist.", "File '/node_modules/foo/bar.tsx' does not exist.", "File '/node_modules/foo/bar.d.ts' does not exist.", @@ -15,10 +15,10 @@ "Loading module 'foo/bar' from 'node_modules' folder, target file type 'JavaScript'.", "File '/node_modules/foo/bar/package.json' does not exist.", "'package.json' does not have a 'typesVersions' field.", - "Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/bar/index.d.ts@1.2.3'.", + "Found 'package.json' at '/node_modules/foo/package.json'.", "File '/node_modules/foo/bar.js' does not exist.", "File '/node_modules/foo/bar.jsx' does not exist.", "File '/node_modules/foo/bar/index.js' exist - use it as a name resolution result.", "Resolving real path for '/node_modules/foo/bar/index.js', result '/node_modules/foo/bar/index.js'.", - "======== Module name 'foo/bar' was successfully resolved to '/node_modules/foo/bar/index.js'. ========" + "======== Module name 'foo/bar' was successfully resolved to '/node_modules/foo/bar/index.js' with Package ID 'foo/bar/index.d.ts@1.2.3'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_fakeScopedPackage.trace.json b/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_fakeScopedPackage.trace.json index 95beae1393e..3f2423ce832 100644 --- a/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_fakeScopedPackage.trace.json +++ b/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_fakeScopedPackage.trace.json @@ -4,7 +4,7 @@ "Loading module 'foo/@bar' from 'node_modules' folder, target file type 'TypeScript'.", "File '/node_modules/foo/@bar/package.json' does not exist.", "'package.json' does not have a 'typesVersions' field.", - "Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/@bar/index.d.ts@1.2.3'.", + "Found 'package.json' at '/node_modules/foo/package.json'.", "File '/node_modules/foo/@bar.ts' does not exist.", "File '/node_modules/foo/@bar.tsx' does not exist.", "File '/node_modules/foo/@bar.d.ts' does not exist.", @@ -15,10 +15,10 @@ "Loading module 'foo/@bar' from 'node_modules' folder, target file type 'JavaScript'.", "File '/node_modules/foo/@bar/package.json' does not exist.", "'package.json' does not have a 'typesVersions' field.", - "Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/@bar/index.d.ts@1.2.3'.", + "Found 'package.json' at '/node_modules/foo/package.json'.", "File '/node_modules/foo/@bar.js' does not exist.", "File '/node_modules/foo/@bar.jsx' does not exist.", "File '/node_modules/foo/@bar/index.js' exist - use it as a name resolution result.", "Resolving real path for '/node_modules/foo/@bar/index.js', result '/node_modules/foo/@bar/index.js'.", - "======== Module name 'foo/@bar' was successfully resolved to '/node_modules/foo/@bar/index.js'. ========" + "======== Module name 'foo/@bar' was successfully resolved to '/node_modules/foo/@bar/index.js' with Package ID 'foo/@bar/index.d.ts@1.2.3'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json b/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json index 4d7ae487813..6b373fb300f 100644 --- a/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json +++ b/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json @@ -6,7 +6,7 @@ "'package.json' does not have a 'types' field.", "'package.json' has 'main' field 'src/index.js' that references '/node_modules/foo/src/index.js'.", "'package.json' does not have a 'typesVersions' field.", - "Found 'package.json' at '/node_modules/foo/package.json'. Package ID is 'foo/src/index.d.ts@1.2.3'.", + "Found 'package.json' at '/node_modules/foo/package.json'.", "File '/node_modules/foo.ts' does not exist.", "File '/node_modules/foo.tsx' does not exist.", "File '/node_modules/foo.d.ts' does not exist.", @@ -23,5 +23,5 @@ "File '/node_modules/foo/src/index.tsx' does not exist.", "File '/node_modules/foo/src/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for '/node_modules/foo/src/index.d.ts', result '/node_modules/foo/src/index.d.ts'.", - "======== Module name 'foo' was successfully resolved to '/node_modules/foo/src/index.d.ts'. ========" + "======== Module name 'foo' was successfully resolved to '/node_modules/foo/src/index.d.ts' with Package ID 'foo/src/index.d.ts@1.2.3'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersions.ambientModules.trace.json b/tests/baselines/reference/typesVersions.ambientModules.trace.json index ad73f88a8ef..dcaf6acc096 100644 --- a/tests/baselines/reference/typesVersions.ambientModules.trace.json +++ b/tests/baselines/reference/typesVersions.ambientModules.trace.json @@ -5,7 +5,7 @@ "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/moduleResolution/node_modules/ext/index'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'. Package ID is 'ext/index.d.ts@1.0.0'.", + "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext.ts' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext.tsx' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext.d.ts' does not exist.", @@ -20,12 +20,12 @@ "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.tsx' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts'. ========", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/index.d.ts@1.0.0'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/moduleResolution/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", + "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", @@ -44,7 +44,7 @@ "Directory '/node_modules' does not exist, skipping all lookups in it.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'JavaScript'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", + "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", diff --git a/tests/baselines/reference/typesVersions.multiFile.trace.json b/tests/baselines/reference/typesVersions.multiFile.trace.json index d52db48acfe..71975474092 100644 --- a/tests/baselines/reference/typesVersions.multiFile.trace.json +++ b/tests/baselines/reference/typesVersions.multiFile.trace.json @@ -5,7 +5,7 @@ "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/moduleResolution/node_modules/ext/index'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'. Package ID is 'ext/index.d.ts@1.0.0'.", + "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext.ts' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext.tsx' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext.d.ts' does not exist.", @@ -20,12 +20,12 @@ "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.tsx' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts'. ========", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/index.d.ts@1.0.0'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/moduleResolution/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", + "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", @@ -33,5 +33,5 @@ "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.tsx' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts'.", - "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts'. ========" + "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts' with Package ID 'ext/other/index.d.ts@1.0.0'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json index 2fcf9d052d4..5d5009e8a41 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json @@ -5,7 +5,7 @@ "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/index.d.ts@1.0.0'.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.ts' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.d.ts' does not exist.", @@ -20,12 +20,12 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'. ========", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/index.d.ts@1.0.0'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", @@ -44,7 +44,7 @@ "Directory '/node_modules' does not exist, skipping all lookups in it.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'JavaScript'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json index eee9622037b..9fb9c48332a 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json @@ -5,7 +5,7 @@ "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/index.d.ts@1.0.0'.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.ts' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.d.ts' does not exist.", @@ -20,12 +20,12 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'. ========", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/index.d.ts@1.0.0'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", @@ -33,5 +33,5 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts'.", - "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts'. ========" + "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts' with Package ID 'ext/other/index.d.ts@1.0.0'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json index 464da214bae..6deb7327c99 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json @@ -5,7 +5,7 @@ "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/ndex/index.d.ts@1.0.0'.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'index'.", @@ -16,7 +16,7 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.ts' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", - "======== Module name '../' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'. ========", + "======== Module name '../' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/ndex/index.d.ts@1.0.0'. ========", "======== Resolving module '../other' from 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module as file / folder, candidate module location 'tests/cases/conformance/declarationEmit/node_modules/ext/other', target file type 'TypeScript'.", @@ -24,15 +24,15 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' exist - use it as a name resolution result.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/other.d.ts@1.0.0'.", - "======== Module name '../other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts'. ========", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", + "======== Module name '../other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' with Package ID 'ext/other.d.ts@1.0.0'. ========", "======== Resolving module 'ext' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext' from 'node_modules' folder, target file type 'TypeScript'.", "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/index.d.ts@1.0.0'.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.ts' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.d.ts' does not exist.", @@ -47,12 +47,12 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'. ========", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/index.d.ts@1.0.0'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", @@ -60,5 +60,5 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts'.", - "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts'. ========" + "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts' with Package ID 'ext/other/index.d.ts@1.0.0'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json index fe65b605283..94f15e64260 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json @@ -6,15 +6,15 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' exist - use it as a name resolution result.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/other.d.ts@1.0.0'.", - "======== Module name '../other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts'. ========", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", + "======== Module name '../other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' with Package ID 'ext/other.d.ts@1.0.0'. ========", "======== Resolving module 'ext' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext' from 'node_modules' folder, target file type 'TypeScript'.", "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/index.d.ts@1.0.0'.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.ts' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.d.ts' does not exist.", @@ -29,16 +29,16 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'. ========", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/index.d.ts@1.0.0'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", - "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.ts' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts'.", - "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts'. ========" + "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' with Package ID 'ext/other/index.d.ts@1.0.0'. ========" ] \ No newline at end of file From eecb6d90497bd460bbe555d39358b30253896de8 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 22 May 2019 13:39:05 -0700 Subject: [PATCH 140/384] Add failing test --- .../conformance/types/tuple/readonlyArraysAndTuples.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts b/tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts index d9fecee7dea..35c86175a0b 100644 --- a/tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts +++ b/tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts @@ -28,3 +28,10 @@ function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: reado rt = ra; // Error rt = mt; } + +declare var v: readonly[number, number, ...number[]]; +v[0] = 1; // Error +v[1] = 1; // Error +v[2] = 1; // Error +v[0 + 1] = 1; // Error +v[0 + 2] = 1; // Error From 5d188a8c68d1a54d6933ad0be5e1375b7be3e4db Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 22 May 2019 14:22:46 -0700 Subject: [PATCH 141/384] Always use resolved file to figure out subModule name in package id Fixes #30429 --- src/compiler/moduleNameResolver.ts | 129 +++++++----------- ...age_relativeImportWithinPackage.trace.json | 11 +- ...ativeImportWithinPackage_scoped.trace.json | 11 +- .../reference/library-reference-10.trace.json | 6 +- .../reference/library-reference-11.trace.json | 3 +- .../reference/library-reference-12.trace.json | 4 +- .../reference/library-reference-2.trace.json | 8 +- ...geIdWithRelativeAndAbsolutePath.trace.json | 10 +- ...lutionWithExtensions_unexpected.trace.json | 10 +- ...utionWithExtensions_unexpected2.trace.json | 8 +- ...on_packageJson_notAtPackageRoot.trace.json | 4 +- ...AtPackageRoot_fakeScopedPackage.trace.json | 4 +- ...ution_packageJson_scopedPackage.trace.json | 4 +- ...on_packageJson_yesAtPackageRoot.trace.json | 15 +- ...AtPackageRoot_fakeScopedPackage.trace.json | 15 +- ...ageRoot_mainFieldInSubDirectory.trace.json | 5 +- .../reference/packageJsonMain.trace.json | 30 +--- .../packageJsonMain_isNonRecursive.trace.json | 10 +- .../typesVersions.ambientModules.trace.json | 13 +- .../typesVersions.justIndex.trace.json | 5 +- .../typesVersions.multiFile.trace.json | 10 +- ...VersionsDeclarationEmit.ambient.trace.json | 13 +- ...rsionsDeclarationEmit.multiFile.trace.json | 10 +- ...it.multiFileBackReferenceToSelf.trace.json | 18 +-- ...ultiFileBackReferenceToUnmapped.trace.json | 12 +- .../reference/typingsLookup4.trace.json | 24 ++-- 26 files changed, 154 insertions(+), 238 deletions(-) diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 0cd9160ac42..19402b03ee9 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -16,12 +16,23 @@ namespace ts { push(value: T): void; } - function withPackageId(packageId: PackageId | undefined, r: PathAndExtension | undefined): Resolved | undefined { + function withPackageId(packageInfo: PackageJsonInfo | undefined, r: PathAndExtension | undefined): Resolved | undefined { + let packageId: PackageId | undefined; + if (r && packageInfo) { + const packageJsonContent = packageInfo.packageJsonContent as PackageJson; + if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") { + packageId = { + name: packageJsonContent.name, + subModuleName: r.path.slice(packageInfo.packageDirectory.length + directorySeparator.length), + version: packageJsonContent.version + }; + } + } return r && { path: r.path, extension: r.ext, packageId }; } function noPackageId(r: PathAndExtension | undefined): Resolved | undefined { - return withPackageId(/*packageId*/ undefined, r); + return withPackageId(/*packageInfo*/ undefined, r); } function removeIgnoredPackageId(r: Resolved | undefined): PathAndExtension | undefined { @@ -978,10 +989,9 @@ namespace ts { } const resolvedFromFile = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state); if (resolvedFromFile) { - const nm = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined; - const packageInfo = nm && getPackageJsonInfo(nm.packageDirectory, nm.subModuleName, /*onlyRecordFailures*/ false, state); - const packageId = packageInfo && packageInfo.packageId; - return withPackageId(packageId, resolvedFromFile); + const packageDirectory = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined; + const packageInfo = packageDirectory ? getPackageJsonInfo(packageDirectory, /*onlyRecordFailures*/ false, state) : undefined; + return withPackageId(packageInfo, resolvedFromFile); } } if (!onlyRecordFailures) { @@ -1008,13 +1018,12 @@ namespace ts { * (Not neeeded for `loadModuleFromNodeModules` as that looks up the `package.json` as part of resolution.) * * packageDirectory is the directory of the package itself. - * subModuleName is the path within the package. - * For `blah/node_modules/foo/index.d.ts` this is { packageDirectory: "foo", subModuleName: "index.d.ts" }. (Part before "/node_modules/" is ignored.) - * For `/node_modules/foo/bar.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }. - * For `/node_modules/@types/foo/bar/index.d.ts` this is { packageDirectory: "@types/foo", subModuleName: "bar/index.d.ts" }. - * For `/node_modules/foo/bar/index.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }. + * For `blah/node_modules/foo/index.d.ts` this is packageDirectory: "foo" + * For `/node_modules/foo/bar.d.ts` this is packageDirectory: "foo" + * For `/node_modules/@types/foo/bar/index.d.ts` this is packageDirectory: "@types/foo" + * For `/node_modules/foo/bar/index.d.ts` this is packageDirectory: "foo" */ - function parseNodeModuleFromPath(resolved: PathAndExtension): { packageDirectory: string, subModuleName: string } | undefined { + function parseNodeModuleFromPath(resolved: PathAndExtension): string | undefined { const path = normalizePath(resolved.path); const idx = path.lastIndexOf(nodeModulesPathPart); if (idx === -1) { @@ -1026,9 +1035,7 @@ namespace ts { if (path.charCodeAt(indexAfterNodeModules) === CharacterCodes.at) { indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName); } - const packageDirectory = path.slice(0, indexAfterPackageName); - const subModuleName = removeExtension(path.slice(indexAfterPackageName + 1), resolved.ext) + Extension.Dts; - return { packageDirectory, subModuleName }; + return path.slice(0, indexAfterPackageName); } function moveToNextDirectorySeparatorIfAvailable(path: string, prevSeparatorIndex: number): number { @@ -1036,19 +1043,6 @@ namespace ts { return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex; } - function addExtensionAndIndex(path: string): string { - if (path === "") { - return "index.d.ts"; - } - if (endsWith(path, ".d.ts")) { - return path; - } - if (path === "index" || endsWith(path, "/index")) { - return path + ".d.ts"; - } - return path + "/index.d.ts"; - } - function loadModuleFromFileNoPackageId(extensions: Extensions, candidate: string, onlyRecordFailures: boolean, state: ModuleResolutionState): Resolved | undefined { return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state)); } @@ -1129,56 +1123,29 @@ namespace ts { } function loadNodeModuleFromDirectory(extensions: Extensions, candidate: string, onlyRecordFailures: boolean, state: ModuleResolutionState, considerPackageJson = true) { - const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, "", onlyRecordFailures, state) : undefined; - const packageId = packageInfo && packageInfo.packageId; + const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined; const packageJsonContent = packageInfo && packageInfo.packageJsonContent; const versionPaths = packageInfo && packageInfo.versionPaths; - return withPackageId(packageId, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths)); + return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths)); } interface PackageJsonInfo { - packageJsonContent: PackageJsonPathFields | undefined; - packageId: PackageId | undefined; + packageDirectory: string; + packageJsonContent: PackageJsonPathFields; versionPaths: VersionPaths | undefined; } - function getPackageJsonInfo(packageDirectory: string, subModuleName: string, onlyRecordFailures: boolean, state: ModuleResolutionState): PackageJsonInfo | undefined { + function getPackageJsonInfo(packageDirectory: string, onlyRecordFailures: boolean, state: ModuleResolutionState): PackageJsonInfo | undefined { const { host, traceEnabled } = state; const directoryExists = !onlyRecordFailures && directoryProbablyExists(packageDirectory, host); const packageJsonPath = combinePaths(packageDirectory, "package.json"); if (directoryExists && host.fileExists(packageJsonPath)) { const packageJsonContent = readJson(packageJsonPath, host) as PackageJson; - if (subModuleName === "") { // looking up the root - need to handle types/typings/main redirects for subModuleName - const path = readPackageJsonTypesFields(packageJsonContent, packageDirectory, state); - if (typeof path === "string") { - subModuleName = addExtensionAndIndex(path.substring(packageDirectory.length + 1)); - } - else { - const jsPath = readPackageJsonMainField(packageJsonContent, packageDirectory, state); - if (typeof jsPath === "string" && jsPath.length > packageDirectory.length) { - const potentialSubModule = jsPath.substring(packageDirectory.length + 1); - subModuleName = (forEach(supportedJSExtensions, extension => - tryRemoveExtension(potentialSubModule, extension)) || potentialSubModule) + Extension.Dts; - } - else { - subModuleName = "index.d.ts"; - } - } - } - - if (!endsWith(subModuleName, Extension.Dts)) { - subModuleName = addExtensionAndIndex(subModuleName); - } - - const versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state); - const packageId: PackageId | undefined = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string" - ? { name: packageJsonContent.name, subModuleName, version: packageJsonContent.version } - : undefined; if (traceEnabled) { trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath); } - - return { packageJsonContent, packageId, versionPaths }; + const versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state); + return { packageDirectory, packageJsonContent, versionPaths }; } else { if (directoryExists && traceEnabled) { @@ -1333,27 +1300,36 @@ namespace ts { const candidate = normalizePath(combinePaths(nodeModulesDirectory, moduleName)); // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. - let packageJsonContent: PackageJsonPathFields | undefined; - let packageId: PackageId | undefined; - let versionPaths: VersionPaths | undefined; - - const packageInfo = getPackageJsonInfo(candidate, "", !nodeModulesDirectoryExists, state); + let packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); if (packageInfo) { - ({ packageJsonContent, packageId, versionPaths } = packageInfo); const fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state); if (fromFile) { return noPackageId(fromFile); } - const fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageJsonContent, versionPaths); - return withPackageId(packageId, fromDirectory); + const fromDirectory = loadNodeModuleFromDirectoryWorker( + extensions, + candidate, + !nodeModulesDirectoryExists, + state, + packageInfo.packageJsonContent, + packageInfo.versionPaths + ); + return withPackageId(packageInfo, fromDirectory); } const loader: ResolutionKindSpecificLoader = (extensions, candidate, onlyRecordFailures, state) => { const pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) || - loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths); - return withPackageId(packageId, pathAndExtension); + loadNodeModuleFromDirectoryWorker( + extensions, + candidate, + onlyRecordFailures, + state, + packageInfo && packageInfo.packageJsonContent, + packageInfo && packageInfo.versionPaths + ); + return withPackageId(packageInfo, pathAndExtension); }; const { packageName, rest } = parsePackageName(moduleName); @@ -1361,14 +1337,13 @@ namespace ts { const packageDirectory = combinePaths(nodeModulesDirectory, packageName); // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings. - const packageInfo = getPackageJsonInfo(packageDirectory, rest, !nodeModulesDirectoryExists, state); - if (packageInfo) ({ packageId, versionPaths } = packageInfo); - if (versionPaths) { + packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); + if (packageInfo && packageInfo.versionPaths) { if (state.traceEnabled) { - trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, rest); + trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.versionPaths.version, version, rest); } const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host); - const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, loader, !packageDirectoryExists, state); + const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.versionPaths.paths, loader, !packageDirectoryExists, state); if (fromPaths) { return fromPaths.value; } diff --git a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.trace.json b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.trace.json index eccaee3a379..8711f881de8 100644 --- a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.trace.json +++ b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.trace.json @@ -2,13 +2,13 @@ "======== Resolving module 'foo/use' from '/index.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'foo/use' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/foo/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/foo/use.ts' does not exist.", "File '/node_modules/foo/use.tsx' does not exist.", "File '/node_modules/foo/use.d.ts' exist - use it as a name resolution result.", "Resolving real path for '/node_modules/foo/use.d.ts', result '/node_modules/foo/use.d.ts'.", - "======== Module name 'foo/use' was successfully resolved to '/node_modules/foo/use.d.ts' with Package ID 'foo/use/index.d.ts@1.2.3'. ========", + "======== Module name 'foo/use' was successfully resolved to '/node_modules/foo/use.d.ts' with Package ID 'foo/use.d.ts@1.2.3'. ========", "======== Resolving module 'a' from '/index.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'a' from 'node_modules' folder, target file type 'TypeScript'.", @@ -27,17 +27,14 @@ "File '/node_modules/foo/index.ts' does not exist.", "File '/node_modules/foo/index.tsx' does not exist.", "File '/node_modules/foo/index.d.ts' exist - use it as a name resolution result.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/foo/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "======== Module name './index' was successfully resolved to '/node_modules/foo/index.d.ts' with Package ID 'foo/index.d.ts@1.2.3'. ========", "======== Resolving module 'foo' from '/node_modules/a/index.d.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' does not have a 'types' field.", - "'package.json' does not have a 'main' field.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/a/node_modules/foo/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/a/node_modules/foo.ts' does not exist.", "File '/node_modules/a/node_modules/foo.tsx' does not exist.", "File '/node_modules/a/node_modules/foo.d.ts' does not exist.", diff --git a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.trace.json b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.trace.json index d08d6e074f5..2a4b74ad555 100644 --- a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.trace.json +++ b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.trace.json @@ -2,13 +2,13 @@ "======== Resolving module '@foo/bar/use' from '/index.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module '@foo/bar/use' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/@foo/bar/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/@foo/bar/use.ts' does not exist.", "File '/node_modules/@foo/bar/use.tsx' does not exist.", "File '/node_modules/@foo/bar/use.d.ts' exist - use it as a name resolution result.", "Resolving real path for '/node_modules/@foo/bar/use.d.ts', result '/node_modules/@foo/bar/use.d.ts'.", - "======== Module name '@foo/bar/use' was successfully resolved to '/node_modules/@foo/bar/use.d.ts' with Package ID '@foo/bar/use/index.d.ts@1.2.3'. ========", + "======== Module name '@foo/bar/use' was successfully resolved to '/node_modules/@foo/bar/use.d.ts' with Package ID '@foo/bar/use.d.ts@1.2.3'. ========", "======== Resolving module 'a' from '/index.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'a' from 'node_modules' folder, target file type 'TypeScript'.", @@ -27,17 +27,14 @@ "File '/node_modules/@foo/bar/index.ts' does not exist.", "File '/node_modules/@foo/bar/index.tsx' does not exist.", "File '/node_modules/@foo/bar/index.d.ts' exist - use it as a name resolution result.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/@foo/bar/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "======== Module name './index' was successfully resolved to '/node_modules/@foo/bar/index.d.ts' with Package ID '@foo/bar/index.d.ts@1.2.3'. ========", "======== Resolving module '@foo/bar' from '/node_modules/a/index.d.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module '@foo/bar' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' does not have a 'types' field.", - "'package.json' does not have a 'main' field.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/a/node_modules/@foo/bar/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/a/node_modules/@foo/bar.ts' does not exist.", "File '/node_modules/a/node_modules/@foo/bar.tsx' does not exist.", "File '/node_modules/a/node_modules/@foo/bar.d.ts' does not exist.", diff --git a/tests/baselines/reference/library-reference-10.trace.json b/tests/baselines/reference/library-reference-10.trace.json index 37f8ab543ca..92b5b035079 100644 --- a/tests/baselines/reference/library-reference-10.trace.json +++ b/tests/baselines/reference/library-reference-10.trace.json @@ -1,18 +1,16 @@ [ "======== Resolving type reference directive 'jquery', containing file '/foo/consumer.ts', root directory './types'. ========", "Resolving with primary search path './types'.", - "'package.json' has 'typings' field 'jquery.d.ts' that references 'types/jquery/jquery.d.ts'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at './types/jquery/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "'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'.", "======== 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'.", - "'package.json' has 'typings' field 'jquery.d.ts' that references 'types/jquery/jquery.d.ts'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at './types/jquery/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "'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'.", diff --git a/tests/baselines/reference/library-reference-11.trace.json b/tests/baselines/reference/library-reference-11.trace.json index b5e324d8c36..ff1905707a3 100644 --- a/tests/baselines/reference/library-reference-11.trace.json +++ b/tests/baselines/reference/library-reference-11.trace.json @@ -3,9 +3,8 @@ "Root directory cannot be determined, skipping primary search paths.", "Looking up in 'node_modules' folder, initial location '/a/b'.", "Directory '/a/b/node_modules' does not exist, skipping all lookups in it.", - "'package.json' has 'typings' field 'jquery.d.ts' that references '/a/node_modules/jquery/jquery.d.ts'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/a/node_modules/jquery/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/a/node_modules/jquery.d.ts' does not exist.", "'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.", diff --git a/tests/baselines/reference/library-reference-12.trace.json b/tests/baselines/reference/library-reference-12.trace.json index 1421f1501d9..63be1cc32a3 100644 --- a/tests/baselines/reference/library-reference-12.trace.json +++ b/tests/baselines/reference/library-reference-12.trace.json @@ -3,10 +3,8 @@ "Root directory cannot be determined, skipping primary search paths.", "Looking up in 'node_modules' folder, initial location '/a/b'.", "Directory '/a/b/node_modules' does not exist, skipping all lookups in it.", - "'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'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/a/node_modules/jquery/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/a/node_modules/jquery.d.ts' does not exist.", "'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'.", diff --git a/tests/baselines/reference/library-reference-2.trace.json b/tests/baselines/reference/library-reference-2.trace.json index b9b4cf08ca2..d4f50990005 100644 --- a/tests/baselines/reference/library-reference-2.trace.json +++ b/tests/baselines/reference/library-reference-2.trace.json @@ -1,10 +1,8 @@ [ "======== Resolving type reference directive 'jquery', containing file '/consumer.ts', root directory '/types'. ========", "Resolving with primary search path '/types'.", - "'package.json' does not have a 'typings' field.", - "'package.json' has 'types' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/types/jquery/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "'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.", @@ -12,10 +10,8 @@ "======== 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'.", - "'package.json' does not have a 'typings' field.", - "'package.json' has 'types' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/types/jquery/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "'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.", diff --git a/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.trace.json b/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.trace.json index 9f514de9f25..e3d7b5dea54 100644 --- a/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.trace.json +++ b/tests/baselines/reference/moduleResolutionPackageIdWithRelativeAndAbsolutePath.trace.json @@ -41,21 +41,21 @@ "Loading module as file / folder, candidate module location '/project/troublesome-lib/lib/Compactable', target file type 'TypeScript'.", "Loading module 'troublesome-lib/lib/Compactable' from 'node_modules' folder, target file type 'TypeScript'.", "Directory '/project/node_modules/anotherLib/node_modules' does not exist, skipping all lookups in it.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/project/node_modules/troublesome-lib/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/project/node_modules/troublesome-lib/lib/Compactable.ts' does not exist.", "File '/project/node_modules/troublesome-lib/lib/Compactable.tsx' does not exist.", "File '/project/node_modules/troublesome-lib/lib/Compactable.d.ts' exist - use it as a name resolution result.", "Resolving real path for '/project/node_modules/troublesome-lib/lib/Compactable.d.ts', result '/project/node_modules/troublesome-lib/lib/Compactable.d.ts'.", - "======== Module name 'troublesome-lib/lib/Compactable' was successfully resolved to '/project/node_modules/troublesome-lib/lib/Compactable.d.ts' with Package ID 'troublesome-lib/lib/Compactable/index.d.ts@1.17.1'. ========", + "======== Module name 'troublesome-lib/lib/Compactable' was successfully resolved to '/project/node_modules/troublesome-lib/lib/Compactable.d.ts' with Package ID 'troublesome-lib/lib/Compactable.d.ts@1.17.1'. ========", "======== Resolving module './Option' from '/project/node_modules/troublesome-lib/lib/Compactable.d.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module as file / folder, candidate module location '/project/node_modules/troublesome-lib/lib/Option', target file type 'TypeScript'.", "File '/project/node_modules/troublesome-lib/lib/Option.ts' does not exist.", "File '/project/node_modules/troublesome-lib/lib/Option.tsx' does not exist.", "File '/project/node_modules/troublesome-lib/lib/Option.d.ts' exist - use it as a name resolution result.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/project/node_modules/troublesome-lib/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "======== Module name './Option' was successfully resolved to '/project/node_modules/troublesome-lib/lib/Option.d.ts' with Package ID 'troublesome-lib/lib/Option.d.ts@1.17.1'. ========", "======== Resolving module 'troublesome-lib/lib/Option' from '/shared/lib/app.d.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -66,11 +66,11 @@ "Loading module as file / folder, candidate module location '/project/troublesome-lib/lib/Option', target file type 'TypeScript'.", "Loading module 'troublesome-lib/lib/Option' from 'node_modules' folder, target file type 'TypeScript'.", "Directory '/shared/lib/node_modules' does not exist, skipping all lookups in it.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/shared/node_modules/troublesome-lib/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/shared/node_modules/troublesome-lib/lib/Option.ts' does not exist.", "File '/shared/node_modules/troublesome-lib/lib/Option.tsx' does not exist.", "File '/shared/node_modules/troublesome-lib/lib/Option.d.ts' exist - use it as a name resolution result.", "Resolving real path for '/shared/node_modules/troublesome-lib/lib/Option.d.ts', result '/shared/node_modules/troublesome-lib/lib/Option.d.ts'.", - "======== Module name 'troublesome-lib/lib/Option' was successfully resolved to '/shared/node_modules/troublesome-lib/lib/Option.d.ts' with Package ID 'troublesome-lib/lib/Option/index.d.ts@1.17.1'. ========" + "======== Module name 'troublesome-lib/lib/Option' was successfully resolved to '/shared/node_modules/troublesome-lib/lib/Option.d.ts' with Package ID 'troublesome-lib/lib/Option.d.ts@1.17.1'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.trace.json index d386774db15..28e150aa345 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.trace.json @@ -2,11 +2,8 @@ "======== Resolving module 'normalize.css' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'normalize.css' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' does not have a 'types' field.", - "'package.json' has 'main' field 'normalize.css' that references '/node_modules/normalize.css/normalize.css'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/normalize.css/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/normalize.css.ts' does not exist.", "File '/node_modules/normalize.css.tsx' does not exist.", "File '/node_modules/normalize.css.d.ts' does not exist.", @@ -25,11 +22,8 @@ "File '/node_modules/normalize.css/index.d.ts' does not exist.", "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", "Loading module 'normalize.css' from 'node_modules' folder, target file type 'JavaScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' does not have a 'types' field.", - "'package.json' has 'main' field 'normalize.css' that references '/node_modules/normalize.css/normalize.css'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/normalize.css/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/normalize.css.js' does not exist.", "File '/node_modules/normalize.css.jsx' does not exist.", "'package.json' has 'main' field 'normalize.css' that references '/node_modules/normalize.css/normalize.css'.", diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json index 09a7bf81c98..a92c5953af3 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json @@ -2,10 +2,8 @@ "======== Resolving module 'foo' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' has 'types' field 'foo.js' that references '/node_modules/foo/foo.js'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/foo/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/foo.ts' does not exist.", "File '/node_modules/foo.tsx' does not exist.", "File '/node_modules/foo.d.ts' does not exist.", @@ -27,10 +25,8 @@ "File '/node_modules/foo/index.d.ts' does not exist.", "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", "Loading module 'foo' from 'node_modules' folder, target file type 'JavaScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' has 'types' field 'foo.js' that references '/node_modules/foo/foo.js'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/foo/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/foo.js' does not exist.", "File '/node_modules/foo.jsx' does not exist.", "'package.json' does not have a 'main' field.", diff --git a/tests/baselines/reference/moduleResolution_packageJson_notAtPackageRoot.trace.json b/tests/baselines/reference/moduleResolution_packageJson_notAtPackageRoot.trace.json index dbd645d9d65..a0ff3e6a5f7 100644 --- a/tests/baselines/reference/moduleResolution_packageJson_notAtPackageRoot.trace.json +++ b/tests/baselines/reference/moduleResolution_packageJson_notAtPackageRoot.trace.json @@ -2,10 +2,8 @@ "======== Resolving module 'foo/bar' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'foo/bar' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' has 'types' field 'types.d.ts' that references '/node_modules/foo/bar/types.d.ts'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/foo/bar/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/foo/bar.ts' does not exist.", "File '/node_modules/foo/bar.tsx' does not exist.", "File '/node_modules/foo/bar.d.ts' does not exist.", diff --git a/tests/baselines/reference/moduleResolution_packageJson_notAtPackageRoot_fakeScopedPackage.trace.json b/tests/baselines/reference/moduleResolution_packageJson_notAtPackageRoot_fakeScopedPackage.trace.json index e47dcc86b12..ebeee4299fe 100644 --- a/tests/baselines/reference/moduleResolution_packageJson_notAtPackageRoot_fakeScopedPackage.trace.json +++ b/tests/baselines/reference/moduleResolution_packageJson_notAtPackageRoot_fakeScopedPackage.trace.json @@ -2,10 +2,8 @@ "======== Resolving module 'foo/@bar' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'foo/@bar' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' has 'types' field 'types.d.ts' that references '/node_modules/foo/@bar/types.d.ts'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/foo/@bar/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/foo/@bar.ts' does not exist.", "File '/node_modules/foo/@bar.tsx' does not exist.", "File '/node_modules/foo/@bar.d.ts' does not exist.", diff --git a/tests/baselines/reference/moduleResolution_packageJson_scopedPackage.trace.json b/tests/baselines/reference/moduleResolution_packageJson_scopedPackage.trace.json index a8e509ff6e8..959e178b57e 100644 --- a/tests/baselines/reference/moduleResolution_packageJson_scopedPackage.trace.json +++ b/tests/baselines/reference/moduleResolution_packageJson_scopedPackage.trace.json @@ -2,10 +2,8 @@ "======== Resolving module '@foo/bar' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module '@foo/bar' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' has 'types' field 'types.d.ts' that references '/node_modules/@foo/bar/types.d.ts'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/@foo/bar/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/@foo/bar.ts' does not exist.", "File '/node_modules/@foo/bar.tsx' does not exist.", "File '/node_modules/@foo/bar.d.ts' does not exist.", diff --git a/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot.trace.json b/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot.trace.json index 4a2e60d9c7f..aafca116d0b 100644 --- a/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot.trace.json +++ b/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot.trace.json @@ -3,22 +3,31 @@ "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'foo/bar' from 'node_modules' folder, target file type 'TypeScript'.", "File '/node_modules/foo/bar/package.json' does not exist.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/foo/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/foo/bar.ts' does not exist.", "File '/node_modules/foo/bar.tsx' does not exist.", "File '/node_modules/foo/bar.d.ts' does not exist.", + "'package.json' does not have a 'typings' field.", + "'package.json' has 'types' field 'types.d.ts' that references '/node_modules/foo/bar/types.d.ts'.", + "File '/node_modules/foo/bar/types.d.ts' does not exist.", + "Loading module as file / folder, candidate module location '/node_modules/foo/bar/types.d.ts', target file type 'TypeScript'.", + "File '/node_modules/foo/bar/types.d.ts.ts' does not exist.", + "File '/node_modules/foo/bar/types.d.ts.tsx' does not exist.", + "File '/node_modules/foo/bar/types.d.ts.d.ts' does not exist.", + "Directory '/node_modules/foo/bar/types.d.ts' does not exist, skipping all lookups in it.", "File '/node_modules/foo/bar/index.ts' does not exist.", "File '/node_modules/foo/bar/index.tsx' does not exist.", "File '/node_modules/foo/bar/index.d.ts' does not exist.", "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", "Loading module 'foo/bar' from 'node_modules' folder, target file type 'JavaScript'.", "File '/node_modules/foo/bar/package.json' does not exist.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/foo/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/foo/bar.js' does not exist.", "File '/node_modules/foo/bar.jsx' does not exist.", + "'package.json' does not have a 'main' field.", "File '/node_modules/foo/bar/index.js' exist - use it as a name resolution result.", "Resolving real path for '/node_modules/foo/bar/index.js', result '/node_modules/foo/bar/index.js'.", - "======== Module name 'foo/bar' was successfully resolved to '/node_modules/foo/bar/index.js' with Package ID 'foo/bar/index.d.ts@1.2.3'. ========" + "======== Module name 'foo/bar' was successfully resolved to '/node_modules/foo/bar/index.js' with Package ID 'foo/bar/index.js@1.2.3'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_fakeScopedPackage.trace.json b/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_fakeScopedPackage.trace.json index 3f2423ce832..f41b1ca0710 100644 --- a/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_fakeScopedPackage.trace.json +++ b/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_fakeScopedPackage.trace.json @@ -3,22 +3,31 @@ "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'foo/@bar' from 'node_modules' folder, target file type 'TypeScript'.", "File '/node_modules/foo/@bar/package.json' does not exist.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/foo/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/foo/@bar.ts' does not exist.", "File '/node_modules/foo/@bar.tsx' does not exist.", "File '/node_modules/foo/@bar.d.ts' does not exist.", + "'package.json' does not have a 'typings' field.", + "'package.json' has 'types' field 'types.d.ts' that references '/node_modules/foo/@bar/types.d.ts'.", + "File '/node_modules/foo/@bar/types.d.ts' does not exist.", + "Loading module as file / folder, candidate module location '/node_modules/foo/@bar/types.d.ts', target file type 'TypeScript'.", + "File '/node_modules/foo/@bar/types.d.ts.ts' does not exist.", + "File '/node_modules/foo/@bar/types.d.ts.tsx' does not exist.", + "File '/node_modules/foo/@bar/types.d.ts.d.ts' does not exist.", + "Directory '/node_modules/foo/@bar/types.d.ts' does not exist, skipping all lookups in it.", "File '/node_modules/foo/@bar/index.ts' does not exist.", "File '/node_modules/foo/@bar/index.tsx' does not exist.", "File '/node_modules/foo/@bar/index.d.ts' does not exist.", "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", "Loading module 'foo/@bar' from 'node_modules' folder, target file type 'JavaScript'.", "File '/node_modules/foo/@bar/package.json' does not exist.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/foo/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/foo/@bar.js' does not exist.", "File '/node_modules/foo/@bar.jsx' does not exist.", + "'package.json' does not have a 'main' field.", "File '/node_modules/foo/@bar/index.js' exist - use it as a name resolution result.", "Resolving real path for '/node_modules/foo/@bar/index.js', result '/node_modules/foo/@bar/index.js'.", - "======== Module name 'foo/@bar' was successfully resolved to '/node_modules/foo/@bar/index.js' with Package ID 'foo/@bar/index.d.ts@1.2.3'. ========" + "======== Module name 'foo/@bar' was successfully resolved to '/node_modules/foo/@bar/index.js' with Package ID 'foo/@bar/index.js@1.2.3'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json b/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json index 6b373fb300f..cf2b1082bf8 100644 --- a/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json +++ b/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json @@ -2,11 +2,8 @@ "======== Resolving module 'foo' from '/index.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' does not have a 'types' field.", - "'package.json' has 'main' field 'src/index.js' that references '/node_modules/foo/src/index.js'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/foo/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/foo.ts' does not exist.", "File '/node_modules/foo.tsx' does not exist.", "File '/node_modules/foo.d.ts' does not exist.", diff --git a/tests/baselines/reference/packageJsonMain.trace.json b/tests/baselines/reference/packageJsonMain.trace.json index 1f722312e1d..2144b6eb15c 100644 --- a/tests/baselines/reference/packageJsonMain.trace.json +++ b/tests/baselines/reference/packageJsonMain.trace.json @@ -2,11 +2,8 @@ "======== Resolving module 'foo' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' does not have a 'types' field.", - "'package.json' has 'main' field 'oof' that references '/node_modules/foo/oof'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/foo/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/foo.ts' does not exist.", "File '/node_modules/foo.tsx' does not exist.", "File '/node_modules/foo.d.ts' does not exist.", @@ -24,11 +21,8 @@ "File '/node_modules/foo/index.d.ts' does not exist.", "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", "Loading module 'foo' from 'node_modules' folder, target file type 'JavaScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' does not have a 'types' field.", - "'package.json' has 'main' field 'oof' that references '/node_modules/foo/oof'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/foo/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/foo.js' does not exist.", "File '/node_modules/foo.jsx' does not exist.", "'package.json' has 'main' field 'oof' that references '/node_modules/foo/oof'.", @@ -40,11 +34,8 @@ "======== Resolving module 'bar' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'bar' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' does not have a 'types' field.", - "'package.json' has 'main' field 'rab.js' that references '/node_modules/bar/rab.js'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/bar/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/bar.ts' does not exist.", "File '/node_modules/bar.tsx' does not exist.", "File '/node_modules/bar.d.ts' does not exist.", @@ -67,11 +58,8 @@ "File '/node_modules/bar/index.d.ts' does not exist.", "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", "Loading module 'bar' from 'node_modules' folder, target file type 'JavaScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' does not have a 'types' field.", - "'package.json' has 'main' field 'rab.js' that references '/node_modules/bar/rab.js'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/bar/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/bar.js' does not exist.", "File '/node_modules/bar.jsx' does not exist.", "'package.json' has 'main' field 'rab.js' that references '/node_modules/bar/rab.js'.", @@ -81,11 +69,8 @@ "======== Resolving module 'baz' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'baz' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' does not have a 'types' field.", - "'package.json' has 'main' field 'zab' that references '/node_modules/baz/zab'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/baz/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/baz.ts' does not exist.", "File '/node_modules/baz.tsx' does not exist.", "File '/node_modules/baz.d.ts' does not exist.", @@ -105,11 +90,8 @@ "File '/node_modules/baz/index.d.ts' does not exist.", "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", "Loading module 'baz' from 'node_modules' folder, target file type 'JavaScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' does not have a 'types' field.", - "'package.json' has 'main' field 'zab' that references '/node_modules/baz/zab'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/baz/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/baz.js' does not exist.", "File '/node_modules/baz.jsx' does not exist.", "'package.json' has 'main' field 'zab' that references '/node_modules/baz/zab'.", diff --git a/tests/baselines/reference/packageJsonMain_isNonRecursive.trace.json b/tests/baselines/reference/packageJsonMain_isNonRecursive.trace.json index f2f16ec6aeb..5bdd8a7e90c 100644 --- a/tests/baselines/reference/packageJsonMain_isNonRecursive.trace.json +++ b/tests/baselines/reference/packageJsonMain_isNonRecursive.trace.json @@ -2,11 +2,8 @@ "======== Resolving module 'foo' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' does not have a 'types' field.", - "'package.json' has 'main' field 'oof' that references '/node_modules/foo/oof'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/foo/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/foo.ts' does not exist.", "File '/node_modules/foo.tsx' does not exist.", "File '/node_modules/foo.d.ts' does not exist.", @@ -26,11 +23,8 @@ "File '/node_modules/foo/index.d.ts' does not exist.", "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", "Loading module 'foo' from 'node_modules' folder, target file type 'JavaScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' does not have a 'types' field.", - "'package.json' has 'main' field 'oof' that references '/node_modules/foo/oof'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/foo/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/foo.js' does not exist.", "File '/node_modules/foo.jsx' does not exist.", "'package.json' has 'main' field 'oof' that references '/node_modules/foo/oof'.", diff --git a/tests/baselines/reference/typesVersions.ambientModules.trace.json b/tests/baselines/reference/typesVersions.ambientModules.trace.json index dcaf6acc096..53de9ae651e 100644 --- a/tests/baselines/reference/typesVersions.ambientModules.trace.json +++ b/tests/baselines/reference/typesVersions.ambientModules.trace.json @@ -2,10 +2,8 @@ "======== Resolving module 'ext' from 'tests/cases/conformance/moduleResolution/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/moduleResolution/node_modules/ext/index'.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext.ts' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext.tsx' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext.d.ts' does not exist.", @@ -20,18 +18,20 @@ "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.tsx' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/index.d.ts@1.0.0'. ========", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/ts3.1/index.d.ts@1.0.0'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/moduleResolution/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.ts' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.tsx' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts' does not exist.", + "'package.json' does not have a 'typings' field.", + "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other/index'.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'index'.", "Module name 'index', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/index'.", @@ -43,13 +43,14 @@ "Directory 'node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'JavaScript'.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.js' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.jsx' does not exist.", + "'package.json' does not have a 'main' field.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'index'.", "Module name 'index', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/index'.", diff --git a/tests/baselines/reference/typesVersions.justIndex.trace.json b/tests/baselines/reference/typesVersions.justIndex.trace.json index 28e4a5cb3bf..263d16b0b4b 100644 --- a/tests/baselines/reference/typesVersions.justIndex.trace.json +++ b/tests/baselines/reference/typesVersions.justIndex.trace.json @@ -7,11 +7,8 @@ "File '/a.ts' does not exist.", "File '/a.tsx' does not exist.", "File '/a.d.ts' does not exist.", - "'package.json' does not have a 'typings' field.", - "'package.json' does not have a 'types' field.", - "'package.json' does not have a 'main' field.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at '/a/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "'package.json' does not have a 'typings' field.", "'package.json' does not have a 'types' field.", "'package.json' does not have a 'main' field.", diff --git a/tests/baselines/reference/typesVersions.multiFile.trace.json b/tests/baselines/reference/typesVersions.multiFile.trace.json index 71975474092..d487d352948 100644 --- a/tests/baselines/reference/typesVersions.multiFile.trace.json +++ b/tests/baselines/reference/typesVersions.multiFile.trace.json @@ -2,10 +2,8 @@ "======== Resolving module 'ext' from 'tests/cases/conformance/moduleResolution/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/moduleResolution/node_modules/ext/index'.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext.ts' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext.tsx' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext.d.ts' does not exist.", @@ -20,12 +18,12 @@ "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.tsx' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/index.d.ts@1.0.0'. ========", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/ts3.1/index.d.ts@1.0.0'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/moduleResolution/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", @@ -33,5 +31,5 @@ "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.tsx' does not exist.", "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts'.", - "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts' with Package ID 'ext/other/index.d.ts@1.0.0'. ========" + "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts' with Package ID 'ext/ts3.1/other.d.ts@1.0.0'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json index 5d5009e8a41..97972b9d1f6 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json @@ -2,10 +2,8 @@ "======== Resolving module 'ext' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.ts' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.d.ts' does not exist.", @@ -20,18 +18,20 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/index.d.ts@1.0.0'. ========", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/ts3.1/index.d.ts@1.0.0'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.ts' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts' does not exist.", + "'package.json' does not have a 'typings' field.", + "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other/index'.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'index'.", "Module name 'index', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/index'.", @@ -43,13 +43,14 @@ "Directory 'node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'JavaScript'.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.js' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.jsx' does not exist.", + "'package.json' does not have a 'main' field.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'index'.", "Module name 'index', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/index'.", diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json index 9fb9c48332a..224839cf26d 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json @@ -2,10 +2,8 @@ "======== Resolving module 'ext' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.ts' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.d.ts' does not exist.", @@ -20,12 +18,12 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/index.d.ts@1.0.0'. ========", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/ts3.1/index.d.ts@1.0.0'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", @@ -33,5 +31,5 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts'.", - "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts' with Package ID 'ext/other/index.d.ts@1.0.0'. ========" + "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts' with Package ID 'ext/ts3.1/other.d.ts@1.0.0'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json index 6deb7327c99..a89df5a6dfe 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json @@ -2,10 +2,8 @@ "======== Resolving module '../' from 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module as file / folder, candidate module location 'tests/cases/conformance/declarationEmit/node_modules/ext/', target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'index'.", @@ -16,23 +14,21 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.ts' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", - "======== Module name '../' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/ndex/index.d.ts@1.0.0'. ========", + "======== Module name '../' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/s3.1/index.d.ts@1.0.0'. ========", "======== Resolving module '../other' from 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module as file / folder, candidate module location 'tests/cases/conformance/declarationEmit/node_modules/ext/other', target file type 'TypeScript'.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.ts' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' exist - use it as a name resolution result.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "======== Module name '../other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' with Package ID 'ext/other.d.ts@1.0.0'. ========", "======== Resolving module 'ext' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.ts' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.d.ts' does not exist.", @@ -47,12 +43,12 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/index.d.ts@1.0.0'. ========", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/ts3.1/index.d.ts@1.0.0'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", @@ -60,5 +56,5 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts'.", - "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts' with Package ID 'ext/other/index.d.ts@1.0.0'. ========" + "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts' with Package ID 'ext/ts3.1/other.d.ts@1.0.0'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json index 94f15e64260..7da95cd402c 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json @@ -5,16 +5,14 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.ts' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' exist - use it as a name resolution result.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "======== Module name '../other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' with Package ID 'ext/other.d.ts@1.0.0'. ========", "======== Resolving module 'ext' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' does not have a 'typings' field.", - "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.ts' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext.d.ts' does not exist.", @@ -29,16 +27,16 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/index.d.ts@1.0.0'. ========", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' with Package ID 'ext/ts3.1/index.d.ts@1.0.0'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", - "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'other'.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.ts' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.tsx' does not exist.", "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' exist - use it as a name resolution result.", "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts'.", - "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' with Package ID 'ext/other/index.d.ts@1.0.0'. ========" + "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' with Package ID 'ext/other.d.ts@1.0.0'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typingsLookup4.trace.json b/tests/baselines/reference/typingsLookup4.trace.json index 6409896ad17..3ce97d9d8c9 100644 --- a/tests/baselines/reference/typingsLookup4.trace.json +++ b/tests/baselines/reference/typingsLookup4.trace.json @@ -5,9 +5,8 @@ "File '/node_modules/jquery.ts' does not exist.", "File '/node_modules/jquery.tsx' does not exist.", "File '/node_modules/jquery.d.ts' does not exist.", - "'package.json' has 'typings' field 'jquery.d.ts' that references '/node_modules/@types/jquery/jquery.d.ts'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/@types/jquery/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/@types/jquery.d.ts' does not exist.", "'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.", @@ -19,9 +18,8 @@ "File '/node_modules/kquery.ts' does not exist.", "File '/node_modules/kquery.tsx' does not exist.", "File '/node_modules/kquery.d.ts' does not exist.", - "'package.json' has 'typings' field 'kquery' that references '/node_modules/@types/kquery/kquery'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/@types/kquery/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/@types/kquery.d.ts' does not exist.", "'package.json' has 'typings' field 'kquery' that references '/node_modules/@types/kquery/kquery'.", "File '/node_modules/@types/kquery/kquery' does not exist.", @@ -37,9 +35,8 @@ "File '/node_modules/lquery.ts' does not exist.", "File '/node_modules/lquery.tsx' does not exist.", "File '/node_modules/lquery.d.ts' does not exist.", - "'package.json' has 'typings' field 'lquery' that references '/node_modules/@types/lquery/lquery'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/@types/lquery/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/@types/lquery.d.ts' does not exist.", "'package.json' has 'typings' field 'lquery' that references '/node_modules/@types/lquery/lquery'.", "File '/node_modules/@types/lquery/lquery' does not exist.", @@ -53,9 +50,8 @@ "File '/node_modules/mquery.ts' does not exist.", "File '/node_modules/mquery.tsx' does not exist.", "File '/node_modules/mquery.d.ts' does not exist.", - "'package.json' has 'typings' field 'mquery' that references '/node_modules/@types/mquery/mquery'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/@types/mquery/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/@types/mquery.d.ts' does not exist.", "'package.json' has 'typings' field 'mquery' that references '/node_modules/@types/mquery/mquery'.", "File '/node_modules/@types/mquery/mquery' does not exist.", @@ -69,18 +65,16 @@ "======== 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'.", - "'package.json' has 'typings' field 'jquery.d.ts' that references '/node_modules/@types/jquery/jquery.d.ts'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/@types/jquery/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "'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'.", "======== 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'.", - "'package.json' has 'typings' field 'kquery' that references '/node_modules/@types/kquery/kquery'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/@types/kquery/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "'package.json' has 'typings' field 'kquery' that references '/node_modules/@types/kquery/kquery'.", "File '/node_modules/@types/kquery/kquery' does not exist.", "Loading module as file / folder, candidate module location '/node_modules/@types/kquery/kquery', target file type 'TypeScript'.", @@ -91,9 +85,8 @@ "======== 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'.", - "'package.json' has 'typings' field 'lquery' that references '/node_modules/@types/lquery/lquery'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/@types/lquery/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "'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'.", @@ -102,9 +95,8 @@ "======== 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'.", - "'package.json' has 'typings' field 'mquery' that references '/node_modules/@types/mquery/mquery'.", - "'package.json' does not have a 'typesVersions' field.", "Found 'package.json' at '/node_modules/@types/mquery/package.json'.", + "'package.json' does not have a 'typesVersions' field.", "'package.json' has 'typings' field 'mquery' that references '/node_modules/@types/mquery/mquery'.", "File '/node_modules/@types/mquery/mquery' does not exist.", "Loading module as file / folder, candidate module location '/node_modules/@types/mquery/mquery', target file type 'TypeScript'.", From 9f6791a5abef5d9e8161de6c7bc545a65fa3fe7c Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 22 May 2019 15:03:17 -0700 Subject: [PATCH 142/384] Error when writing to readonly tuple in rest element range --- src/compiler/checker.ts | 15 ++--- .../readonlyArraysAndTuples.errors.txt | 32 ++++++++++- .../reference/readonlyArraysAndTuples.js | 17 ++++++ .../reference/readonlyArraysAndTuples.symbols | 26 +++++++++ .../reference/readonlyArraysAndTuples.types | 56 +++++++++++++++++++ .../types/tuple/readonlyArraysAndTuples.ts | 12 ++-- 6 files changed, 145 insertions(+), 13 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 05b1015b124..dd3a67d0938 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10101,6 +10101,7 @@ namespace ts { error(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType)); } } + errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, IndexKind.Number)); return mapType(objectType, t => getRestTypeOfTupleType(t) || undefinedType); } } @@ -10122,13 +10123,7 @@ namespace ts { error(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); return indexInfo.type; } - if (indexInfo.isReadonly && accessExpression && (isAssignmentTarget(accessExpression) || isDeleteTarget(accessExpression))) { - if (accessExpression) { - error(accessExpression, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); - return indexInfo.type; - } - return undefined; - } + errorIfWritingToReadonlyIndex(indexInfo); return indexInfo.type; } if (indexType.flags & TypeFlags.Never) { @@ -10188,6 +10183,12 @@ namespace ts { return indexType; } return undefined; + + function errorIfWritingToReadonlyIndex(indexInfo: IndexInfo | undefined): void { + if (indexInfo && indexInfo.isReadonly && accessExpression && (isAssignmentTarget(accessExpression) || isDeleteTarget(accessExpression))) { + error(accessExpression, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); + } + } } function getIndexNodeForAccessExpression(accessNode: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression) { diff --git a/tests/baselines/reference/readonlyArraysAndTuples.errors.txt b/tests/baselines/reference/readonlyArraysAndTuples.errors.txt index 3680b78bb1b..39f377f4ee9 100644 --- a/tests/baselines/reference/readonlyArraysAndTuples.errors.txt +++ b/tests/baselines/reference/readonlyArraysAndTuples.errors.txt @@ -9,9 +9,16 @@ tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(22,5): error TS27 tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(23,5): error TS4104: The type 'readonly [string, string]' is 'readonly' and cannot be assigned to the mutable type '[string, string]'. tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(24,5): error TS2739: Type 'string[]' is missing the following properties from type 'readonly [string, string]': 0, 1 tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(25,5): error TS2739: Type 'readonly string[]' is missing the following properties from type 'readonly [string, string]': 0, 1 +tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(30,3): error TS2540: Cannot assign to '0' because it is a read-only property. +tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(31,3): error TS2540: Cannot assign to '1' because it is a read-only property. +tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(32,1): error TS2542: Index signature in type 'readonly [number, number, ...number[]]' only permits reading. +tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(33,8): error TS2542: Index signature in type 'readonly [number, number, ...number[]]' only permits reading. +tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(34,1): error TS2542: Index signature in type 'readonly [number, number, ...number[]]' only permits reading. +tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(35,1): error TS2542: Index signature in type 'readonly [number, number, ...number[]]' only permits reading. +tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(36,8): error TS2542: Index signature in type 'readonly [number, number, ...number[]]' only permits reading. -==== tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts (11 errors) ==== +==== tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts (18 errors) ==== type T10 = string[]; type T11 = Array; type T12 = readonly string[]; @@ -61,4 +68,27 @@ tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(25,5): error TS27 !!! error TS2739: Type 'readonly string[]' is missing the following properties from type 'readonly [string, string]': 0, 1 rt = mt; } + + declare var v: readonly[number, number, ...number[]]; + v[0] = 1; // Error + ~ +!!! error TS2540: Cannot assign to '0' because it is a read-only property. + v[1] = 1; // Error + ~ +!!! error TS2540: Cannot assign to '1' because it is a read-only property. + v[2] = 1; // Error + ~~~~ +!!! error TS2542: Index signature in type 'readonly [number, number, ...number[]]' only permits reading. + delete v[2]; // Error + ~~~~ +!!! error TS2542: Index signature in type 'readonly [number, number, ...number[]]' only permits reading. + v[0 + 1] = 1; // Error + ~~~~~~~~ +!!! error TS2542: Index signature in type 'readonly [number, number, ...number[]]' only permits reading. + v[0 + 2] = 1; // Error + ~~~~~~~~ +!!! error TS2542: Index signature in type 'readonly [number, number, ...number[]]' only permits reading. + delete v[0 + 1]; // Error + ~~~~~~~~ +!!! error TS2542: Index signature in type 'readonly [number, number, ...number[]]' only permits reading. \ No newline at end of file diff --git a/tests/baselines/reference/readonlyArraysAndTuples.js b/tests/baselines/reference/readonlyArraysAndTuples.js index 0ba392dadb4..f293ad01b7b 100644 --- a/tests/baselines/reference/readonlyArraysAndTuples.js +++ b/tests/baselines/reference/readonlyArraysAndTuples.js @@ -26,6 +26,15 @@ function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: reado rt = ra; // Error rt = mt; } + +declare var v: readonly[number, number, ...number[]]; +v[0] = 1; // Error +v[1] = 1; // Error +v[2] = 1; // Error +delete v[2]; // Error +v[0 + 1] = 1; // Error +v[0 + 2] = 1; // Error +delete v[0 + 1]; // Error //// [readonlyArraysAndTuples.js] @@ -44,6 +53,13 @@ function f1(ma, ra, mt, rt) { rt = ra; // Error rt = mt; } +v[0] = 1; // Error +v[1] = 1; // Error +v[2] = 1; // Error +delete v[2]; // Error +v[0 + 1] = 1; // Error +v[0 + 2] = 1; // Error +delete v[0 + 1]; // Error //// [readonlyArraysAndTuples.d.ts] @@ -58,3 +74,4 @@ declare type T31 = readonly T; declare type T32 = readonly readonly string[]; declare type T33 = readonly Array; declare function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]): void; +declare var v: readonly [number, number, ...number[]]; diff --git a/tests/baselines/reference/readonlyArraysAndTuples.symbols b/tests/baselines/reference/readonlyArraysAndTuples.symbols index c7c371af0d8..53b425fec09 100644 --- a/tests/baselines/reference/readonlyArraysAndTuples.symbols +++ b/tests/baselines/reference/readonlyArraysAndTuples.symbols @@ -90,3 +90,29 @@ function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: reado >mt : Symbol(mt, Decl(readonlyArraysAndTuples.ts, 13, 48)) } +declare var v: readonly[number, number, ...number[]]; +>v : Symbol(v, Decl(readonlyArraysAndTuples.ts, 28, 11)) + +v[0] = 1; // Error +>v : Symbol(v, Decl(readonlyArraysAndTuples.ts, 28, 11)) +>0 : Symbol(0) + +v[1] = 1; // Error +>v : Symbol(v, Decl(readonlyArraysAndTuples.ts, 28, 11)) +>1 : Symbol(1) + +v[2] = 1; // Error +>v : Symbol(v, Decl(readonlyArraysAndTuples.ts, 28, 11)) + +delete v[2]; // Error +>v : Symbol(v, Decl(readonlyArraysAndTuples.ts, 28, 11)) + +v[0 + 1] = 1; // Error +>v : Symbol(v, Decl(readonlyArraysAndTuples.ts, 28, 11)) + +v[0 + 2] = 1; // Error +>v : Symbol(v, Decl(readonlyArraysAndTuples.ts, 28, 11)) + +delete v[0 + 1]; // Error +>v : Symbol(v, Decl(readonlyArraysAndTuples.ts, 28, 11)) + diff --git a/tests/baselines/reference/readonlyArraysAndTuples.types b/tests/baselines/reference/readonlyArraysAndTuples.types index 9ffb409d526..5075319ef95 100644 --- a/tests/baselines/reference/readonlyArraysAndTuples.types +++ b/tests/baselines/reference/readonlyArraysAndTuples.types @@ -97,3 +97,59 @@ function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: reado >mt : [string, string] } +declare var v: readonly[number, number, ...number[]]; +>v : readonly [number, number, ...number[]] + +v[0] = 1; // Error +>v[0] = 1 : 1 +>v[0] : any +>v : readonly [number, number, ...number[]] +>0 : 0 +>1 : 1 + +v[1] = 1; // Error +>v[1] = 1 : 1 +>v[1] : any +>v : readonly [number, number, ...number[]] +>1 : 1 +>1 : 1 + +v[2] = 1; // Error +>v[2] = 1 : 1 +>v[2] : number +>v : readonly [number, number, ...number[]] +>2 : 2 +>1 : 1 + +delete v[2]; // Error +>delete v[2] : boolean +>v[2] : number +>v : readonly [number, number, ...number[]] +>2 : 2 + +v[0 + 1] = 1; // Error +>v[0 + 1] = 1 : 1 +>v[0 + 1] : number +>v : readonly [number, number, ...number[]] +>0 + 1 : number +>0 : 0 +>1 : 1 +>1 : 1 + +v[0 + 2] = 1; // Error +>v[0 + 2] = 1 : 1 +>v[0 + 2] : number +>v : readonly [number, number, ...number[]] +>0 + 2 : number +>0 : 0 +>2 : 2 +>1 : 1 + +delete v[0 + 1]; // Error +>delete v[0 + 1] : boolean +>v[0 + 1] : number +>v : readonly [number, number, ...number[]] +>0 + 1 : number +>0 : 0 +>1 : 1 + diff --git a/tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts b/tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts index 35c86175a0b..6cfdad0d5c4 100644 --- a/tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts +++ b/tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts @@ -30,8 +30,10 @@ function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: reado } declare var v: readonly[number, number, ...number[]]; -v[0] = 1; // Error -v[1] = 1; // Error -v[2] = 1; // Error -v[0 + 1] = 1; // Error -v[0 + 2] = 1; // Error +v[0] = 1; // Error +v[1] = 1; // Error +v[2] = 1; // Error +delete v[2]; // Error +v[0 + 1] = 1; // Error +v[0 + 2] = 1; // Error +delete v[0 + 1]; // Error From b688e25cd37b4e0df5727846a02295e8b84ca702 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 22 May 2019 17:12:37 -0700 Subject: [PATCH 143/384] Implement inferrable index signatures for enum types --- src/compiler/checker.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9e5c864f6b9..e786eca9981 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7299,7 +7299,8 @@ namespace ts { stringIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false); } } - const numberIndexInfo = symbol.flags & SymbolFlags.Enum ? enumNumberIndexInfo : undefined; + const numberIndexInfo = symbol.flags & SymbolFlags.Enum && (getDeclaredTypeOfSymbol(symbol).flags & TypeFlags.Enum || + some(type.properties, prop => !!(getTypeOfSymbol(prop).flags & TypeFlags.NumberLike))) ? enumNumberIndexInfo : undefined; setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); // We resolve the members before computing the signatures because a signature may use // typeof with a qualified name expression that circularly references the type we are @@ -8161,6 +8162,9 @@ namespace ts { propTypes.push(getTypeOfSymbol(prop)); } } + if (kind === IndexKind.String) { + append(propTypes, getIndexTypeOfType(type, IndexKind.Number)); + } if (propTypes.length) { return getUnionType(propTypes, UnionReduction.Subtype); } @@ -14498,7 +14502,7 @@ namespace ts { * with no call or construct signatures. */ function isObjectTypeWithInferableIndex(type: Type) { - return type.symbol && (type.symbol.flags & (SymbolFlags.ObjectLiteral | SymbolFlags.TypeLiteral | SymbolFlags.ValueModule)) !== 0 && + return type.symbol && (type.symbol.flags & (SymbolFlags.ObjectLiteral | SymbolFlags.TypeLiteral | SymbolFlags.Enum| SymbolFlags.ValueModule)) !== 0 && !typeHasCallOrConstructSignatures(type); } From a95d18e7b4492e0cba86e295b767a9516167646b Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 22 May 2019 17:13:36 -0700 Subject: [PATCH 144/384] Accept new baselines --- .../baselines/reference/useObjectValuesAndEntries1.types | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/baselines/reference/useObjectValuesAndEntries1.types b/tests/baselines/reference/useObjectValuesAndEntries1.types index 94deebdfd8c..bbfd4c87d2a 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries1.types +++ b/tests/baselines/reference/useObjectValuesAndEntries1.types @@ -121,16 +121,16 @@ enum E { A, B } >B : E.B var entries5 = Object.entries(E); // [string, any][] ->entries5 : [string, any][] ->Object.entries(E) : [string, any][] +>entries5 : [string, string | E][] +>Object.entries(E) : [string, string | E][] >Object.entries : { (o: { [s: string]: T; } | ArrayLike): [string, T][]; (o: {}): [string, any][]; } >Object : ObjectConstructor >entries : { (o: { [s: string]: T; } | ArrayLike): [string, T][]; (o: {}): [string, any][]; } >E : typeof E var values5 = Object.values(E); // any[] ->values5 : any[] ->Object.values(E) : any[] +>values5 : (string | E)[] +>Object.values(E) : (string | E)[] >Object.values : { (o: { [s: string]: T; } | ArrayLike): T[]; (o: {}): any[]; } >Object : ObjectConstructor >values : { (o: { [s: string]: T; } | ArrayLike): T[]; (o: {}): any[]; } From cd7a14ac21974209fc870642e6d1489a66f91af1 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 22 May 2019 17:22:33 -0700 Subject: [PATCH 145/384] Reuse getSimplifiedTypeOrConstraint function --- src/compiler/checker.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index bd8d4c05901..386beb7f24d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -13066,8 +13066,7 @@ namespace ts { } // A type S is assignable to keyof T if S is assignable to keyof C, where C is the // simplified form of T or, if T doesn't simplify, the constraint of T. - const simplified = getSimplifiedType((target).type, /*writing*/ false); - const constraint = simplified !== (target).type ? simplified : getConstraintOfType((target).type); + const constraint = getSimplifiedTypeOrConstraint((target).type); if (constraint) { // We require Ternary.True here such that circular constraints don't cause // false positives. For example, given 'T extends { [K in keyof T]: string }', From 300cbef07105247ec1c826de9d785bfc72849103 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 22 May 2019 17:42:05 -0700 Subject: [PATCH 146/384] =?UTF-8?q?Don=E2=80=99t=20crash=20when=20creating?= =?UTF-8?q?=20a=20union=20signature=20from=20signatures=20that=20do=20and?= =?UTF-8?q?=20don=E2=80=99t=20have=20this=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/checker.ts | 6 ++-- .../reference/unionTypeCallSignatures5.js | 17 ++++++++++ .../unionTypeCallSignatures5.symbols | 31 +++++++++++++++++++ .../reference/unionTypeCallSignatures5.types | 24 ++++++++++++++ .../types/union/unionTypeCallSignatures5.ts | 12 +++++++ 5 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 tests/baselines/reference/unionTypeCallSignatures5.js create mode 100644 tests/baselines/reference/unionTypeCallSignatures5.symbols create mode 100644 tests/baselines/reference/unionTypeCallSignatures5.types create mode 100644 tests/cases/conformance/types/union/unionTypeCallSignatures5.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 05b1015b124..936c73ee9a0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7052,10 +7052,10 @@ namespace ts { // Union the result types when more than one signature matches if (unionSignatures.length > 1) { let thisParameter = signature.thisParameter; - if (forEach(unionSignatures, sig => sig.thisParameter)) { - // TODO: GH#18217 We tested that *some* has thisParameter and now act as if *all* do + const firstThisParameterOfUnionSignatures = forEach(unionSignatures, sig => sig.thisParameter); + if (firstThisParameterOfUnionSignatures) { const thisType = getUnionType(map(unionSignatures, sig => sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType), UnionReduction.Subtype); - thisParameter = createSymbolWithType(signature.thisParameter!, thisType); + thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType); } s = createUnionSignature(signature, unionSignatures); s.thisParameter = thisParameter; diff --git a/tests/baselines/reference/unionTypeCallSignatures5.js b/tests/baselines/reference/unionTypeCallSignatures5.js new file mode 100644 index 00000000000..2e756540d94 --- /dev/null +++ b/tests/baselines/reference/unionTypeCallSignatures5.js @@ -0,0 +1,17 @@ +//// [unionTypeCallSignatures5.ts] +// #31485 +interface A { + (this: void, b?: number): void; +} +interface B { + (this: number, b?: number): void; +} +interface C { + (i: number): void; +} +declare const fn: A | B | C; +fn(0); + + +//// [unionTypeCallSignatures5.js] +fn(0); diff --git a/tests/baselines/reference/unionTypeCallSignatures5.symbols b/tests/baselines/reference/unionTypeCallSignatures5.symbols new file mode 100644 index 00000000000..d729dcd7aba --- /dev/null +++ b/tests/baselines/reference/unionTypeCallSignatures5.symbols @@ -0,0 +1,31 @@ +=== tests/cases/conformance/types/union/unionTypeCallSignatures5.ts === +// #31485 +interface A { +>A : Symbol(A, Decl(unionTypeCallSignatures5.ts, 0, 0)) + + (this: void, b?: number): void; +>this : Symbol(this, Decl(unionTypeCallSignatures5.ts, 2, 3)) +>b : Symbol(b, Decl(unionTypeCallSignatures5.ts, 2, 14)) +} +interface B { +>B : Symbol(B, Decl(unionTypeCallSignatures5.ts, 3, 1)) + + (this: number, b?: number): void; +>this : Symbol(this, Decl(unionTypeCallSignatures5.ts, 5, 3)) +>b : Symbol(b, Decl(unionTypeCallSignatures5.ts, 5, 16)) +} +interface C { +>C : Symbol(C, Decl(unionTypeCallSignatures5.ts, 6, 1)) + + (i: number): void; +>i : Symbol(i, Decl(unionTypeCallSignatures5.ts, 8, 3)) +} +declare const fn: A | B | C; +>fn : Symbol(fn, Decl(unionTypeCallSignatures5.ts, 10, 13)) +>A : Symbol(A, Decl(unionTypeCallSignatures5.ts, 0, 0)) +>B : Symbol(B, Decl(unionTypeCallSignatures5.ts, 3, 1)) +>C : Symbol(C, Decl(unionTypeCallSignatures5.ts, 6, 1)) + +fn(0); +>fn : Symbol(fn, Decl(unionTypeCallSignatures5.ts, 10, 13)) + diff --git a/tests/baselines/reference/unionTypeCallSignatures5.types b/tests/baselines/reference/unionTypeCallSignatures5.types new file mode 100644 index 00000000000..53ce4ea6550 --- /dev/null +++ b/tests/baselines/reference/unionTypeCallSignatures5.types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/types/union/unionTypeCallSignatures5.ts === +// #31485 +interface A { + (this: void, b?: number): void; +>this : void +>b : number +} +interface B { + (this: number, b?: number): void; +>this : number +>b : number +} +interface C { + (i: number): void; +>i : number +} +declare const fn: A | B | C; +>fn : A | B | C + +fn(0); +>fn(0) : void +>fn : A | B | C +>0 : 0 + diff --git a/tests/cases/conformance/types/union/unionTypeCallSignatures5.ts b/tests/cases/conformance/types/union/unionTypeCallSignatures5.ts new file mode 100644 index 00000000000..30a5ac031ad --- /dev/null +++ b/tests/cases/conformance/types/union/unionTypeCallSignatures5.ts @@ -0,0 +1,12 @@ +// #31485 +interface A { + (this: void, b?: number): void; +} +interface B { + (this: number, b?: number): void; +} +interface C { + (i: number): void; +} +declare const fn: A | B | C; +fn(0); From 6cd992132d68428773f26de9d1c150c94a25358f Mon Sep 17 00:00:00 2001 From: Alexander T Date: Tue, 7 May 2019 16:32:48 +0300 Subject: [PATCH 147/384] Add string properties declaration to the completion list --- src/services/completions.ts | 3 +++ .../completionForComputedStringProperties.ts | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/cases/fourslash/completionForComputedStringProperties.ts diff --git a/src/services/completions.ts b/src/services/completions.ts index 9d569fbedde..277d095d59a 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -965,6 +965,9 @@ namespace ts.Completions { symbolToOriginInfoMap[getSymbolId(firstAccessibleSymbol)] = !moduleSymbol || !isExternalModuleSymbol(moduleSymbol) ? { kind: SymbolOriginInfoKind.SymbolMemberNoExport } : { kind: SymbolOriginInfoKind.SymbolMemberExport, moduleSymbol, isDefaultExport: false }; } + else if (preferences.includeCompletionsWithInsertText) { + symbols.push(symbol); + } } else { symbols.push(symbol); diff --git a/tests/cases/fourslash/completionForComputedStringProperties.ts b/tests/cases/fourslash/completionForComputedStringProperties.ts new file mode 100644 index 00000000000..e03ceb4abd0 --- /dev/null +++ b/tests/cases/fourslash/completionForComputedStringProperties.ts @@ -0,0 +1,18 @@ +/// + +//// const p2 = "p2"; +//// interface A { +//// ["p1"]: string; +//// [p2]: string; +//// } +//// declare const a: A; +//// a[|./**/|] + +verify.completions({ + marker: "", + exact: [ + { name: "p1" }, + { name: "p2", insertText: '[p2]', replacementSpan: test.ranges()[0] }, + ], + preferences: { includeInsertTextCompletions: true }, +}); \ No newline at end of file From 4d27361680796581f3f4fd5aedadff69b120470b Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 23 May 2019 11:09:28 -0700 Subject: [PATCH 148/384] Allow JS with isolated modules (#31483) * Allow JS with isolated modules Previously legacy JS code was not allowed; it was required to use ES6 module syntax. Unfortunately, the check happens after parsing but before binding, and the commonjs module indicator isn't set until binding because it's not syntactically simple like the ES6 module indicator, which is set during parsing. So I decided that JS should be allowed during isolatedModules unconditionally. We're not going to be transforming it anyway. * Update baselines * Switch test to outDir instead of noEmit --- src/compiler/diagnosticMessages.json | 2 +- src/compiler/program.ts | 4 ++-- tests/baselines/reference/commonJsIsolatedModules.js | 8 ++++++++ .../reference/commonJsIsolatedModules.symbols | 9 +++++++++ .../reference/commonJsIsolatedModules.types | 12 ++++++++++++ .../importHelpersInIsolatedModules.errors.txt | 4 ++-- .../isolatedModulesNoExternalModule.errors.txt | 4 ++-- .../reference/isolatedModulesOut.errors.txt | 4 ++-- .../isolatedModulesPlainFile-AMD.errors.txt | 4 ++-- .../isolatedModulesPlainFile-CommonJS.errors.txt | 4 ++-- .../isolatedModulesPlainFile-ES6.errors.txt | 4 ++-- .../isolatedModulesPlainFile-System.errors.txt | 4 ++-- .../isolatedModulesPlainFile-UMD.errors.txt | 4 ++-- tests/cases/compiler/commonJsIsolatedModules.ts | 12 ++++++++++++ 14 files changed, 60 insertions(+), 19 deletions(-) create mode 100644 tests/baselines/reference/commonJsIsolatedModules.js create mode 100644 tests/baselines/reference/commonJsIsolatedModules.symbols create mode 100644 tests/baselines/reference/commonJsIsolatedModules.types create mode 100644 tests/cases/compiler/commonJsIsolatedModules.ts diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index e8784e7d1f2..101b584ca13 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -655,7 +655,7 @@ "category": "Error", "code": 1207 }, - "Cannot compile namespaces when the '--isolatedModules' flag is provided.": { + "All files must be modules when the '--isolatedModules' flag is provided.": { "category": "Error", "code": 1208 }, diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 6313cc19902..8e4cd48b5ba 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2858,10 +2858,10 @@ namespace ts { createDiagnosticForOptionName(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher, "isolatedModules", "target"); } - const firstNonExternalModuleSourceFile = find(files, f => !isExternalModule(f) && !f.isDeclarationFile && f.scriptKind !== ScriptKind.JSON); + const firstNonExternalModuleSourceFile = find(files, f => !isExternalModule(f) && !isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== ScriptKind.JSON); if (firstNonExternalModuleSourceFile) { const span = getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); + programDiagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.All_files_must_be_modules_when_the_isolatedModules_flag_is_provided)); } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < ScriptTarget.ES2015 && options.module === ModuleKind.None) { diff --git a/tests/baselines/reference/commonJsIsolatedModules.js b/tests/baselines/reference/commonJsIsolatedModules.js new file mode 100644 index 00000000000..fe983eec37a --- /dev/null +++ b/tests/baselines/reference/commonJsIsolatedModules.js @@ -0,0 +1,8 @@ +//// [index.js] +module.exports = {} +var x = 1 + + +//// [index.js] +module.exports = {}; +var x = 1; diff --git a/tests/baselines/reference/commonJsIsolatedModules.symbols b/tests/baselines/reference/commonJsIsolatedModules.symbols new file mode 100644 index 00000000000..f0f9d0d7855 --- /dev/null +++ b/tests/baselines/reference/commonJsIsolatedModules.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/index.js === +module.exports = {} +>module.exports : Symbol("tests/cases/compiler/index", Decl(index.js, 0, 0)) +>module : Symbol(module, Decl(index.js, 0, 0)) +>exports : Symbol("tests/cases/compiler/index", Decl(index.js, 0, 0)) + +var x = 1 +>x : Symbol(x, Decl(index.js, 1, 3)) + diff --git a/tests/baselines/reference/commonJsIsolatedModules.types b/tests/baselines/reference/commonJsIsolatedModules.types new file mode 100644 index 00000000000..363b450cef9 --- /dev/null +++ b/tests/baselines/reference/commonJsIsolatedModules.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/index.js === +module.exports = {} +>module.exports = {} : typeof import("tests/cases/compiler/index") +>module.exports : typeof import("tests/cases/compiler/index") +>module : { "tests/cases/compiler/index": typeof import("tests/cases/compiler/index"); } +>exports : typeof import("tests/cases/compiler/index") +>{} : {} + +var x = 1 +>x : number +>1 : 1 + diff --git a/tests/baselines/reference/importHelpersInIsolatedModules.errors.txt b/tests/baselines/reference/importHelpersInIsolatedModules.errors.txt index 7a53c1c8c99..9655daa3325 100644 --- a/tests/baselines/reference/importHelpersInIsolatedModules.errors.txt +++ b/tests/baselines/reference/importHelpersInIsolatedModules.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/script.ts(1,1): error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. +tests/cases/compiler/script.ts(1,1): error TS1208: All files must be modules when the '--isolatedModules' flag is provided. ==== tests/cases/compiler/external.ts (0 errors) ==== @@ -16,7 +16,7 @@ tests/cases/compiler/script.ts(1,1): error TS1208: Cannot compile namespaces whe ==== tests/cases/compiler/script.ts (1 errors) ==== class A { } ~~~~~ -!!! error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. +!!! error TS1208: All files must be modules when the '--isolatedModules' flag is provided. class B extends A { } declare var dec: any; diff --git a/tests/baselines/reference/isolatedModulesNoExternalModule.errors.txt b/tests/baselines/reference/isolatedModulesNoExternalModule.errors.txt index 6d0f12bb1ab..2ca0a1139fb 100644 --- a/tests/baselines/reference/isolatedModulesNoExternalModule.errors.txt +++ b/tests/baselines/reference/isolatedModulesNoExternalModule.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/file1.ts(1,1): error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. +tests/cases/compiler/file1.ts(1,1): error TS1208: All files must be modules when the '--isolatedModules' flag is provided. ==== tests/cases/compiler/file1.ts (1 errors) ==== var x; ~~~ -!!! error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. \ No newline at end of file +!!! error TS1208: All files must be modules when the '--isolatedModules' flag is provided. \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesOut.errors.txt b/tests/baselines/reference/isolatedModulesOut.errors.txt index 5581ece62e6..ef9455189d0 100644 --- a/tests/baselines/reference/isolatedModulesOut.errors.txt +++ b/tests/baselines/reference/isolatedModulesOut.errors.txt @@ -1,6 +1,6 @@ error TS5053: Option 'out' cannot be specified with option 'isolatedModules'. tests/cases/compiler/file1.ts(1,1): error TS6131: Cannot compile modules using option 'out' unless the '--module' flag is 'amd' or 'system'. -tests/cases/compiler/file2.ts(1,1): error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. +tests/cases/compiler/file2.ts(1,1): error TS1208: All files must be modules when the '--isolatedModules' flag is provided. !!! error TS5053: Option 'out' cannot be specified with option 'isolatedModules'. @@ -11,4 +11,4 @@ tests/cases/compiler/file2.ts(1,1): error TS1208: Cannot compile namespaces when ==== tests/cases/compiler/file2.ts (1 errors) ==== var y; ~~~ -!!! error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. \ No newline at end of file +!!! error TS1208: All files must be modules when the '--isolatedModules' flag is provided. \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesPlainFile-AMD.errors.txt b/tests/baselines/reference/isolatedModulesPlainFile-AMD.errors.txt index d24da5e09cc..6c34c9953f0 100644 --- a/tests/baselines/reference/isolatedModulesPlainFile-AMD.errors.txt +++ b/tests/baselines/reference/isolatedModulesPlainFile-AMD.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/isolatedModulesPlainFile-AMD.ts(1,1): error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. +tests/cases/compiler/isolatedModulesPlainFile-AMD.ts(1,1): error TS1208: All files must be modules when the '--isolatedModules' flag is provided. ==== tests/cases/compiler/isolatedModulesPlainFile-AMD.ts (1 errors) ==== declare function run(a: number): void; ~~~~~~~ -!!! error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. +!!! error TS1208: All files must be modules when the '--isolatedModules' flag is provided. run(1); \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesPlainFile-CommonJS.errors.txt b/tests/baselines/reference/isolatedModulesPlainFile-CommonJS.errors.txt index 43d18c54eb9..61a6021bf73 100644 --- a/tests/baselines/reference/isolatedModulesPlainFile-CommonJS.errors.txt +++ b/tests/baselines/reference/isolatedModulesPlainFile-CommonJS.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/isolatedModulesPlainFile-CommonJS.ts(1,1): error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. +tests/cases/compiler/isolatedModulesPlainFile-CommonJS.ts(1,1): error TS1208: All files must be modules when the '--isolatedModules' flag is provided. ==== tests/cases/compiler/isolatedModulesPlainFile-CommonJS.ts (1 errors) ==== declare function run(a: number): void; ~~~~~~~ -!!! error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. +!!! error TS1208: All files must be modules when the '--isolatedModules' flag is provided. run(1); \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesPlainFile-ES6.errors.txt b/tests/baselines/reference/isolatedModulesPlainFile-ES6.errors.txt index 56316072aff..d1f9d635b0e 100644 --- a/tests/baselines/reference/isolatedModulesPlainFile-ES6.errors.txt +++ b/tests/baselines/reference/isolatedModulesPlainFile-ES6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/isolatedModulesPlainFile-ES6.ts(1,1): error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. +tests/cases/compiler/isolatedModulesPlainFile-ES6.ts(1,1): error TS1208: All files must be modules when the '--isolatedModules' flag is provided. ==== tests/cases/compiler/isolatedModulesPlainFile-ES6.ts (1 errors) ==== declare function run(a: number): void; ~~~~~~~ -!!! error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. +!!! error TS1208: All files must be modules when the '--isolatedModules' flag is provided. run(1); \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesPlainFile-System.errors.txt b/tests/baselines/reference/isolatedModulesPlainFile-System.errors.txt index b1e2ba643fa..e955549d754 100644 --- a/tests/baselines/reference/isolatedModulesPlainFile-System.errors.txt +++ b/tests/baselines/reference/isolatedModulesPlainFile-System.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/isolatedModulesPlainFile-System.ts(1,1): error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. +tests/cases/compiler/isolatedModulesPlainFile-System.ts(1,1): error TS1208: All files must be modules when the '--isolatedModules' flag is provided. ==== tests/cases/compiler/isolatedModulesPlainFile-System.ts (1 errors) ==== declare function run(a: number): void; ~~~~~~~ -!!! error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. +!!! error TS1208: All files must be modules when the '--isolatedModules' flag is provided. run(1); \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesPlainFile-UMD.errors.txt b/tests/baselines/reference/isolatedModulesPlainFile-UMD.errors.txt index 29dfe4f67fb..1b7a01dd5bc 100644 --- a/tests/baselines/reference/isolatedModulesPlainFile-UMD.errors.txt +++ b/tests/baselines/reference/isolatedModulesPlainFile-UMD.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/isolatedModulesPlainFile-UMD.ts(1,1): error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. +tests/cases/compiler/isolatedModulesPlainFile-UMD.ts(1,1): error TS1208: All files must be modules when the '--isolatedModules' flag is provided. ==== tests/cases/compiler/isolatedModulesPlainFile-UMD.ts (1 errors) ==== declare function run(a: number): void; ~~~~~~~ -!!! error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. +!!! error TS1208: All files must be modules when the '--isolatedModules' flag is provided. run(1); \ No newline at end of file diff --git a/tests/cases/compiler/commonJsIsolatedModules.ts b/tests/cases/compiler/commonJsIsolatedModules.ts new file mode 100644 index 00000000000..a75a5ec96d2 --- /dev/null +++ b/tests/cases/compiler/commonJsIsolatedModules.ts @@ -0,0 +1,12 @@ +// @Filename: tsconfig.json +{ + "compilerOptions": { + "allowJs": true, + "outDir": "foo", + "isolatedModules": true, + } +} + +// @Filename: index.js +module.exports = {} +var x = 1 From f97f57c1556bde40149ef30f034480917c27fce0 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 23 May 2019 12:15:50 -0700 Subject: [PATCH 149/384] Fix containsPrecedingToken for tokens whose preceding token is a missing node --- src/harness/fourslash.ts | 10 +++++----- src/services/signatureHelp.ts | 20 +++++++++++++++----- tests/cases/fourslash/fourslash.ts | 8 ++++---- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 8a0a2bffbd4..bdcb3e082d2 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1208,7 +1208,7 @@ Actual: ${stringify(fullActual)}`); } } - public verifySignatureHelpPresence(expectPresent: boolean, triggerReason: ts.SignatureHelpTriggerReason | undefined, markers: ReadonlyArray) { + public verifySignatureHelpPresence(expectPresent: boolean, triggerReason: ts.SignatureHelpTriggerReason | undefined, markers: ReadonlyArray) { if (markers.length) { for (const marker of markers) { this.goToMarker(marker); @@ -3768,15 +3768,15 @@ namespace FourSlashInterface { assert(ranges.length !== 0, "Array of ranges is expected to be non-empty"); } - public noSignatureHelp(...markers: string[]): void { + public noSignatureHelp(...markers: (string | FourSlash.Marker)[]): void { this.state.verifySignatureHelpPresence(/*expectPresent*/ false, /*triggerReason*/ undefined, markers); } - public noSignatureHelpForTriggerReason(reason: ts.SignatureHelpTriggerReason, ...markers: string[]): void { + public noSignatureHelpForTriggerReason(reason: ts.SignatureHelpTriggerReason, ...markers: (string | FourSlash.Marker)[]): void { this.state.verifySignatureHelpPresence(/*expectPresent*/ false, reason, markers); } - public signatureHelpPresentForTriggerReason(reason: ts.SignatureHelpTriggerReason, ...markers: string[]): void { + public signatureHelpPresentForTriggerReason(reason: ts.SignatureHelpTriggerReason, ...markers: (string | FourSlash.Marker)[]): void { this.state.verifySignatureHelpPresence(/*expectPresent*/ true, reason, markers); } @@ -5124,7 +5124,7 @@ namespace FourSlashInterface { } export interface VerifySignatureHelpOptions { - readonly marker?: ArrayOrSingle; + readonly marker?: ArrayOrSingle; /** @default 1 */ readonly overloadsCount?: number; /** @default undefined */ diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 25f958dfc6a..998e45bd461 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -133,11 +133,21 @@ namespace ts.SignatureHelp { } function containsPrecedingToken(startingToken: Node, sourceFile: SourceFile, container: Node) { - const precedingToken = Debug.assertDefined( - findPrecedingToken(startingToken.getFullStart(), sourceFile, startingToken.parent, /*excludeJsdoc*/ true) - ); - - return rangeContainsRange(container, precedingToken); + const pos = startingToken.getFullStart(); + // There’s a possibility that `startingToken.parent` contains only `startingToken` and + // missing nodes, none of which are valid to be returned by `findPrecedingToken`. In that + // case, the preceding token we want is actually higher up the tree—almost definitely the + // next parent, but theoretically the situation with missing nodes might be happening on + // multiple nested levels. + let currentParent: Node | undefined = startingToken.parent; + while (currentParent) { + const precedingToken = findPrecedingToken(pos, sourceFile, currentParent, /*excludeJsdoc*/ true); + if (precedingToken) { + return rangeContainsRange(container, precedingToken); + } + currentParent = currentParent.parent; + } + return Debug.fail("Could not find preceding token"); } export interface ArgumentInfoForCompletions { diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index fa9cdd61c2f..b3253bcd59f 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -232,9 +232,9 @@ declare namespace FourSlashInterface { rangesWithSameTextAreRenameLocations(): void; rangesAreRenameLocations(options?: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges?: Range[] }); findReferencesDefinitionDisplayPartsAtCaretAre(expected: ts.SymbolDisplayPart[]): void; - noSignatureHelp(...markers: string[]): void; - noSignatureHelpForTriggerReason(triggerReason: SignatureHelpTriggerReason, ...markers: string[]): void - signatureHelpPresentForTriggerReason(triggerReason: SignatureHelpTriggerReason, ...markers: string[]): void + noSignatureHelp(...markers: (string | Marker)[]): void; + noSignatureHelpForTriggerReason(triggerReason: SignatureHelpTriggerReason, ...markers: (string | Marker)[]): void + signatureHelpPresentForTriggerReason(triggerReason: SignatureHelpTriggerReason, ...markers: (string | Marker)[]): void signatureHelp(...options: VerifySignatureHelpOptions[], ): void; // Checks that there are no compile errors. noErrors(): void; @@ -538,7 +538,7 @@ declare namespace FourSlashInterface { } interface VerifySignatureHelpOptions { - marker?: ArrayOrSingle; + marker?: ArrayOrSingle; /** @default 1 */ overloadsCount?: number; docComment?: string; From 5d9d4b2553df08effc21d27dc90ca726698db348 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 23 May 2019 13:26:41 -0700 Subject: [PATCH 150/384] Manually copy just postMessage changes (#31557) * Manually copy just postMessage changes * Update baselines --- src/lib/dom.generated.d.ts | 3 ++- src/lib/webworker.generated.d.ts | 3 ++- .../baselines/reference/intersectionsOfLargeUnions2.errors.txt | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/dom.generated.d.ts b/src/lib/dom.generated.d.ts index b1daca71fed..18f38b53560 100644 --- a/src/lib/dom.generated.d.ts +++ b/src/lib/dom.generated.d.ts @@ -17328,7 +17328,8 @@ interface WorkerEventMap extends AbstractWorkerEventMap { /** An interface of the Web Workers API represents a background task that can be easily created and can send messages back to its creator. Creating a worker is as simple as calling the Worker() constructor and specifying a script to be run in the worker thread. */ interface Worker extends EventTarget, AbstractWorker { onmessage: ((this: Worker, ev: MessageEvent) => any) | null; - postMessage(message: any, transfer?: Transferable[]): void; + postMessage(message: any, transfer: Transferable[]): void; + postMessage(message: any, options?: PostMessageOptions): void; terminate(): void; addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; diff --git a/src/lib/webworker.generated.d.ts b/src/lib/webworker.generated.d.ts index cc35615d129..de98e9537aa 100644 --- a/src/lib/webworker.generated.d.ts +++ b/src/lib/webworker.generated.d.ts @@ -4231,7 +4231,8 @@ interface WorkerEventMap extends AbstractWorkerEventMap { /** An interface of the Web Workers API represents a background task that can be easily created and can send messages back to its creator. Creating a worker is as simple as calling the Worker() constructor and specifying a script to be run in the worker thread. */ interface Worker extends EventTarget, AbstractWorker { onmessage: ((this: Worker, ev: MessageEvent) => any) | null; - postMessage(message: any, transfer?: Transferable[]): void; + postMessage(message: any, transfer: Transferable[]): void; + postMessage(message: any, options?: PostMessageOptions): void; terminate(): void; addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; diff --git a/tests/baselines/reference/intersectionsOfLargeUnions2.errors.txt b/tests/baselines/reference/intersectionsOfLargeUnions2.errors.txt index a8d4f797fea..bad3705abc0 100644 --- a/tests/baselines/reference/intersectionsOfLargeUnions2.errors.txt +++ b/tests/baselines/reference/intersectionsOfLargeUnions2.errors.txt @@ -10,7 +10,7 @@ tests/cases/compiler/intersectionsOfLargeUnions2.ts(31,15): error TS2536: Type ' interface ElementTagNameMap { ~~~~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'ElementTagNameMap'. -!!! related TS6203 /.ts/lib.dom.d.ts:18109:6: 'ElementTagNameMap' was also declared here. +!!! related TS6203 /.ts/lib.dom.d.ts:18110:6: 'ElementTagNameMap' was also declared here. [index: number]: HTMLElement } From 7359ff8158df18207ff66cb7040509051eab5242 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 23 May 2019 13:33:38 -0700 Subject: [PATCH 151/384] Add test --- tests/cases/fourslash/signatureHelpJSX.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/cases/fourslash/signatureHelpJSX.ts diff --git a/tests/cases/fourslash/signatureHelpJSX.ts b/tests/cases/fourslash/signatureHelpJSX.ts new file mode 100644 index 00000000000..181ff85541b --- /dev/null +++ b/tests/cases/fourslash/signatureHelpJSX.ts @@ -0,0 +1,10 @@ +/// + +//@Filename: test.tsx +//@jsx: react +////declare var React: any; +////const z =
{[].map(x => Date: Fri, 24 May 2019 01:27:50 +0300 Subject: [PATCH 152/384] Improve error messages when indexing into a type (#31379) * Improved error messages when indexing an object type with a literal string, a literal string union or a string. * Added more specific message when using the indexing operator with an incompatible index argument. * Fixed spelling and error message. --- src/compiler/checker.ts | 32 ++++++++-- src/compiler/diagnosticMessages.json | 8 +++ .../globalThisUnknownNoImplicitAny.errors.txt | 12 ++-- .../keyofAndIndexedAccess2.errors.txt | 6 +- .../reference/noImplicitAnyForIn.errors.txt | 12 ++-- .../noImplicitAnyIndexing.errors.txt | 16 +++-- ...mplicitAnyStringIndexerOnObject.errors.txt | 59 +++++++++++++++++-- .../noImplicitAnyStringIndexerOnObject.js | 38 ++++++++++++ ...noImplicitAnyStringIndexerOnObject.symbols | 52 ++++++++++++++++ .../noImplicitAnyStringIndexerOnObject.types | 59 +++++++++++++++++++ ...eIndexingWithForInNoImplicitAny.errors.txt | 6 +- .../objectSpreadIndexSignature.errors.txt | 6 +- ...ringIndexSignatureNoImplicitAny.errors.txt | 6 +- .../typeFromPrototypeAssignment3.errors.txt | 6 +- .../unionTypeWithIndexSignature.errors.txt | 12 ++-- .../noImplicitAnyStringIndexerOnObject.ts | 20 +++++++ 16 files changed, 312 insertions(+), 38 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c221da7bdb2..0d7c7b022dd 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10067,7 +10067,7 @@ namespace ts { return false; } - function getPropertyTypeForIndexType(originalObjectType: Type, objectType: Type, indexType: Type, accessNode: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression | undefined, accessFlags: AccessFlags) { + function getPropertyTypeForIndexType(originalObjectType: Type, objectType: Type, indexType: Type, fullIndexType: Type, suppressNoImplicitAnyError: boolean, accessNode: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression | undefined, accessFlags: AccessFlags) { const accessExpression = accessNode && accessNode.kind === SyntaxKind.ElementAccessExpression ? accessNode : undefined; const propName = isTypeUsableAsPropertyName(indexType) ? getPropertyNameFromType(indexType) : @@ -10141,7 +10141,7 @@ namespace ts { if (objectType.symbol === globalThisSymbol && propName !== undefined && globalThisSymbol.exports!.has(propName) && (globalThisSymbol.exports!.get(propName)!.flags & SymbolFlags.BlockScoped)) { error(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType)); } - else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) { + else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !suppressNoImplicitAnyError) { if (propName !== undefined && typeHasStaticProperty(propName, objectType)) { error(accessExpression, Diagnostics.Property_0_is_a_static_member_of_type_1, propName as string, typeToString(objectType)); } @@ -10161,7 +10161,29 @@ namespace ts { error(accessExpression, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion); } else { - error(accessExpression, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(objectType)); + let errorInfo: DiagnosticMessageChain | undefined; + if (indexType.flags & TypeFlags.EnumLiteral) { + errorInfo = chainDiagnosticMessages(/* details */ undefined, Diagnostics.Property_0_does_not_exist_on_type_1, "[" + typeToString(indexType) + "]", typeToString(objectType)); + } + else if (indexType.flags & TypeFlags.UniqueESSymbol) { + const symbolName = getFullyQualifiedName((indexType as UniqueESSymbolType).symbol, accessExpression); + errorInfo = chainDiagnosticMessages(/* details */ undefined, Diagnostics.Property_0_does_not_exist_on_type_1, "[" + symbolName + "]", typeToString(objectType)); + } + else if (indexType.flags & TypeFlags.StringLiteral) { + errorInfo = chainDiagnosticMessages(/* details */ undefined, Diagnostics.Property_0_does_not_exist_on_type_1, (indexType as StringLiteralType).value, typeToString(objectType)); + } + else if (indexType.flags & TypeFlags.NumberLiteral) { + errorInfo = chainDiagnosticMessages(/* details */ undefined, Diagnostics.Property_0_does_not_exist_on_type_1, (indexType as NumberLiteralType).value, typeToString(objectType)); + } + else if (indexType.flags & (TypeFlags.Number | TypeFlags.String)) { + errorInfo = chainDiagnosticMessages(/* details */ undefined, Diagnostics.No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1, typeToString(indexType), typeToString(objectType)); + } + + errorInfo = chainDiagnosticMessages( + errorInfo, + Diagnostics.Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1, typeToString(fullIndexType), typeToString(objectType) + ); + diagnostics.add(createDiagnosticForNodeFromMessageChain(accessExpression, errorInfo)); } } } @@ -10360,7 +10382,7 @@ namespace ts { const propTypes: Type[] = []; let wasMissingProp = false; for (const t of (indexType).types) { - const propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, accessNode, accessFlags); + const propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, wasMissingProp, accessNode, accessFlags); if (propType) { propTypes.push(propType); } @@ -10378,7 +10400,7 @@ namespace ts { } return accessFlags & AccessFlags.Writing ? getIntersectionType(propTypes) : getUnionType(propTypes); } - return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, accessNode, accessFlags | AccessFlags.CacheSymbol); + return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, /* supressNoImplicitAnyError */ false, accessNode, accessFlags | AccessFlags.CacheSymbol); } function getTypeFromIndexedAccessTypeNode(node: IndexedAccessTypeNode) { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 101b584ca13..e0579429def 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4288,6 +4288,14 @@ "category": "Error", "code": 7052 }, + "Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'.": { + "category": "Error", + "code": 7053 + }, + "No index signature with a parameter of type '{0}' was found on type '{1}'.": { + "category": "Error", + "code": 7054 + }, "You cannot rename this element.": { "category": "Error", "code": 8000 diff --git a/tests/baselines/reference/globalThisUnknownNoImplicitAny.errors.txt b/tests/baselines/reference/globalThisUnknownNoImplicitAny.errors.txt index 0668d03f93b..907a6cd1ced 100644 --- a/tests/baselines/reference/globalThisUnknownNoImplicitAny.errors.txt +++ b/tests/baselines/reference/globalThisUnknownNoImplicitAny.errors.txt @@ -2,8 +2,10 @@ tests/cases/conformance/es2019/globalThisUnknownNoImplicitAny.ts(4,5): error TS2 tests/cases/conformance/es2019/globalThisUnknownNoImplicitAny.ts(5,6): error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature. tests/cases/conformance/es2019/globalThisUnknownNoImplicitAny.ts(6,12): error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature. tests/cases/conformance/es2019/globalThisUnknownNoImplicitAny.ts(8,5): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'. -tests/cases/conformance/es2019/globalThisUnknownNoImplicitAny.ts(9,1): error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature. -tests/cases/conformance/es2019/globalThisUnknownNoImplicitAny.ts(10,1): error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature. +tests/cases/conformance/es2019/globalThisUnknownNoImplicitAny.ts(9,1): error TS7053: Element implicitly has an 'any' type because expression of type '"hi"' can't be used to index type 'typeof globalThis'. + Property 'hi' does not exist on type 'typeof globalThis'. +tests/cases/conformance/es2019/globalThisUnknownNoImplicitAny.ts(10,1): error TS7053: Element implicitly has an 'any' type because expression of type '"hi"' can't be used to index type 'typeof globalThis'. + Property 'hi' does not exist on type 'typeof globalThis'. ==== tests/cases/conformance/es2019/globalThisUnknownNoImplicitAny.ts (6 errors) ==== @@ -25,8 +27,10 @@ tests/cases/conformance/es2019/globalThisUnknownNoImplicitAny.ts(10,1): error TS !!! error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'. this['hi'] ~~~~~~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"hi"' can't be used to index type 'typeof globalThis'. +!!! error TS7053: Property 'hi' does not exist on type 'typeof globalThis'. globalThis['hi'] ~~~~~~~~~~~~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"hi"' can't be used to index type 'typeof globalThis'. +!!! error TS7053: Property 'hi' does not exist on type 'typeof globalThis'. \ No newline at end of file diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt index 1cad297c52d..40ccd13dac4 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt @@ -15,7 +15,8 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(26,7): error TS233 tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(27,5): error TS2322: Type '1' is not assignable to type 'T[keyof T]'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(31,5): error TS2322: Type '{ [key: string]: number; }' is not assignable to type '{ [P in K]: number; }'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(38,5): error TS2322: Type '{ [x: string]: number; }' is not assignable to type '{ [P in K]: number; }'. -tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(50,3): error TS7017: Element implicitly has an 'any' type because type 'Item' has no index signature. +tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(50,3): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Item'. + No index signature with a parameter of type 'string' was found on type 'Item'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(51,3): error TS2322: Type '123' is not assignable to type 'string & number'. Type '123' is not assignable to type 'string'. tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(52,3): error TS2322: Type '123' is not assignable to type 'T[keyof T]'. @@ -112,7 +113,8 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 function f10(obj: T, k1: string, k2: keyof Item, k3: keyof T, k4: K) { obj[k1] = 123; // Error ~~~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type 'Item' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Item'. +!!! error TS7053: No index signature with a parameter of type 'string' was found on type 'Item'. obj[k2] = 123; // Error ~~~~~~~ !!! error TS2322: Type '123' is not assignable to type 'string & number'. diff --git a/tests/baselines/reference/noImplicitAnyForIn.errors.txt b/tests/baselines/reference/noImplicitAnyForIn.errors.txt index b384735d82e..c66a7e07f96 100644 --- a/tests/baselines/reference/noImplicitAnyForIn.errors.txt +++ b/tests/baselines/reference/noImplicitAnyForIn.errors.txt @@ -1,5 +1,7 @@ -tests/cases/compiler/noImplicitAnyForIn.ts(7,18): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. -tests/cases/compiler/noImplicitAnyForIn.ts(14,18): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. +tests/cases/compiler/noImplicitAnyForIn.ts(7,18): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. + No index signature with a parameter of type 'string' was found on type '{}'. +tests/cases/compiler/noImplicitAnyForIn.ts(14,18): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. + No index signature with a parameter of type 'string' was found on type '{}'. tests/cases/compiler/noImplicitAnyForIn.ts(28,5): error TS7005: Variable 'n' implicitly has an 'any[][]' type. tests/cases/compiler/noImplicitAnyForIn.ts(30,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. @@ -13,7 +15,8 @@ tests/cases/compiler/noImplicitAnyForIn.ts(30,6): error TS2405: The left-hand si //Should yield an implicit 'any' error var _j = x[i][j]; ~~~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. +!!! error TS7053: No index signature with a parameter of type 'string' was found on type '{}'. } for (var k in x[0]) { @@ -22,7 +25,8 @@ tests/cases/compiler/noImplicitAnyForIn.ts(30,6): error TS2405: The left-hand si //Should yield an implicit 'any' error var k2 = k1[k]; ~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. +!!! error TS7053: No index signature with a parameter of type 'string' was found on type '{}'. } } diff --git a/tests/baselines/reference/noImplicitAnyIndexing.errors.txt b/tests/baselines/reference/noImplicitAnyIndexing.errors.txt index 8d1d3ea6c46..f9631f29aa1 100644 --- a/tests/baselines/reference/noImplicitAnyIndexing.errors.txt +++ b/tests/baselines/reference/noImplicitAnyIndexing.errors.txt @@ -1,7 +1,9 @@ tests/cases/compiler/noImplicitAnyIndexing.ts(12,37): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'. -tests/cases/compiler/noImplicitAnyIndexing.ts(19,9): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. -tests/cases/compiler/noImplicitAnyIndexing.ts(22,9): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. -tests/cases/compiler/noImplicitAnyIndexing.ts(30,10): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. +tests/cases/compiler/noImplicitAnyIndexing.ts(19,9): error TS7053: Element implicitly has an 'any' type because expression of type '"hi"' can't be used to index type '{}'. + Property 'hi' does not exist on type '{}'. +tests/cases/compiler/noImplicitAnyIndexing.ts(22,9): error TS7053: Element implicitly has an 'any' type because expression of type '10' can't be used to index type '{}'. + Property '10' does not exist on type '{}'. +tests/cases/compiler/noImplicitAnyIndexing.ts(30,10): error TS7053: Element implicitly has an 'any' type because expression of type 'any' can't be used to index type '{}'. ==== tests/cases/compiler/noImplicitAnyIndexing.ts (4 errors) ==== @@ -27,12 +29,14 @@ tests/cases/compiler/noImplicitAnyIndexing.ts(30,10): error TS7017: Element impl // Should report an implicit 'any'. var x = {}["hi"]; ~~~~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"hi"' can't be used to index type '{}'. +!!! error TS7053: Property 'hi' does not exist on type '{}'. // Should report an implicit 'any'. var y = {}[10]; ~~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type '10' can't be used to index type '{}'. +!!! error TS7053: Property '10' does not exist on type '{}'. var hi: any = "hi"; @@ -42,7 +46,7 @@ tests/cases/compiler/noImplicitAnyIndexing.ts(30,10): error TS7017: Element impl // Should report an implicit 'any'. var z1 = emptyObj[hi]; ~~~~~~~~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'any' can't be used to index type '{}'. var z2 = (emptyObj)[hi]; interface MyMap { diff --git a/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.errors.txt b/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.errors.txt index 6df52aea46a..0d2fc1b860e 100644 --- a/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.errors.txt +++ b/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.errors.txt @@ -1,16 +1,29 @@ -tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(1,9): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. +tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(1,9): error TS7053: Element implicitly has an 'any' type because expression of type '"hello"' can't be used to index type '{}'. + Property 'hello' does not exist on type '{}'. tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(7,1): error TS7052: Element implicitly has an 'any' type because type '{ get: (key: string) => string; }' has no index signature. Did you mean to call 'get' ? tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(8,13): error TS7052: Element implicitly has an 'any' type because type '{ get: (key: string) => string; }' has no index signature. Did you mean to call 'get' ? -tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(13,13): error TS7017: Element implicitly has an 'any' type because type '{ set: (key: string) => string; }' has no index signature. +tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(13,13): error TS7053: Element implicitly has an 'any' type because expression of type '"hello"' can't be used to index type '{ set: (key: string) => string; }'. + Property 'hello' does not exist on type '{ set: (key: string) => string; }'. tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(19,1): error TS7052: Element implicitly has an 'any' type because type '{ set: (key: string) => string; get: (key: string) => string; }' has no index signature. Did you mean to call 'set' ? tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(20,1): error TS7052: Element implicitly has an 'any' type because type '{ set: (key: string) => string; get: (key: string) => string; }' has no index signature. Did you mean to call 'set' ? tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(21,1): error TS7052: Element implicitly has an 'any' type because type '{ set: (key: string) => string; get: (key: string) => string; }' has no index signature. Did you mean to call 'set' ? +tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(26,1): error TS7053: Element implicitly has an 'any' type because expression of type '"a" | "b" | "c"' can't be used to index type '{ a: number; }'. + Property 'b' does not exist on type '{ a: number; }'. +tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(30,1): error TS7053: Element implicitly has an 'any' type because expression of type '"c"' can't be used to index type '{ a: number; }'. + Property 'c' does not exist on type '{ a: number; }'. +tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(33,1): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type '{ a: number; }'. + Property '[sym]' does not exist on type '{ a: number; }'. +tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(37,1): error TS7053: Element implicitly has an 'any' type because expression of type 'NumEnum' can't be used to index type '{ a: number; }'. + Property '[NumEnum.a]' does not exist on type '{ a: number; }'. +tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(42,1): error TS7053: Element implicitly has an 'any' type because expression of type 'StrEnum' can't be used to index type '{ a: number; }'. + Property '[StrEnum.b]' does not exist on type '{ a: number; }'. -==== tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts (7 errors) ==== +==== tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts (12 errors) ==== var a = {}["hello"]; ~~~~~~~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"hello"' can't be used to index type '{}'. +!!! error TS7053: Property 'hello' does not exist on type '{}'. var b: string = { '': 'foo' }['']; var c = { @@ -28,7 +41,8 @@ tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(21,1): error TS7052: }; const bar = d['hello']; ~~~~~~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type '{ set: (key: string) => string; }' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"hello"' can't be used to index type '{ set: (key: string) => string; }'. +!!! error TS7053: Property 'hello' does not exist on type '{ set: (key: string) => string; }'. var e = { set: (key: string) => 'foobar', @@ -44,4 +58,39 @@ tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(21,1): error TS7052: ~~~~~~~~~~ !!! error TS7052: Element implicitly has an 'any' type because type '{ set: (key: string) => string; get: (key: string) => string; }' has no index signature. Did you mean to call 'set' ? + const o = { a: 0 }; + + declare const k: "a" | "b" | "c"; + o[k]; + ~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"a" | "b" | "c"' can't be used to index type '{ a: number; }'. +!!! error TS7053: Property 'b' does not exist on type '{ a: number; }'. + + + declare const k2: "c"; + o[k2]; + ~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"c"' can't be used to index type '{ a: number; }'. +!!! error TS7053: Property 'c' does not exist on type '{ a: number; }'. + + declare const sym : unique symbol; + o[sym]; + ~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type '{ a: number; }'. +!!! error TS7053: Property '[sym]' does not exist on type '{ a: number; }'. + + enum NumEnum { a, b } + let numEnumKey: NumEnum; + o[numEnumKey]; + ~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'NumEnum' can't be used to index type '{ a: number; }'. +!!! error TS7053: Property '[NumEnum.a]' does not exist on type '{ a: number; }'. + + + enum StrEnum { a = "a", b = "b" } + let strEnumKey: StrEnum; + o[strEnumKey]; + ~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'StrEnum' can't be used to index type '{ a: number; }'. +!!! error TS7053: Property '[StrEnum.b]' does not exist on type '{ a: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.js b/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.js index a02740351cf..572d9f38caf 100644 --- a/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.js +++ b/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.js @@ -21,6 +21,26 @@ e['hello'] = 'modified'; e['hello'] += 1; e['hello'] ++; +const o = { a: 0 }; + +declare const k: "a" | "b" | "c"; +o[k]; + + +declare const k2: "c"; +o[k2]; + +declare const sym : unique symbol; +o[sym]; + +enum NumEnum { a, b } +let numEnumKey: NumEnum; +o[numEnumKey]; + + +enum StrEnum { a = "a", b = "b" } +let strEnumKey: StrEnum; +o[strEnumKey]; //// [noImplicitAnyStringIndexerOnObject.js] @@ -42,3 +62,21 @@ var e = { e['hello'] = 'modified'; e['hello'] += 1; e['hello']++; +var o = { a: 0 }; +o[k]; +o[k2]; +o[sym]; +var NumEnum; +(function (NumEnum) { + NumEnum[NumEnum["a"] = 0] = "a"; + NumEnum[NumEnum["b"] = 1] = "b"; +})(NumEnum || (NumEnum = {})); +var numEnumKey; +o[numEnumKey]; +var StrEnum; +(function (StrEnum) { + StrEnum["a"] = "a"; + StrEnum["b"] = "b"; +})(StrEnum || (StrEnum = {})); +var strEnumKey; +o[strEnumKey]; diff --git a/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.symbols b/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.symbols index f86c0d14b6f..307144b8563 100644 --- a/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.symbols +++ b/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.symbols @@ -55,4 +55,56 @@ e['hello'] += 1; e['hello'] ++; >e : Symbol(e, Decl(noImplicitAnyStringIndexerOnObject.ts, 14, 3)) +const o = { a: 0 }; +>o : Symbol(o, Decl(noImplicitAnyStringIndexerOnObject.ts, 22, 5)) +>a : Symbol(a, Decl(noImplicitAnyStringIndexerOnObject.ts, 22, 11)) + +declare const k: "a" | "b" | "c"; +>k : Symbol(k, Decl(noImplicitAnyStringIndexerOnObject.ts, 24, 13)) + +o[k]; +>o : Symbol(o, Decl(noImplicitAnyStringIndexerOnObject.ts, 22, 5)) +>k : Symbol(k, Decl(noImplicitAnyStringIndexerOnObject.ts, 24, 13)) + + +declare const k2: "c"; +>k2 : Symbol(k2, Decl(noImplicitAnyStringIndexerOnObject.ts, 28, 13)) + +o[k2]; +>o : Symbol(o, Decl(noImplicitAnyStringIndexerOnObject.ts, 22, 5)) +>k2 : Symbol(k2, Decl(noImplicitAnyStringIndexerOnObject.ts, 28, 13)) + +declare const sym : unique symbol; +>sym : Symbol(sym, Decl(noImplicitAnyStringIndexerOnObject.ts, 31, 13)) + +o[sym]; +>o : Symbol(o, Decl(noImplicitAnyStringIndexerOnObject.ts, 22, 5)) +>sym : Symbol(sym, Decl(noImplicitAnyStringIndexerOnObject.ts, 31, 13)) + +enum NumEnum { a, b } +>NumEnum : Symbol(NumEnum, Decl(noImplicitAnyStringIndexerOnObject.ts, 32, 7)) +>a : Symbol(NumEnum.a, Decl(noImplicitAnyStringIndexerOnObject.ts, 34, 14)) +>b : Symbol(NumEnum.b, Decl(noImplicitAnyStringIndexerOnObject.ts, 34, 17)) + +let numEnumKey: NumEnum; +>numEnumKey : Symbol(numEnumKey, Decl(noImplicitAnyStringIndexerOnObject.ts, 35, 3)) +>NumEnum : Symbol(NumEnum, Decl(noImplicitAnyStringIndexerOnObject.ts, 32, 7)) + +o[numEnumKey]; +>o : Symbol(o, Decl(noImplicitAnyStringIndexerOnObject.ts, 22, 5)) +>numEnumKey : Symbol(numEnumKey, Decl(noImplicitAnyStringIndexerOnObject.ts, 35, 3)) + + +enum StrEnum { a = "a", b = "b" } +>StrEnum : Symbol(StrEnum, Decl(noImplicitAnyStringIndexerOnObject.ts, 36, 14)) +>a : Symbol(StrEnum.a, Decl(noImplicitAnyStringIndexerOnObject.ts, 39, 14)) +>b : Symbol(StrEnum.b, Decl(noImplicitAnyStringIndexerOnObject.ts, 39, 23)) + +let strEnumKey: StrEnum; +>strEnumKey : Symbol(strEnumKey, Decl(noImplicitAnyStringIndexerOnObject.ts, 40, 3)) +>StrEnum : Symbol(StrEnum, Decl(noImplicitAnyStringIndexerOnObject.ts, 36, 14)) + +o[strEnumKey]; +>o : Symbol(o, Decl(noImplicitAnyStringIndexerOnObject.ts, 22, 5)) +>strEnumKey : Symbol(strEnumKey, Decl(noImplicitAnyStringIndexerOnObject.ts, 40, 3)) diff --git a/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.types b/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.types index dcf01d8c5e8..fa74a192248 100644 --- a/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.types +++ b/tests/baselines/reference/noImplicitAnyStringIndexerOnObject.types @@ -89,4 +89,63 @@ e['hello'] ++; >e : { set: (key: string) => string; get: (key: string) => string; } >'hello' : "hello" +const o = { a: 0 }; +>o : { a: number; } +>{ a: 0 } : { a: number; } +>a : number +>0 : 0 + +declare const k: "a" | "b" | "c"; +>k : "a" | "b" | "c" + +o[k]; +>o[k] : any +>o : { a: number; } +>k : "a" | "b" | "c" + + +declare const k2: "c"; +>k2 : "c" + +o[k2]; +>o[k2] : any +>o : { a: number; } +>k2 : "c" + +declare const sym : unique symbol; +>sym : unique symbol + +o[sym]; +>o[sym] : any +>o : { a: number; } +>sym : unique symbol + +enum NumEnum { a, b } +>NumEnum : NumEnum +>a : NumEnum.a +>b : NumEnum.b + +let numEnumKey: NumEnum; +>numEnumKey : NumEnum + +o[numEnumKey]; +>o[numEnumKey] : any +>o : { a: number; } +>numEnumKey : NumEnum + + +enum StrEnum { a = "a", b = "b" } +>StrEnum : StrEnum +>a : StrEnum.a +>"a" : "a" +>b : StrEnum.b +>"b" : "b" + +let strEnumKey: StrEnum; +>strEnumKey : StrEnum + +o[strEnumKey]; +>o[strEnumKey] : any +>o : { a: number; } +>strEnumKey : StrEnum diff --git a/tests/baselines/reference/nonPrimitiveIndexingWithForInNoImplicitAny.errors.txt b/tests/baselines/reference/nonPrimitiveIndexingWithForInNoImplicitAny.errors.txt index f7f2ee3db16..07f52bf3e6f 100644 --- a/tests/baselines/reference/nonPrimitiveIndexingWithForInNoImplicitAny.errors.txt +++ b/tests/baselines/reference/nonPrimitiveIndexingWithForInNoImplicitAny.errors.txt @@ -1,4 +1,5 @@ -tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInNoImplicitAny.ts(4,17): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInNoImplicitAny.ts(4,17): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. + No index signature with a parameter of type 'string' was found on type '{}'. ==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInNoImplicitAny.ts (1 errors) ==== @@ -7,6 +8,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveIndexingWithForInNoImplic for (var key in a) { var value = a[key]; // error ~~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. +!!! error TS7053: No index signature with a parameter of type 'string' was found on type '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/objectSpreadIndexSignature.errors.txt b/tests/baselines/reference/objectSpreadIndexSignature.errors.txt index dede126d063..5c373b82ae4 100644 --- a/tests/baselines/reference/objectSpreadIndexSignature.errors.txt +++ b/tests/baselines/reference/objectSpreadIndexSignature.errors.txt @@ -1,4 +1,5 @@ -tests/cases/conformance/types/spread/objectSpreadIndexSignature.ts(6,1): error TS7017: Element implicitly has an 'any' type because type '{ b: number; a: number; }' has no index signature. +tests/cases/conformance/types/spread/objectSpreadIndexSignature.ts(6,1): error TS7053: Element implicitly has an 'any' type because expression of type '101' can't be used to index type '{ b: number; a: number; }'. + Property '101' does not exist on type '{ b: number; a: number; }'. ==== tests/cases/conformance/types/spread/objectSpreadIndexSignature.ts (1 errors) ==== @@ -9,7 +10,8 @@ tests/cases/conformance/types/spread/objectSpreadIndexSignature.ts(6,1): error T // only indexed has indexer, so i[101]: any i[101]; ~~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type '{ b: number; a: number; }' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type '101' can't be used to index type '{ b: number; a: number; }'. +!!! error TS7053: Property '101' does not exist on type '{ b: number; a: number; }'. let ii = { ...indexed1, ...indexed2 }; // both have indexer, so i[1001]: number | boolean ii[1001]; diff --git a/tests/baselines/reference/propertyAccessStringIndexSignatureNoImplicitAny.errors.txt b/tests/baselines/reference/propertyAccessStringIndexSignatureNoImplicitAny.errors.txt index d5fda181096..0211bf321bf 100644 --- a/tests/baselines/reference/propertyAccessStringIndexSignatureNoImplicitAny.errors.txt +++ b/tests/baselines/reference/propertyAccessStringIndexSignatureNoImplicitAny.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccessStringIndexSignatureNoImplicitAny.ts(10,7): error TS2339: Property 'nope' does not exist on type 'Empty'. -tests/cases/conformance/expressions/propertyAccess/propertyAccessStringIndexSignatureNoImplicitAny.ts(11,1): error TS7017: Element implicitly has an 'any' type because type 'Empty' has no index signature. +tests/cases/conformance/expressions/propertyAccess/propertyAccessStringIndexSignatureNoImplicitAny.ts(11,1): error TS7053: Element implicitly has an 'any' type because expression of type '"not allowed either"' can't be used to index type 'Empty'. + Property 'not allowed either' does not exist on type 'Empty'. ==== tests/cases/conformance/expressions/propertyAccess/propertyAccessStringIndexSignatureNoImplicitAny.ts (2 errors) ==== @@ -17,5 +18,6 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccessStringIndexSign !!! error TS2339: Property 'nope' does not exist on type 'Empty'. empty["not allowed either"]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type 'Empty' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"not allowed either"' can't be used to index type 'Empty'. +!!! error TS7053: Property 'not allowed either' does not exist on type 'Empty'. \ No newline at end of file diff --git a/tests/baselines/reference/typeFromPrototypeAssignment3.errors.txt b/tests/baselines/reference/typeFromPrototypeAssignment3.errors.txt index 579c3efac72..02ff4ae344c 100644 --- a/tests/baselines/reference/typeFromPrototypeAssignment3.errors.txt +++ b/tests/baselines/reference/typeFromPrototypeAssignment3.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/salsa/bug26885.js(2,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. -tests/cases/conformance/salsa/bug26885.js(11,16): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. +tests/cases/conformance/salsa/bug26885.js(11,16): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. + No index signature with a parameter of type 'string' was found on type '{}'. ==== tests/cases/conformance/salsa/bug26885.js (2 errors) ==== @@ -17,7 +18,8 @@ tests/cases/conformance/salsa/bug26885.js(11,16): error TS7017: Element implicit get(key) { return this._map[key + '']; ~~~~~~~~~~~~~~~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. +!!! error TS7053: No index signature with a parameter of type 'string' was found on type '{}'. } } diff --git a/tests/baselines/reference/unionTypeWithIndexSignature.errors.txt b/tests/baselines/reference/unionTypeWithIndexSignature.errors.txt index fb4463bc2d9..14a3ffc58a6 100644 --- a/tests/baselines/reference/unionTypeWithIndexSignature.errors.txt +++ b/tests/baselines/reference/unionTypeWithIndexSignature.errors.txt @@ -1,9 +1,11 @@ tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(11,3): error TS2339: Property 'bar' does not exist on type 'Missing'. Property 'bar' does not exist on type '{ [s: string]: string; }'. tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(14,4): error TS2540: Cannot assign to 'foo' because it is a read-only property. -tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(24,1): error TS7017: Element implicitly has an 'any' type because type 'Both' has no index signature. +tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(24,1): error TS7053: Element implicitly has an 'any' type because expression of type '1' can't be used to index type 'Both'. + Property '1' does not exist on type 'Both'. tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(25,1): error TS2322: Type '"not ok"' is not assignable to type 'number'. -tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(26,1): error TS7017: Element implicitly has an 'any' type because type 'Both' has no index signature. +tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(26,1): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'Both'. + Property '[sym]' does not exist on type 'Both'. ==== tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts (5 errors) ==== @@ -37,11 +39,13 @@ tests/cases/conformance/types/union/unionTypeWithIndexSignature.ts(26,1): error both[0] = 1 both[1] = 0 // not ok ~~~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type 'Both' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type '1' can't be used to index type 'Both'. +!!! error TS7053: Property '1' does not exist on type 'Both'. both[0] = 'not ok' ~~~~~~~ !!! error TS2322: Type '"not ok"' is not assignable to type 'number'. both[sym] = 'not ok' ~~~~~~~~~ -!!! error TS7017: Element implicitly has an 'any' type because type 'Both' has no index signature. +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'Both'. +!!! error TS7053: Property '[sym]' does not exist on type 'Both'. \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts b/tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts index 1cd967c294f..5e1b9430088 100644 --- a/tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts +++ b/tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts @@ -22,3 +22,23 @@ e['hello'] = 'modified'; e['hello'] += 1; e['hello'] ++; +const o = { a: 0 }; + +declare const k: "a" | "b" | "c"; +o[k]; + + +declare const k2: "c"; +o[k2]; + +declare const sym : unique symbol; +o[sym]; + +enum NumEnum { a, b } +let numEnumKey: NumEnum; +o[numEnumKey]; + + +enum StrEnum { a = "a", b = "b" } +let strEnumKey: StrEnum; +o[strEnumKey]; From f20a4fdfc48a5ea2c13896d9087d0492ed34811f Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 23 May 2019 15:39:40 -0700 Subject: [PATCH 153/384] Limit size of union types resulting from intersection type normalization --- src/compiler/checker.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3111cffa126..8760f1709c4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9908,6 +9908,12 @@ namespace ts { else { // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. + // If the estimated size of the resulting union type exceeds 100000 constituents, report an error. + const size = reduceLeft(typeSet, (n, t) => n * (t.flags & TypeFlags.Union ? (t).types.length : 1), 1); + if (size >= 100000) { + error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent); + return errorType; + } const unionIndex = findIndex(typeSet, t => (t.flags & TypeFlags.Union) !== 0); const unionType = typeSet[unionIndex]; result = getUnionType(map(unionType.types, t => getIntersectionType(replaceElement(typeSet, unionIndex, t))), From 53f37cfec3dec5810c6099a4545f0fc974698984 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 23 May 2019 17:09:17 -0700 Subject: [PATCH 154/384] Add test --- .../normalizedIntersectionTooComplex.ts | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/cases/compiler/normalizedIntersectionTooComplex.ts diff --git a/tests/cases/compiler/normalizedIntersectionTooComplex.ts b/tests/cases/compiler/normalizedIntersectionTooComplex.ts new file mode 100644 index 00000000000..dff8bb12019 --- /dev/null +++ b/tests/cases/compiler/normalizedIntersectionTooComplex.ts @@ -0,0 +1,38 @@ +// @strict: true + +// Repro from #30050 + +interface Obj { + ref: T; +} +interface Func { + (x: T): void; +} +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never; +type CtorOf = (arg: UnionToIntersection) => T; + +interface Big { + "0": { common?: string; "0"?: number, ref?: Obj | Func; } + "1": { common?: string; "1"?: number, ref?: Obj | Func; } + "2": { common?: string; "2"?: number, ref?: Obj | Func; } + "3": { common?: string; "3"?: number, ref?: Obj | Func; } + "4": { common?: string; "4"?: number, ref?: Obj | Func; } + "5": { common?: string; "5"?: number, ref?: Obj | Func; } + "6": { common?: string; "6"?: number, ref?: Obj | Func; } + "7": { common?: string; "7"?: number, ref?: Obj | Func; } + "8": { common?: string; "8"?: number, ref?: Obj | Func; } + "9": { common?: string; "9"?: number, ref?: Obj | Func; } + "10": { common?: string; "10"?: number, ref?: Obj | Func; } + "11": { common?: string; "11"?: number, ref?: Obj | Func; } + "12": { common?: string; "12"?: number, ref?: Obj | Func; } + "13": { common?: string; "13"?: number, ref?: Obj | Func; } + "14": { common?: string; "14"?: number, ref?: Obj | Func; } + "15": { common?: string; "15"?: number, ref?: Obj | Func; } + "16": { common?: string; "16"?: number, ref?: Obj | Func; } + "17": { common?: string; "17"?: number, ref?: Obj | Func; } +} +declare function getCtor(comp: T): CtorOf + +declare var all: keyof Big; +const ctor = getCtor(all); +const comp = ctor({ common: "ok", ref: x => console.log(x) }); From 01d15145b402c65505baed1a078a8aa1c65dd4a1 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 23 May 2019 17:09:25 -0700 Subject: [PATCH 155/384] Accept new baselines --- ...ormalizedIntersectionTooComplex.errors.txt | 46 ++++ .../normalizedIntersectionTooComplex.js | 44 +++ .../normalizedIntersectionTooComplex.symbols | 250 ++++++++++++++++++ .../normalizedIntersectionTooComplex.types | 158 +++++++++++ 4 files changed, 498 insertions(+) create mode 100644 tests/baselines/reference/normalizedIntersectionTooComplex.errors.txt create mode 100644 tests/baselines/reference/normalizedIntersectionTooComplex.js create mode 100644 tests/baselines/reference/normalizedIntersectionTooComplex.symbols create mode 100644 tests/baselines/reference/normalizedIntersectionTooComplex.types diff --git a/tests/baselines/reference/normalizedIntersectionTooComplex.errors.txt b/tests/baselines/reference/normalizedIntersectionTooComplex.errors.txt new file mode 100644 index 00000000000..4e214eff507 --- /dev/null +++ b/tests/baselines/reference/normalizedIntersectionTooComplex.errors.txt @@ -0,0 +1,46 @@ +tests/cases/compiler/normalizedIntersectionTooComplex.ts(36,14): error TS2590: Expression produces a union type that is too complex to represent. +tests/cases/compiler/normalizedIntersectionTooComplex.ts(36,40): error TS7006: Parameter 'x' implicitly has an 'any' type. + + +==== tests/cases/compiler/normalizedIntersectionTooComplex.ts (2 errors) ==== + // Repro from #30050 + + interface Obj { + ref: T; + } + interface Func { + (x: T): void; + } + type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never; + type CtorOf = (arg: UnionToIntersection) => T; + + interface Big { + "0": { common?: string; "0"?: number, ref?: Obj | Func; } + "1": { common?: string; "1"?: number, ref?: Obj | Func; } + "2": { common?: string; "2"?: number, ref?: Obj | Func; } + "3": { common?: string; "3"?: number, ref?: Obj | Func; } + "4": { common?: string; "4"?: number, ref?: Obj | Func; } + "5": { common?: string; "5"?: number, ref?: Obj | Func; } + "6": { common?: string; "6"?: number, ref?: Obj | Func; } + "7": { common?: string; "7"?: number, ref?: Obj | Func; } + "8": { common?: string; "8"?: number, ref?: Obj | Func; } + "9": { common?: string; "9"?: number, ref?: Obj | Func; } + "10": { common?: string; "10"?: number, ref?: Obj | Func; } + "11": { common?: string; "11"?: number, ref?: Obj | Func; } + "12": { common?: string; "12"?: number, ref?: Obj | Func; } + "13": { common?: string; "13"?: number, ref?: Obj | Func; } + "14": { common?: string; "14"?: number, ref?: Obj | Func; } + "15": { common?: string; "15"?: number, ref?: Obj | Func; } + "16": { common?: string; "16"?: number, ref?: Obj | Func; } + "17": { common?: string; "17"?: number, ref?: Obj | Func; } + } + declare function getCtor(comp: T): CtorOf + + declare var all: keyof Big; + const ctor = getCtor(all); + const comp = ctor({ common: "ok", ref: x => console.log(x) }); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2590: Expression produces a union type that is too complex to represent. + ~ +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. + \ No newline at end of file diff --git a/tests/baselines/reference/normalizedIntersectionTooComplex.js b/tests/baselines/reference/normalizedIntersectionTooComplex.js new file mode 100644 index 00000000000..d55189f7a1c --- /dev/null +++ b/tests/baselines/reference/normalizedIntersectionTooComplex.js @@ -0,0 +1,44 @@ +//// [normalizedIntersectionTooComplex.ts] +// Repro from #30050 + +interface Obj { + ref: T; +} +interface Func { + (x: T): void; +} +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never; +type CtorOf = (arg: UnionToIntersection) => T; + +interface Big { + "0": { common?: string; "0"?: number, ref?: Obj | Func; } + "1": { common?: string; "1"?: number, ref?: Obj | Func; } + "2": { common?: string; "2"?: number, ref?: Obj | Func; } + "3": { common?: string; "3"?: number, ref?: Obj | Func; } + "4": { common?: string; "4"?: number, ref?: Obj | Func; } + "5": { common?: string; "5"?: number, ref?: Obj | Func; } + "6": { common?: string; "6"?: number, ref?: Obj | Func; } + "7": { common?: string; "7"?: number, ref?: Obj | Func; } + "8": { common?: string; "8"?: number, ref?: Obj | Func; } + "9": { common?: string; "9"?: number, ref?: Obj | Func; } + "10": { common?: string; "10"?: number, ref?: Obj | Func; } + "11": { common?: string; "11"?: number, ref?: Obj | Func; } + "12": { common?: string; "12"?: number, ref?: Obj | Func; } + "13": { common?: string; "13"?: number, ref?: Obj | Func; } + "14": { common?: string; "14"?: number, ref?: Obj | Func; } + "15": { common?: string; "15"?: number, ref?: Obj | Func; } + "16": { common?: string; "16"?: number, ref?: Obj | Func; } + "17": { common?: string; "17"?: number, ref?: Obj | Func; } +} +declare function getCtor(comp: T): CtorOf + +declare var all: keyof Big; +const ctor = getCtor(all); +const comp = ctor({ common: "ok", ref: x => console.log(x) }); + + +//// [normalizedIntersectionTooComplex.js] +"use strict"; +// Repro from #30050 +var ctor = getCtor(all); +var comp = ctor({ common: "ok", ref: function (x) { return console.log(x); } }); diff --git a/tests/baselines/reference/normalizedIntersectionTooComplex.symbols b/tests/baselines/reference/normalizedIntersectionTooComplex.symbols new file mode 100644 index 00000000000..0854ef907df --- /dev/null +++ b/tests/baselines/reference/normalizedIntersectionTooComplex.symbols @@ -0,0 +1,250 @@ +=== tests/cases/compiler/normalizedIntersectionTooComplex.ts === +// Repro from #30050 + +interface Obj { +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>T : Symbol(T, Decl(normalizedIntersectionTooComplex.ts, 2, 14)) + + ref: T; +>ref : Symbol(Obj.ref, Decl(normalizedIntersectionTooComplex.ts, 2, 18)) +>T : Symbol(T, Decl(normalizedIntersectionTooComplex.ts, 2, 14)) +} +interface Func { +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>T : Symbol(T, Decl(normalizedIntersectionTooComplex.ts, 5, 15)) + + (x: T): void; +>x : Symbol(x, Decl(normalizedIntersectionTooComplex.ts, 6, 2)) +>T : Symbol(T, Decl(normalizedIntersectionTooComplex.ts, 5, 15)) +} +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never; +>UnionToIntersection : Symbol(UnionToIntersection, Decl(normalizedIntersectionTooComplex.ts, 7, 1)) +>U : Symbol(U, Decl(normalizedIntersectionTooComplex.ts, 8, 25)) +>U : Symbol(U, Decl(normalizedIntersectionTooComplex.ts, 8, 25)) +>k : Symbol(k, Decl(normalizedIntersectionTooComplex.ts, 8, 48)) +>U : Symbol(U, Decl(normalizedIntersectionTooComplex.ts, 8, 25)) +>k : Symbol(k, Decl(normalizedIntersectionTooComplex.ts, 8, 81)) +>I : Symbol(I, Decl(normalizedIntersectionTooComplex.ts, 8, 89)) +>I : Symbol(I, Decl(normalizedIntersectionTooComplex.ts, 8, 89)) + +type CtorOf = (arg: UnionToIntersection) => T; +>CtorOf : Symbol(CtorOf, Decl(normalizedIntersectionTooComplex.ts, 8, 114)) +>T : Symbol(T, Decl(normalizedIntersectionTooComplex.ts, 9, 12)) +>arg : Symbol(arg, Decl(normalizedIntersectionTooComplex.ts, 9, 18)) +>UnionToIntersection : Symbol(UnionToIntersection, Decl(normalizedIntersectionTooComplex.ts, 7, 1)) +>T : Symbol(T, Decl(normalizedIntersectionTooComplex.ts, 9, 12)) +>T : Symbol(T, Decl(normalizedIntersectionTooComplex.ts, 9, 12)) + +interface Big { +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "0": { common?: string; "0"?: number, ref?: Obj | Func; } +>"0" : Symbol(Big["0"], Decl(normalizedIntersectionTooComplex.ts, 11, 15)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 12, 10)) +>"0" : Symbol("0", Decl(normalizedIntersectionTooComplex.ts, 12, 27)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 12, 41)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "1": { common?: string; "1"?: number, ref?: Obj | Func; } +>"1" : Symbol(Big["1"], Decl(normalizedIntersectionTooComplex.ts, 12, 81)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 13, 10)) +>"1" : Symbol("1", Decl(normalizedIntersectionTooComplex.ts, 13, 27)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 13, 41)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "2": { common?: string; "2"?: number, ref?: Obj | Func; } +>"2" : Symbol(Big["2"], Decl(normalizedIntersectionTooComplex.ts, 13, 81)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 14, 10)) +>"2" : Symbol("2", Decl(normalizedIntersectionTooComplex.ts, 14, 27)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 14, 41)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "3": { common?: string; "3"?: number, ref?: Obj | Func; } +>"3" : Symbol(Big["3"], Decl(normalizedIntersectionTooComplex.ts, 14, 81)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 15, 10)) +>"3" : Symbol("3", Decl(normalizedIntersectionTooComplex.ts, 15, 27)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 15, 41)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "4": { common?: string; "4"?: number, ref?: Obj | Func; } +>"4" : Symbol(Big["4"], Decl(normalizedIntersectionTooComplex.ts, 15, 81)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 16, 10)) +>"4" : Symbol("4", Decl(normalizedIntersectionTooComplex.ts, 16, 27)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 16, 41)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "5": { common?: string; "5"?: number, ref?: Obj | Func; } +>"5" : Symbol(Big["5"], Decl(normalizedIntersectionTooComplex.ts, 16, 81)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 17, 10)) +>"5" : Symbol("5", Decl(normalizedIntersectionTooComplex.ts, 17, 27)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 17, 41)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "6": { common?: string; "6"?: number, ref?: Obj | Func; } +>"6" : Symbol(Big["6"], Decl(normalizedIntersectionTooComplex.ts, 17, 81)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 18, 10)) +>"6" : Symbol("6", Decl(normalizedIntersectionTooComplex.ts, 18, 27)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 18, 41)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "7": { common?: string; "7"?: number, ref?: Obj | Func; } +>"7" : Symbol(Big["7"], Decl(normalizedIntersectionTooComplex.ts, 18, 81)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 19, 10)) +>"7" : Symbol("7", Decl(normalizedIntersectionTooComplex.ts, 19, 27)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 19, 41)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "8": { common?: string; "8"?: number, ref?: Obj | Func; } +>"8" : Symbol(Big["8"], Decl(normalizedIntersectionTooComplex.ts, 19, 81)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 20, 10)) +>"8" : Symbol("8", Decl(normalizedIntersectionTooComplex.ts, 20, 27)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 20, 41)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "9": { common?: string; "9"?: number, ref?: Obj | Func; } +>"9" : Symbol(Big["9"], Decl(normalizedIntersectionTooComplex.ts, 20, 81)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 21, 10)) +>"9" : Symbol("9", Decl(normalizedIntersectionTooComplex.ts, 21, 27)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 21, 41)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "10": { common?: string; "10"?: number, ref?: Obj | Func; } +>"10" : Symbol(Big["10"], Decl(normalizedIntersectionTooComplex.ts, 21, 81)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 22, 11)) +>"10" : Symbol("10", Decl(normalizedIntersectionTooComplex.ts, 22, 28)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 22, 43)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "11": { common?: string; "11"?: number, ref?: Obj | Func; } +>"11" : Symbol(Big["11"], Decl(normalizedIntersectionTooComplex.ts, 22, 85)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 23, 11)) +>"11" : Symbol("11", Decl(normalizedIntersectionTooComplex.ts, 23, 28)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 23, 43)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "12": { common?: string; "12"?: number, ref?: Obj | Func; } +>"12" : Symbol(Big["12"], Decl(normalizedIntersectionTooComplex.ts, 23, 85)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 24, 11)) +>"12" : Symbol("12", Decl(normalizedIntersectionTooComplex.ts, 24, 28)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 24, 43)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "13": { common?: string; "13"?: number, ref?: Obj | Func; } +>"13" : Symbol(Big["13"], Decl(normalizedIntersectionTooComplex.ts, 24, 85)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 25, 11)) +>"13" : Symbol("13", Decl(normalizedIntersectionTooComplex.ts, 25, 28)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 25, 43)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "14": { common?: string; "14"?: number, ref?: Obj | Func; } +>"14" : Symbol(Big["14"], Decl(normalizedIntersectionTooComplex.ts, 25, 85)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 26, 11)) +>"14" : Symbol("14", Decl(normalizedIntersectionTooComplex.ts, 26, 28)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 26, 43)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "15": { common?: string; "15"?: number, ref?: Obj | Func; } +>"15" : Symbol(Big["15"], Decl(normalizedIntersectionTooComplex.ts, 26, 85)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 27, 11)) +>"15" : Symbol("15", Decl(normalizedIntersectionTooComplex.ts, 27, 28)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 27, 43)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "16": { common?: string; "16"?: number, ref?: Obj | Func; } +>"16" : Symbol(Big["16"], Decl(normalizedIntersectionTooComplex.ts, 27, 85)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 28, 11)) +>"16" : Symbol("16", Decl(normalizedIntersectionTooComplex.ts, 28, 28)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 28, 43)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + + "17": { common?: string; "17"?: number, ref?: Obj | Func; } +>"17" : Symbol(Big["17"], Decl(normalizedIntersectionTooComplex.ts, 28, 85)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 29, 11)) +>"17" : Symbol("17", Decl(normalizedIntersectionTooComplex.ts, 29, 28)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 29, 43)) +>Obj : Symbol(Obj, Decl(normalizedIntersectionTooComplex.ts, 0, 0)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>Func : Symbol(Func, Decl(normalizedIntersectionTooComplex.ts, 4, 1)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +} +declare function getCtor(comp: T): CtorOf +>getCtor : Symbol(getCtor, Decl(normalizedIntersectionTooComplex.ts, 30, 1)) +>T : Symbol(T, Decl(normalizedIntersectionTooComplex.ts, 31, 25)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>comp : Symbol(comp, Decl(normalizedIntersectionTooComplex.ts, 31, 46)) +>T : Symbol(T, Decl(normalizedIntersectionTooComplex.ts, 31, 25)) +>CtorOf : Symbol(CtorOf, Decl(normalizedIntersectionTooComplex.ts, 8, 114)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) +>T : Symbol(T, Decl(normalizedIntersectionTooComplex.ts, 31, 25)) + +declare var all: keyof Big; +>all : Symbol(all, Decl(normalizedIntersectionTooComplex.ts, 33, 11)) +>Big : Symbol(Big, Decl(normalizedIntersectionTooComplex.ts, 9, 52)) + +const ctor = getCtor(all); +>ctor : Symbol(ctor, Decl(normalizedIntersectionTooComplex.ts, 34, 5)) +>getCtor : Symbol(getCtor, Decl(normalizedIntersectionTooComplex.ts, 30, 1)) +>all : Symbol(all, Decl(normalizedIntersectionTooComplex.ts, 33, 11)) + +const comp = ctor({ common: "ok", ref: x => console.log(x) }); +>comp : Symbol(comp, Decl(normalizedIntersectionTooComplex.ts, 35, 5)) +>ctor : Symbol(ctor, Decl(normalizedIntersectionTooComplex.ts, 34, 5)) +>common : Symbol(common, Decl(normalizedIntersectionTooComplex.ts, 35, 19)) +>ref : Symbol(ref, Decl(normalizedIntersectionTooComplex.ts, 35, 33)) +>x : Symbol(x, Decl(normalizedIntersectionTooComplex.ts, 35, 38)) +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>x : Symbol(x, Decl(normalizedIntersectionTooComplex.ts, 35, 38)) + diff --git a/tests/baselines/reference/normalizedIntersectionTooComplex.types b/tests/baselines/reference/normalizedIntersectionTooComplex.types new file mode 100644 index 00000000000..6750b0b0c73 --- /dev/null +++ b/tests/baselines/reference/normalizedIntersectionTooComplex.types @@ -0,0 +1,158 @@ +=== tests/cases/compiler/normalizedIntersectionTooComplex.ts === +// Repro from #30050 + +interface Obj { + ref: T; +>ref : T +} +interface Func { + (x: T): void; +>x : T +} +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never; +>UnionToIntersection : UnionToIntersection +>k : U +>k : I + +type CtorOf = (arg: UnionToIntersection) => T; +>CtorOf : CtorOf +>arg : UnionToIntersection + +interface Big { + "0": { common?: string; "0"?: number, ref?: Obj | Func; } +>"0" : { common?: string | undefined; "0"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"0" : number | undefined +>ref : Obj<{ common?: string | undefined; "0"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "0"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "1": { common?: string; "1"?: number, ref?: Obj | Func; } +>"1" : { common?: string | undefined; "1"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"1" : number | undefined +>ref : Obj<{ common?: string | undefined; "1"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "1"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "2": { common?: string; "2"?: number, ref?: Obj | Func; } +>"2" : { common?: string | undefined; "2"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"2" : number | undefined +>ref : Obj<{ common?: string | undefined; "2"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "2"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "3": { common?: string; "3"?: number, ref?: Obj | Func; } +>"3" : { common?: string | undefined; "3"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"3" : number | undefined +>ref : Obj<{ common?: string | undefined; "3"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "3"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "4": { common?: string; "4"?: number, ref?: Obj | Func; } +>"4" : { common?: string | undefined; "4"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"4" : number | undefined +>ref : Obj<{ common?: string | undefined; "4"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "4"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "5": { common?: string; "5"?: number, ref?: Obj | Func; } +>"5" : { common?: string | undefined; "5"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"5" : number | undefined +>ref : Obj<{ common?: string | undefined; "5"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "5"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "6": { common?: string; "6"?: number, ref?: Obj | Func; } +>"6" : { common?: string | undefined; "6"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"6" : number | undefined +>ref : Obj<{ common?: string | undefined; "6"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "6"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "7": { common?: string; "7"?: number, ref?: Obj | Func; } +>"7" : { common?: string | undefined; "7"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"7" : number | undefined +>ref : Obj<{ common?: string | undefined; "7"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "7"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "8": { common?: string; "8"?: number, ref?: Obj | Func; } +>"8" : { common?: string | undefined; "8"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"8" : number | undefined +>ref : Obj<{ common?: string | undefined; "8"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "8"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "9": { common?: string; "9"?: number, ref?: Obj | Func; } +>"9" : { common?: string | undefined; "9"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"9" : number | undefined +>ref : Obj<{ common?: string | undefined; "9"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "9"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "10": { common?: string; "10"?: number, ref?: Obj | Func; } +>"10" : { common?: string | undefined; "10"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"10" : number | undefined +>ref : Obj<{ common?: string | undefined; "10"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "10"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "11": { common?: string; "11"?: number, ref?: Obj | Func; } +>"11" : { common?: string | undefined; "11"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"11" : number | undefined +>ref : Obj<{ common?: string | undefined; "11"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "11"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "12": { common?: string; "12"?: number, ref?: Obj | Func; } +>"12" : { common?: string | undefined; "12"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"12" : number | undefined +>ref : Obj<{ common?: string | undefined; "12"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "12"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "13": { common?: string; "13"?: number, ref?: Obj | Func; } +>"13" : { common?: string | undefined; "13"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"13" : number | undefined +>ref : Obj<{ common?: string | undefined; "13"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "13"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "14": { common?: string; "14"?: number, ref?: Obj | Func; } +>"14" : { common?: string | undefined; "14"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"14" : number | undefined +>ref : Obj<{ common?: string | undefined; "14"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "14"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "15": { common?: string; "15"?: number, ref?: Obj | Func; } +>"15" : { common?: string | undefined; "15"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"15" : number | undefined +>ref : Obj<{ common?: string | undefined; "15"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "15"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "16": { common?: string; "16"?: number, ref?: Obj | Func; } +>"16" : { common?: string | undefined; "16"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"16" : number | undefined +>ref : Obj<{ common?: string | undefined; "16"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "16"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined + + "17": { common?: string; "17"?: number, ref?: Obj | Func; } +>"17" : { common?: string | undefined; "17"?: number | undefined; ref?: Obj | Func | undefined; } +>common : string | undefined +>"17" : number | undefined +>ref : Obj<{ common?: string | undefined; "17"?: number | undefined; ref?: Obj | Func | undefined; }> | Func<{ common?: string | undefined; "17"?: number | undefined; ref?: Obj | Func | undefined; }> | undefined +} +declare function getCtor(comp: T): CtorOf +>getCtor : (comp: T) => CtorOf +>comp : T + +declare var all: keyof Big; +>all : "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" + +const ctor = getCtor(all); +>ctor : CtorOf<{ common?: string | undefined; "0"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "1"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "2"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "3"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "4"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "5"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "6"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "7"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "8"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "9"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "10"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "11"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "12"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "13"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "14"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "15"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "16"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "17"?: number | undefined; ref?: Obj | Func | undefined; }> +>getCtor(all) : CtorOf<{ common?: string | undefined; "0"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "1"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "2"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "3"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "4"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "5"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "6"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "7"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "8"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "9"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "10"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "11"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "12"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "13"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "14"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "15"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "16"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "17"?: number | undefined; ref?: Obj | Func | undefined; }> +>getCtor : (comp: T) => CtorOf +>all : "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" + +const comp = ctor({ common: "ok", ref: x => console.log(x) }); +>comp : { common?: string | undefined; "0"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "1"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "2"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "3"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "4"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "5"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "6"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "7"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "8"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "9"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "10"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "11"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "12"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "13"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "14"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "15"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "16"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "17"?: number | undefined; ref?: Obj | Func | undefined; } +>ctor({ common: "ok", ref: x => console.log(x) }) : { common?: string | undefined; "0"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "1"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "2"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "3"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "4"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "5"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "6"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "7"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "8"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "9"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "10"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "11"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "12"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "13"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "14"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "15"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "16"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "17"?: number | undefined; ref?: Obj | Func | undefined; } +>ctor : CtorOf<{ common?: string | undefined; "0"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "1"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "2"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "3"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "4"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "5"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "6"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "7"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "8"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "9"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "10"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "11"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "12"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "13"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "14"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "15"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "16"?: number | undefined; ref?: Obj | Func | undefined; } | { common?: string | undefined; "17"?: number | undefined; ref?: Obj | Func | undefined; }> +>{ common: "ok", ref: x => console.log(x) } : { common: string; ref: (x: any) => void; } +>common : string +>"ok" : "ok" +>ref : (x: any) => void +>x => console.log(x) : (x: any) => void +>x : any +>console.log(x) : void +>console.log : (message?: any, ...optionalParams: any[]) => void +>console : Console +>log : (message?: any, ...optionalParams: any[]) => void +>x : any + From bb4080c175d0f554070b963bee05a0696bc958a2 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 23 May 2019 17:17:24 -0700 Subject: [PATCH 156/384] Collect _all_ symlinks a file may have witnessed when attempting to generate specifiers (#31571) --- src/compiler/moduleSpecifiers.ts | 6 +-- ...arationEmitForGlobalishSpecifierSymlink.js | 45 +++++++++++++++++++ ...onEmitForGlobalishSpecifierSymlink.symbols | 43 ++++++++++++++++++ ...tionEmitForGlobalishSpecifierSymlink.types | 41 +++++++++++++++++ ...rationEmitForGlobalishSpecifierSymlink2.js | 33 ++++++++++++++ ...nEmitForGlobalishSpecifierSymlink2.symbols | 30 +++++++++++++ ...ionEmitForGlobalishSpecifierSymlink2.types | 29 ++++++++++++ ...arationEmitForGlobalishSpecifierSymlink.ts | 35 +++++++++++++++ ...rationEmitForGlobalishSpecifierSymlink2.ts | 25 +++++++++++ 9 files changed, 284 insertions(+), 3 deletions(-) create mode 100644 tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink.js create mode 100644 tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink.symbols create mode 100644 tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink.types create mode 100644 tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink2.js create mode 100644 tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink2.symbols create mode 100644 tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink2.types create mode 100644 tests/cases/compiler/declarationEmitForGlobalishSpecifierSymlink.ts create mode 100644 tests/cases/compiler/declarationEmitForGlobalishSpecifierSymlink2.ts diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index 59bb74a22c1..bc448698c69 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -175,9 +175,9 @@ namespace ts.moduleSpecifiers { function discoverProbableSymlinks(files: ReadonlyArray, getCanonicalFileName: GetCanonicalFileName, cwd: string): ReadonlyMap { const result = createMap(); - const symlinks = mapDefined(files, sf => - sf.resolvedModules && firstDefinedIterator(sf.resolvedModules.values(), res => - res && res.originalPath && res.resolvedFileName !== res.originalPath ? [res.resolvedFileName, res.originalPath] : undefined)); + const symlinks = flatten(mapDefined(files, sf => + sf.resolvedModules && compact(arrayFrom(mapIterator(sf.resolvedModules.values(), res => + res && res.originalPath && res.resolvedFileName !== res.originalPath ? [res.resolvedFileName, res.originalPath] as const : undefined))))); for (const [resolvedPath, originalPath] of symlinks) { const [commonResolved, commonOriginal] = guessDirectorySymlink(resolvedPath, originalPath, cwd, getCanonicalFileName); result.set(commonOriginal, commonResolved); diff --git a/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink.js b/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink.js new file mode 100644 index 00000000000..00efdd49280 --- /dev/null +++ b/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink.js @@ -0,0 +1,45 @@ +//// [tests/cases/compiler/declarationEmitForGlobalishSpecifierSymlink.ts] //// + +//// [impl.d.ts] +export function getA(): A; +export enum A { + Val +} +//// [index.d.ts] +export * from "./src/impl"; +//// [package.json] +{ + "name": "typescript-fsa", + "version": "1.0.0" +} +//// [impl.d.ts] +export function getA(): A; +export enum A { + Val +} +//// [index.d.ts] +export * from "./src/impl"; +//// [package.json] +{ + "name": "typescript-fsa", + "version": "1.0.0" +} +//// [index.ts] +import * as _whatever from "p2"; +import { getA } from "typescript-fsa"; + +export const a = getA(); +//// [index.d.ts] +export const a: import("typescript-fsa").A; + + + +//// [index.js] +"use strict"; +exports.__esModule = true; +var typescript_fsa_1 = require("typescript-fsa"); +exports.a = typescript_fsa_1.getA(); + + +//// [index.d.ts] +export declare const a: import("typescript-fsa").A; diff --git a/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink.symbols b/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink.symbols new file mode 100644 index 00000000000..fa0a8593339 --- /dev/null +++ b/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink.symbols @@ -0,0 +1,43 @@ +=== /p1/node_modules/typescript-fsa/src/impl.d.ts === +export function getA(): A; +>getA : Symbol(getA, Decl(impl.d.ts, 0, 0)) +>A : Symbol(A, Decl(impl.d.ts, 0, 26)) + +export enum A { +>A : Symbol(A, Decl(impl.d.ts, 0, 26)) + + Val +>Val : Symbol(A.Val, Decl(impl.d.ts, 1, 15)) +} +=== /p1/node_modules/typescript-fsa/index.d.ts === +export * from "./src/impl"; +No type information for this code.=== /p2/node_modules/typescript-fsa/src/impl.d.ts === +export function getA(): A; +>getA : Symbol(getA, Decl(impl.d.ts, 0, 0)) +>A : Symbol(A, Decl(impl.d.ts, 0, 26)) + +export enum A { +>A : Symbol(A, Decl(impl.d.ts, 0, 26)) + + Val +>Val : Symbol(A.Val, Decl(impl.d.ts, 1, 15)) +} +=== /p2/node_modules/typescript-fsa/index.d.ts === +export * from "./src/impl"; +No type information for this code.=== /p1/index.ts === +import * as _whatever from "p2"; +>_whatever : Symbol(_whatever, Decl(index.ts, 0, 6)) + +import { getA } from "typescript-fsa"; +>getA : Symbol(getA, Decl(index.ts, 1, 8)) + +export const a = getA(); +>a : Symbol(a, Decl(index.ts, 3, 12)) +>getA : Symbol(getA, Decl(index.ts, 1, 8)) + +=== /p2/index.d.ts === +export const a: import("typescript-fsa").A; +>a : Symbol(a, Decl(index.d.ts, 0, 12)) +>A : Symbol(A, Decl(impl.d.ts, 0, 26)) + + diff --git a/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink.types b/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink.types new file mode 100644 index 00000000000..3f62193fd83 --- /dev/null +++ b/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink.types @@ -0,0 +1,41 @@ +=== /p1/node_modules/typescript-fsa/src/impl.d.ts === +export function getA(): A; +>getA : () => A + +export enum A { +>A : A + + Val +>Val : A +} +=== /p1/node_modules/typescript-fsa/index.d.ts === +export * from "./src/impl"; +No type information for this code.=== /p2/node_modules/typescript-fsa/src/impl.d.ts === +export function getA(): A; +>getA : () => A + +export enum A { +>A : A + + Val +>Val : A +} +=== /p2/node_modules/typescript-fsa/index.d.ts === +export * from "./src/impl"; +No type information for this code.=== /p1/index.ts === +import * as _whatever from "p2"; +>_whatever : typeof _whatever + +import { getA } from "typescript-fsa"; +>getA : () => import("/p1/node_modules/typescript-fsa/index").A + +export const a = getA(); +>a : import("/p1/node_modules/typescript-fsa/index").A +>getA() : import("/p1/node_modules/typescript-fsa/index").A +>getA : () => import("/p1/node_modules/typescript-fsa/index").A + +=== /p2/index.d.ts === +export const a: import("typescript-fsa").A; +>a : import("/p2/node_modules/typescript-fsa/index").A + + diff --git a/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink2.js b/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink2.js new file mode 100644 index 00000000000..22889aba461 --- /dev/null +++ b/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink2.js @@ -0,0 +1,33 @@ +//// [tests/cases/compiler/declarationEmitForGlobalishSpecifierSymlink2.ts] //// + +//// [impl.d.ts] +export function getA(): A; +export enum A { + Val +} +//// [index.d.ts] +export * from "./src/impl"; +//// [package.json] +{ + "name": "typescript-fsa", + "version": "1.0.0" +} +//// [index.ts] +import * as _whatever from "p2"; +import { getA } from "typescript-fsa"; + +export const a = getA(); +//// [index.d.ts] +export const a: import("typescript-fsa").A; + + + +//// [index.js] +"use strict"; +exports.__esModule = true; +var typescript_fsa_1 = require("typescript-fsa"); +exports.a = typescript_fsa_1.getA(); + + +//// [index.d.ts] +export declare const a: import("typescript-fsa").A; diff --git a/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink2.symbols b/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink2.symbols new file mode 100644 index 00000000000..e183f07d558 --- /dev/null +++ b/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink2.symbols @@ -0,0 +1,30 @@ +=== /cache/typescript-fsa/src/impl.d.ts === +export function getA(): A; +>getA : Symbol(getA, Decl(impl.d.ts, 0, 0)) +>A : Symbol(A, Decl(impl.d.ts, 0, 26)) + +export enum A { +>A : Symbol(A, Decl(impl.d.ts, 0, 26)) + + Val +>Val : Symbol(A.Val, Decl(impl.d.ts, 1, 15)) +} +=== /cache/typescript-fsa/index.d.ts === +export * from "./src/impl"; +No type information for this code.=== /p1/index.ts === +import * as _whatever from "p2"; +>_whatever : Symbol(_whatever, Decl(index.ts, 0, 6)) + +import { getA } from "typescript-fsa"; +>getA : Symbol(getA, Decl(index.ts, 1, 8)) + +export const a = getA(); +>a : Symbol(a, Decl(index.ts, 3, 12)) +>getA : Symbol(getA, Decl(index.ts, 1, 8)) + +=== /p2/index.d.ts === +export const a: import("typescript-fsa").A; +>a : Symbol(a, Decl(index.d.ts, 0, 12)) +>A : Symbol(A, Decl(impl.d.ts, 0, 26)) + + diff --git a/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink2.types b/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink2.types new file mode 100644 index 00000000000..7c214ced6b6 --- /dev/null +++ b/tests/baselines/reference/declarationEmitForGlobalishSpecifierSymlink2.types @@ -0,0 +1,29 @@ +=== /cache/typescript-fsa/src/impl.d.ts === +export function getA(): A; +>getA : () => A + +export enum A { +>A : A + + Val +>Val : A +} +=== /cache/typescript-fsa/index.d.ts === +export * from "./src/impl"; +No type information for this code.=== /p1/index.ts === +import * as _whatever from "p2"; +>_whatever : typeof _whatever + +import { getA } from "typescript-fsa"; +>getA : () => import("/cache/typescript-fsa/index").A + +export const a = getA(); +>a : import("/cache/typescript-fsa/index").A +>getA() : import("/cache/typescript-fsa/index").A +>getA : () => import("/cache/typescript-fsa/index").A + +=== /p2/index.d.ts === +export const a: import("typescript-fsa").A; +>a : import("/cache/typescript-fsa/index").A + + diff --git a/tests/cases/compiler/declarationEmitForGlobalishSpecifierSymlink.ts b/tests/cases/compiler/declarationEmitForGlobalishSpecifierSymlink.ts new file mode 100644 index 00000000000..b42d679b521 --- /dev/null +++ b/tests/cases/compiler/declarationEmitForGlobalishSpecifierSymlink.ts @@ -0,0 +1,35 @@ +// @useCaseSensitiveFilenames: true +// @declaration: true +// @filename: /p1/node_modules/typescript-fsa/src/impl.d.ts +export function getA(): A; +export enum A { + Val +} +// @filename: /p1/node_modules/typescript-fsa/index.d.ts +export * from "./src/impl"; +// @filename: /p1/node_modules/typescript-fsa/package.json +{ + "name": "typescript-fsa", + "version": "1.0.0" +} +// @filename: /p2/node_modules/typescript-fsa/src/impl.d.ts +export function getA(): A; +export enum A { + Val +} +// @filename: /p2/node_modules/typescript-fsa/index.d.ts +export * from "./src/impl"; +// @filename: /p2/node_modules/typescript-fsa/package.json +{ + "name": "typescript-fsa", + "version": "1.0.0" +} +// @filename: /p1/index.ts +import * as _whatever from "p2"; +import { getA } from "typescript-fsa"; + +export const a = getA(); +// @filename: /p2/index.d.ts +export const a: import("typescript-fsa").A; + +// @link: /p2 -> /p1/node_modules/p2 diff --git a/tests/cases/compiler/declarationEmitForGlobalishSpecifierSymlink2.ts b/tests/cases/compiler/declarationEmitForGlobalishSpecifierSymlink2.ts new file mode 100644 index 00000000000..5b46de99622 --- /dev/null +++ b/tests/cases/compiler/declarationEmitForGlobalishSpecifierSymlink2.ts @@ -0,0 +1,25 @@ +// @useCaseSensitiveFilenames: true +// @declaration: true +// @filename: /cache/typescript-fsa/src/impl.d.ts +export function getA(): A; +export enum A { + Val +} +// @filename: /cache/typescript-fsa/index.d.ts +export * from "./src/impl"; +// @filename: /cache/typescript-fsa/package.json +{ + "name": "typescript-fsa", + "version": "1.0.0" +} +// @filename: /p1/index.ts +import * as _whatever from "p2"; +import { getA } from "typescript-fsa"; + +export const a = getA(); +// @filename: /p2/index.d.ts +export const a: import("typescript-fsa").A; + +// @link: /p2 -> /p1/node_modules/p2 +// @link: /cache/typescript-fsa -> /p1/node_modules/typescript-fsa +// @link: /cache/typescript-fsa -> /p2/node_modules/typescript-fsa From dfd28d275100db73433318236a2299b002cf0ce3 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 23 May 2019 17:19:32 -0700 Subject: [PATCH 157/384] Fix handling of empty 'types', 'typings', etc. fields in package.json (#31539) --- src/compiler/diagnosticMessages.json | 4 ++++ src/compiler/moduleNameResolver.ts | 10 +++++++- .../reference/typesVersions.emptyTypes.js | 20 ++++++++++++++++ .../typesVersions.emptyTypes.symbols | 8 +++++++ .../typesVersions.emptyTypes.trace.json | 24 +++++++++++++++++++ .../reference/typesVersions.emptyTypes.types | 9 +++++++ .../typesVersions.emptyTypes.ts | 18 ++++++++++++++ 7 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/typesVersions.emptyTypes.js create mode 100644 tests/baselines/reference/typesVersions.emptyTypes.symbols create mode 100644 tests/baselines/reference/typesVersions.emptyTypes.trace.json create mode 100644 tests/baselines/reference/typesVersions.emptyTypes.types create mode 100644 tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index e0579429def..5d6dc7d6df4 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3927,6 +3927,10 @@ "category": "Message", "code": 6219 }, + "'package.json' had a falsy '{0}' field.": { + "category": "Message", + "code": 6220 + }, "Projects to reference": { "category": "Message", diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 19402b03ee9..604b82cce5e 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -141,7 +141,15 @@ namespace ts { function readPackageJsonPathField(jsonContent: PackageJson, fieldName: K, baseDirectory: string, state: ModuleResolutionState): PackageJson[K] | undefined { const fileName = readPackageJsonField(jsonContent, fieldName, "string", state); - if (fileName === undefined) return; + if (fileName === undefined) { + return; + } + if (!fileName) { + if (state.traceEnabled) { + trace(state.host, Diagnostics.package_json_had_a_falsy_0_field, fieldName); + } + return; + } const path = normalizePath(combinePaths(baseDirectory, fileName)); if (state.traceEnabled) { trace(state.host, Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path); diff --git a/tests/baselines/reference/typesVersions.emptyTypes.js b/tests/baselines/reference/typesVersions.emptyTypes.js new file mode 100644 index 00000000000..0bcc27d7a65 --- /dev/null +++ b/tests/baselines/reference/typesVersions.emptyTypes.js @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts] //// + +//// [package.json] +{ + "types": "", + "typesVersions": { + ">=3.1.0-0": { "*" : ["ts3.1/*"] } + } +} + +//// [index.d.ts] +export const a = 0; + +//// [user.ts] +import { a } from "a"; + + +//// [user.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/typesVersions.emptyTypes.symbols b/tests/baselines/reference/typesVersions.emptyTypes.symbols new file mode 100644 index 00000000000..a4441e407d7 --- /dev/null +++ b/tests/baselines/reference/typesVersions.emptyTypes.symbols @@ -0,0 +1,8 @@ +=== /a/ts3.1/index.d.ts === +export const a = 0; +>a : Symbol(a, Decl(index.d.ts, 0, 12)) + +=== /b/user.ts === +import { a } from "a"; +>a : Symbol(a, Decl(user.ts, 0, 8)) + diff --git a/tests/baselines/reference/typesVersions.emptyTypes.trace.json b/tests/baselines/reference/typesVersions.emptyTypes.trace.json new file mode 100644 index 00000000000..e7a9e7547cf --- /dev/null +++ b/tests/baselines/reference/typesVersions.emptyTypes.trace.json @@ -0,0 +1,24 @@ +[ + "======== Resolving module 'a' from '/b/user.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "'baseUrl' option is set to '/', using this value to resolve non-relative module name 'a'.", + "Resolving module name 'a' relative to base url '/' - '/a'.", + "Loading module as file / folder, candidate module location '/a', target file type 'TypeScript'.", + "File '/a.ts' does not exist.", + "File '/a.tsx' does not exist.", + "File '/a.d.ts' does not exist.", + "Found 'package.json' at '/a/package.json'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", + "'package.json' does not have a 'typings' field.", + "'package.json' had a falsy 'types' field.", + "'package.json' does not have a 'main' field.", + "'package.json' has a 'typesVersions' entry '>=3.1.0-0' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'index'.", + "Module name 'index', matched pattern '*'.", + "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/index'.", + "File '/a/ts3.1/index' does not exist.", + "Loading module as file / folder, candidate module location '/a/ts3.1/index', target file type 'TypeScript'.", + "File '/a/ts3.1/index.ts' does not exist.", + "File '/a/ts3.1/index.tsx' does not exist.", + "File '/a/ts3.1/index.d.ts' exist - use it as a name resolution result.", + "======== Module name 'a' was successfully resolved to '/a/ts3.1/index.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersions.emptyTypes.types b/tests/baselines/reference/typesVersions.emptyTypes.types new file mode 100644 index 00000000000..578d4695e1c --- /dev/null +++ b/tests/baselines/reference/typesVersions.emptyTypes.types @@ -0,0 +1,9 @@ +=== /a/ts3.1/index.d.ts === +export const a = 0; +>a : 0 +>0 : 0 + +=== /b/user.ts === +import { a } from "a"; +>a : 0 + diff --git a/tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts b/tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts new file mode 100644 index 00000000000..f5d0792bfc4 --- /dev/null +++ b/tests/cases/conformance/moduleResolution/typesVersions.emptyTypes.ts @@ -0,0 +1,18 @@ +// @baseUrl: / +// @traceResolution: true +// @target: esnext +// @module: commonjs + +// @filename: /a/package.json +{ + "types": "", + "typesVersions": { + ">=3.1.0-0": { "*" : ["ts3.1/*"] } + } +} + +// @filename: /a/ts3.1/index.d.ts +export const a = 0; + +// @filename: /b/user.ts +import { a } from "a"; From b460d8cd267a8fc01c949289de96d424223a666d Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 23 May 2019 17:50:44 -0700 Subject: [PATCH 158/384] Expose getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment with better name (#31564) --- src/compiler/checker.ts | 21 +++++++++++-------- src/compiler/types.ts | 1 + .../reference/api/tsserverlibrary.d.ts | 1 + tests/baselines/reference/api/typescript.d.ts | 1 + 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0d7c7b022dd..b1e62d69e22 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -182,6 +182,10 @@ namespace ts { node = getParseTreeNode(node); return node ? getTypeOfNode(node) : errorType; }, + getTypeOfAssignmentPattern: nodeIn => { + const node = getParseTreeNode(nodeIn, isAssignmentPattern); + return node && getTypeOfAssignmentPattern(node) || errorType; + }, getPropertySymbolOfDestructuringAssignment: locationIn => { const location = getParseTreeNode(locationIn, isIdentifier); return location ? getPropertySymbolOfDestructuringAssignment(location) : undefined; @@ -29982,7 +29986,7 @@ namespace ts { // } // [ a ] from // [a] = [ some array ...] - function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr: Expression): Type { + function getTypeOfAssignmentPattern(expr: AssignmentPattern): Type | undefined { Debug.assert(expr.kind === SyntaxKind.ObjectLiteralExpression || expr.kind === SyntaxKind.ArrayLiteralExpression); // If this is from "for of" // for ( { a } of elems) { @@ -30001,17 +30005,16 @@ namespace ts { // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { if (expr.parent.kind === SyntaxKind.PropertyAssignment) { const node = cast(expr.parent.parent, isObjectLiteralExpression); - const typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(node); + const typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node) || errorType; const propertyIndex = indexOfNode(node.properties, expr.parent); - return checkObjectLiteralDestructuringPropertyAssignment(node, typeOfParentObjectLiteral || errorType, propertyIndex)!; // TODO: GH#18217 + return checkObjectLiteralDestructuringPropertyAssignment(node, typeOfParentObjectLiteral, propertyIndex); } // Array literal assignment - array destructuring pattern - Debug.assert(expr.parent.kind === SyntaxKind.ArrayLiteralExpression); + const node = cast(expr.parent, isArrayLiteralExpression); // [{ property1: p1, property2 }] = elems; - const typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); - const elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || errorType, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType; - return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, - (expr.parent).elements.indexOf(expr), elementType || errorType)!; // TODO: GH#18217 + const typeOfArrayLiteral = getTypeOfAssignmentPattern(node) || errorType; + const elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType; + return checkArrayLiteralDestructuringElementAssignment(node, typeOfArrayLiteral, node.elements.indexOf(expr), elementType); } // Gets the property symbol corresponding to the property in destructuring assignment @@ -30022,7 +30025,7 @@ namespace ts { // [a] = [ property1, property2 ] function getPropertySymbolOfDestructuringAssignment(location: Identifier) { // Get the type of the object or array literal and then look for property of given name in the type - const typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); + const typeOfObjectLiteral = getTypeOfAssignmentPattern(cast(location.parent.parent, isAssignmentPattern)); return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.escapedText); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index db1a62937e6..03ca196a860 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3154,6 +3154,7 @@ namespace ts { */ getExportSymbolOfSymbol(symbol: Symbol): Symbol; getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined; + getTypeOfAssignmentPattern(pattern: AssignmentPattern): Type; getTypeAtLocation(node: Node): Type; getTypeFromTypeNode(node: TypeNode): Type; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 4b06bc9e839..d10aa28ffe4 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -1969,6 +1969,7 @@ declare namespace ts { */ getExportSymbolOfSymbol(symbol: Symbol): Symbol; getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined; + getTypeOfAssignmentPattern(pattern: AssignmentPattern): Type; getTypeAtLocation(node: Node): Type; getTypeFromTypeNode(node: TypeNode): Type; signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index f70916a882b..58ccd42344b 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1969,6 +1969,7 @@ declare namespace ts { */ getExportSymbolOfSymbol(symbol: Symbol): Symbol; getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined; + getTypeOfAssignmentPattern(pattern: AssignmentPattern): Type; getTypeAtLocation(node: Node): Type; getTypeFromTypeNode(node: TypeNode): Type; signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; From 57d9ecc39f588917c3c587795dea739f740b066b Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 24 May 2019 15:04:42 -0700 Subject: [PATCH 159/384] Do not log errors when ts server plugin is not found in one folder but is eventually resolved. Fixes #30106 --- src/server/project.ts | 14 +++++++------- tests/baselines/reference/api/tsserverlibrary.d.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/server/project.ts b/src/server/project.ts index c204facad5c..20cd5667dd9 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -198,13 +198,13 @@ namespace ts.server { return hasOneOrMoreJsAndNoTsFiles(this); } - public static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {} | undefined { + public static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void, logErrors?: (message: string) => void): {} | undefined { const resolvedPath = normalizeSlashes(host.resolvePath(combinePaths(initialDir, "node_modules"))); log(`Loading ${moduleName} from ${initialDir} (resolved to ${resolvedPath})`); const result = host.require!(resolvedPath, moduleName); // TODO: GH#18217 if (result.error) { const err = result.error.stack || result.error.message || JSON.stringify(result.error); - log(`Failed to load module '${moduleName}': ${err}`); + (logErrors || log)(`Failed to load module '${moduleName}' from ${resolvedPath}: ${err}`); return undefined; } return result.module; @@ -1142,12 +1142,11 @@ namespace ts.server { protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[], pluginConfigOverrides: Map | undefined) { this.projectService.logger.info(`Enabling plugin ${pluginConfigEntry.name} from candidate paths: ${searchPaths.join(",")}`); - const log = (message: string) => { - this.projectService.logger.info(message); - }; - + const log = (message: string) => this.projectService.logger.info(message); + let errorLogs: string[] | undefined; + const logError = (message: string) => { (errorLogs || (errorLogs = [])).push(message); }; const resolvedModule = firstDefined(searchPaths, searchPath => - Project.resolveModule(pluginConfigEntry.name, searchPath, this.projectService.host, log)); + Project.resolveModule(pluginConfigEntry.name, searchPath, this.projectService.host, log, logError)); if (resolvedModule) { const configurationOverride = pluginConfigOverrides && pluginConfigOverrides.get(pluginConfigEntry.name); if (configurationOverride) { @@ -1160,6 +1159,7 @@ namespace ts.server { this.enableProxy(resolvedModule, pluginConfigEntry); } else { + forEach(errorLogs, log); this.projectService.logger.info(`Couldn't find ${pluginConfigEntry.name}`); } } diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index d10aa28ffe4..993a7494994 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -8321,7 +8321,7 @@ declare namespace ts.server { private readonly cancellationToken; isNonTsProject(): boolean; isJsOnlyProject(): boolean; - static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {} | undefined; + static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void, logErrors?: (message: string) => void): {} | undefined; isKnownTypesPackageName(name: string): boolean; installPackage(options: InstallPackageOptions): Promise; private readonly typingsCache; From fd86f40d05cc6f6abff9c89c5340d3a07941eb6f Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 23 May 2019 09:33:07 -0700 Subject: [PATCH 160/384] Include declarationSpan as relevant declaration span when defintion or other places are declaration name Fixes #30849 --- src/server/protocol.ts | 24 +- src/server/session.ts | 237 ++++++++++-------- src/services/findAllReferences.ts | 116 +++++++-- src/services/goToDefinition.ts | 6 +- src/services/services.ts | 23 +- src/services/types.ts | 8 + .../unittests/tsserver/declarationFileMaps.ts | 195 ++++++++++---- src/testRunner/unittests/tsserver/helpers.ts | 67 ++++- .../unittests/tsserver/projectReferences.ts | 56 +++-- src/testRunner/unittests/tsserver/rename.ts | 107 ++++++-- src/testRunner/unittests/tsserver/symLinks.ts | 18 +- .../reference/api/tsserverlibrary.d.ts | 31 ++- tests/baselines/reference/api/typescript.d.ts | 7 + 13 files changed, 658 insertions(+), 237 deletions(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 486208c2819..37bb8d0c045 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -872,8 +872,16 @@ namespace ts.server.protocol { file: string; } + export interface DeclarationTextSpan extends TextSpan { + declarationStart?: Location; + declarationEnd?: Location; + } + + export interface DeclarationFileSpan extends FileSpan, DeclarationTextSpan { + } + export interface DefinitionInfoAndBoundSpan { - definitions: ReadonlyArray; + definitions: ReadonlyArray; textSpan: TextSpan; } @@ -881,7 +889,7 @@ namespace ts.server.protocol { * Definition response message. Gives text range for definition. */ export interface DefinitionResponse extends Response { - body?: FileSpan[]; + body?: DeclarationFileSpan[]; } export interface DefinitionInfoAndBoundSpanReponse extends Response { @@ -892,14 +900,14 @@ namespace ts.server.protocol { * Definition response message. Gives text range for definition. */ export interface TypeDefinitionResponse extends Response { - body?: FileSpan[]; + body?: DeclarationFileSpan[]; } /** * Implementation response message. Gives text range for implementations. */ export interface ImplementationResponse extends Response { - body?: FileSpan[]; + body?: DeclarationFileSpan[]; } /** @@ -942,7 +950,7 @@ namespace ts.server.protocol { } /** @deprecated */ - export interface OccurrencesResponseItem extends FileSpan { + export interface OccurrencesResponseItem extends DeclarationFileSpan { /** * True if the occurrence is a write location, false otherwise. */ @@ -972,7 +980,7 @@ namespace ts.server.protocol { /** * Span augmented with extra information that denotes the kind of the highlighting to be used for span. */ - export interface HighlightSpan extends TextSpan { + export interface HighlightSpan extends DeclarationTextSpan { kind: HighlightSpanKind; } @@ -1007,7 +1015,7 @@ namespace ts.server.protocol { command: CommandTypes.References; } - export interface ReferencesResponseItem extends FileSpan { + export interface ReferencesResponseItem extends DeclarationFileSpan { /** Text of line containing the reference. Including this * with the response avoids latency of editor loading files * to show text of reference line (the server already has @@ -1150,7 +1158,7 @@ namespace ts.server.protocol { locs: RenameTextSpan[]; } - export interface RenameTextSpan extends TextSpan { + export interface RenameTextSpan extends DeclarationTextSpan { readonly prefixText?: string; readonly suffixText?: string; } diff --git a/src/server/session.ts b/src/server/session.ts index 2e9d6948b1a..118a1d93468 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -354,13 +354,17 @@ namespace ts.server { defaultProject, initialLocation, ({ project, location }, getMappedLocation) => { - for (const outputReferencedSymbol of project.getLanguageService().findReferences(location.fileName, location.pos) || emptyArray) { + for (const outputReferencedSymbol of project.getLanguageService().findReferences(location.fileName, location.pos) || emptyArray) { const mappedDefinitionFile = getMappedLocation(project, documentSpanLocation(outputReferencedSymbol.definition)); - const definition: ReferencedSymbolDefinitionInfo = mappedDefinitionFile === undefined ? outputReferencedSymbol.definition : { - ...outputReferencedSymbol.definition, - textSpan: createTextSpan(mappedDefinitionFile.pos, outputReferencedSymbol.definition.textSpan.length), - fileName: mappedDefinitionFile.fileName, - }; + const definition: ReferencedSymbolDefinitionInfo = mappedDefinitionFile === undefined ? + outputReferencedSymbol.definition : + { + ...outputReferencedSymbol.definition, + textSpan: createTextSpan(mappedDefinitionFile.pos, outputReferencedSymbol.definition.textSpan.length), + fileName: mappedDefinitionFile.fileName, + declarationSpan: getMappedDeclarationSpan(outputReferencedSymbol.definition, project) + }; + let symbolToAddTo = find(outputs, o => documentSpansEqual(o.definition, definition)); if (!symbolToAddTo) { symbolToAddTo = { definition, references: [] }; @@ -481,9 +485,39 @@ namespace ts.server { return { fileName, pos: textSpan.start }; } - function getMappedLocation(location: DocumentPosition, projectService: ProjectService, project: Project): DocumentPosition | undefined { + function getMappedLocation(location: DocumentPosition, project: Project): DocumentPosition | undefined { const mapsTo = project.getSourceMapper().tryGetSourcePosition(location); - return mapsTo && projectService.fileExists(toNormalizedPath(mapsTo.fileName)) ? mapsTo : undefined; + return mapsTo && project.projectService.fileExists(toNormalizedPath(mapsTo.fileName)) ? mapsTo : undefined; + } + + function getMappedDocumentSpan(documentSpan: DocumentSpan, project: Project): DocumentSpan | undefined { + const newPosition = getMappedLocation(documentSpanLocation(documentSpan), project); + if (!newPosition) return undefined; + return { + fileName: newPosition.fileName, + textSpan: { + start: newPosition.pos, + length: documentSpan.textSpan.length + }, + originalFileName: documentSpan.fileName, + originalTextSpan: documentSpan.textSpan, + declarationSpan: getMappedDeclarationSpan(documentSpan, project), + originalDeclarationSpan: documentSpan.declarationSpan + }; + } + + function getMappedDeclarationSpan(documentSpan: DocumentSpan, project: Project): TextSpan | undefined { + const declarationSpanStart = documentSpan.declarationSpan && getMappedLocation( + { fileName: documentSpan.fileName, pos: documentSpan.declarationSpan.start }, + project + ); + const declarationSpanEnd = documentSpan.declarationSpan && getMappedLocation( + { fileName: documentSpan.fileName, pos: documentSpan.declarationSpan.start + documentSpan.declarationSpan.length }, + project + ); + return declarationSpanStart && declarationSpanEnd ? + { start: declarationSpanStart.pos, length: declarationSpanEnd.pos - declarationSpanStart.pos } : + undefined; } export interface SessionOptions { @@ -937,7 +971,7 @@ namespace ts.server { : diagnostics.map(d => formatDiag(file, project, d)); } - private getDefinition(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): ReadonlyArray | ReadonlyArray { + private getDefinition(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): ReadonlyArray | ReadonlyArray { const { file, project } = this.getFileAndProject(args); const position = this.getPositionInFile(args, file); const definitions = this.mapDefinitionInfoLocations(project.getLanguageService().getDefinitionAtPosition(file, position) || emptyArray, project); @@ -946,19 +980,13 @@ namespace ts.server { private mapDefinitionInfoLocations(definitions: ReadonlyArray, project: Project): ReadonlyArray { return definitions.map((info): DefinitionInfo => { - const newLoc = getMappedLocation(documentSpanLocation(info), this.projectService, project); - return !newLoc ? info : { + const newDocumentSpan = getMappedDocumentSpan(info, project); + return !newDocumentSpan ? info : { + ...newDocumentSpan, containerKind: info.containerKind, containerName: info.containerName, - fileName: newLoc.fileName, kind: info.kind, name: info.name, - textSpan: { - start: newLoc.pos, - length: info.textSpan.length - }, - originalFileName: info.fileName, - originalTextSpan: info.textSpan, }; }); } @@ -983,7 +1011,7 @@ namespace ts.server { if (simplifiedResult) { return { definitions: this.mapDefinitionInfo(definitions, project), - textSpan: this.toLocationTextSpan(textSpan, scriptInfo) + textSpan: toProcolTextSpan(textSpan, scriptInfo) }; } @@ -998,8 +1026,8 @@ namespace ts.server { return project.getLanguageService().getEmitOutput(file); } - private mapDefinitionInfo(definitions: ReadonlyArray, project: Project): ReadonlyArray { - return definitions.map(def => this.toFileSpan(def.fileName, def.textSpan, project)); + private mapDefinitionInfo(definitions: ReadonlyArray, project: Project): ReadonlyArray { + return definitions.map(def => this.toDeclarationFileSpan(def.fileName, def.textSpan, def.declarationSpan, project)); } /* @@ -1017,7 +1045,9 @@ namespace ts.server { fileName: def.originalFileName, textSpan: def.originalTextSpan, targetFileName: def.fileName, - targetTextSpan: def.textSpan + targetTextSpan: def.textSpan, + declarationSpan: def.originalDeclarationSpan, + targetDeclarationSpan: def.declarationSpan }; } return def; @@ -1035,7 +1065,18 @@ namespace ts.server { }; } - private getTypeDefinition(args: protocol.FileLocationRequestArgs): ReadonlyArray { + private toDeclarationFileSpan(fileName: string, textSpan: TextSpan, declarationSpan: TextSpan | undefined, project: Project): protocol.DeclarationFileSpan { + const result = this.toFileSpan(fileName, textSpan, project) as protocol.DeclarationFileSpan; + if (declarationSpan) { + const declaration = this.toFileSpan(fileName, declarationSpan, project); + result.declarationStart = declaration.start; + result.declarationEnd = declaration.end; + } + return result; + + } + + private getTypeDefinition(args: protocol.FileLocationRequestArgs): ReadonlyArray { const { file, project } = this.getFileAndProject(args); const position = this.getPositionInFile(args, file); @@ -1045,27 +1086,21 @@ namespace ts.server { private mapImplementationLocations(implementations: ReadonlyArray, project: Project): ReadonlyArray { return implementations.map((info): ImplementationLocation => { - const newLoc = getMappedLocation(documentSpanLocation(info), this.projectService, project); - return !newLoc ? info : { - fileName: newLoc.fileName, + const newDocumentSpan = getMappedDocumentSpan(info, project); + return !newDocumentSpan ? info : { + ...newDocumentSpan, kind: info.kind, displayParts: info.displayParts, - textSpan: { - start: newLoc.pos, - length: info.textSpan.length - }, - originalFileName: info.fileName, - originalTextSpan: info.textSpan, }; }); } - private getImplementation(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): ReadonlyArray | ReadonlyArray { + private getImplementation(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): ReadonlyArray | ReadonlyArray { const { file, project } = this.getFileAndProject(args); const position = this.getPositionInFile(args, file); const implementations = this.mapImplementationLocations(project.getLanguageService().getImplementationAtPosition(file, position) || emptyArray, project); if (simplifiedResult) { - return implementations.map(({ fileName, textSpan }) => this.toFileSpan(fileName, textSpan, project)); + return implementations.map(({ fileName, textSpan, declarationSpan }) => this.toDeclarationFileSpan(fileName, textSpan, declarationSpan, project)); } return implementations.map(Session.mapToOriginalLocation); @@ -1083,14 +1118,11 @@ namespace ts.server { } return occurrences.map(occurrence => { - const { fileName, isWriteAccess, textSpan, isInString } = occurrence; + const { fileName, isWriteAccess, textSpan, isInString, declarationSpan } = occurrence; const scriptInfo = project.getScriptInfo(fileName)!; - const result: protocol.OccurrencesResponseItem = { - start: scriptInfo.positionToLineOffset(textSpan.start), - end: scriptInfo.positionToLineOffset(textSpanEnd(textSpan)), - file: fileName, - isWriteAccess, - }; + const result = toProtocolDeclarationTextSpan(textSpan, declarationSpan, scriptInfo) as protocol.OccurrencesResponseItem; + result.file = fileName; + result.isWriteAccess = isWriteAccess; // no need to serialize the property if it is not true if (isInString) { result.isInString = isInString; @@ -1139,33 +1171,20 @@ namespace ts.server { const position = this.getPositionInFile(args, file); const documentHighlights = project.getLanguageService().getDocumentHighlights(file, position, args.filesToSearch); - if (!documentHighlights) { - return emptyArray; - } - - if (simplifiedResult) { - return documentHighlights.map(convertToDocumentHighlightsItem); - } - else { - return documentHighlights; - } - - function convertToDocumentHighlightsItem(documentHighlights: DocumentHighlights): protocol.DocumentHighlightsItem { - const { fileName, highlightSpans } = documentHighlights; + if (!documentHighlights) return emptyArray; + if (!simplifiedResult) return documentHighlights; + return documentHighlights.map(({ fileName, highlightSpans }) => { const scriptInfo = project.getScriptInfo(fileName)!; return { file: fileName, - highlightSpans: highlightSpans.map(convertHighlightSpan) + highlightSpans: highlightSpans.map(({ textSpan, kind, declarationSpan }) => { + const result = toProtocolDeclarationTextSpan(textSpan, declarationSpan, scriptInfo) as protocol.HighlightSpan; + result.kind = kind; + return result; + }) }; - - function convertHighlightSpan(highlightSpan: HighlightSpan): protocol.HighlightSpan { - const { textSpan, kind } = highlightSpan; - const start = scriptInfo.positionToLineOffset(textSpan.start); - const end = scriptInfo.positionToLineOffset(textSpanEnd(textSpan)); - return { start, end, kind }; - } - } + }); } private setCompilerOptionsForInferredProjects(args: protocol.SetCompilerOptionsForInferredProjectsArgs): void { @@ -1258,7 +1277,7 @@ namespace ts.server { if (info.canRename) { const { canRename, fileToRename, displayName, fullDisplayName, kind, kindModifiers, triggerSpan } = info; return identity( - { canRename, fileToRename, displayName, fullDisplayName, kind, kindModifiers, triggerSpan: this.toLocationTextSpan(triggerSpan, scriptInfo) }); + { canRename, fileToRename, displayName, fullDisplayName, kind, kindModifiers, triggerSpan: toProcolTextSpan(triggerSpan, scriptInfo) }); } else { return info; @@ -1267,11 +1286,11 @@ namespace ts.server { private toSpanGroups(locations: ReadonlyArray): ReadonlyArray { const map = createMap(); - for (const { fileName, textSpan, originalTextSpan: _, originalFileName: _1, ...prefixSuffixText } of locations) { + for (const { fileName, textSpan, declarationSpan, originalDeclarationSpan: _2, originalTextSpan: _, originalFileName: _1, ...prefixSuffixText } of locations) { let group = map.get(fileName); if (!group) map.set(fileName, group = { file: fileName, locs: [] }); const scriptInfo = Debug.assertDefined(this.projectService.getScriptInfo(fileName)); - group.locs.push({ ...this.toLocationTextSpan(textSpan, scriptInfo), ...prefixSuffixText }); + group.locs.push({ ...toProtocolDeclarationTextSpan(textSpan, declarationSpan, scriptInfo), ...prefixSuffixText }); } return arrayFrom(map.values()); } @@ -1286,30 +1305,32 @@ namespace ts.server { { fileName: args.file, pos: position }, ); - if (simplifiedResult) { - const defaultProject = this.getDefaultProject(args); - const scriptInfo = defaultProject.getScriptInfoForNormalizedPath(file)!; - const nameInfo = defaultProject.getLanguageService().getQuickInfoAtPosition(file, position); - const symbolDisplayString = nameInfo ? displayPartsToString(nameInfo.displayParts) : ""; - const nameSpan = nameInfo && nameInfo.textSpan; - const symbolStartOffset = nameSpan ? scriptInfo.positionToLineOffset(nameSpan.start).offset : 0; - const symbolName = nameSpan ? scriptInfo.getSnapshot().getText(nameSpan.start, textSpanEnd(nameSpan)) : ""; - const refs: ReadonlyArray = flatMap(references, referencedSymbol => - referencedSymbol.references.map(({ fileName, textSpan, isWriteAccess, isDefinition }): protocol.ReferencesResponseItem => { - const scriptInfo = Debug.assertDefined(this.projectService.getScriptInfo(fileName)); - const start = scriptInfo.positionToLineOffset(textSpan.start); - const lineSpan = scriptInfo.lineToTextSpan(start.line - 1); - const lineText = scriptInfo.getSnapshot().getText(lineSpan.start, textSpanEnd(lineSpan)).replace(/\r|\n/g, ""); - return { ...toFileSpan(fileName, textSpan, scriptInfo), lineText, isWriteAccess, isDefinition }; - })); - const result: protocol.ReferencesResponseBody = { refs, symbolName, symbolStartOffset, symbolDisplayString }; - return result; - } - else { - return references; - } - } + if (!simplifiedResult) return references; + const defaultProject = this.getDefaultProject(args); + const scriptInfo = defaultProject.getScriptInfoForNormalizedPath(file)!; + const nameInfo = defaultProject.getLanguageService().getQuickInfoAtPosition(file, position); + const symbolDisplayString = nameInfo ? displayPartsToString(nameInfo.displayParts) : ""; + const nameSpan = nameInfo && nameInfo.textSpan; + const symbolStartOffset = nameSpan ? scriptInfo.positionToLineOffset(nameSpan.start).offset : 0; + const symbolName = nameSpan ? scriptInfo.getSnapshot().getText(nameSpan.start, textSpanEnd(nameSpan)) : ""; + const refs: ReadonlyArray = flatMap(references, referencedSymbol => + referencedSymbol.references.map(({ fileName, textSpan, declarationSpan, isWriteAccess, isDefinition }): protocol.ReferencesResponseItem => { + const scriptInfo = Debug.assertDefined(this.projectService.getScriptInfo(fileName)); + const span = toProtocolDeclarationTextSpan(textSpan, declarationSpan, scriptInfo); + const lineSpan = scriptInfo.lineToTextSpan(span.start.line - 1); + const lineText = scriptInfo.getSnapshot().getText(lineSpan.start, textSpanEnd(lineSpan)).replace(/\r|\n/g, ""); + return { + file: fileName, + ...span, + lineText, + isWriteAccess, + isDefinition + }; + })); + const result: protocol.ReferencesResponseBody = { refs, symbolName, symbolStartOffset, symbolDisplayString }; + return result; + } /** * @param fileName is the name of the file to be opened * @param fileContent is a version of the file content that is known to be more up to date than the one on disk @@ -1357,8 +1378,8 @@ namespace ts.server { if (simplifiedResult) { const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!; return spans.map(s => ({ - textSpan: this.toLocationTextSpan(s.textSpan, scriptInfo), - hintSpan: this.toLocationTextSpan(s.hintSpan, scriptInfo), + textSpan: toProcolTextSpan(s.textSpan, scriptInfo), + hintSpan: toProcolTextSpan(s.hintSpan, scriptInfo), bannerText: s.bannerText, autoCollapse: s.autoCollapse, kind: s.kind @@ -1547,7 +1568,7 @@ namespace ts.server { const entries = mapDefined(completions.entries, entry => { if (completions.isMemberCompletion || startsWith(entry.name.toLowerCase(), prefix.toLowerCase())) { const { name, kind, kindModifiers, sortText, insertText, replacementSpan, hasAction, source, isRecommended } = entry; - const convertedSpan = replacementSpan ? this.toLocationTextSpan(replacementSpan, scriptInfo) : undefined; + const convertedSpan = replacementSpan ? toProcolTextSpan(replacementSpan, scriptInfo) : undefined; // Use `hasAction || undefined` to avoid serializing `false`. return { name, kind, kindModifiers, sortText, insertText, replacementSpan: convertedSpan, hasAction: hasAction || undefined, source, isRecommended }; } @@ -1710,7 +1731,7 @@ namespace ts.server { text: item.text, kind: item.kind, kindModifiers: item.kindModifiers, - spans: item.spans.map(span => this.toLocationTextSpan(span, scriptInfo)), + spans: item.spans.map(span => toProcolTextSpan(span, scriptInfo)), childItems: this.mapLocationNavigationBarItems(item.childItems, scriptInfo), indent: item.indent })); @@ -1731,19 +1752,12 @@ namespace ts.server { text: tree.text, kind: tree.kind, kindModifiers: tree.kindModifiers, - spans: tree.spans.map(span => this.toLocationTextSpan(span, scriptInfo)), - nameSpan: tree.nameSpan && this.toLocationTextSpan(tree.nameSpan, scriptInfo), + spans: tree.spans.map(span => toProcolTextSpan(span, scriptInfo)), + nameSpan: tree.nameSpan && toProcolTextSpan(tree.nameSpan, scriptInfo), childItems: map(tree.childItems, item => this.toLocationNavigationTree(item, scriptInfo)) }; } - private toLocationTextSpan(span: TextSpan, scriptInfo: ScriptInfo): protocol.TextSpan { - return { - start: scriptInfo.positionToLineOffset(span.start), - end: scriptInfo.positionToLineOffset(textSpanEnd(span)) - }; - } - private getNavigationTree(args: protocol.FileRequestArgs, simplifiedResult: boolean): protocol.NavigationTree | NavigationTree | undefined { const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args); const tree = languageService.getNavigationTree(file); @@ -2001,7 +2015,7 @@ namespace ts.server { return !spans ? undefined : simplifiedResult - ? spans.map(span => this.toLocationTextSpan(span, scriptInfo)) + ? spans.map(span => toProcolTextSpan(span, scriptInfo)) : spans; } @@ -2073,7 +2087,7 @@ namespace ts.server { private mapSelectionRange(selectionRange: SelectionRange, scriptInfo: ScriptInfo): protocol.SelectionRange { const result: protocol.SelectionRange = { - textSpan: this.toLocationTextSpan(selectionRange.textSpan, scriptInfo), + textSpan: toProcolTextSpan(selectionRange.textSpan, scriptInfo), }; if (selectionRange.parent) { result.parent = this.mapSelectionRange(selectionRange.parent, scriptInfo); @@ -2558,8 +2572,19 @@ namespace ts.server { readonly project: Project; } - function toFileSpan(fileName: string, textSpan: TextSpan, scriptInfo: ScriptInfo): protocol.FileSpan { - return { file: fileName, start: scriptInfo.positionToLineOffset(textSpan.start), end: scriptInfo.positionToLineOffset(textSpanEnd(textSpan)) }; + function toProcolTextSpan(textSpan: TextSpan, scriptInfo: ScriptInfo): protocol.TextSpan { + return { + start: scriptInfo.positionToLineOffset(textSpan.start), + end: scriptInfo.positionToLineOffset(textSpanEnd(textSpan)) + }; + } + + function toProtocolDeclarationTextSpan(span: TextSpan, declarationSpan: TextSpan | undefined, scriptInfo: ScriptInfo): protocol.DeclarationTextSpan { + const result = toProcolTextSpan(span, scriptInfo) as protocol.DeclarationTextSpan; + if (!declarationSpan) return result; + result.declarationStart = scriptInfo.positionToLineOffset(declarationSpan.start); + result.declarationEnd = scriptInfo.positionToLineOffset(textSpanEnd(declarationSpan)); + return result; } function convertTextChangeToCodeEdit(change: TextChange, scriptInfo: ScriptInfoOrConfig): protocol.CodeEdit { diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index cf0046d2688..b29061076ff 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -19,6 +19,7 @@ namespace ts.FindAllReferences { export interface NodeEntry { readonly kind: NodeEntryKind; readonly node: Node; + readonly declaration?: Node; } export interface SpanEntry { readonly kind: EntryKind.Span; @@ -26,7 +27,47 @@ namespace ts.FindAllReferences { readonly textSpan: TextSpan; } export function nodeEntry(node: Node, kind: NodeEntryKind = EntryKind.Node): NodeEntry { - return { kind, node: (node as NamedDeclaration).name || node }; + const declaration = getDeclarationForDeclarationSpan( + isDeclaration(node) ? + node : + node.parent && isDeclaration(node.parent) && node.parent.name === node ? + node.parent : + undefined + ); + return { kind, node: (node as NamedDeclaration).name || node, declaration }; + } + + export function getDeclarationForDeclarationSpan(node: NamedDeclaration | undefined): Node | undefined { + if (!node) return undefined; + switch (node.kind) { + case SyntaxKind.VariableDeclaration: + return !isVariableDeclarationList(node.parent) || node.parent.declarations.length !== 1 ? + node : + isVariableStatement(node.parent.parent) ? + node.parent.parent : + node.parent; + + case SyntaxKind.BindingElement: + return getDeclarationForDeclarationSpan(node.parent.parent as NamedDeclaration); + + case SyntaxKind.ImportSpecifier: + return node.parent.parent.parent; + + case SyntaxKind.ExportSpecifier: + case SyntaxKind.NamespaceImport: + return node.parent.parent; + + case SyntaxKind.ImportClause: + return node.parent; + + // Not really interesting definition + // Should we show whole object literal instead? + case SyntaxKind.ShorthandPropertyAssignment: + return undefined; + + default: + return node; + } } export interface Options { @@ -123,7 +164,16 @@ namespace ts.FindAllReferences { const { symbol } = def; const { displayParts, kind } = getDefinitionKindAndDisplayParts(symbol, checker, originalNode); const name = displayParts.map(p => p.text).join(""); - return { node: symbol.declarations ? getNameOfDeclaration(first(symbol.declarations)) || first(symbol.declarations) : originalNode, name, kind, displayParts }; + const declaration = symbol.declarations ? first(symbol.declarations) : undefined; + return { + node: declaration ? + getNameOfDeclaration(declaration) || declaration : + originalNode, + name, + kind, + displayParts, + declaration: getDeclarationForDeclarationSpan(declaration) + }; } case DefinitionKind.Label: { const { node } = def; @@ -150,9 +200,21 @@ namespace ts.FindAllReferences { } })(); - const { node, name, kind, displayParts } = info; + const { node, name, kind, displayParts, declaration } = info; const sourceFile = node.getSourceFile(); - return { containerKind: ScriptElementKind.unknown, containerName: "", fileName: sourceFile.fileName, kind, name, textSpan: getTextSpan(isComputedPropertyName(node) ? node.expression : node, sourceFile), displayParts }; + const result: ReferencedSymbolDefinitionInfo = { + containerKind: ScriptElementKind.unknown, + containerName: "", + fileName: sourceFile.fileName, + kind, + name, + textSpan: getTextSpan(isComputedPropertyName(node) ? node.expression : node, sourceFile), + displayParts + }; + if (declaration) { + result.declarationSpan = getTextSpan(declaration, sourceFile); + } + return result; } function getDefinitionKindAndDisplayParts(symbol: Symbol, checker: TypeChecker, node: Node): { displayParts: SymbolDisplayPart[], kind: ScriptElementKind } { @@ -168,14 +230,13 @@ namespace ts.FindAllReferences { } export function toReferenceEntry(entry: Entry): ReferenceEntry { - const { textSpan, fileName } = entryToDocumentSpan(entry); + const documentSpan = entryToDocumentSpan(entry); if (entry.kind === EntryKind.Span) { - return { textSpan, fileName, isWriteAccess: false, isDefinition: false }; + return { ...documentSpan, isWriteAccess: false, isDefinition: false }; } const { kind, node } = entry; return { - textSpan, - fileName, + ...documentSpan, isWriteAccess: isWriteAccessForReference(node), isDefinition: node.kind === SyntaxKind.DefaultKeyword || !!getDeclarationFromName(node) @@ -190,7 +251,11 @@ namespace ts.FindAllReferences { } else { const sourceFile = entry.node.getSourceFile(); - return { textSpan: getTextSpan(entry.node, sourceFile), fileName: sourceFile.fileName }; + const result: DocumentSpan = { textSpan: getTextSpan(entry.node, sourceFile), fileName: sourceFile.fileName }; + if (entry.declaration) { + result.declarationSpan = getTextSpan(entry.declaration, sourceFile); + } + return result; } } @@ -223,14 +288,16 @@ namespace ts.FindAllReferences { } function toImplementationLocation(entry: Entry, checker: TypeChecker): ImplementationLocation { + const documentSpan = entryToDocumentSpan(entry); if (entry.kind !== EntryKind.Span) { const { node } = entry; - const sourceFile = node.getSourceFile(); - return { textSpan: getTextSpan(node, sourceFile), fileName: sourceFile.fileName, ...implementationKindDisplayParts(node, checker) }; + return { + ...documentSpan, + ...implementationKindDisplayParts(node, checker) + }; } else { - const { textSpan, fileName } = entry; - return { textSpan, fileName, kind: ScriptElementKind.unknown, displayParts: [] }; + return { ...documentSpan, kind: ScriptElementKind.unknown, displayParts: [] }; } } @@ -257,20 +324,27 @@ namespace ts.FindAllReferences { } export function toHighlightSpan(entry: Entry): { fileName: string, span: HighlightSpan } { + const documentSpan = entryToDocumentSpan(entry); if (entry.kind === EntryKind.Span) { - const { fileName, textSpan } = entry; - return { fileName, span: { textSpan, kind: HighlightSpanKind.reference } }; + return { + fileName: documentSpan.fileName, + span: { + textSpan: documentSpan.textSpan, + kind: HighlightSpanKind.reference + } + }; } - const { node, kind } = entry; - const sourceFile = node.getSourceFile(); - const writeAccess = isWriteAccessForReference(node); + const writeAccess = isWriteAccessForReference(entry.node); const span: HighlightSpan = { - textSpan: getTextSpan(node, sourceFile), + textSpan: documentSpan.textSpan, kind: writeAccess ? HighlightSpanKind.writtenReference : HighlightSpanKind.reference, - isInString: kind === EntryKind.StringLiteral ? true : undefined, + isInString: entry.kind === EntryKind.StringLiteral ? true : undefined, }; - return { fileName: sourceFile.fileName, span }; + if (documentSpan.declarationSpan) { + span.declarationSpan = documentSpan.declarationSpan; + } + return { fileName: documentSpan.fileName, span }; } function getTextSpan(node: Node, sourceFile: SourceFile): TextSpan { diff --git a/src/services/goToDefinition.ts b/src/services/goToDefinition.ts index 8f495aadfe1..7a04184c5d9 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -279,7 +279,11 @@ namespace ts.GoToDefinition { kind: symbolKind, name: symbolName, containerKind: undefined!, // TODO: GH#18217 - containerName + containerName, + declarationSpan: createTextSpanFromNode( + FindAllReferences.getDeclarationForDeclarationSpan(declaration)!, + sourceFile + ) }; } diff --git a/src/services/services.ts b/src/services/services.ts index 6c882bbb28f..cae6ce7ac47 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1544,13 +1544,22 @@ namespace ts { /// References and Occurrences function getOccurrencesAtPosition(fileName: string, position: number): ReadonlyArray | undefined { - return flatMap(getDocumentHighlights(fileName, position, [fileName]), entry => entry.highlightSpans.map(highlightSpan => ({ - fileName: entry.fileName, - textSpan: highlightSpan.textSpan, - isWriteAccess: highlightSpan.kind === HighlightSpanKind.writtenReference, - isDefinition: false, - isInString: highlightSpan.isInString, - }))); + return flatMap( + getDocumentHighlights(fileName, position, [fileName]), + entry => entry.highlightSpans.map(highlightSpan => { + const result: ReferenceEntry = { + fileName: entry.fileName, + textSpan: highlightSpan.textSpan, + isWriteAccess: highlightSpan.kind === HighlightSpanKind.writtenReference, + isDefinition: false, + isInString: highlightSpan.isInString, + }; + if (highlightSpan.declarationSpan) { + result.declarationSpan = highlightSpan.declarationSpan; + } + return result; + }) + ); } function getDocumentHighlights(fileName: string, position: number, filesToSearch: ReadonlyArray): DocumentHighlights[] | undefined { diff --git a/src/services/types.ts b/src/services/types.ts index 8dee6c4f053..8a185cddced 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -613,6 +613,13 @@ namespace ts { */ originalTextSpan?: TextSpan; originalFileName?: string; + + /** + * If DocumentSpan.textSpan is the span for name of the declaration, + * then this is the span for relevant declaration + */ + declarationSpan?: TextSpan; + originalDeclarationSpan?: TextSpan; } export interface RenameLocation extends DocumentSpan { @@ -647,6 +654,7 @@ namespace ts { fileName?: string; isInString?: true; textSpan: TextSpan; + declarationSpan?: TextSpan; kind: HighlightSpanKind; } diff --git a/src/testRunner/unittests/tsserver/declarationFileMaps.ts b/src/testRunner/unittests/tsserver/declarationFileMaps.ts index 200d7af0240..1ab0928630c 100644 --- a/src/testRunner/unittests/tsserver/declarationFileMaps.ts +++ b/src/testRunner/unittests/tsserver/declarationFileMaps.ts @@ -1,28 +1,43 @@ namespace ts.projectSystem { - function protocolFileSpanFromSubstring(file: File, substring: string, options?: SpanFromSubstringOptions): protocol.FileSpan { - return { file: file.path, ...protocolTextSpanFromSubstring(file.content, substring, options) }; + interface DocumentSpanFromSubstring { + file: File; + text: string; + options?: SpanFromSubstringOptions; + declarationText?: string; + declarationOptions?: SpanFromSubstringOptions; + } + function documentSpanFromSubstring({ file, text, declarationText, options, declarationOptions }: DocumentSpanFromSubstring): DocumentSpan { + const result: DocumentSpan = { fileName: file.path, textSpan: textSpanFromSubstring(file.content, text, options) }; + if (declarationText) { + const declarationSpan = documentSpanFromSubstring({ file, text: declarationText, options: declarationOptions }); + result.declarationSpan = declarationSpan.textSpan; + } + return result; } - function documentSpanFromSubstring(file: File, substring: string, options?: SpanFromSubstringOptions): DocumentSpan { - return { fileName: file.path, textSpan: textSpanFromSubstring(file.content, substring, options) }; + function renameLocation(input: DocumentSpanFromSubstring): RenameLocation { + return documentSpanFromSubstring(input); } - function renameLocation(file: File, substring: string, options?: SpanFromSubstringOptions): RenameLocation { - return documentSpanFromSubstring(file, substring, options); + interface MakeReferenceItem extends DocumentSpanFromSubstring { + isDefinition: boolean; + lineText: string; } - - function makeReferenceItem(file: File, isDefinition: boolean, text: string, lineText: string, options?: SpanFromSubstringOptions): protocol.ReferencesResponseItem { + function makeReferenceItem({ isDefinition, lineText, ...rest }: MakeReferenceItem): protocol.ReferencesResponseItem { return { - ...protocolFileSpanFromSubstring(file, text, options), + ...protocolDeclarationFileSpanFromSubstring(rest), isDefinition, isWriteAccess: isDefinition, lineText, }; } - function makeReferenceEntry(file: File, isDefinition: boolean, text: string, options?: SpanFromSubstringOptions): ReferenceEntry { + interface MakeReferenceEntry extends DocumentSpanFromSubstring { + isDefinition: boolean; + } + function makeReferenceEntry({ isDefinition, ...rest }: MakeReferenceEntry): ReferenceEntry { return { - ...documentSpanFromSubstring(file, text, options), + ...documentSpanFromSubstring(rest), isDefinition, isWriteAccess: isDefinition, isInString: undefined, @@ -190,7 +205,13 @@ namespace ts.projectSystem { it("goToDefinition", () => { const session = makeSampleProjects(); const response = executeSessionRequest(session, protocol.CommandTypes.Definition, protocolFileLocationFromSubstring(userTs, "fnA()")); - assert.deepEqual(response, [protocolFileSpanFromSubstring(aTs, "fnA")]); + assert.deepEqual(response, [ + protocolDeclarationFileSpanFromSubstring({ + file: aTs, + text: "fnA", + declarationText: "export function fnA() {}" + }) + ]); verifySingleInferredProject(session); }); @@ -199,7 +220,13 @@ namespace ts.projectSystem { const response = executeSessionRequest(session, protocol.CommandTypes.DefinitionAndBoundSpan, protocolFileLocationFromSubstring(userTs, "fnA()")); assert.deepEqual(response, { textSpan: protocolTextSpanFromSubstring(userTs.content, "fnA"), - definitions: [protocolFileSpanFromSubstring(aTs, "fnA")], + definitions: [ + protocolDeclarationFileSpanFromSubstring({ + file: aTs, + text: "fnA", + declarationText: "export function fnA() {}" + }) + ], }); verifySingleInferredProject(session); }); @@ -209,7 +236,13 @@ namespace ts.projectSystem { const response = executeSessionRequest(session, protocol.CommandTypes.DefinitionAndBoundSpan, protocolFileLocationFromSubstring(userTs, "fnA()")); assert.deepEqual(response, { textSpan: protocolTextSpanFromSubstring(userTs.content, "fnA"), - definitions: [protocolFileSpanFromSubstring(aTs, "fnA")], + definitions: [ + protocolDeclarationFileSpanFromSubstring({ + file: aTs, + text: "fnA", + declarationText: "export function fnA() {}" + }) + ], }); checkNumberOfProjects(session.getProjectService(), { configuredProjects: 1 }); verifyUserTsConfigProject(session); @@ -230,14 +263,25 @@ namespace ts.projectSystem { it("goToType", () => { const session = makeSampleProjects(); const response = executeSessionRequest(session, protocol.CommandTypes.TypeDefinition, protocolFileLocationFromSubstring(userTs, "instanceA")); - assert.deepEqual(response, [protocolFileSpanFromSubstring(aTs, "IfaceA")]); + assert.deepEqual(response, [ + protocolDeclarationFileSpanFromSubstring({ + file: aTs, + text: "IfaceA", + declarationText: "export interface IfaceA {}" + }) + ]); verifySingleInferredProject(session); }); it("goToImplementation", () => { const session = makeSampleProjects(); const response = executeSessionRequest(session, protocol.CommandTypes.Implementation, protocolFileLocationFromSubstring(userTs, "fnA()")); - assert.deepEqual(response, [protocolFileSpanFromSubstring(aTs, "fnA")]); + assert.deepEqual(response, [ + protocolDeclarationFileSpanFromSubstring({ + file: aTs, + text: "fnA", + declarationText: "export function fnA() {}" + })]); verifySingleInferredProject(session); }); @@ -245,7 +289,13 @@ namespace ts.projectSystem { const session = makeSampleProjects(); const response = executeSessionRequest(session, CommandNames.Definition, protocolFileLocationFromSubstring(userTs, "fnB()")); // bTs does not exist, so stick with bDts - assert.deepEqual(response, [protocolFileSpanFromSubstring(bDts, "fnB")]); + assert.deepEqual(response, [ + protocolDeclarationFileSpanFromSubstring({ + file: bDts, + text: "fnB", + declarationText: "export declare function fnB(): void;" + }) + ]); verifySingleInferredProject(session); }); @@ -254,7 +304,10 @@ namespace ts.projectSystem { const response = executeSessionRequest(session, CommandNames.Navto, { file: userTs.path, searchValue: "fn" }); assert.deepEqual | undefined>(response, [ { - ...protocolFileSpanFromSubstring(bDts, "export declare function fnB(): void;"), + ...protocolFileSpanFromSubstring({ + file: bDts, + text: "export declare function fnB(): void;" + }), name: "fnB", matchKind: "prefix", isCaseSensitive: true, @@ -262,7 +315,10 @@ namespace ts.projectSystem { kindModifiers: "export,declare", }, { - ...protocolFileSpanFromSubstring(userTs, "export function fnUser() { a.fnA(); b.fnB(); a.instanceA; }"), + ...protocolFileSpanFromSubstring({ + file: userTs, + text: "export function fnUser() { a.fnA(); b.fnB(); a.instanceA; }" + }), name: "fnUser", matchKind: "prefix", isCaseSensitive: true, @@ -270,7 +326,10 @@ namespace ts.projectSystem { kindModifiers: "export", }, { - ...protocolFileSpanFromSubstring(aTs, "export function fnA() {}"), + ...protocolFileSpanFromSubstring({ + file: aTs, + text: "export function fnA() {}" + }), name: "fnA", matchKind: "prefix", isCaseSensitive: true, @@ -282,9 +341,20 @@ namespace ts.projectSystem { verifyATsConfigOriginalProject(session); }); - const referenceATs = (aTs: File): protocol.ReferencesResponseItem => makeReferenceItem(aTs, /*isDefinition*/ true, "fnA", "export function fnA() {}"); + const referenceATs = (aTs: File): protocol.ReferencesResponseItem => makeReferenceItem({ + file: aTs, + isDefinition: true, + text: "fnA", + declarationText: "export function fnA() {}", + lineText: "export function fnA() {}" + }); const referencesUserTs = (userTs: File): ReadonlyArray => [ - makeReferenceItem(userTs, /*isDefinition*/ false, "fnA", "export function fnUser() { a.fnA(); b.fnB(); a.instanceA; }"), + makeReferenceItem({ + file: userTs, + isDefinition: false, + text: "fnA", + lineText: "export function fnUser() { a.fnA(); b.fnB(); a.instanceA; }" + }), ]; it("findAllReferences", () => { @@ -325,7 +395,11 @@ namespace ts.projectSystem { assert.deepEqual>(responseFull, [ { definition: { - ...documentSpanFromSubstring(aTs, "fnA"), + ...documentSpanFromSubstring({ + file: aTs, + text: "fnA", + declarationText: "export function fnA() {}" + }), kind: ScriptElementKind.functionElement, name: "function fnA(): void", containerKind: ScriptElementKind.unknown, @@ -342,8 +416,8 @@ namespace ts.projectSystem { ], }, references: [ - makeReferenceEntry(userTs, /*isDefinition*/ false, "fnA"), - makeReferenceEntry(aTs, /*isDefinition*/ true, "fnA"), + makeReferenceEntry({ file: userTs, /*isDefinition*/ isDefinition: false, text: "fnA" }), + makeReferenceEntry({ file: aTs, /*isDefinition*/ isDefinition: true, text: "fnA", declarationText: "export function fnA() {}" }), ], }, ]); @@ -374,6 +448,12 @@ namespace ts.projectSystem { assert.deepEqual>(responseFull, [ { definition: { + ...documentSpanFromSubstring({ + file: aTs, + text: "f", + options: { index: 1 }, + declarationText: "function f() {}" + }), containerKind: ScriptElementKind.unknown, containerName: "", displayParts: [ @@ -386,10 +466,8 @@ namespace ts.projectSystem { spacePart(), keywordPart(SyntaxKind.VoidKeyword), ], - fileName: aTs.path, kind: ScriptElementKind.functionElement, name: "function f(): void", - textSpan: { start: 9, length: 1 }, }, references: [ { @@ -399,13 +477,13 @@ namespace ts.projectSystem { isWriteAccess: false, textSpan: { start: 0, length: 1 }, }, - { - fileName: aTs.path, - isDefinition: true, - isInString: undefined, - isWriteAccess: true, - textSpan: { start: 9, length: 1 }, - }, + makeReferenceEntry({ + file: aTs, + text: "f", + options: { index: 1 }, + declarationText: "function f() {}", + isDefinition: true + }) ], } ]); @@ -417,8 +495,19 @@ namespace ts.projectSystem { const response = executeSessionRequest(session, protocol.CommandTypes.References, protocolFileLocationFromSubstring(userTs, "fnB()")); assert.deepEqual(response, { refs: [ - makeReferenceItem(bDts, /*isDefinition*/ true, "fnB", "export declare function fnB(): void;"), - makeReferenceItem(userTs, /*isDefinition*/ false, "fnB", "export function fnUser() { a.fnA(); b.fnB(); a.instanceA; }"), + makeReferenceItem({ + file: bDts, + isDefinition: true, + text: "fnB", + declarationText: "export declare function fnB(): void;", + lineText: "export declare function fnB(): void;" + }), + makeReferenceItem({ + file: userTs, + isDefinition: false, + text: "fnB", + lineText: "export function fnUser() { a.fnA(); b.fnB(); a.instanceA; }" + }), ], symbolName: "fnB", symbolStartOffset: protocolLocationFromSubstring(userTs.content, "fnB()").offset, @@ -429,11 +518,22 @@ namespace ts.projectSystem { const renameATs = (aTs: File): protocol.SpanGroup => ({ file: aTs.path, - locs: [protocolRenameSpanFromSubstring(aTs.content, "fnA")], + locs: [ + protocolRenameSpanFromSubstring({ + fileText: aTs.content, + text: "fnA", + declarationText: "export function fnA() {}" + }) + ], }); const renameUserTs = (userTs: File): protocol.SpanGroup => ({ file: userTs.path, - locs: [protocolRenameSpanFromSubstring(userTs.content, "fnA")], + locs: [ + protocolRenameSpanFromSubstring({ + fileText: userTs.content, + text: "fnA" + }) + ], }); it("renameLocations", () => { @@ -477,8 +577,8 @@ namespace ts.projectSystem { const session = makeSampleProjects(); const response = executeSessionRequest(session, protocol.CommandTypes.RenameLocationsFull, protocolFileLocationFromSubstring(userTs, "fnA()")); assert.deepEqual>(response, [ - renameLocation(userTs, "fnA"), - renameLocation(aTs, "fnA"), + renameLocation({ file: userTs, text: "fnA" }), + renameLocation({ file: aTs, text: "fnA", declarationText: "export function fnA() {}" }), ]); verifyATsConfigOriginalProject(session); }); @@ -499,11 +599,22 @@ namespace ts.projectSystem { locs: [ { file: bDts.path, - locs: [protocolRenameSpanFromSubstring(bDts.content, "fnB")], + locs: [ + protocolRenameSpanFromSubstring({ + fileText: bDts.content, + text: "fnB", + declarationText: "export declare function fnB(): void;" + }) + ], }, { file: userTs.path, - locs: [protocolRenameSpanFromSubstring(userTs.content, "fnB")], + locs: [ + protocolRenameSpanFromSubstring({ + fileText: userTs.content, + text: "fnB" + }) + ], }, ], }); diff --git a/src/testRunner/unittests/tsserver/helpers.ts b/src/testRunner/unittests/tsserver/helpers.ts index 3cd1d605996..e9c06a7e859 100644 --- a/src/testRunner/unittests/tsserver/helpers.ts +++ b/src/testRunner/unittests/tsserver/helpers.ts @@ -505,13 +505,66 @@ namespace ts.projectSystem { return { start: toLocation(span.start), end: toLocation(textSpanEnd(span)) }; } - export function protocolRenameSpanFromSubstring( - str: string, - substring: string, - options?: SpanFromSubstringOptions, - prefixSuffixText?: { readonly prefixText?: string, readonly suffixText?: string }, - ): protocol.RenameTextSpan { - return { ...protocolTextSpanFromSubstring(str, substring, options), ...prefixSuffixText }; + export interface DocumentSpanFromSubstring { + file: File; + text: string; + options?: SpanFromSubstringOptions; + } + export function protocolFileSpanFromSubstring({ file, text, options }: DocumentSpanFromSubstring): protocol.FileSpan { + return { file: file.path, ...protocolTextSpanFromSubstring(file.content, text, options) }; + } + + interface DeclarationFileSpanFromSubString { + file: File; + text: string; + options?: SpanFromSubstringOptions; + declarationText?: string; + declarationOptions?: SpanFromSubstringOptions; + } + export function protocolDeclarationFileSpanFromSubstring({ declarationText, declarationOptions, ...rest }: DeclarationFileSpanFromSubString): protocol.DeclarationFileSpan { + const result = protocolFileSpanFromSubstring(rest); + if (!declarationText) return result; + const declarationSpan = protocolFileSpanFromSubstring({ file: rest.file, text: declarationText, options: declarationOptions }); + return { + ...result, + declarationStart: declarationSpan.start, + declarationEnd: declarationSpan.end + }; + } + + export interface ProtocolDeclarationTextSpanFromString { + fileText: string; + text: string; + options?: SpanFromSubstringOptions; + declarationText?: string; + declarationOptions?: SpanFromSubstringOptions; + } + export function protocolDeclarationTextSpanFromSubstring({ fileText, text, options, declarationText, declarationOptions }: ProtocolDeclarationTextSpanFromString): protocol.DeclarationTextSpan { + const span = textSpanFromSubstring(fileText, text, options); + const toLocation = protocolToLocation(fileText); + const result: protocol.DeclarationTextSpan = { + start: toLocation(span.start), + end: toLocation(textSpanEnd(span)) + }; + if (declarationText) { + const span = textSpanFromSubstring(fileText, declarationText, declarationOptions); + result.declarationStart = toLocation(span.start); + result.declarationEnd = toLocation(textSpanEnd(span)); + } + return result; + } + + export interface ProtocolRenameSpanFromSubstring extends ProtocolDeclarationTextSpanFromString { + prefixSuffixText?: { + readonly prefixText?: string; + readonly suffixText?: string; + }; + } + export function protocolRenameSpanFromSubstring({ prefixSuffixText, ...rest }: ProtocolRenameSpanFromSubstring): protocol.RenameTextSpan { + return { + ...protocolDeclarationTextSpanFromSubstring(rest), + ...prefixSuffixText + }; } export function textSpanFromSubstring(str: string, substring: string, options?: SpanFromSubstringOptions): TextSpan { diff --git a/src/testRunner/unittests/tsserver/projectReferences.ts b/src/testRunner/unittests/tsserver/projectReferences.ts index e39c510216d..af6e9d7281e 100644 --- a/src/testRunner/unittests/tsserver/projectReferences.ts +++ b/src/testRunner/unittests/tsserver/projectReferences.ts @@ -69,21 +69,24 @@ namespace ts.projectSystem { openFilesForSession([containerCompositeExec[1]], session); const service = session.getProjectService(); checkNumberOfProjects(service, { configuredProjects: 1 }); - const locationOfMyConst = protocolLocationFromSubstring(containerCompositeExec[1].content, "myConst"); + const { file: myConstFile, start: myConstStart, end: myConstEnd } = protocolFileSpanFromSubstring({ + file: containerCompositeExec[1], + text: "myConst", + }); const response = session.executeCommandSeq({ command: protocol.CommandTypes.Rename, - arguments: { - file: containerCompositeExec[1].path, - ...locationOfMyConst - } + arguments: { file: myConstFile, ...myConstStart } }).response as protocol.RenameResponseBody; - - const myConstLen = "myConst".length; - const locationOfMyConstInLib = protocolLocationFromSubstring(containerLib[1].content, "myConst"); + const locationOfMyConstInLib = protocolDeclarationFileSpanFromSubstring({ + file: containerLib[1], + text: "myConst", + declarationText: "export const myConst = 30;" + }); + const { file: _, ...renameTextOfMyConstInLib } = locationOfMyConstInLib; assert.deepEqual(response.locs, [ - { file: containerCompositeExec[1].path, locs: [{ start: locationOfMyConst, end: { line: locationOfMyConst.line, offset: locationOfMyConst.offset + myConstLen } }] }, - { file: containerLib[1].path, locs: [{ start: locationOfMyConstInLib, end: { line: locationOfMyConstInLib.line, offset: locationOfMyConstInLib.offset + myConstLen } }] } + { file: myConstFile, locs: [{ start: myConstStart, end: myConstEnd }] }, + { file: locationOfMyConstInLib.file, locs: [renameTextOfMyConstInLib] } ]); }); }); @@ -169,7 +172,7 @@ fn5(); } function gotoDefintinionFromMainTs(fn: number): SessionAction { const textSpan = usageSpan(fn); - const definition: protocol.FileSpan = { file: dependencyTs.path, ...definitionSpan(fn) }; + const definition: protocol.FileSpan = { file: dependencyTs.path, ...declarationSpan(fn) }; const declareSpaceLength = "declare ".length; return { reqName: "goToDef", @@ -184,7 +187,13 @@ fn5(); }, expectedResponseNoMap: { // To the dts - definitions: [{ file: dtsPath, start: { line: fn, offset: definition.start.offset + declareSpaceLength }, end: { line: fn, offset: definition.end.offset + declareSpaceLength } }], + definitions: [{ + file: dtsPath, + start: { line: fn, offset: definition.start.offset + declareSpaceLength }, + end: { line: fn, offset: definition.end.offset + declareSpaceLength }, + declarationStart: { line: fn, offset: 1 }, + declarationEnd: { line: fn, offset: 37 } + }], textSpan }, expectedResponseNoDts: { @@ -195,18 +204,29 @@ fn5(); }; } - function definitionSpan(fn: number): protocol.TextSpan { - return { start: { line: fn, offset: 17 }, end: { line: fn, offset: 20 } }; + function declarationSpan(fn: number): protocol.DeclarationTextSpan { + return { + start: { line: fn, offset: 17 }, + end: { line: fn, offset: 20 }, + declarationStart: { line: fn, offset: 1 }, + declarationEnd: { line: fn, offset: 26 } + }; } - function importSpan(fn: number): protocol.TextSpan { - return { start: { line: fn + 1, offset: 5 }, end: { line: fn + 1, offset: 8 } }; + function importSpan(fn: number): protocol.DeclarationTextSpan { + return { + start: { line: fn + 1, offset: 5 }, + end: { line: fn + 1, offset: 8 }, + declarationStart: { line: 1, offset: 1 }, + declarationEnd: { line: 7, offset: 27 } + }; } function usageSpan(fn: number): protocol.TextSpan { return { start: { line: fn + 8, offset: 1 }, end: { line: fn + 8, offset: 4 } }; } function renameFromDependencyTs(fn: number): SessionAction { - const triggerSpan = definitionSpan(fn); + const defSpan = declarationSpan(fn); + const { declarationStart: _, declarationEnd: _1, ...triggerSpan } = defSpan; return { reqName: "rename", request: { @@ -224,7 +244,7 @@ fn5(); triggerSpan }, locs: [ - { file: dependencyTs.path, locs: [triggerSpan] } + { file: dependencyTs.path, locs: [defSpan] } ] } }; diff --git a/src/testRunner/unittests/tsserver/rename.ts b/src/testRunner/unittests/tsserver/rename.ts index f565524aded..67464499a5b 100644 --- a/src/testRunner/unittests/tsserver/rename.ts +++ b/src/testRunner/unittests/tsserver/rename.ts @@ -14,7 +14,15 @@ namespace ts.projectSystem { canRename: false, localizedErrorMessage: "You cannot rename this element." }, - locs: [{ file: bTs.path, locs: [protocolRenameSpanFromSubstring(bTs.content, "./a")] }], + locs: [{ + file: bTs.path, + locs: [ + protocolRenameSpanFromSubstring({ + fileText: bTs.content, + text: "./a" + }) + ] + }], }); // rename succeeds with allowRenameOfImportPath enabled in host @@ -30,7 +38,15 @@ namespace ts.projectSystem { kindModifiers: "", triggerSpan: protocolTextSpanFromSubstring(bTs.content, "a", { index: 1 }), }, - locs: [{ file: bTs.path, locs: [protocolRenameSpanFromSubstring(bTs.content, "./a")] }], + locs: [{ + file: bTs.path, + locs: [ + protocolRenameSpanFromSubstring({ + fileText: bTs.content, + text: "./a" + }) + ] + }], }); // rename succeeds with allowRenameOfImportPath enabled in file @@ -47,7 +63,15 @@ namespace ts.projectSystem { kindModifiers: "", triggerSpan: protocolTextSpanFromSubstring(bTs.content, "a", { index: 1 }), }, - locs: [{ file: bTs.path, locs: [protocolRenameSpanFromSubstring(bTs.content, "./a")] }], + locs: [{ + file: bTs.path, + locs: [ + protocolRenameSpanFromSubstring({ + fileText: bTs.content, + text: "./a" + }) + ] + }], }); }); @@ -73,8 +97,16 @@ namespace ts.projectSystem { { file: aTs.path, locs: [ - protocolRenameSpanFromSubstring(aTs.content, "x"), - protocolRenameSpanFromSubstring(aTs.content, "x", { index: 1 }), + protocolRenameSpanFromSubstring({ + fileText: aTs.content, + text: "x", + declarationText: "const x = 0;" + }), + protocolRenameSpanFromSubstring({ + fileText: aTs.content, + text: "x", + options: { index: 1 } + }), ], }, ], @@ -97,8 +129,17 @@ namespace ts.projectSystem { { file: aTs.path, locs: [ - protocolRenameSpanFromSubstring(aTs.content, "x"), - protocolRenameSpanFromSubstring(aTs.content, "x", { index: 1 }, { prefixText: "x: " }), + protocolRenameSpanFromSubstring({ + fileText: aTs.content, + text: "x", + declarationText: "const x = 0;" + }), + protocolRenameSpanFromSubstring({ + fileText: aTs.content, + text: "x", + options: { index: 1 }, + prefixSuffixText: { prefixText: "x: " } + }), ], }, ], @@ -122,8 +163,17 @@ namespace ts.projectSystem { { file: aTs.path, locs: [ - protocolRenameSpanFromSubstring(aTs.content, "x"), - protocolRenameSpanFromSubstring(aTs.content, "x", { index: 1 }, { prefixText: "x: " }), + protocolRenameSpanFromSubstring({ + fileText: aTs.content, + text: "x", + declarationText: "const x = 0;" + }), + protocolRenameSpanFromSubstring({ + fileText: aTs.content, + text: "x", + options: { index: 1 }, + prefixSuffixText: { prefixText: "x: " } + }), ], }, ], @@ -154,8 +204,18 @@ namespace ts.projectSystem { { file: aTs.path, locs: [ - protocolRenameSpanFromSubstring(aTs.content, "x"), - protocolRenameSpanFromSubstring(aTs.content, "x", { index: 2 }, { suffixText: " as x" }), + protocolRenameSpanFromSubstring({ + fileText: aTs.content, + text: "x", + declarationText: "const x = 1;" + }), + protocolRenameSpanFromSubstring({ + fileText: aTs.content, + text: "x", + options: { index: 2 }, + declarationText: "export { x };", + prefixSuffixText: { suffixText: " as x" } + }), ], }, ], @@ -177,15 +237,32 @@ namespace ts.projectSystem { { file: bTs.path, locs: [ - protocolRenameSpanFromSubstring(bTs.content, "x"), - protocolRenameSpanFromSubstring(bTs.content, "x", { index: 1 }) + protocolRenameSpanFromSubstring({ + fileText: bTs.content, + text: "x", + declarationText: `import { x } from "./a";` + }), + protocolRenameSpanFromSubstring({ + fileText: bTs.content, + text: "x", + options: { index: 1 }, + }) ] }, { file: aTs.path, locs: [ - protocolRenameSpanFromSubstring(aTs.content, "x"), - protocolRenameSpanFromSubstring(aTs.content, "x", { index: 2 }), + protocolRenameSpanFromSubstring({ + fileText: aTs.content, + text: "x", + declarationText: "const x = 1;" + }), + protocolRenameSpanFromSubstring({ + fileText: aTs.content, + text: "x", + options: { index: 2 }, + declarationText: "export { x };", + }), ], }, ], diff --git a/src/testRunner/unittests/tsserver/symLinks.ts b/src/testRunner/unittests/tsserver/symLinks.ts index e331c94ca1a..1297b8ee0ac 100644 --- a/src/testRunner/unittests/tsserver/symLinks.ts +++ b/src/testRunner/unittests/tsserver/symLinks.ts @@ -58,10 +58,22 @@ namespace ts.projectSystem { assert.equal(aFile.content, bFile.content); const abLocs: protocol.RenameTextSpan[] = [ - protocolRenameSpanFromSubstring(aFile.content, "C"), - protocolRenameSpanFromSubstring(aFile.content, "C", { index: 1 }), + protocolRenameSpanFromSubstring({ + fileText: aFile.content, + text: "C", + declarationText: `import {C} from "./c/fc";` + }), + protocolRenameSpanFromSubstring({ + fileText: aFile.content, + text: "C", + options: { index: 1 } + }), ]; - const span = protocolRenameSpanFromSubstring(cFile.content, "C"); + const span = protocolRenameSpanFromSubstring({ + fileText: cFile.content, + text: "C", + declarationText: "export const C = 8" + }); const cLocs: protocol.RenameTextSpan[] = [span]; assert.deepEqual(response, { info: { diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 4b06bc9e839..d2db2d24b0d 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -5070,6 +5070,12 @@ declare namespace ts { */ originalTextSpan?: TextSpan; originalFileName?: string; + /** + * If DocumentSpan.textSpan is the span for name of the declaration, + * then this is the span for relevant declaration + */ + declarationSpan?: TextSpan; + originalDeclarationSpan?: TextSpan; } interface RenameLocation extends DocumentSpan { readonly prefixText?: string; @@ -5098,6 +5104,7 @@ declare namespace ts { fileName?: string; isInString?: true; textSpan: TextSpan; + declarationSpan?: TextSpan; kind: HighlightSpanKind; } interface NavigateToItem { @@ -6391,15 +6398,21 @@ declare namespace ts.server.protocol { */ file: string; } + interface DeclarationTextSpan extends TextSpan { + declarationStart?: Location; + declarationEnd?: Location; + } + interface DeclarationFileSpan extends FileSpan, DeclarationTextSpan { + } interface DefinitionInfoAndBoundSpan { - definitions: ReadonlyArray; + definitions: ReadonlyArray; textSpan: TextSpan; } /** * Definition response message. Gives text range for definition. */ interface DefinitionResponse extends Response { - body?: FileSpan[]; + body?: DeclarationFileSpan[]; } interface DefinitionInfoAndBoundSpanReponse extends Response { body?: DefinitionInfoAndBoundSpan; @@ -6408,13 +6421,13 @@ declare namespace ts.server.protocol { * Definition response message. Gives text range for definition. */ interface TypeDefinitionResponse extends Response { - body?: FileSpan[]; + body?: DeclarationFileSpan[]; } /** * Implementation response message. Gives text range for implementations. */ interface ImplementationResponse extends Response { - body?: FileSpan[]; + body?: DeclarationFileSpan[]; } /** * Request to get brace completion for a location in the file. @@ -6451,7 +6464,7 @@ declare namespace ts.server.protocol { command: CommandTypes.Occurrences; } /** @deprecated */ - interface OccurrencesResponseItem extends FileSpan { + interface OccurrencesResponseItem extends DeclarationFileSpan { /** * True if the occurrence is a write location, false otherwise. */ @@ -6477,7 +6490,7 @@ declare namespace ts.server.protocol { /** * Span augmented with extra information that denotes the kind of the highlighting to be used for span. */ - interface HighlightSpan extends TextSpan { + interface HighlightSpan extends DeclarationTextSpan { kind: HighlightSpanKind; } /** @@ -6507,7 +6520,7 @@ declare namespace ts.server.protocol { interface ReferencesRequest extends FileLocationRequest { command: CommandTypes.References; } - interface ReferencesResponseItem extends FileSpan { + interface ReferencesResponseItem extends DeclarationFileSpan { /** Text of line containing the reference. Including this * with the response avoids latency of editor loading files * to show text of reference line (the server already has @@ -6622,7 +6635,7 @@ declare namespace ts.server.protocol { /** The text spans in this group */ locs: RenameTextSpan[]; } - interface RenameTextSpan extends TextSpan { + interface RenameTextSpan extends DeclarationTextSpan { readonly prefixText?: string; readonly suffixText?: string; } @@ -8979,6 +8992,7 @@ declare namespace ts.server { private mapDefinitionInfo; private static mapToOriginalLocation; private toFileSpan; + private toDeclarationFileSpan; private getTypeDefinition; private mapImplementationLocations; private getImplementation; @@ -9036,7 +9050,6 @@ declare namespace ts.server { private mapLocationNavigationBarItems; private getNavigationBarItems; private toLocationNavigationTree; - private toLocationTextSpan; private getNavigationTree; private getNavigateToItems; private getFullNavigateToItems; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index f70916a882b..9b560c0ef09 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -5070,6 +5070,12 @@ declare namespace ts { */ originalTextSpan?: TextSpan; originalFileName?: string; + /** + * If DocumentSpan.textSpan is the span for name of the declaration, + * then this is the span for relevant declaration + */ + declarationSpan?: TextSpan; + originalDeclarationSpan?: TextSpan; } interface RenameLocation extends DocumentSpan { readonly prefixText?: string; @@ -5098,6 +5104,7 @@ declare namespace ts { fileName?: string; isInString?: true; textSpan: TextSpan; + declarationSpan?: TextSpan; kind: HighlightSpanKind; } interface NavigateToItem { From 1d830ffe7a6fa15674359d8d09a65848cc8ce6a7 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 24 May 2019 16:29:27 -0700 Subject: [PATCH 161/384] Start fixing fourslash tests --- src/harness/fourslash.ts | 12 ++++++++---- tests/cases/fourslash/untypedModuleImport.ts | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 8a0a2bffbd4..c48da8bee56 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -955,14 +955,18 @@ namespace FourSlash { const fullExpected = ts.map(parts, ({ definition, ranges }) => ({ definition: typeof definition === "string" ? definition : { ...definition, range: ts.createTextSpanFromRange(definition.range) }, references: ranges.map(r => { - const { isWriteAccess = false, isDefinition = false, isInString } = (r.marker && r.marker.data || {}) as { isWriteAccess?: boolean, isDefinition?: boolean, isInString?: true }; - return { + const { isWriteAccess = false, isDefinition = false, isInString, declarationRange } = (r.marker && r.marker.data || {}) as { isWriteAccess?: boolean, isDefinition?: boolean, isInString?: true, declarationRange?: number }; + const result: ts.ReferenceEntry = { fileName: r.fileName, textSpan: ts.createTextSpanFromRange(r), isWriteAccess, isDefinition, ...(isInString ? { isInString: true } : undefined), }; + if (declarationRange !== undefined) { + result.declarationSpan = ts.createTextSpanFromRange(this.getRanges()[declarationRange]); + } + return result; }), })); @@ -1011,7 +1015,7 @@ Actual: ${stringify(fullActual)}`); }; if ((actual === undefined) !== (expected === undefined)) { - fail(`Expected ${expected}, got ${actual}`); + fail(`Expected ${stringify(expected)}, got ${stringify(actual)}`); } for (const key in actual) { @@ -1021,7 +1025,7 @@ Actual: ${stringify(fullActual)}`); recur(ak, ek, path ? path + "." + key : key); } else if (ak !== ek) { - fail(`Expected '${key}' to be '${ek}', got '${ak}'`); + fail(`Expected '${key}' to be '${stringify(ek)}', got '${stringify(ak)}'`); } } } diff --git a/tests/cases/fourslash/untypedModuleImport.ts b/tests/cases/fourslash/untypedModuleImport.ts index 5501cec4792..e64d37d0e6c 100644 --- a/tests/cases/fourslash/untypedModuleImport.ts +++ b/tests/cases/fourslash/untypedModuleImport.ts @@ -4,7 +4,7 @@ ////{} // @Filename: a.ts -////import /*foo*/[|{| "isWriteAccess": true, "isDefinition": true |}foo|] from /*fooModule*/"[|{| "isInString": true |}foo|]"; +////[|import /*foo*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRange": 0 |}foo|] from /*fooModule*/"[|{| "isInString": true |}foo|]";|] ////[|foo|](); goTo.file("a.ts"); @@ -13,7 +13,7 @@ verify.numberOfErrorsInCurrentFile(0); goTo.marker("fooModule"); verify.goToDefinitionIs([]); verify.quickInfoIs(""); -const [r0, r1, r2] = test.ranges(); +const [r00, r0, r1, r2] = test.ranges(); verify.singleReferenceGroup('"foo"', [r1]); goTo.marker("foo"); From 273617cc8873b91b030c8d4e7279c2e331bc46ee Mon Sep 17 00:00:00 2001 From: Dhruv Rajvanshi Date: Mon, 27 May 2019 17:16:05 +0530 Subject: [PATCH 162/384] Use node.expression as error node for call diagnostics --- src/compiler/checker.ts | 8 ++++-- ...yErrorRelatedSpanBindingPattern.errors.txt | 4 +-- .../baselines/reference/baseCheck.errors.txt | 2 +- ...dSameNameFunctionDeclarationES5.errors.txt | 2 +- ...dSameNameFunctionDeclarationES6.errors.txt | 2 +- ...ameFunctionDeclarationStrictES5.errors.txt | 4 +-- ...ameFunctionDeclarationStrictES6.errors.txt | 4 +-- .../reference/callOverload.errors.txt | 2 +- .../reference/callWithMissingVoid.errors.txt | 16 +++++------ ...assCanExtendConstructorFunction.errors.txt | 2 +- .../reference/functionCall11.errors.txt | 2 +- .../reference/functionCall12.errors.txt | 2 +- .../reference/functionCall13.errors.txt | 2 +- .../reference/functionCall16.errors.txt | 2 +- .../reference/functionCall17.errors.txt | 2 +- .../reference/functionCall18.errors.txt | 2 +- .../reference/functionCall6.errors.txt | 2 +- .../reference/functionCall7.errors.txt | 2 +- .../reference/functionOverloads29.errors.txt | 2 +- .../reference/functionOverloads34.errors.txt | 2 +- .../reference/functionOverloads37.errors.txt | 2 +- .../functionParameterArityMismatch.errors.txt | 10 +++---- .../reference/genericRestArity.errors.txt | 2 +- .../genericRestArityStrict.errors.txt | 2 +- .../genericRestParameters3.errors.txt | 2 +- .../iterableArrayPattern25.errors.txt | 2 +- ...leFunctionParametersAsOptional2.errors.txt | 6 ++-- .../jsdocTypeTagRequiredParameters.errors.txt | 6 ++-- .../optionalParamArgsTest.errors.txt | 8 +++--- ...loadsAndTypeArgumentArityErrors.errors.txt | 2 +- .../requiredInitializedParameter1.errors.txt | 4 +-- .../restParamsWithNonRestParams.errors.txt | 2 +- ...romGeneratorMakesRequiredParams.errors.txt | 2 +- .../unionTypeCallSignatures.errors.txt | 28 +++++++++---------- .../unionTypeCallSignatures4.errors.txt | 2 +- 35 files changed, 75 insertions(+), 71 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2cdeaec2cee..44b3b4dc862 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21354,8 +21354,12 @@ namespace ts { return produceDiagnostics || !args ? resolveErrorCall(node) : getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray); function getCallErrorNode(node: CallLikeExpression): Node { - if (isCallExpression(node) && isPropertyAccessExpression(node.expression)) { - return node.expression.name; + if (isCallExpression(node)) { + if (isPropertyAccessExpression(node.expression)) { + return node.expression.name; + } else { + return node.expression; + } } return node; } diff --git a/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.errors.txt b/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.errors.txt index 788ff30c58f..3ebaaa1004f 100644 --- a/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.errors.txt +++ b/tests/baselines/reference/arityErrorRelatedSpanBindingPattern.errors.txt @@ -8,12 +8,12 @@ tests/cases/compiler/arityErrorRelatedSpanBindingPattern.ts(7,1): error TS2554: function bar(a, b, [c]): void {} foo("", 0); - ~~~~~~~~~~ + ~~~ !!! error TS2554: Expected 3 arguments, but got 2. !!! related TS6211 tests/cases/compiler/arityErrorRelatedSpanBindingPattern.ts:1:20: An argument matching this binding pattern was not provided. bar("", 0); - ~~~~~~~~~~ + ~~~ !!! error TS2554: Expected 3 arguments, but got 2. !!! related TS6211 tests/cases/compiler/arityErrorRelatedSpanBindingPattern.ts:3:20: An argument matching this binding pattern was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/baseCheck.errors.txt b/tests/baselines/reference/baseCheck.errors.txt index 67358a10338..359d689e3fe 100644 --- a/tests/baselines/reference/baseCheck.errors.txt +++ b/tests/baselines/reference/baseCheck.errors.txt @@ -30,7 +30,7 @@ tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'. } class D extends C { constructor(public z: number) { super(this.z) } } // too few params - ~~~~~~~~~~~~~ + ~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/compiler/baseCheck.ts:1:34: An argument for 'y' was not provided. ~~~~ diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt index 407c1c22a37..96d23c6a304 100644 --- a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt @@ -33,6 +33,6 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(16,1): error T } foo(10); foo(); // not ok - needs number - ~~~~~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts:1:14: An argument for 'a' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.errors.txt index 0a6109ee05f..da0e50d3086 100644 --- a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.errors.txt +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.errors.txt @@ -33,6 +33,6 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(16,1): error T } foo(10); foo(); // not ok - needs number - ~~~~~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts:1:14: An argument for 'a' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt index b6c4ac4c6a5..c8c98c51917 100644 --- a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt @@ -29,12 +29,12 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): e } foo(10); foo(); // not ok - needs number - ~~~~~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts:2:14: An argument for 'a' was not provided. } foo(10); foo(); // not ok - needs number - ~~~~~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts:2:14: An argument for 'a' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.errors.txt index d9b81d2686f..963b849ee72 100644 --- a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.errors.txt +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.errors.txt @@ -23,12 +23,12 @@ tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(17,1): e } foo(10); foo(); // not ok - ~~~~~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts:2:14: An argument for 'a' was not provided. } foo(10); foo(); // not ok - needs number - ~~~~~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts:2:14: An argument for 'a' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/callOverload.errors.txt b/tests/baselines/reference/callOverload.errors.txt index 0f6a2ade085..b08bf7ce891 100644 --- a/tests/baselines/reference/callOverload.errors.txt +++ b/tests/baselines/reference/callOverload.errors.txt @@ -19,7 +19,7 @@ tests/cases/conformance/expressions/functionCalls/callOverload.ts(11,10): error !!! error TS2554: Expected 2 arguments, but got 4. withRest('a', ...n); // no error withRest(); - ~~~~~~~~~~ + ~~~~~~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callOverload.ts:3:27: An argument for 'a' was not provided. withRest(...n); diff --git a/tests/baselines/reference/callWithMissingVoid.errors.txt b/tests/baselines/reference/callWithMissingVoid.errors.txt index 67d380be662..8b38f53acd4 100644 --- a/tests/baselines/reference/callWithMissingVoid.errors.txt +++ b/tests/baselines/reference/callWithMissingVoid.errors.txt @@ -56,15 +56,15 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1): new MyPromise(resolve => resolve()); // no error new MyPromise(resolve => resolve()); // no error new MyPromise(resolve => resolve()); // error, `any` arguments cannot be omitted - ~~~~~~~~~ + ~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:28:38: An argument for 'value' was not provided. new MyPromise(resolve => resolve()); // error, `unknown` arguments cannot be omitted - ~~~~~~~~~ + ~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:28:38: An argument for 'value' was not provided. new MyPromise(resolve => resolve()); // error, `never` arguments cannot be omitted - ~~~~~~~~~ + ~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:28:38: An argument for 'value' was not provided. @@ -78,7 +78,7 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1): a(4, "hello"); // ok a(4, "hello", void 0); // ok a(4); // not ok - ~~~~ + ~ !!! error TS2554: Expected 3 arguments, but got 1. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:42:23: An argument for 'y' was not provided. @@ -88,15 +88,15 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1): b(4, "hello", void 0, 2); // ok b(4, "hello"); // not ok - ~~~~~~~~~~~~~ + ~ !!! error TS2554: Expected 4 arguments, but got 2. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:50:34: An argument for 'z' was not provided. b(4, "hello", void 0); // not ok - ~~~~~~~~~~~~~~~~~~~~~ + ~ !!! error TS2554: Expected 4 arguments, but got 3. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:50:43: An argument for 'what' was not provided. b(4); // not ok - ~~~~ + ~ !!! error TS2554: Expected 4 arguments, but got 1. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:50:23: An argument for 'y' was not provided. @@ -117,7 +117,7 @@ tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts(75,1): ...args: TS): void; call((x: number, y: number) => x + y) // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2554: Expected 3 arguments, but got 1. !!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithMissingVoid.ts:73:5: An argument for 'args' was not provided. call((x: number, y: number) => x + y, 4, 2) // ok diff --git a/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt b/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt index 02c5940be14..26b83dc08a6 100644 --- a/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt +++ b/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt @@ -38,7 +38,7 @@ tests/cases/conformance/salsa/second.ts(17,15): error TS2345: Argument of type ' class Sql extends Wagon { constructor() { super(); // error: not enough arguments - ~~~~~~~ + ~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/salsa/first.js:5:16: An argument for 'numberOxen' was not provided. this.foonly = 12 diff --git a/tests/baselines/reference/functionCall11.errors.txt b/tests/baselines/reference/functionCall11.errors.txt index 4fb06f83157..b35a38fd099 100644 --- a/tests/baselines/reference/functionCall11.errors.txt +++ b/tests/baselines/reference/functionCall11.errors.txt @@ -8,7 +8,7 @@ tests/cases/compiler/functionCall11.ts(6,15): error TS2554: Expected 1-2 argumen foo('foo', 1); foo('foo'); foo(); - ~~~~~ + ~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionCall11.ts:1:14: An argument for 'a' was not provided. foo(1, 'bar'); diff --git a/tests/baselines/reference/functionCall12.errors.txt b/tests/baselines/reference/functionCall12.errors.txt index 8b6c02b4804..0221a9006b7 100644 --- a/tests/baselines/reference/functionCall12.errors.txt +++ b/tests/baselines/reference/functionCall12.errors.txt @@ -8,7 +8,7 @@ tests/cases/compiler/functionCall12.ts(7,15): error TS2345: Argument of type '3' foo('foo', 1); foo('foo'); foo(); - ~~~~~ + ~~~ !!! error TS2554: Expected 1-3 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionCall12.ts:1:14: An argument for 'a' was not provided. foo(1, 'bar'); diff --git a/tests/baselines/reference/functionCall13.errors.txt b/tests/baselines/reference/functionCall13.errors.txt index 8e7b5ecc97a..4717d04f241 100644 --- a/tests/baselines/reference/functionCall13.errors.txt +++ b/tests/baselines/reference/functionCall13.errors.txt @@ -7,7 +7,7 @@ tests/cases/compiler/functionCall13.ts(5,5): error TS2345: Argument of type '1' foo('foo', 1); foo('foo'); foo(); - ~~~~~ + ~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionCall13.ts:1:14: An argument for 'a' was not provided. foo(1, 'bar'); diff --git a/tests/baselines/reference/functionCall16.errors.txt b/tests/baselines/reference/functionCall16.errors.txt index 220e2017b67..15e67bb6b14 100644 --- a/tests/baselines/reference/functionCall16.errors.txt +++ b/tests/baselines/reference/functionCall16.errors.txt @@ -11,7 +11,7 @@ tests/cases/compiler/functionCall16.ts(6,5): error TS2345: Argument of type '1' foo('foo'); foo('foo', 'bar'); foo(); - ~~~~~ + ~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionCall16.ts:1:14: An argument for 'a' was not provided. foo(1, 'bar'); diff --git a/tests/baselines/reference/functionCall17.errors.txt b/tests/baselines/reference/functionCall17.errors.txt index 5d1bfe98edd..8bb5a7e3e17 100644 --- a/tests/baselines/reference/functionCall17.errors.txt +++ b/tests/baselines/reference/functionCall17.errors.txt @@ -11,7 +11,7 @@ tests/cases/compiler/functionCall17.ts(6,12): error TS2345: Argument of type '1' !!! error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. foo('foo'); foo(); - ~~~~~ + ~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionCall17.ts:1:14: An argument for 'a' was not provided. foo(1, 'bar'); diff --git a/tests/baselines/reference/functionCall18.errors.txt b/tests/baselines/reference/functionCall18.errors.txt index 1744c76982f..dfd0ab9af4f 100644 --- a/tests/baselines/reference/functionCall18.errors.txt +++ b/tests/baselines/reference/functionCall18.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/functionCall18.ts(4,1): error TS2554: Expected 2 arguments, declare function foo(a: T, b: T); declare function foo(a: {}); foo("hello"); - ~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/compiler/functionCall18.ts:2:31: An argument for 'b' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/functionCall6.errors.txt b/tests/baselines/reference/functionCall6.errors.txt index af3d4a0be22..585c12aa354 100644 --- a/tests/baselines/reference/functionCall6.errors.txt +++ b/tests/baselines/reference/functionCall6.errors.txt @@ -13,7 +13,7 @@ tests/cases/compiler/functionCall6.ts(5,1): error TS2554: Expected 1 arguments, ~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. foo(); - ~~~~~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionCall6.ts:1:14: An argument for 'a' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/functionCall7.errors.txt b/tests/baselines/reference/functionCall7.errors.txt index 53a3c575ec3..31d0eb32008 100644 --- a/tests/baselines/reference/functionCall7.errors.txt +++ b/tests/baselines/reference/functionCall7.errors.txt @@ -15,7 +15,7 @@ tests/cases/compiler/functionCall7.ts(7,1): error TS2554: Expected 1 arguments, ~ !!! error TS2345: Argument of type '4' is not assignable to parameter of type 'c1'. foo(); - ~~~~~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionCall7.ts:2:14: An argument for 'a' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads29.errors.txt b/tests/baselines/reference/functionOverloads29.errors.txt index 908380417f9..3f0fdea31b4 100644 --- a/tests/baselines/reference/functionOverloads29.errors.txt +++ b/tests/baselines/reference/functionOverloads29.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/functionOverloads29.ts(4,9): error TS2554: Expected 1 argum function foo(bar:number):number; function foo(bar:any):any{ return bar } var x = foo(); - ~~~~~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionOverloads29.ts:1:14: An argument for 'bar' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads34.errors.txt b/tests/baselines/reference/functionOverloads34.errors.txt index 1d032b7c34d..c83981b9159 100644 --- a/tests/baselines/reference/functionOverloads34.errors.txt +++ b/tests/baselines/reference/functionOverloads34.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/functionOverloads34.ts(4,9): error TS2554: Expected 1 argum function foo(bar:{a:boolean;}):number; function foo(bar:{a:any;}):any{ return bar } var x = foo(); - ~~~~~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionOverloads34.ts:1:14: An argument for 'bar' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads37.errors.txt b/tests/baselines/reference/functionOverloads37.errors.txt index 9f0ac5ee0e5..7760944cd01 100644 --- a/tests/baselines/reference/functionOverloads37.errors.txt +++ b/tests/baselines/reference/functionOverloads37.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/functionOverloads37.ts(4,9): error TS2554: Expected 1 argum function foo(bar:{a:boolean;}[]):number; function foo(bar:{a:any;}[]):any{ return bar } var x = foo(); - ~~~~~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionOverloads37.ts:1:14: An argument for 'bar' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/functionParameterArityMismatch.errors.txt b/tests/baselines/reference/functionParameterArityMismatch.errors.txt index aa870c23028..45533c6a3fa 100644 --- a/tests/baselines/reference/functionParameterArityMismatch.errors.txt +++ b/tests/baselines/reference/functionParameterArityMismatch.errors.txt @@ -11,11 +11,11 @@ tests/cases/compiler/functionParameterArityMismatch.ts(14,22): error TS2554: Exp declare function f1(a: number); declare function f1(a: number, b: number, c: number); f1(); - ~~~~ + ~~ !!! error TS2554: Expected 1-3 arguments, but got 0. !!! related TS6210 tests/cases/compiler/functionParameterArityMismatch.ts:1:21: An argument for 'a' was not provided. f1(1, 2); - ~~~~~~~~ + ~~ !!! error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 3 arguments. f1(1, 2, 3, 4); ~ @@ -26,13 +26,13 @@ tests/cases/compiler/functionParameterArityMismatch.ts(14,22): error TS2554: Exp declare function f2(a: number, b: number, c: number, d: number); declare function f2(a: number, b: number, c: number, d: number, e: number, f: number); f2(1); - ~~~~~ + ~~ !!! error TS2575: No overload expects 1 arguments, but overloads do exist that expect either 0 or 2 arguments. f2(1, 2, 3); - ~~~~~~~~~~~ + ~~ !!! error TS2575: No overload expects 3 arguments, but overloads do exist that expect either 2 or 4 arguments. f2(1, 2, 3, 4, 5); - ~~~~~~~~~~~~~~~~~ + ~~ !!! error TS2575: No overload expects 5 arguments, but overloads do exist that expect either 4 or 6 arguments. f2(1, 2, 3, 4, 5, 6, 7); ~ diff --git a/tests/baselines/reference/genericRestArity.errors.txt b/tests/baselines/reference/genericRestArity.errors.txt index e9c98c35584..97889f68bd4 100644 --- a/tests/baselines/reference/genericRestArity.errors.txt +++ b/tests/baselines/reference/genericRestArity.errors.txt @@ -10,7 +10,7 @@ tests/cases/conformance/types/rest/genericRestArity.ts(8,45): error TS2554: Expe ...args: TS): void; call((x: number, y: number) => x + y); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2554: Expected 3 arguments, but got 1. !!! related TS6210 tests/cases/conformance/types/rest/genericRestArity.ts:5:5: An argument for 'args' was not provided. call((x: number, y: number) => x + y, 1, 2, 3, 4, 5, 6, 7); diff --git a/tests/baselines/reference/genericRestArityStrict.errors.txt b/tests/baselines/reference/genericRestArityStrict.errors.txt index c5fc4e9704f..d91611ab494 100644 --- a/tests/baselines/reference/genericRestArityStrict.errors.txt +++ b/tests/baselines/reference/genericRestArityStrict.errors.txt @@ -10,7 +10,7 @@ tests/cases/conformance/types/rest/genericRestArityStrict.ts(8,45): error TS2554 ...args: TS): void; call((x: number, y: number) => x + y); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2554: Expected 3 arguments, but got 1. !!! related TS6210 tests/cases/conformance/types/rest/genericRestArityStrict.ts:5:5: An argument for 'args' was not provided. call((x: number, y: number) => x + y, 1, 2, 3, 4, 5, 6, 7); diff --git a/tests/baselines/reference/genericRestParameters3.errors.txt b/tests/baselines/reference/genericRestParameters3.errors.txt index 612140ea940..417338401e3 100644 --- a/tests/baselines/reference/genericRestParameters3.errors.txt +++ b/tests/baselines/reference/genericRestParameters3.errors.txt @@ -87,7 +87,7 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(53,5): error TS2345 declare function foo(cb: (...args: T) => void): void; foo>(); // Error - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/rest/genericRestParameters3.ts:27:39: An argument for 'cb' was not provided. foo>(100); // Error diff --git a/tests/baselines/reference/iterableArrayPattern25.errors.txt b/tests/baselines/reference/iterableArrayPattern25.errors.txt index 0161be07d4b..d566c127e43 100644 --- a/tests/baselines/reference/iterableArrayPattern25.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern25.errors.txt @@ -4,5 +4,5 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern25.ts(2,1): error ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern25.ts (1 errors) ==== function takeFirstTwoEntries(...[[k1, v1], [k2, v2]]) { } takeFirstTwoEntries(new Map([["", 0], ["hello", 1]])); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileFunctionParametersAsOptional2.errors.txt b/tests/baselines/reference/jsFileFunctionParametersAsOptional2.errors.txt index dda54d6dbe3..23b7c200b83 100644 --- a/tests/baselines/reference/jsFileFunctionParametersAsOptional2.errors.txt +++ b/tests/baselines/reference/jsFileFunctionParametersAsOptional2.errors.txt @@ -14,15 +14,15 @@ tests/cases/compiler/bar.ts(3,1): error TS2554: Expected 3 arguments, but got 2. ==== tests/cases/compiler/bar.ts (3 errors) ==== f(); // Error - ~~~ + ~ !!! error TS2554: Expected 3 arguments, but got 0. !!! related TS6210 tests/cases/compiler/foo.js:6:12: An argument for 'a' was not provided. f(1); // Error - ~~~~ + ~ !!! error TS2554: Expected 3 arguments, but got 1. !!! related TS6210 tests/cases/compiler/foo.js:6:15: An argument for 'b' was not provided. f(1, 2); // Error - ~~~~~~~ + ~ !!! error TS2554: Expected 3 arguments, but got 2. !!! related TS6210 tests/cases/compiler/foo.js:6:18: An argument for 'c' was not provided. diff --git a/tests/baselines/reference/jsdocTypeTagRequiredParameters.errors.txt b/tests/baselines/reference/jsdocTypeTagRequiredParameters.errors.txt index 3658797f87f..270050e0317 100644 --- a/tests/baselines/reference/jsdocTypeTagRequiredParameters.errors.txt +++ b/tests/baselines/reference/jsdocTypeTagRequiredParameters.errors.txt @@ -15,15 +15,15 @@ tests/cases/conformance/jsdoc/a.js(13,1): error TS2554: Expected 1 arguments, bu } f() // should error - ~~~ + ~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/jsdoc/a.js:1:21: An argument for '0' was not provided. g() // should error - ~~~ + ~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/jsdoc/a.js:5:12: An argument for 's' was not provided. h() - ~~~ + ~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/jsdoc/a.js:8:12: An argument for 's' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/optionalParamArgsTest.errors.txt b/tests/baselines/reference/optionalParamArgsTest.errors.txt index 139c83f7141..5b7c500db0c 100644 --- a/tests/baselines/reference/optionalParamArgsTest.errors.txt +++ b/tests/baselines/reference/optionalParamArgsTest.errors.txt @@ -145,11 +145,11 @@ tests/cases/compiler/optionalParamArgsTest.ts(117,1): error TS2554: Expected 1-2 !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:11:10: An argument for 'C1M2A1' was not provided. F2(); - ~~~~ + ~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:45:13: An argument for 'F2A1' was not provided. L2(); - ~~~~ + ~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:50:20: An argument for 'L2A1' was not provided. c1o1.C1M2(1,2); @@ -185,11 +185,11 @@ tests/cases/compiler/optionalParamArgsTest.ts(117,1): error TS2554: Expected 1-2 !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:13:10: An argument for 'C1M4A1' was not provided. F4(); - ~~~~ + ~~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:47:13: An argument for 'F4A1' was not provided. L4(); - ~~~~ + ~~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/compiler/optionalParamArgsTest.ts:52:20: An argument for 'L4A1' was not provided. diff --git a/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt b/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt index 6b64cd8a773..95e9bf27d23 100644 --- a/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt +++ b/tests/baselines/reference/overloadsAndTypeArgumentArityErrors.errors.txt @@ -17,7 +17,7 @@ tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts(9,1): error TS2554: declare function f(arg: number): void; f(); // wrong number of arguments (#25683) - ~~~~~~~~~~~ + ~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/overloadsAndTypeArgumentArityErrors.ts:8:31: An argument for 'arg' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/requiredInitializedParameter1.errors.txt b/tests/baselines/reference/requiredInitializedParameter1.errors.txt index f9baca7a1b5..e5963845d28 100644 --- a/tests/baselines/reference/requiredInitializedParameter1.errors.txt +++ b/tests/baselines/reference/requiredInitializedParameter1.errors.txt @@ -14,7 +14,7 @@ tests/cases/compiler/requiredInitializedParameter1.ts(16,1): error TS2554: Expec f4(0, 1, 2); f1(0, 1); - ~~~~~~~~ + ~~ !!! error TS2554: Expected 3 arguments, but got 2. !!! related TS6210 tests/cases/compiler/requiredInitializedParameter1.ts:1:23: An argument for 'c' was not provided. f2(0, 1); @@ -22,7 +22,7 @@ tests/cases/compiler/requiredInitializedParameter1.ts(16,1): error TS2554: Expec f4(0, 1); f1(0); - ~~~~~ + ~~ !!! error TS2554: Expected 3 arguments, but got 1. !!! related TS6210 tests/cases/compiler/requiredInitializedParameter1.ts:1:16: An argument for 'b' was not provided. f2(0); diff --git a/tests/baselines/reference/restParamsWithNonRestParams.errors.txt b/tests/baselines/reference/restParamsWithNonRestParams.errors.txt index 5bbcf92f702..067cf6c8267 100644 --- a/tests/baselines/reference/restParamsWithNonRestParams.errors.txt +++ b/tests/baselines/reference/restParamsWithNonRestParams.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/restParamsWithNonRestParams.ts(4,1): error TS2555: Expected foo(); // ok function foo2(a:string, ...b:number[]){} foo2(); // should be an error - ~~~~~~ + ~~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. !!! related TS6210 tests/cases/compiler/restParamsWithNonRestParams.ts:3:15: An argument for 'a' was not provided. function foo3(a?:string, ...b:number[]){} diff --git a/tests/baselines/reference/spreadOfParamsFromGeneratorMakesRequiredParams.errors.txt b/tests/baselines/reference/spreadOfParamsFromGeneratorMakesRequiredParams.errors.txt index 393e21edb6c..d37b20f7403 100644 --- a/tests/baselines/reference/spreadOfParamsFromGeneratorMakesRequiredParams.errors.txt +++ b/tests/baselines/reference/spreadOfParamsFromGeneratorMakesRequiredParams.errors.txt @@ -10,6 +10,6 @@ tests/cases/compiler/spreadOfParamsFromGeneratorMakesRequiredParams.ts(6,1): err ): any; call(function* (a: 'a') { }); // error, 2nd argument required - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/compiler/spreadOfParamsFromGeneratorMakesRequiredParams.ts:3:5: An argument for 'args' was not provided. \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeCallSignatures.errors.txt b/tests/baselines/reference/unionTypeCallSignatures.errors.txt index f7a2c9d0766..3aaf2dad581 100644 --- a/tests/baselines/reference/unionTypeCallSignatures.errors.txt +++ b/tests/baselines/reference/unionTypeCallSignatures.errors.txt @@ -52,7 +52,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~ !!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. unionOfDifferentReturnType1(); // error missing parameter - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:12:37: An argument for 'a' was not provided. @@ -66,13 +66,13 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number & string'. !!! error TS2345: Type '"hello"' is not assignable to type 'number'. unionOfDifferentParameterTypes();// error - no call signatures - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:18:40: An argument for 'a' was not provided. var unionOfDifferentNumberOfSignatures: { (a: number): number; } | { (a: number): Date; (a: string): boolean; }; unionOfDifferentNumberOfSignatures(); // error - no call signatures - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:23:44: An argument for 'a' was not provided. unionOfDifferentNumberOfSignatures(10); // error - no call signatures @@ -82,11 +82,11 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ; unionWithDifferentParameterCount();// needs more args - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:28:69: An argument for 'a' was not provided. unionWithDifferentParameterCount("hello");// needs more args - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:28:80: An argument for 'b' was not provided. unionWithDifferentParameterCount("hello", 10);// OK @@ -98,13 +98,13 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~~~~ !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. strOrNum = unionWithOptionalParameter1(); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:33:37: An argument for 'a' was not provided. var unionWithOptionalParameter2: { (a: string, b?: number): string; } | { (a: string, b: number): number }; strOrNum = unionWithOptionalParameter2('hello'); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:39:87: An argument for 'b' was not provided. strOrNum = unionWithOptionalParameter2('hello', 10); // error no call signature @@ -112,7 +112,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~~~~ !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. strOrNum = unionWithOptionalParameter2(); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:39:76: An argument for 'a' was not provided. @@ -123,7 +123,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~~~~ !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. strOrNum = unionWithOptionalParameter3(); // needs more args - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 1-2 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:45:37: An argument for 'a' was not provided. @@ -135,13 +135,13 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~~~~ !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. strOrNum = unionWithRestParameter1(); // error - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:51:33: An argument for 'a' was not provided. var unionWithRestParameter2: { (a: string, ...b: number[]): string; } | { (a: string, b: number): number }; strOrNum = unionWithRestParameter2('hello'); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:58:87: An argument for 'b' was not provided. strOrNum = unionWithRestParameter2('hello', 10); // error no call signature @@ -152,7 +152,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~~~~ !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. strOrNum = unionWithRestParameter2(); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:58:76: An argument for 'a' was not provided. @@ -164,13 +164,13 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2 ~~~~~~~ !!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'. strOrNum = unionWithRestParameter3(); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2555: Expected at least 1 arguments, but got 0. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:65:33: An argument for 'a' was not provided. var unionWithRestParameter4: { (...a: string[]): string; } | { (a: string, b: string): number; }; strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures.ts:72:76: An argument for 'b' was not provided. strOrNum = unionWithRestParameter4("hello", "world"); diff --git a/tests/baselines/reference/unionTypeCallSignatures4.errors.txt b/tests/baselines/reference/unionTypeCallSignatures4.errors.txt index 37f8d7708c5..e991b211db2 100644 --- a/tests/baselines/reference/unionTypeCallSignatures4.errors.txt +++ b/tests/baselines/reference/unionTypeCallSignatures4.errors.txt @@ -26,7 +26,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures4.ts(25,18): error TS var f12345: F1 | F2 | F3 | F4 | F5; f12345("a"); // error - ~~~~~~~~~~~ + ~~~~~~ !!! error TS2554: Expected 2 arguments, but got 1. !!! related TS6210 tests/cases/conformance/types/union/unionTypeCallSignatures4.ts:5:23: An argument for 'b' was not provided. f12345("a", "b"); From 9ca8045baab84b8e27a1d6b8b15be8ae7c439c7d Mon Sep 17 00:00:00 2001 From: Dhruv Rajvanshi Date: Tue, 28 May 2019 22:23:33 +0530 Subject: [PATCH 163/384] Fix linter errors --- src/compiler/checker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 44b3b4dc862..ba5a69c32f4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21357,7 +21357,8 @@ namespace ts { if (isCallExpression(node)) { if (isPropertyAccessExpression(node.expression)) { return node.expression.name; - } else { + } + else { return node.expression; } } From e70f2af25d7d94a88ef0d852c35e38ce8504d59f Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 28 May 2019 10:51:47 -0700 Subject: [PATCH 164/384] Defer union or intersection property type normalization (#31486) * Defer union or intersection property type normalization * Accept moved span --- src/compiler/checker.ts | 77 +++++++++++++++++-- src/compiler/types.ts | 3 + .../reference/intersectionTypeMembers.js | 34 ++++++++ .../reference/intersectionTypeMembers.symbols | 55 +++++++++++++ .../reference/intersectionTypeMembers.types | 58 ++++++++++++++ ...ormalizedIntersectionTooComplex.errors.txt | 6 +- .../reactTagNameComponentWithPropsNoOOM.js | 33 ++++++++ ...eactTagNameComponentWithPropsNoOOM.symbols | 32 ++++++++ .../reactTagNameComponentWithPropsNoOOM.types | 35 +++++++++ .../reactTagNameComponentWithPropsNoOOM2.js | 33 ++++++++ ...actTagNameComponentWithPropsNoOOM2.symbols | 35 +++++++++ ...reactTagNameComponentWithPropsNoOOM2.types | 36 +++++++++ .../reactTagNameComponentWithPropsNoOOM.tsx | 13 ++++ .../reactTagNameComponentWithPropsNoOOM2.tsx | 13 ++++ .../intersection/intersectionTypeMembers.ts | 22 ++++++ 15 files changed, 474 insertions(+), 11 deletions(-) create mode 100644 tests/baselines/reference/reactTagNameComponentWithPropsNoOOM.js create mode 100644 tests/baselines/reference/reactTagNameComponentWithPropsNoOOM.symbols create mode 100644 tests/baselines/reference/reactTagNameComponentWithPropsNoOOM.types create mode 100644 tests/baselines/reference/reactTagNameComponentWithPropsNoOOM2.js create mode 100644 tests/baselines/reference/reactTagNameComponentWithPropsNoOOM2.symbols create mode 100644 tests/baselines/reference/reactTagNameComponentWithPropsNoOOM2.types create mode 100644 tests/cases/compiler/reactTagNameComponentWithPropsNoOOM.tsx create mode 100644 tests/cases/compiler/reactTagNameComponentWithPropsNoOOM2.tsx diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5091f5f0306..d59cf4c5470 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5921,7 +5921,20 @@ namespace ts { return anyType; } + function getTypeOfSymbolWithDeferredType(symbol: Symbol) { + const links = getSymbolLinks(symbol); + if (!links.type) { + Debug.assertDefined(links.deferralParent); + Debug.assertDefined(links.deferralConstituents); + links.type = links.deferralParent!.flags & TypeFlags.Union ? getUnionType(links.deferralConstituents!) : getIntersectionType(links.deferralConstituents!); + } + return links.type; + } + function getTypeOfSymbol(symbol: Symbol): Type { + if (getCheckFlags(symbol) & CheckFlags.DeferredType) { + return getTypeOfSymbolWithDeferredType(symbol); + } if (getCheckFlags(symbol) & CheckFlags.Instantiated) { return getTypeOfInstantiatedSymbol(symbol); } @@ -8061,7 +8074,15 @@ namespace ts { result.declarations = declarations!; result.nameType = nameType; - result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes); + if (propTypes.length > 2) { + // When `propTypes` has the potential to explode in size when normalized, defer normalization until absolutely needed + result.checkFlags |= CheckFlags.DeferredType; + result.deferralParent = containingType; + result.deferralConstituents = propTypes; + } + else { + result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes); + } return result; } @@ -12313,8 +12334,8 @@ namespace ts { return false; } - function isIgnoredJsxProperty(source: Type, sourceProp: Symbol, targetMemberType: Type | undefined) { - return getObjectFlags(source) & ObjectFlags.JsxAttributes && !(isUnhyphenatedJsxName(sourceProp.escapedName) || targetMemberType); + function isIgnoredJsxProperty(source: Type, sourceProp: Symbol) { + return getObjectFlags(source) & ObjectFlags.JsxAttributes && !isUnhyphenatedJsxName(sourceProp.escapedName); } /** @@ -13495,6 +13516,49 @@ namespace ts { return result || properties; } + function isPropertySymbolTypeRelated(sourceProp: Symbol, targetProp: Symbol, getTypeOfSourceProperty: (sym: Symbol) => Type, reportErrors: boolean): Ternary { + const targetIsOptional = strictNullChecks && !!(getCheckFlags(targetProp) & CheckFlags.Partial); + const source = getTypeOfSourceProperty(sourceProp); + if (getCheckFlags(targetProp) & CheckFlags.DeferredType && !getSymbolLinks(targetProp).type) { + // Rather than resolving (and normalizing) the type, relate constituent-by-constituent without performing normalization or seconadary passes + const links = getSymbolLinks(targetProp); + Debug.assertDefined(links.deferralParent); + Debug.assertDefined(links.deferralConstituents); + const unionParent = !!(links.deferralParent!.flags & TypeFlags.Union); + let result = unionParent ? Ternary.False : Ternary.True; + const targetTypes = links.deferralConstituents!; + for (const targetType of targetTypes) { + const related = isRelatedTo(source, targetType, /*reportErrors*/ false, /*headMessage*/ undefined, /*isIntersectionConstituent*/ !unionParent); + if (!unionParent) { + if (!related) { + // Can't assign to a target individually - have to fallback to assigning to the _whole_ intersection (which forces normalization) + return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors); + } + result &= related; + } + else { + if (related) { + return related; + } + } + } + if (unionParent && !result && targetIsOptional) { + result = isRelatedTo(source, undefinedType); + } + if (unionParent && !result && reportErrors) { + // The easiest way to get the right errors here is to un-defer (which may be costly) + // If it turns out this is too costly too often, we can replicate the error handling logic within + // typeRelatedToSomeType without the discriminatable type branch (as that requires a manifest union + // type on which to hand discriminable properties, which we are expressly trying to avoid here) + return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors); + } + return result; + } + else { + return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors); + } + } + function propertyRelatedTo(source: Type, target: Type, sourceProp: Symbol, targetProp: Symbol, getTypeOfSourceProperty: (sym: Symbol) => Type, reportErrors: boolean): Ternary { const sourcePropFlags = getDeclarationModifierFlagsFromSymbol(sourceProp); const targetPropFlags = getDeclarationModifierFlagsFromSymbol(targetProp); @@ -13537,7 +13601,7 @@ namespace ts { return Ternary.False; } // If the target comes from a partial union prop, allow `undefined` in the target type - const related = isRelatedTo(getTypeOfSourceProperty(sourceProp), addOptionality(getTypeOfSymbol(targetProp), !!(getCheckFlags(targetProp) & CheckFlags.Partial)), reportErrors); + const related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors); if (!related) { if (reportErrors) { reportError(Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); @@ -13649,9 +13713,6 @@ namespace ts { if (!(targetProp.flags & SymbolFlags.Prototype)) { const sourceProp = getPropertyOfType(source, targetProp.escapedName); if (sourceProp && sourceProp !== targetProp) { - if (isIgnoredJsxProperty(source, sourceProp, getTypeOfSymbol(targetProp))) { - continue; - } const related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors); if (!related) { return Ternary.False; @@ -13797,7 +13858,7 @@ namespace ts { function eachPropertyRelatedTo(source: Type, target: Type, kind: IndexKind, reportErrors: boolean): Ternary { let result = Ternary.True; for (const prop of getPropertiesOfObjectType(source)) { - if (isIgnoredJsxProperty(source, prop, /*targetMemberType*/ undefined)) { + if (isIgnoredJsxProperty(source, prop)) { continue; } // Skip over symbol-named members diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 03ca196a860..3a80655385d 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3752,6 +3752,8 @@ namespace ts { extendedContainers?: Symbol[]; // Containers (other than the parent) which this symbol is aliased in extendedContainersByFile?: Map; // Containers (other than the parent) which this symbol is aliased in variances?: VarianceFlags[]; // Alias symbol type argument variance cache + deferralConstituents?: Type[]; // Calculated list of constituents for a deferred type + deferralParent?: Type; // Source union/intersection of a deferred type } /* @internal */ @@ -3778,6 +3780,7 @@ namespace ts { ReverseMapped = 1 << 13, // Property of reverse-inferred homomorphic mapped type OptionalParameter = 1 << 14, // Optional parameter RestParameter = 1 << 15, // Rest parameter + DeferredType = 1 << 16, // Calculation of the type of this symbol is deferred due to processing costs, should be fetched with `getTypeOfSymbolWithDeferredType` Synthetic = SyntheticProperty | SyntheticMethod, Discriminant = HasNonUniformType | HasLiteralType, Partial = ReadPartial | WritePartial diff --git a/tests/baselines/reference/intersectionTypeMembers.js b/tests/baselines/reference/intersectionTypeMembers.js index 59968b007db..867a6f0fc66 100644 --- a/tests/baselines/reference/intersectionTypeMembers.js +++ b/tests/baselines/reference/intersectionTypeMembers.js @@ -43,6 +43,28 @@ const de: D & E = { other: { g: 101 } } } + +// Additional test case with >2 doubly nested members so fix for #31441 is tested w/ excess props +interface F { + nested: { doublyNested: { g: string; } } +} + +interface G { + nested: { doublyNested: { h: string; } } +} + +const defg: D & E & F & G = { + nested: { + doublyNested: { + d: 'yes', + f: 'no', + g: 'ok', + h: 'affirmative' + }, + different: { e: 12 }, + other: { g: 101 } + } +} //// [intersectionTypeMembers.js] @@ -69,3 +91,15 @@ var de = { other: { g: 101 } } }; +var defg = { + nested: { + doublyNested: { + d: 'yes', + f: 'no', + g: 'ok', + h: 'affirmative' + }, + different: { e: 12 }, + other: { g: 101 } + } +}; diff --git a/tests/baselines/reference/intersectionTypeMembers.symbols b/tests/baselines/reference/intersectionTypeMembers.symbols index be47b2960db..b4629d1659d 100644 --- a/tests/baselines/reference/intersectionTypeMembers.symbols +++ b/tests/baselines/reference/intersectionTypeMembers.symbols @@ -146,3 +146,58 @@ const de: D & E = { } } +// Additional test case with >2 doubly nested members so fix for #31441 is tested w/ excess props +interface F { +>F : Symbol(F, Decl(intersectionTypeMembers.ts, 43, 1)) + + nested: { doublyNested: { g: string; } } +>nested : Symbol(F.nested, Decl(intersectionTypeMembers.ts, 46, 13)) +>doublyNested : Symbol(doublyNested, Decl(intersectionTypeMembers.ts, 47, 13)) +>g : Symbol(g, Decl(intersectionTypeMembers.ts, 47, 29)) +} + +interface G { +>G : Symbol(G, Decl(intersectionTypeMembers.ts, 48, 1)) + + nested: { doublyNested: { h: string; } } +>nested : Symbol(G.nested, Decl(intersectionTypeMembers.ts, 50, 13)) +>doublyNested : Symbol(doublyNested, Decl(intersectionTypeMembers.ts, 51, 13)) +>h : Symbol(h, Decl(intersectionTypeMembers.ts, 51, 29)) +} + +const defg: D & E & F & G = { +>defg : Symbol(defg, Decl(intersectionTypeMembers.ts, 54, 5)) +>D : Symbol(D, Decl(intersectionTypeMembers.ts, 26, 14)) +>E : Symbol(E, Decl(intersectionTypeMembers.ts, 30, 1)) +>F : Symbol(F, Decl(intersectionTypeMembers.ts, 43, 1)) +>G : Symbol(G, Decl(intersectionTypeMembers.ts, 48, 1)) + + nested: { +>nested : Symbol(nested, Decl(intersectionTypeMembers.ts, 54, 29)) + + doublyNested: { +>doublyNested : Symbol(doublyNested, Decl(intersectionTypeMembers.ts, 55, 13)) + + d: 'yes', +>d : Symbol(d, Decl(intersectionTypeMembers.ts, 56, 23)) + + f: 'no', +>f : Symbol(f, Decl(intersectionTypeMembers.ts, 57, 21)) + + g: 'ok', +>g : Symbol(g, Decl(intersectionTypeMembers.ts, 58, 20)) + + h: 'affirmative' +>h : Symbol(h, Decl(intersectionTypeMembers.ts, 59, 20)) + + }, + different: { e: 12 }, +>different : Symbol(different, Decl(intersectionTypeMembers.ts, 61, 10)) +>e : Symbol(e, Decl(intersectionTypeMembers.ts, 62, 20)) + + other: { g: 101 } +>other : Symbol(other, Decl(intersectionTypeMembers.ts, 62, 29)) +>g : Symbol(g, Decl(intersectionTypeMembers.ts, 63, 16)) + } +} + diff --git a/tests/baselines/reference/intersectionTypeMembers.types b/tests/baselines/reference/intersectionTypeMembers.types index eb9d5fa4eb8..817fa044624 100644 --- a/tests/baselines/reference/intersectionTypeMembers.types +++ b/tests/baselines/reference/intersectionTypeMembers.types @@ -148,3 +148,61 @@ const de: D & E = { } } +// Additional test case with >2 doubly nested members so fix for #31441 is tested w/ excess props +interface F { + nested: { doublyNested: { g: string; } } +>nested : { doublyNested: { g: string; }; } +>doublyNested : { g: string; } +>g : string +} + +interface G { + nested: { doublyNested: { h: string; } } +>nested : { doublyNested: { h: string; }; } +>doublyNested : { h: string; } +>h : string +} + +const defg: D & E & F & G = { +>defg : D & E & F & G +>{ nested: { doublyNested: { d: 'yes', f: 'no', g: 'ok', h: 'affirmative' }, different: { e: 12 }, other: { g: 101 } }} : { nested: { doublyNested: { d: string; f: string; g: string; h: string; }; different: { e: number; }; other: { g: number; }; }; } + + nested: { +>nested : { doublyNested: { d: string; f: string; g: string; h: string; }; different: { e: number; }; other: { g: number; }; } +>{ doublyNested: { d: 'yes', f: 'no', g: 'ok', h: 'affirmative' }, different: { e: 12 }, other: { g: 101 } } : { doublyNested: { d: string; f: string; g: string; h: string; }; different: { e: number; }; other: { g: number; }; } + + doublyNested: { +>doublyNested : { d: string; f: string; g: string; h: string; } +>{ d: 'yes', f: 'no', g: 'ok', h: 'affirmative' } : { d: string; f: string; g: string; h: string; } + + d: 'yes', +>d : string +>'yes' : "yes" + + f: 'no', +>f : string +>'no' : "no" + + g: 'ok', +>g : string +>'ok' : "ok" + + h: 'affirmative' +>h : string +>'affirmative' : "affirmative" + + }, + different: { e: 12 }, +>different : { e: number; } +>{ e: 12 } : { e: number; } +>e : number +>12 : 12 + + other: { g: 101 } +>other : { g: number; } +>{ g: 101 } : { g: number; } +>g : number +>101 : 101 + } +} + diff --git a/tests/baselines/reference/normalizedIntersectionTooComplex.errors.txt b/tests/baselines/reference/normalizedIntersectionTooComplex.errors.txt index 4e214eff507..64e7d7f00c5 100644 --- a/tests/baselines/reference/normalizedIntersectionTooComplex.errors.txt +++ b/tests/baselines/reference/normalizedIntersectionTooComplex.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/normalizedIntersectionTooComplex.ts(36,14): error TS2590: Expression produces a union type that is too complex to represent. tests/cases/compiler/normalizedIntersectionTooComplex.ts(36,40): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/normalizedIntersectionTooComplex.ts(36,40): error TS2590: Expression produces a union type that is too complex to represent. ==== tests/cases/compiler/normalizedIntersectionTooComplex.ts (2 errors) ==== @@ -39,8 +39,8 @@ tests/cases/compiler/normalizedIntersectionTooComplex.ts(36,40): error TS7006: P declare var all: keyof Big; const ctor = getCtor(all); const comp = ctor({ common: "ok", ref: x => console.log(x) }); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2590: Expression produces a union type that is too complex to represent. ~ !!! error TS7006: Parameter 'x' implicitly has an 'any' type. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2590: Expression produces a union type that is too complex to represent. \ No newline at end of file diff --git a/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM.js b/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM.js new file mode 100644 index 00000000000..c85d07ec99b --- /dev/null +++ b/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM.js @@ -0,0 +1,33 @@ +//// [reactTagNameComponentWithPropsNoOOM.tsx] +/// + +import * as React from "react"; +declare const Tag: keyof React.ReactHTML; + +const classes = ""; +const rest: {} = {}; +const children: any[] = []; + +{children} + + +//// [reactTagNameComponentWithPropsNoOOM.js] +"use strict"; +/// +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +exports.__esModule = true; +var React = require("react"); +var classes = ""; +var rest = {}; +var children = []; +React.createElement(Tag, __assign({ className: classes }, rest), children); diff --git a/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM.symbols b/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM.symbols new file mode 100644 index 00000000000..0b827bf7a0d --- /dev/null +++ b/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM.symbols @@ -0,0 +1,32 @@ +=== tests/cases/compiler/reactTagNameComponentWithPropsNoOOM.tsx === +/// + +import * as React from "react"; +>React : Symbol(React, Decl(reactTagNameComponentWithPropsNoOOM.tsx, 2, 6)) + +declare const Tag: keyof React.ReactHTML; +>Tag : Symbol(Tag, Decl(reactTagNameComponentWithPropsNoOOM.tsx, 3, 13)) +>React : Symbol(React, Decl(reactTagNameComponentWithPropsNoOOM.tsx, 2, 6)) +>ReactHTML : Symbol(React.ReactHTML, Decl(react16.d.ts, 2089, 9)) + +const classes = ""; +>classes : Symbol(classes, Decl(reactTagNameComponentWithPropsNoOOM.tsx, 5, 5)) + +const rest: {} = {}; +>rest : Symbol(rest, Decl(reactTagNameComponentWithPropsNoOOM.tsx, 6, 5)) + +const children: any[] = []; +>children : Symbol(children, Decl(reactTagNameComponentWithPropsNoOOM.tsx, 7, 5)) + + +>Tag : Symbol(Tag, Decl(reactTagNameComponentWithPropsNoOOM.tsx, 3, 13)) +>className : Symbol(className, Decl(reactTagNameComponentWithPropsNoOOM.tsx, 8, 4)) +>classes : Symbol(classes, Decl(reactTagNameComponentWithPropsNoOOM.tsx, 5, 5)) +>rest : Symbol(rest, Decl(reactTagNameComponentWithPropsNoOOM.tsx, 6, 5)) + +{children} +>children : Symbol(children, Decl(reactTagNameComponentWithPropsNoOOM.tsx, 7, 5)) + + +>Tag : Symbol(Tag, Decl(reactTagNameComponentWithPropsNoOOM.tsx, 3, 13)) + diff --git a/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM.types b/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM.types new file mode 100644 index 00000000000..f31716a55e4 --- /dev/null +++ b/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/reactTagNameComponentWithPropsNoOOM.tsx === +/// + +import * as React from "react"; +>React : typeof React + +declare const Tag: keyof React.ReactHTML; +>Tag : "object" | "time" | "link" | "menu" | "dialog" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "main" | "map" | "mark" | "menuitem" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "webview" +>React : any + +const classes = ""; +>classes : "" +>"" : "" + +const rest: {} = {}; +>rest : {} +>{} : {} + +const children: any[] = []; +>children : any[] +>[] : never[] + + +>{children} : JSX.Element +>Tag : "object" | "time" | "link" | "menu" | "dialog" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "main" | "map" | "mark" | "menuitem" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "webview" +>className : string +>classes : "" +>rest : {} + +{children} +>children : any[] + + +>Tag : "object" | "time" | "link" | "menu" | "dialog" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "main" | "map" | "mark" | "menuitem" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "webview" + diff --git a/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM2.js b/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM2.js new file mode 100644 index 00000000000..4b6e9d0c54a --- /dev/null +++ b/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM2.js @@ -0,0 +1,33 @@ +//// [reactTagNameComponentWithPropsNoOOM2.tsx] +/// + +import * as React from "react"; +declare const Tag: keyof React.ReactHTML; + +const classes = ""; +const rest: React.HTMLAttributes = {}; +const children: any[] = []; + +{children} + + +//// [reactTagNameComponentWithPropsNoOOM2.js] +"use strict"; +/// +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +exports.__esModule = true; +var React = require("react"); +var classes = ""; +var rest = {}; +var children = []; +React.createElement(Tag, __assign({ className: classes }, rest), children); diff --git a/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM2.symbols b/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM2.symbols new file mode 100644 index 00000000000..658f9fd5c43 --- /dev/null +++ b/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM2.symbols @@ -0,0 +1,35 @@ +=== tests/cases/compiler/reactTagNameComponentWithPropsNoOOM2.tsx === +/// + +import * as React from "react"; +>React : Symbol(React, Decl(reactTagNameComponentWithPropsNoOOM2.tsx, 2, 6)) + +declare const Tag: keyof React.ReactHTML; +>Tag : Symbol(Tag, Decl(reactTagNameComponentWithPropsNoOOM2.tsx, 3, 13)) +>React : Symbol(React, Decl(reactTagNameComponentWithPropsNoOOM2.tsx, 2, 6)) +>ReactHTML : Symbol(React.ReactHTML, Decl(react16.d.ts, 2089, 9)) + +const classes = ""; +>classes : Symbol(classes, Decl(reactTagNameComponentWithPropsNoOOM2.tsx, 5, 5)) + +const rest: React.HTMLAttributes = {}; +>rest : Symbol(rest, Decl(reactTagNameComponentWithPropsNoOOM2.tsx, 6, 5)) +>React : Symbol(React, Decl(reactTagNameComponentWithPropsNoOOM2.tsx, 2, 6)) +>HTMLAttributes : Symbol(React.HTMLAttributes, Decl(react16.d.ts, 1048, 9), Decl(react16.d.ts, 1105, 9)) +>HTMLElement : Symbol(HTMLElement, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) + +const children: any[] = []; +>children : Symbol(children, Decl(reactTagNameComponentWithPropsNoOOM2.tsx, 7, 5)) + + +>Tag : Symbol(Tag, Decl(reactTagNameComponentWithPropsNoOOM2.tsx, 3, 13)) +>className : Symbol(className, Decl(reactTagNameComponentWithPropsNoOOM2.tsx, 8, 4)) +>classes : Symbol(classes, Decl(reactTagNameComponentWithPropsNoOOM2.tsx, 5, 5)) +>rest : Symbol(rest, Decl(reactTagNameComponentWithPropsNoOOM2.tsx, 6, 5)) + +{children} +>children : Symbol(children, Decl(reactTagNameComponentWithPropsNoOOM2.tsx, 7, 5)) + + +>Tag : Symbol(Tag, Decl(reactTagNameComponentWithPropsNoOOM2.tsx, 3, 13)) + diff --git a/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM2.types b/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM2.types new file mode 100644 index 00000000000..fac8a844e03 --- /dev/null +++ b/tests/baselines/reference/reactTagNameComponentWithPropsNoOOM2.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/reactTagNameComponentWithPropsNoOOM2.tsx === +/// + +import * as React from "react"; +>React : typeof React + +declare const Tag: keyof React.ReactHTML; +>Tag : "object" | "time" | "link" | "menu" | "dialog" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "main" | "map" | "mark" | "menuitem" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "webview" +>React : any + +const classes = ""; +>classes : "" +>"" : "" + +const rest: React.HTMLAttributes = {}; +>rest : React.HTMLAttributes +>React : any +>{} : {} + +const children: any[] = []; +>children : any[] +>[] : never[] + + +>{children} : JSX.Element +>Tag : "object" | "time" | "link" | "menu" | "dialog" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "main" | "map" | "mark" | "menuitem" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "webview" +>className : string +>classes : "" +>rest : React.HTMLAttributes + +{children} +>children : any[] + + +>Tag : "object" | "time" | "link" | "menu" | "dialog" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "main" | "map" | "mark" | "menuitem" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "webview" + diff --git a/tests/cases/compiler/reactTagNameComponentWithPropsNoOOM.tsx b/tests/cases/compiler/reactTagNameComponentWithPropsNoOOM.tsx new file mode 100644 index 00000000000..e6011974230 --- /dev/null +++ b/tests/cases/compiler/reactTagNameComponentWithPropsNoOOM.tsx @@ -0,0 +1,13 @@ +// @jsx: react +// @strict: true +/// + +import * as React from "react"; +declare const Tag: keyof React.ReactHTML; + +const classes = ""; +const rest: {} = {}; +const children: any[] = []; + +{children} + \ No newline at end of file diff --git a/tests/cases/compiler/reactTagNameComponentWithPropsNoOOM2.tsx b/tests/cases/compiler/reactTagNameComponentWithPropsNoOOM2.tsx new file mode 100644 index 00000000000..64d46b5dd95 --- /dev/null +++ b/tests/cases/compiler/reactTagNameComponentWithPropsNoOOM2.tsx @@ -0,0 +1,13 @@ +// @jsx: react +// @strict: true +/// + +import * as React from "react"; +declare const Tag: keyof React.ReactHTML; + +const classes = ""; +const rest: React.HTMLAttributes = {}; +const children: any[] = []; + +{children} + \ No newline at end of file diff --git a/tests/cases/conformance/types/intersection/intersectionTypeMembers.ts b/tests/cases/conformance/types/intersection/intersectionTypeMembers.ts index a350c657f61..bfb257b8ac2 100644 --- a/tests/cases/conformance/types/intersection/intersectionTypeMembers.ts +++ b/tests/cases/conformance/types/intersection/intersectionTypeMembers.ts @@ -42,3 +42,25 @@ const de: D & E = { other: { g: 101 } } } + +// Additional test case with >2 doubly nested members so fix for #31441 is tested w/ excess props +interface F { + nested: { doublyNested: { g: string; } } +} + +interface G { + nested: { doublyNested: { h: string; } } +} + +const defg: D & E & F & G = { + nested: { + doublyNested: { + d: 'yes', + f: 'no', + g: 'ok', + h: 'affirmative' + }, + different: { e: 12 }, + other: { g: 101 } + } +} From 63b8c6443f809367c2e902fb5261126755b23cca Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Tue, 28 May 2019 11:03:29 -0700 Subject: [PATCH 165/384] Update user baselines (#31615) --- tests/baselines/reference/user/bluebird.log | 106 +++++++++--------- .../user/chrome-devtools-frontend.log | 9 +- tests/baselines/reference/user/webpack.log | 5 +- 3 files changed, 56 insertions(+), 64 deletions(-) diff --git a/tests/baselines/reference/user/bluebird.log b/tests/baselines/reference/user/bluebird.log index 5c1689ff49b..26d7270bcb6 100644 --- a/tests/baselines/reference/user/bluebird.log +++ b/tests/baselines/reference/user/bluebird.log @@ -131,60 +131,62 @@ node_modules/bluebird/js/release/promise.js(65,15): error TS2350: Only a void fu node_modules/bluebird/js/release/promise.js(65,68): error TS2339: Property 'classString' does not exist on type 'typeof ret'. node_modules/bluebird/js/release/promise.js(95,22): error TS2339: Property 'isObject' does not exist on type 'typeof ret'. node_modules/bluebird/js/release/promise.js(99,59): error TS2339: Property 'classString' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(119,22): error TS2339: Property 'classString' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(121,32): error TS2339: Property 'classString' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(123,14): error TS2339: Property '_warn' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(136,68): error TS2339: Property 'classString' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(148,14): error TS2551: Property 'isFulfilled' does not exist on type 'Promise'. Did you mean '_setFulfilled'? -node_modules/bluebird/js/release/promise.js(149,37): error TS2339: Property 'value' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(151,21): error TS2551: Property 'isRejected' does not exist on type 'Promise'. Did you mean '_setRejected'? -node_modules/bluebird/js/release/promise.js(152,36): error TS2339: Property 'reason' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(160,14): error TS2339: Property '_warn' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(166,29): error TS2339: Property 'originatesFromRejection' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(177,9): error TS2339: Property '_captureStackTrace' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(207,9): error TS2339: Property '_captureStackTrace' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(214,15): error TS2350: Only a void function can be called with the 'new' keyword. -node_modules/bluebird/js/release/promise.js(214,68): error TS2339: Property 'classString' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(238,63): error TS2339: Property '_boundTo' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(241,14): error TS2339: Property '_fireEvent' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(253,20): error TS2339: Property '_unsetRejectionIsUnhandled' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(257,20): error TS2339: Property '_attachExtraTrace' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(264,26): error TS2339: Property 'domainBind' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(295,10): error TS2339: Property '_fireEvent' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(106,19): error TS2350: Only a void function can be called with the 'new' keyword. +node_modules/bluebird/js/release/promise.js(107,60): error TS2554: Expected 0 arguments, but got 1. +node_modules/bluebird/js/release/promise.js(124,22): error TS2339: Property 'classString' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(126,32): error TS2339: Property 'classString' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(128,14): error TS2339: Property '_warn' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(141,68): error TS2339: Property 'classString' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(153,14): error TS2551: Property 'isFulfilled' does not exist on type 'Promise'. Did you mean '_setFulfilled'? +node_modules/bluebird/js/release/promise.js(154,37): error TS2339: Property 'value' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(156,21): error TS2551: Property 'isRejected' does not exist on type 'Promise'. Did you mean '_setRejected'? +node_modules/bluebird/js/release/promise.js(157,36): error TS2339: Property 'reason' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(165,14): error TS2339: Property '_warn' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(171,29): error TS2339: Property 'originatesFromRejection' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(182,9): error TS2339: Property '_captureStackTrace' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(212,9): error TS2339: Property '_captureStackTrace' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(219,15): error TS2350: Only a void function can be called with the 'new' keyword. +node_modules/bluebird/js/release/promise.js(219,68): error TS2339: Property 'classString' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(243,63): error TS2339: Property '_boundTo' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(246,14): error TS2339: Property '_fireEvent' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(258,20): error TS2339: Property '_unsetRejectionIsUnhandled' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(262,20): error TS2339: Property '_attachExtraTrace' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(269,26): error TS2339: Property 'domainBind' does not exist on type 'typeof ret'. node_modules/bluebird/js/release/promise.js(300,10): error TS2339: Property '_fireEvent' does not exist on type 'Promise'. node_modules/bluebird/js/release/promise.js(305,10): error TS2339: Property '_fireEvent' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(322,10): error TS2339: Property '_fireEvent' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(339,42): error TS2339: Property '_isBound' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(400,50): error TS2339: Property 'domainBind' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(404,49): error TS2339: Property 'domainBind' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(412,50): error TS2339: Property 'domainBind' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(416,49): error TS2339: Property 'domainBind' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(434,26): error TS2339: Property '_propagateFrom' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(454,31): error TS2339: Property '_value' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(456,30): error TS2339: Property '_reason' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(459,17): error TS2339: Property '_attachExtraTrace' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(466,22): error TS2339: Property 'ensureErrorObject' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(470,18): error TS2339: Property 'classString' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(471,14): error TS2339: Property '_warn' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(473,10): error TS2339: Property '_attachExtraTrace' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(480,10): error TS2339: Property '_captureStackTrace' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(481,10): error TS2339: Property '_pushContext' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(483,18): error TS2339: Property '_execute' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(489,10): error TS2339: Property '_popContext' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(506,19): error TS2350: Only a void function can be called with the 'new' keyword. -node_modules/bluebird/js/release/promise.js(507,42): error TS2339: Property 'classString' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(558,22): error TS2339: Property '_promiseCancelled' does not exist on type '{}'. -node_modules/bluebird/js/release/promise.js(572,23): error TS2339: Property '_isResolved' does not exist on type '{}'. -node_modules/bluebird/js/release/promise.js(574,26): error TS2339: Property '_promiseFulfilled' does not exist on type '{}'. -node_modules/bluebird/js/release/promise.js(576,26): error TS2339: Property '_promiseRejected' does not exist on type '{}'. -node_modules/bluebird/js/release/promise.js(630,14): error TS2339: Property '_attachExtraTrace' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(642,14): error TS2339: Property '_dereferenceTrace' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(653,46): error TS2339: Property 'isNode' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(659,14): error TS2339: Property '_ensurePossibleRejectionHandled' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(699,10): error TS2339: Property '_clearCancellationData' does not exist on type 'Promise'. -node_modules/bluebird/js/release/promise.js(724,6): error TS2339: Property 'notEnumerableProp' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(754,10): error TS2339: Property 'toFastProperties' does not exist on type 'typeof ret'. -node_modules/bluebird/js/release/promise.js(755,10): error TS2339: Property 'toFastProperties' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(310,10): error TS2339: Property '_fireEvent' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(327,10): error TS2339: Property '_fireEvent' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(344,42): error TS2339: Property '_isBound' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(405,50): error TS2339: Property 'domainBind' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(409,49): error TS2339: Property 'domainBind' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(417,50): error TS2339: Property 'domainBind' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(421,49): error TS2339: Property 'domainBind' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(439,26): error TS2339: Property '_propagateFrom' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(459,31): error TS2339: Property '_value' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(461,30): error TS2339: Property '_reason' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(464,17): error TS2339: Property '_attachExtraTrace' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(471,22): error TS2339: Property 'ensureErrorObject' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(475,18): error TS2339: Property 'classString' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(476,14): error TS2339: Property '_warn' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(478,10): error TS2339: Property '_attachExtraTrace' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(485,10): error TS2339: Property '_captureStackTrace' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(486,10): error TS2339: Property '_pushContext' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(488,18): error TS2339: Property '_execute' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(494,10): error TS2339: Property '_popContext' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(511,19): error TS2350: Only a void function can be called with the 'new' keyword. +node_modules/bluebird/js/release/promise.js(512,42): error TS2339: Property 'classString' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(563,22): error TS2339: Property '_promiseCancelled' does not exist on type '{}'. +node_modules/bluebird/js/release/promise.js(577,23): error TS2339: Property '_isResolved' does not exist on type '{}'. +node_modules/bluebird/js/release/promise.js(579,26): error TS2339: Property '_promiseFulfilled' does not exist on type '{}'. +node_modules/bluebird/js/release/promise.js(581,26): error TS2339: Property '_promiseRejected' does not exist on type '{}'. +node_modules/bluebird/js/release/promise.js(635,14): error TS2339: Property '_attachExtraTrace' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(647,14): error TS2339: Property '_dereferenceTrace' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(658,46): error TS2339: Property 'isNode' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(664,14): error TS2339: Property '_ensurePossibleRejectionHandled' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(704,10): error TS2339: Property '_clearCancellationData' does not exist on type 'Promise'. +node_modules/bluebird/js/release/promise.js(737,6): error TS2339: Property 'notEnumerableProp' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(767,10): error TS2339: Property 'toFastProperties' does not exist on type 'typeof ret'. +node_modules/bluebird/js/release/promise.js(768,10): error TS2339: Property 'toFastProperties' does not exist on type 'typeof ret'. node_modules/bluebird/js/release/promise_array.js(5,20): error TS2339: Property 'isArray' does not exist on type 'typeof ret'. node_modules/bluebird/js/release/promise_array.js(26,6): error TS2339: Property 'inherits' does not exist on type 'typeof ret'. node_modules/bluebird/js/release/promise_array.js(61,19): error TS2339: Property 'asArray' does not exist on type 'typeof ret'. diff --git a/tests/baselines/reference/user/chrome-devtools-frontend.log b/tests/baselines/reference/user/chrome-devtools-frontend.log index bdde6b918c0..d32422fb416 100644 --- a/tests/baselines/reference/user/chrome-devtools-frontend.log +++ b/tests/baselines/reference/user/chrome-devtools-frontend.log @@ -698,13 +698,6 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(10092,16): error TS2304: Cannot find name 'd41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(10513,19): error TS2488: Type 'NodeListOf' must have a '[Symbol.iterator]()' method that returns an iterator. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(10811,19): error TS2304: Cannot find name 'getElementsInDocument'. -node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(11441,1): error TS2322: Type 'unknown' is not assignable to type 'number'. -node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(11444,1): error TS2322: Type 'unknown' is not assignable to type 'number'. -node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(11447,15): error TS2339: Property 'textLength' does not exist on type 'unknown'. -node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(11447,28): error TS2339: Property 'textLength' does not exist on type 'unknown'. -node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(11450,43): error TS2339: Property 'node' does not exist on type 'unknown'. -node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(11453,6): error TS2339: Property 'cssRule' does not exist on type 'unknown'. -node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(11460,6): error TS2339: Property 'cssRule' does not exist on type 'unknown'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(12197,34): error TS2554: Expected 0 arguments, but got 2. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(12327,36): error TS2554: Expected 0 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(13607,7): error TS2339: Property 'protocolMethod' does not exist on type 'Error'. @@ -3389,7 +3382,7 @@ node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(2765,22): error node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(2785,91): error TS2339: Property 'xRel' does not exist on type 'Pos'. node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(2855,32): error TS2339: Property 'left' does not exist on type 'never'. node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(2855,49): error TS2339: Property 'right' does not exist on type 'never'. -node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(2856,10): error TS2365: Operator '+' cannot be applied to types 'null' and '0 | 1'. +node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(2856,10): error TS2365: Operator '+' cannot be applied to types 'null' and '1 | 0'. node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(2858,32): error TS2339: Property 'left' does not exist on type 'never'. node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(2858,49): error TS2339: Property 'right' does not exist on type 'never'. node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(3034,25): error TS2339: Property 'xRel' does not exist on type 'Pos'. diff --git a/tests/baselines/reference/user/webpack.log b/tests/baselines/reference/user/webpack.log index 0cde6bb1623..ce91836eddf 100644 --- a/tests/baselines/reference/user/webpack.log +++ b/tests/baselines/reference/user/webpack.log @@ -1,10 +1,7 @@ Exit Code: 1 Standard output: -../../../../../built/local/lib.dom.d.ts(17676,19): error TS2451: Cannot redeclare block-scoped variable 'WebAssembly'. +../../../../../built/local/lib.dom.d.ts(17677,19): error TS2451: Cannot redeclare block-scoped variable 'WebAssembly'. declarations.d.ts(258,15): error TS2451: Cannot redeclare block-scoped variable 'WebAssembly'. -lib/ContextModuleFactory.js(253,50): error TS2339: Property 'concat' does not exist on type 'unknown'. -lib/web/JsonpChunkTemplatePlugin.js(13,6): error TS2339: Property 'id' does not exist on type 'unknown'. -lib/web/JsonpMainTemplatePlugin.js(501,11): error TS2339: Property 'id' does not exist on type 'unknown'. From cd09cbbd5e5e483d5441e41d0acbcde9e868af60 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 28 May 2019 13:13:46 -0700 Subject: [PATCH 166/384] Cache widened types (#31586) * Cache widened types * Fix lint --- src/compiler/checker.ts | 26 ++-- src/compiler/types.ts | 2 + .../reference/noImplicitThisBigThis.js | 115 ++++++++++++++++++ .../reference/noImplicitThisBigThis.symbols | 99 +++++++++++++++ .../reference/noImplicitThisBigThis.types | 103 ++++++++++++++++ tests/cases/compiler/noImplicitThisBigThis.ts | 50 ++++++++ 6 files changed, 386 insertions(+), 9 deletions(-) create mode 100644 tests/baselines/reference/noImplicitThisBigThis.js create mode 100644 tests/baselines/reference/noImplicitThisBigThis.symbols create mode 100644 tests/baselines/reference/noImplicitThisBigThis.types create mode 100644 tests/cases/compiler/noImplicitThisBigThis.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d59cf4c5470..85b3641f004 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14740,26 +14740,34 @@ namespace ts { function getWidenedTypeWithContext(type: Type, context: WideningContext | undefined): Type { if (getObjectFlags(type) & ObjectFlags.RequiresWidening) { + if (context === undefined && type.widened) { + return type.widened; + } + let result: Type | undefined; if (type.flags & TypeFlags.Nullable) { - return anyType; + result = anyType; } - if (isObjectLiteralType(type)) { - return getWidenedTypeOfObjectLiteral(type, context); + else if (isObjectLiteralType(type)) { + result = getWidenedTypeOfObjectLiteral(type, context); } - if (type.flags & TypeFlags.Union) { + else if (type.flags & TypeFlags.Union) { const unionContext = context || createWideningContext(/*parent*/ undefined, /*propertyName*/ undefined, (type).types); const widenedTypes = sameMap((type).types, t => t.flags & TypeFlags.Nullable ? t : getWidenedTypeWithContext(t, unionContext)); // Widening an empty object literal transitions from a highly restrictive type to // a highly inclusive one. For that reason we perform subtype reduction here if the // union includes empty object types (e.g. reducing {} | string to just {}). - return getUnionType(widenedTypes, some(widenedTypes, isEmptyObjectType) ? UnionReduction.Subtype : UnionReduction.Literal); + result = getUnionType(widenedTypes, some(widenedTypes, isEmptyObjectType) ? UnionReduction.Subtype : UnionReduction.Literal); } - if (type.flags & TypeFlags.Intersection) { - return getIntersectionType(sameMap((type).types, getWidenedType)); + else if (type.flags & TypeFlags.Intersection) { + result = getIntersectionType(sameMap((type).types, getWidenedType)); } - if (isArrayType(type) || isTupleType(type)) { - return createTypeReference((type).target, sameMap((type).typeArguments, getWidenedType)); + else if (isArrayType(type) || isTupleType(type)) { + result = createTypeReference((type).target, sameMap((type).typeArguments, getWidenedType)); } + if (result && context === undefined) { + type.widened = result; + } + return result || type; } return type; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 3a80655385d..cb646a0b687 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4013,6 +4013,8 @@ namespace ts { restrictiveInstantiation?: Type; // Instantiation with type parameters mapped to unconstrained form /* @internal */ immediateBaseConstraint?: Type; // Immediate base constraint cache + /* @internal */ + widened?: Type; // Cached widened form of the type } /* @internal */ diff --git a/tests/baselines/reference/noImplicitThisBigThis.js b/tests/baselines/reference/noImplicitThisBigThis.js new file mode 100644 index 00000000000..f2e633f2dcf --- /dev/null +++ b/tests/baselines/reference/noImplicitThisBigThis.js @@ -0,0 +1,115 @@ +//// [noImplicitThisBigThis.ts] +// https://github.com/microsoft/TypeScript/issues/29902 + +function createObj() { + return { + func1() { + return this; + }, + func2() { + return this; + }, + func3() { + return this; + } + }; +} + +function createObjNoCrash() { + return { + func1() { + return this; + }, + func2() { + return this; + }, + func3() { + return this; + }, + func4() { + return this; + }, + func5() { + return this; + }, + func6() { + return this; + }, + func7() { + return this; + }, + func8() { + return this; + }, + func9() { + return this; + } + }; +} + + +//// [noImplicitThisBigThis.js] +// https://github.com/microsoft/TypeScript/issues/29902 +function createObj() { + return { + func1: function () { + return this; + }, + func2: function () { + return this; + }, + func3: function () { + return this; + } + }; +} +function createObjNoCrash() { + return { + func1: function () { + return this; + }, + func2: function () { + return this; + }, + func3: function () { + return this; + }, + func4: function () { + return this; + }, + func5: function () { + return this; + }, + func6: function () { + return this; + }, + func7: function () { + return this; + }, + func8: function () { + return this; + }, + func9: function () { + return this; + } + }; +} + + +//// [noImplicitThisBigThis.d.ts] +declare function createObj(): { + func1(): any; + func2(): any; + func3(): any; +}; +declare function createObjNoCrash(): { + func1(): any; + func2(): any; + func3(): any; + func4(): any; + func5(): any; + func6(): any; + func7(): any; + func8(): any; + func9(): any; +}; diff --git a/tests/baselines/reference/noImplicitThisBigThis.symbols b/tests/baselines/reference/noImplicitThisBigThis.symbols new file mode 100644 index 00000000000..9f0c8c1bf24 --- /dev/null +++ b/tests/baselines/reference/noImplicitThisBigThis.symbols @@ -0,0 +1,99 @@ +=== tests/cases/compiler/noImplicitThisBigThis.ts === +// https://github.com/microsoft/TypeScript/issues/29902 + +function createObj() { +>createObj : Symbol(createObj, Decl(noImplicitThisBigThis.ts, 0, 0)) + + return { + func1() { +>func1 : Symbol(func1, Decl(noImplicitThisBigThis.ts, 3, 12)) + + return this; +>this : Symbol(__object, Decl(noImplicitThisBigThis.ts, 3, 10)) + + }, + func2() { +>func2 : Symbol(func2, Decl(noImplicitThisBigThis.ts, 6, 10)) + + return this; +>this : Symbol(__object, Decl(noImplicitThisBigThis.ts, 3, 10)) + + }, + func3() { +>func3 : Symbol(func3, Decl(noImplicitThisBigThis.ts, 9, 10)) + + return this; +>this : Symbol(__object, Decl(noImplicitThisBigThis.ts, 3, 10)) + } + }; +} + +function createObjNoCrash() { +>createObjNoCrash : Symbol(createObjNoCrash, Decl(noImplicitThisBigThis.ts, 14, 1)) + + return { + func1() { +>func1 : Symbol(func1, Decl(noImplicitThisBigThis.ts, 17, 12)) + + return this; +>this : Symbol(__object, Decl(noImplicitThisBigThis.ts, 17, 10)) + + }, + func2() { +>func2 : Symbol(func2, Decl(noImplicitThisBigThis.ts, 20, 10)) + + return this; +>this : Symbol(__object, Decl(noImplicitThisBigThis.ts, 17, 10)) + + }, + func3() { +>func3 : Symbol(func3, Decl(noImplicitThisBigThis.ts, 23, 10)) + + return this; +>this : Symbol(__object, Decl(noImplicitThisBigThis.ts, 17, 10)) + + }, + func4() { +>func4 : Symbol(func4, Decl(noImplicitThisBigThis.ts, 26, 10)) + + return this; +>this : Symbol(__object, Decl(noImplicitThisBigThis.ts, 17, 10)) + + }, + func5() { +>func5 : Symbol(func5, Decl(noImplicitThisBigThis.ts, 29, 10)) + + return this; +>this : Symbol(__object, Decl(noImplicitThisBigThis.ts, 17, 10)) + + }, + func6() { +>func6 : Symbol(func6, Decl(noImplicitThisBigThis.ts, 32, 10)) + + return this; +>this : Symbol(__object, Decl(noImplicitThisBigThis.ts, 17, 10)) + + }, + func7() { +>func7 : Symbol(func7, Decl(noImplicitThisBigThis.ts, 35, 10)) + + return this; +>this : Symbol(__object, Decl(noImplicitThisBigThis.ts, 17, 10)) + + }, + func8() { +>func8 : Symbol(func8, Decl(noImplicitThisBigThis.ts, 38, 10)) + + return this; +>this : Symbol(__object, Decl(noImplicitThisBigThis.ts, 17, 10)) + + }, + func9() { +>func9 : Symbol(func9, Decl(noImplicitThisBigThis.ts, 41, 10)) + + return this; +>this : Symbol(__object, Decl(noImplicitThisBigThis.ts, 17, 10)) + } + }; +} + diff --git a/tests/baselines/reference/noImplicitThisBigThis.types b/tests/baselines/reference/noImplicitThisBigThis.types new file mode 100644 index 00000000000..4e1731aebc7 --- /dev/null +++ b/tests/baselines/reference/noImplicitThisBigThis.types @@ -0,0 +1,103 @@ +=== tests/cases/compiler/noImplicitThisBigThis.ts === +// https://github.com/microsoft/TypeScript/issues/29902 + +function createObj() { +>createObj : () => { func1(): any; func2(): any; func3(): any; } + + return { +>{ func1() { return this; }, func2() { return this; }, func3() { return this; } } : { func1(): { func1(): any; func2(): any; func3(): any; }; func2(): { func1(): any; func2(): any; func3(): any; }; func3(): { func1(): any; func2(): any; func3(): any; }; } + + func1() { +>func1 : () => { func1(): any; func2(): any; func3(): any; } + + return this; +>this : { func1(): { func1(): any; func2(): any; func3(): any; }; func2(): { func1(): any; func2(): any; func3(): any; }; func3(): { func1(): any; func2(): any; func3(): any; }; } + + }, + func2() { +>func2 : () => { func1(): any; func2(): any; func3(): any; } + + return this; +>this : { func1(): { func1(): any; func2(): any; func3(): any; }; func2(): { func1(): any; func2(): any; func3(): any; }; func3(): { func1(): any; func2(): any; func3(): any; }; } + + }, + func3() { +>func3 : () => { func1(): any; func2(): any; func3(): any; } + + return this; +>this : { func1(): { func1(): any; func2(): any; func3(): any; }; func2(): { func1(): any; func2(): any; func3(): any; }; func3(): { func1(): any; func2(): any; func3(): any; }; } + } + }; +} + +function createObjNoCrash() { +>createObjNoCrash : () => { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; } + + return { +>{ func1() { return this; }, func2() { return this; }, func3() { return this; }, func4() { return this; }, func5() { return this; }, func6() { return this; }, func7() { return this; }, func8() { return this; }, func9() { return this; } } : { func1(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func2(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func3(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func4(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func5(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func6(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func7(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func8(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func9(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; } + + func1() { +>func1 : () => { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; } + + return this; +>this : { func1(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func2(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func3(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func4(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func5(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func6(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func7(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func8(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func9(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; } + + }, + func2() { +>func2 : () => { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; } + + return this; +>this : { func1(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func2(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func3(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func4(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func5(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func6(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func7(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func8(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func9(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; } + + }, + func3() { +>func3 : () => { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; } + + return this; +>this : { func1(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func2(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func3(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func4(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func5(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func6(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func7(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func8(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func9(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; } + + }, + func4() { +>func4 : () => { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; } + + return this; +>this : { func1(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func2(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func3(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func4(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func5(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func6(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func7(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func8(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func9(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; } + + }, + func5() { +>func5 : () => { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; } + + return this; +>this : { func1(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func2(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func3(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func4(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func5(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func6(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func7(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func8(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func9(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; } + + }, + func6() { +>func6 : () => { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; } + + return this; +>this : { func1(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func2(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func3(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func4(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func5(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func6(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func7(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func8(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func9(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; } + + }, + func7() { +>func7 : () => { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; } + + return this; +>this : { func1(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func2(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func3(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func4(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func5(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func6(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func7(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func8(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func9(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; } + + }, + func8() { +>func8 : () => { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; } + + return this; +>this : { func1(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func2(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func3(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func4(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func5(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func6(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func7(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func8(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func9(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; } + + }, + func9() { +>func9 : () => { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; } + + return this; +>this : { func1(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func2(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func3(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func4(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func5(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func6(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func7(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func8(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; func9(): { func1(): any; func2(): any; func3(): any; func4(): any; func5(): any; func6(): any; func7(): any; func8(): any; func9(): any; }; } + } + }; +} + diff --git a/tests/cases/compiler/noImplicitThisBigThis.ts b/tests/cases/compiler/noImplicitThisBigThis.ts new file mode 100644 index 00000000000..687f2f9355d --- /dev/null +++ b/tests/cases/compiler/noImplicitThisBigThis.ts @@ -0,0 +1,50 @@ +// @declaration: true +// @noImplicitThis: true + +// https://github.com/microsoft/TypeScript/issues/29902 + +function createObj() { + return { + func1() { + return this; + }, + func2() { + return this; + }, + func3() { + return this; + } + }; +} + +function createObjNoCrash() { + return { + func1() { + return this; + }, + func2() { + return this; + }, + func3() { + return this; + }, + func4() { + return this; + }, + func5() { + return this; + }, + func6() { + return this; + }, + func7() { + return this; + }, + func8() { + return this; + }, + func9() { + return this; + } + }; +} From 6a961b5bc5b4938ab46a9c3df5546574af775c70 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 28 May 2019 15:38:21 -0700 Subject: [PATCH 167/384] More tests --- src/harness/fourslash.ts | 9 ++++++-- src/services/findAllReferences.ts | 9 +++++++- tests/cases/fourslash/tsxRename1.ts | 8 +++---- tests/cases/fourslash/tsxRename2.ts | 7 +++--- tests/cases/fourslash/tsxRename3.ts | 7 +++--- tests/cases/fourslash/tsxRename4.ts | 8 +++---- tests/cases/fourslash/tsxRename5.ts | 5 ++-- tests/cases/fourslash/tsxRename6.ts | 6 +++-- tests/cases/fourslash/tsxRename7.ts | 9 ++++---- tests/cases/fourslash/tsxRename9.ts | 36 +++++++++++++++++++++-------- 10 files changed, 70 insertions(+), 34 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index c48da8bee56..edbb485a30b 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1191,9 +1191,14 @@ Actual: ${stringify(fullActual)}`); const sort = (locations: ReadonlyArray | undefined) => locations && ts.sort(locations, (r1, r2) => ts.compareStringsCaseSensitive(r1.fileName, r2.fileName) || r1.textSpan.start - r2.textSpan.start); - assert.deepEqual(sort(references), sort(ranges.map((rangeOrOptions): ts.RenameLocation => { + assert.deepEqual(sort(references), sort(ranges.map(rangeOrOptions => { const { range, ...prefixSuffixText } = "range" in rangeOrOptions ? rangeOrOptions : { range: rangeOrOptions }; - return { fileName: range.fileName, textSpan: ts.createTextSpanFromRange(range), ...prefixSuffixText }; + const result: ts.RenameLocation = { fileName: range.fileName, textSpan: ts.createTextSpanFromRange(range), ...prefixSuffixText }; + const { declarationRange } = (range.marker && range.marker.data || {}) as { declarationRange?: number; }; + if (declarationRange !== undefined) { + result.declarationSpan = ts.createTextSpanFromRange(this.getRanges()[declarationRange]); + } + return result; }))); } } diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index b29061076ff..72ac25c2e21 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -27,6 +27,8 @@ namespace ts.FindAllReferences { readonly textSpan: TextSpan; } export function nodeEntry(node: Node, kind: NodeEntryKind = EntryKind.Node): NodeEntry { + // TODO(shkamat):: + // JSXOpeningElement or JSXElement for tagName ? const declaration = getDeclarationForDeclarationSpan( isDeclaration(node) ? node : @@ -60,8 +62,13 @@ namespace ts.FindAllReferences { case SyntaxKind.ImportClause: return node.parent; + case SyntaxKind.JsxAttribute: + return (node as JsxAttribute).initializer === undefined ? + undefined : + node; + // Not really interesting definition - // Should we show whole object literal instead? + // TODO(shkamat):: Should we show whole object literal instead? case SyntaxKind.ShorthandPropertyAssignment: return undefined; diff --git a/tests/cases/fourslash/tsxRename1.ts b/tests/cases/fourslash/tsxRename1.ts index 4323e99df59..bdf2cf6d2ef 100644 --- a/tests/cases/fourslash/tsxRename1.ts +++ b/tests/cases/fourslash/tsxRename1.ts @@ -4,13 +4,13 @@ //// declare module JSX { //// interface Element { } //// interface IntrinsicElements { -//// [|div|]: { +//// [|[|{| "declarationRange": 0 |}div|]: { //// name?: string; //// isOpen?: boolean; -//// }; +//// };|] //// span: { n: string; }; //// } //// } //// var x = <[|div|] />; - -verify.rangesAreRenameLocations(); +const rangesByText = test.rangesByText(); +verify.rangesAreRenameLocations(rangesByText.get("div")); diff --git a/tests/cases/fourslash/tsxRename2.ts b/tests/cases/fourslash/tsxRename2.ts index e5e0688150c..7a578b3383d 100644 --- a/tests/cases/fourslash/tsxRename2.ts +++ b/tests/cases/fourslash/tsxRename2.ts @@ -5,12 +5,13 @@ //// interface Element { } //// interface IntrinsicElements { //// div: { -//// [|name|]?: string; +//// [|[|{| "declarationRange": 0 |}name|]?: string;|] //// isOpen?: boolean; //// }; //// span: { n: string; }; //// } //// } -//// var x =
; +//// var x =
; -verify.rangesAreRenameLocations(); +const rangesByText = test.rangesByText(); +verify.rangesAreRenameLocations(rangesByText.get("name")); diff --git a/tests/cases/fourslash/tsxRename3.ts b/tests/cases/fourslash/tsxRename3.ts index b997ea2fdca..5a8d0d7a19d 100644 --- a/tests/cases/fourslash/tsxRename3.ts +++ b/tests/cases/fourslash/tsxRename3.ts @@ -9,11 +9,12 @@ //// } //// class MyClass { //// props: { -//// [|name|]?: string; +//// [|[|{| "declarationRange": 0 |}name|]?: string;|] //// size?: number; //// } //// //// -//// var x = ; +//// var x = ; -verify.rangesAreRenameLocations(); +const rangesByText = test.rangesByText(); +verify.rangesAreRenameLocations(rangesByText.get("name")); diff --git a/tests/cases/fourslash/tsxRename4.ts b/tests/cases/fourslash/tsxRename4.ts index e46c2b7ebcb..1a932768b17 100644 --- a/tests/cases/fourslash/tsxRename4.ts +++ b/tests/cases/fourslash/tsxRename4.ts @@ -9,7 +9,7 @@ //// div: {}; //// } ////} -////class [|MyClass|] {} +////[|class [|{| "declarationRange": 0 |}MyClass|] {}|] //// ////<[|MyClass|]>; ////<[|MyClass|]/>; @@ -18,6 +18,6 @@ verify.noErrors(); -const [r0, r1, r2, r3, d0, d1] = test.ranges(); -verify.rangesAreRenameLocations([r0, r1, r2, r3]); -verify.rangesAreRenameLocations([d0, d1]); +const rangesByText = test.rangesByText(); +verify.rangesAreRenameLocations(rangesByText.get("MyClass")); +verify.rangesAreRenameLocations(rangesByText.get("div")); \ No newline at end of file diff --git a/tests/cases/fourslash/tsxRename5.ts b/tests/cases/fourslash/tsxRename5.ts index a4c70b4b1c3..5ccfcd61953 100644 --- a/tests/cases/fourslash/tsxRename5.ts +++ b/tests/cases/fourslash/tsxRename5.ts @@ -13,7 +13,8 @@ //// size?: number; //// } //// -//// var [|nn|]: string; +//// [|var [|{| "declarationRange": 0 |}nn|]: string;|] //// var x = ; -verify.rangesAreRenameLocations(); +const rangesByText = test.rangesByText(); +verify.rangesAreRenameLocations(rangesByText.get("nn")); diff --git a/tests/cases/fourslash/tsxRename6.ts b/tests/cases/fourslash/tsxRename6.ts index 6f999c12760..f8c2ab41ebf 100644 --- a/tests/cases/fourslash/tsxRename6.ts +++ b/tests/cases/fourslash/tsxRename6.ts @@ -15,11 +15,13 @@ //// propString: string //// optional?: boolean //// } -//// declare function [|Opt|](attributes: OptionPropBag): JSX.Element; +//// [|declare function [|{| "declarationRange": 0 |}Opt|](attributes: OptionPropBag): JSX.Element;|] //// let opt = <[|Opt|] />; //// let opt1 = <[|Opt|] propx={100} propString />; //// let opt2 = <[|Opt|] propx={100} optional/>; //// let opt3 = <[|Opt|] wrong />; //// let opt4 = <[|Opt|] propx={100} propString="hi" />; -verify.rangesAreRenameLocations(); +//verify.rangesAreRenameLocations(); +const rangesByText = test.rangesByText(); +verify.rangesAreRenameLocations(rangesByText.get("Opt")); diff --git a/tests/cases/fourslash/tsxRename7.ts b/tests/cases/fourslash/tsxRename7.ts index 5533db1b4db..8565487c240 100644 --- a/tests/cases/fourslash/tsxRename7.ts +++ b/tests/cases/fourslash/tsxRename7.ts @@ -11,14 +11,15 @@ //// interface ElementAttributesProperty { props; } //// } //// interface OptionPropBag { -//// [|propx|]: number +//// [|[|{| "declarationRange": 0 |}propx|]: number|] //// propString: string //// optional?: boolean //// } //// declare function Opt(attributes: OptionPropBag): JSX.Element; //// let opt = ; -//// let opt1 = ; -//// let opt2 = ; +//// let opt1 = ; +//// let opt2 = ; //// let opt3 = ; -verify.rangesAreRenameLocations(); +const rangesByText = test.rangesByText(); +verify.rangesAreRenameLocations(rangesByText.get("propx")); diff --git a/tests/cases/fourslash/tsxRename9.ts b/tests/cases/fourslash/tsxRename9.ts index b39b009634d..763b9af68a2 100644 --- a/tests/cases/fourslash/tsxRename9.ts +++ b/tests/cases/fourslash/tsxRename9.ts @@ -15,19 +15,37 @@ //// className?: string; //// } //// interface ButtonProps extends ClickableProps { -//// [|onClick|](event?: React.MouseEvent): void; +//// [|[|{| "declarationRange": 0 |}onClick|](event?: React.MouseEvent): void;|] //// } //// interface LinkProps extends ClickableProps { -//// [|goTo|]: string; +//// [|[|{| "declarationRange": 2 |}goTo|]: string;|] //// } -//// declare function [|MainButton|](buttonProps: ButtonProps): JSX.Element; -//// declare function [|MainButton|](linkProps: LinkProps): JSX.Element; -//// declare function [|MainButton|](props: ButtonProps | LinkProps): JSX.Element; +//// [|declare function [|{| "declarationRange": 4 |}MainButton|](buttonProps: ButtonProps): JSX.Element;|] +//// [|declare function [|{| "declarationRange": 6 |}MainButton|](linkProps: LinkProps): JSX.Element;|] +//// [|declare function [|{| "declarationRange": 8 |}MainButton|](props: ButtonProps | LinkProps): JSX.Element;|] //// let opt = <[|MainButton|] />; //// let opt = <[|MainButton|] children="chidlren" />; -//// let opt = <[|MainButton|] [|onClick|]={()=>{}} />; -//// let opt = <[|MainButton|] [|onClick|]={()=>{}} [|ignore-prop|] />; -//// let opt = <[|MainButton|] [|goTo|]="goTo" />; +//// let opt = <[|MainButton|] [|[|{| "declarationRange": 13 |}onClick|]={()=>{}}|] />; +//// let opt = <[|MainButton|] [|[|{| "declarationRange": 16 |}onClick|]={()=>{}}|] [|ignore-prop|] />; +//// let opt = <[|MainButton|] [|[|{| "declarationRange": 20 |}goTo|]="goTo"|] />; //// let opt = <[|MainButton|] [|wrong|] />; -verify.rangesWithSameTextAreRenameLocations(); +const [ + onClickDef_0, onClick_1, + goToDef_2, goTo_3, + mainButtonDef_4, mainButton_5, + mainButtonDef_6, mainButton_7, + mainButtonDef_8, mainButton_9, + mainButton_10, + mainButton_11, + mainButton_12, onClickDef_13, onClick_14, + mainButton_15, onClickDef_16, onClick_17, ignoreProp_18, + mainButton_19, goToDef_20, goTo_21, + mainButton_22, wrong_23 +] = test.ranges(); +const rangesByText = test.rangesByText(); +verify.rangesAreRenameLocations(rangesByText.get("onClick")); +verify.rangesAreRenameLocations(rangesByText.get("goTo")); +verify.rangesAreRenameLocations(rangesByText.get("MainButton")); +verify.rangesAreRenameLocations(rangesByText.get("ignore-prop")); +verify.rangesAreRenameLocations(rangesByText.get("wrong")); \ No newline at end of file From b75a90e95ab619a8874737a1bce136284b963e11 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 28 May 2019 16:32:10 -0700 Subject: [PATCH 168/384] Return type inference should not include parameter inferences --- src/compiler/checker.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5091f5f0306..e83137b87e8 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14864,13 +14864,6 @@ namespace ts { return context && createInferenceContextWorker(map(context.inferences, cloneInferenceInfo), context.signature, context.flags | extraFlags, context.compareTypes); } - function cloneInferredPartOfContext(context: InferenceContext): InferenceContext | undefined { - const inferences = filter(context.inferences, hasInferenceCandidates); - return inferences.length ? - createInferenceContextWorker(map(inferences, cloneInferenceInfo), context.signature, context.flags, context.compareTypes) : - undefined; - } - function createInferenceContextWorker(inferences: InferenceInfo[], signature: Signature | undefined, flags: InferenceFlags, compareTypes: TypeComparer): InferenceContext { const context: InferenceContext = { inferences, @@ -20846,7 +20839,8 @@ namespace ts { // We clone the inference context to avoid disturbing a resolution in progress for an // outer call expression. Effectively we just want a snapshot of whatever has been // inferred for any outer call expression so far. - const outerMapper = getMapperFromContext(cloneInferenceContext(getInferenceContext(node), InferenceFlags.NoDefault)); + const outerContext = getInferenceContext(node); + const outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, InferenceFlags.NoDefault)); const instantiatedType = instantiateType(contextualType, outerMapper); // If the contextual type is a generic function type with a single call signature, we // instantiate the type with its own type parameters and type arguments. This ensures that @@ -20864,7 +20858,10 @@ namespace ts { inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, InferencePriority.ReturnType); // Create a type mapper for instantiating generic contextual types using the inferences made // from the return type. - context.returnMapper = getMapperFromContext(cloneInferredPartOfContext(context)); + const returnContext = createInferenceContext(signature.typeParameters!, signature, context.flags); + const returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper); + inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType); + context.returnMapper = some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(returnContext) : undefined; } } From 94f19c7edd741ea7fe985c57541dcf233677d22b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 29 May 2019 08:59:44 -0700 Subject: [PATCH 169/384] Update version to 3.6.0. --- package.json | 2 +- src/compiler/core.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a50a79aff13..ae67f3166b5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "3.5.0", + "version": "3.6.0", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 0034c275999..f1511b79c12 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1,7 +1,7 @@ namespace ts { // WARNING: The script `configureNightly.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configureNightly` too. - export const versionMajorMinor = "3.5"; + export const versionMajorMinor = "3.6"; /** The version of the TypeScript compiler release */ export const version = `${versionMajorMinor}.0-dev`; } From c5c869f673044d7e0daa27e194103409251d89dd Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 29 May 2019 10:20:49 -0700 Subject: [PATCH 170/384] Accepted baselines --- tests/baselines/reference/api/tsserverlibrary.d.ts | 2 +- tests/baselines/reference/api/typescript.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 993a7494994..e940c5055ff 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "3.5"; + const versionMajorMinor = "3.6"; /** The version of the TypeScript compiler release */ const version: string; } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 58ccd42344b..d67a1638a5e 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "3.5"; + const versionMajorMinor = "3.6"; /** The version of the TypeScript compiler release */ const version: string; } From 08cd0b3700cbe62a170d9c5693170fc0210d598a Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 29 May 2019 12:42:43 -0700 Subject: [PATCH 171/384] Use proper variances when inferring between type alias instantiations --- src/compiler/checker.ts | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 85b3641f004..99ae67d764f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15171,11 +15171,7 @@ namespace ts { if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { // Source and target are types originating in the same generic type alias declaration. // Simply infer from source type arguments to target type arguments. - const sourceTypes = source.aliasTypeArguments; - const targetTypes = target.aliasTypeArguments!; - for (let i = 0; i < sourceTypes.length; i++) { - inferFromTypes(sourceTypes[i], targetTypes[i]); - } + inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments!, getAliasVariances(source.aliasSymbol)); return; } if (source.flags & TypeFlags.Union && target.flags & TypeFlags.Union && !(source.flags & TypeFlags.EnumLiteral && target.flags & TypeFlags.EnumLiteral) || @@ -15281,18 +15277,7 @@ namespace ts { } if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (source).target === (target).target) { // If source and target are references to the same generic type, infer from type arguments - const sourceTypes = (source).typeArguments || emptyArray; - const targetTypes = (target).typeArguments || emptyArray; - const count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length; - const variances = getVariances((source).target); - for (let i = 0; i < count; i++) { - if (i < variances.length && (variances[i] & VarianceFlags.VarianceMask) === VarianceFlags.Contravariant) { - inferFromContravariantTypes(sourceTypes[i], targetTypes[i]); - } - else { - inferFromTypes(sourceTypes[i], targetTypes[i]); - } - } + inferFromTypeArguments((source).typeArguments || emptyArray, (target).typeArguments || emptyArray, getVariances((source).target)); } else if (source.flags & TypeFlags.Index && target.flags & TypeFlags.Index) { contravariant = !contravariant; @@ -15412,6 +15397,18 @@ namespace ts { } } + function inferFromTypeArguments(sourceTypes: readonly Type[], targetTypes: readonly Type[], variances: readonly VarianceFlags[]) { + const count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length; + for (let i = 0; i < count; i++) { + if (i < variances.length && (variances[i] & VarianceFlags.VarianceMask) === VarianceFlags.Contravariant) { + inferFromContravariantTypes(sourceTypes[i], targetTypes[i]); + } + else { + inferFromTypes(sourceTypes[i], targetTypes[i]); + } + } + } + function inferFromContravariantTypes(source: Type, target: Type) { if (strictFunctionTypes || priority & InferencePriority.AlwaysStrict) { contravariant = !contravariant; From 22475e8958ce2892c5311c3249165548606b10e8 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 29 May 2019 13:09:51 -0700 Subject: [PATCH 172/384] Add regression tests --- .../contravariantTypeAliasInference.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/cases/compiler/contravariantTypeAliasInference.ts diff --git a/tests/cases/compiler/contravariantTypeAliasInference.ts b/tests/cases/compiler/contravariantTypeAliasInference.ts new file mode 100644 index 00000000000..77044eeae76 --- /dev/null +++ b/tests/cases/compiler/contravariantTypeAliasInference.ts @@ -0,0 +1,19 @@ +// @strict: true + +type Func1 = (x: T) => void; +type Func2 = ((x: T) => void) | undefined; + +declare let f1: Func1; +declare let f2: Func1<"a">; + +declare function foo(f1: Func1, f2: Func1): void; + +foo(f1, f2); + +declare let g1: Func2; +declare let g2: Func2<"a">; + +declare function bar(g1: Func2, g2: Func2): void; + +bar(f1, f2); +bar(g1, g2); From bb412ab73b1cbc9eaa38145bc733b3325c55f30d Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 29 May 2019 13:10:01 -0700 Subject: [PATCH 173/384] Accept new baselines --- .../contravariantTypeAliasInference.js | 25 ++++++++ .../contravariantTypeAliasInference.symbols | 64 +++++++++++++++++++ .../contravariantTypeAliasInference.types | 49 ++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 tests/baselines/reference/contravariantTypeAliasInference.js create mode 100644 tests/baselines/reference/contravariantTypeAliasInference.symbols create mode 100644 tests/baselines/reference/contravariantTypeAliasInference.types diff --git a/tests/baselines/reference/contravariantTypeAliasInference.js b/tests/baselines/reference/contravariantTypeAliasInference.js new file mode 100644 index 00000000000..a0a7b45db91 --- /dev/null +++ b/tests/baselines/reference/contravariantTypeAliasInference.js @@ -0,0 +1,25 @@ +//// [contravariantTypeAliasInference.ts] +type Func1 = (x: T) => void; +type Func2 = ((x: T) => void) | undefined; + +declare let f1: Func1; +declare let f2: Func1<"a">; + +declare function foo(f1: Func1, f2: Func1): void; + +foo(f1, f2); + +declare let g1: Func2; +declare let g2: Func2<"a">; + +declare function bar(g1: Func2, g2: Func2): void; + +bar(f1, f2); +bar(g1, g2); + + +//// [contravariantTypeAliasInference.js] +"use strict"; +foo(f1, f2); +bar(f1, f2); +bar(g1, g2); diff --git a/tests/baselines/reference/contravariantTypeAliasInference.symbols b/tests/baselines/reference/contravariantTypeAliasInference.symbols new file mode 100644 index 00000000000..ff34d3ea17e --- /dev/null +++ b/tests/baselines/reference/contravariantTypeAliasInference.symbols @@ -0,0 +1,64 @@ +=== tests/cases/compiler/contravariantTypeAliasInference.ts === +type Func1 = (x: T) => void; +>Func1 : Symbol(Func1, Decl(contravariantTypeAliasInference.ts, 0, 0)) +>T : Symbol(T, Decl(contravariantTypeAliasInference.ts, 0, 11)) +>x : Symbol(x, Decl(contravariantTypeAliasInference.ts, 0, 17)) +>T : Symbol(T, Decl(contravariantTypeAliasInference.ts, 0, 11)) + +type Func2 = ((x: T) => void) | undefined; +>Func2 : Symbol(Func2, Decl(contravariantTypeAliasInference.ts, 0, 31)) +>T : Symbol(T, Decl(contravariantTypeAliasInference.ts, 1, 11)) +>x : Symbol(x, Decl(contravariantTypeAliasInference.ts, 1, 18)) +>T : Symbol(T, Decl(contravariantTypeAliasInference.ts, 1, 11)) + +declare let f1: Func1; +>f1 : Symbol(f1, Decl(contravariantTypeAliasInference.ts, 3, 11)) +>Func1 : Symbol(Func1, Decl(contravariantTypeAliasInference.ts, 0, 0)) + +declare let f2: Func1<"a">; +>f2 : Symbol(f2, Decl(contravariantTypeAliasInference.ts, 4, 11)) +>Func1 : Symbol(Func1, Decl(contravariantTypeAliasInference.ts, 0, 0)) + +declare function foo(f1: Func1, f2: Func1): void; +>foo : Symbol(foo, Decl(contravariantTypeAliasInference.ts, 4, 27)) +>T : Symbol(T, Decl(contravariantTypeAliasInference.ts, 6, 21)) +>f1 : Symbol(f1, Decl(contravariantTypeAliasInference.ts, 6, 24)) +>Func1 : Symbol(Func1, Decl(contravariantTypeAliasInference.ts, 0, 0)) +>T : Symbol(T, Decl(contravariantTypeAliasInference.ts, 6, 21)) +>f2 : Symbol(f2, Decl(contravariantTypeAliasInference.ts, 6, 37)) +>Func1 : Symbol(Func1, Decl(contravariantTypeAliasInference.ts, 0, 0)) +>T : Symbol(T, Decl(contravariantTypeAliasInference.ts, 6, 21)) + +foo(f1, f2); +>foo : Symbol(foo, Decl(contravariantTypeAliasInference.ts, 4, 27)) +>f1 : Symbol(f1, Decl(contravariantTypeAliasInference.ts, 3, 11)) +>f2 : Symbol(f2, Decl(contravariantTypeAliasInference.ts, 4, 11)) + +declare let g1: Func2; +>g1 : Symbol(g1, Decl(contravariantTypeAliasInference.ts, 10, 11)) +>Func2 : Symbol(Func2, Decl(contravariantTypeAliasInference.ts, 0, 31)) + +declare let g2: Func2<"a">; +>g2 : Symbol(g2, Decl(contravariantTypeAliasInference.ts, 11, 11)) +>Func2 : Symbol(Func2, Decl(contravariantTypeAliasInference.ts, 0, 31)) + +declare function bar(g1: Func2, g2: Func2): void; +>bar : Symbol(bar, Decl(contravariantTypeAliasInference.ts, 11, 27)) +>T : Symbol(T, Decl(contravariantTypeAliasInference.ts, 13, 21)) +>g1 : Symbol(g1, Decl(contravariantTypeAliasInference.ts, 13, 24)) +>Func2 : Symbol(Func2, Decl(contravariantTypeAliasInference.ts, 0, 31)) +>T : Symbol(T, Decl(contravariantTypeAliasInference.ts, 13, 21)) +>g2 : Symbol(g2, Decl(contravariantTypeAliasInference.ts, 13, 37)) +>Func2 : Symbol(Func2, Decl(contravariantTypeAliasInference.ts, 0, 31)) +>T : Symbol(T, Decl(contravariantTypeAliasInference.ts, 13, 21)) + +bar(f1, f2); +>bar : Symbol(bar, Decl(contravariantTypeAliasInference.ts, 11, 27)) +>f1 : Symbol(f1, Decl(contravariantTypeAliasInference.ts, 3, 11)) +>f2 : Symbol(f2, Decl(contravariantTypeAliasInference.ts, 4, 11)) + +bar(g1, g2); +>bar : Symbol(bar, Decl(contravariantTypeAliasInference.ts, 11, 27)) +>g1 : Symbol(g1, Decl(contravariantTypeAliasInference.ts, 10, 11)) +>g2 : Symbol(g2, Decl(contravariantTypeAliasInference.ts, 11, 11)) + diff --git a/tests/baselines/reference/contravariantTypeAliasInference.types b/tests/baselines/reference/contravariantTypeAliasInference.types new file mode 100644 index 00000000000..9ff197cdfce --- /dev/null +++ b/tests/baselines/reference/contravariantTypeAliasInference.types @@ -0,0 +1,49 @@ +=== tests/cases/compiler/contravariantTypeAliasInference.ts === +type Func1 = (x: T) => void; +>Func1 : Func1 +>x : T + +type Func2 = ((x: T) => void) | undefined; +>Func2 : Func2 +>x : T + +declare let f1: Func1; +>f1 : Func1 + +declare let f2: Func1<"a">; +>f2 : Func1<"a"> + +declare function foo(f1: Func1, f2: Func1): void; +>foo : (f1: Func1, f2: Func1) => void +>f1 : Func1 +>f2 : Func1 + +foo(f1, f2); +>foo(f1, f2) : void +>foo : (f1: Func1, f2: Func1) => void +>f1 : Func1 +>f2 : Func1<"a"> + +declare let g1: Func2; +>g1 : Func2 + +declare let g2: Func2<"a">; +>g2 : Func2<"a"> + +declare function bar(g1: Func2, g2: Func2): void; +>bar : (g1: Func2, g2: Func2) => void +>g1 : Func2 +>g2 : Func2 + +bar(f1, f2); +>bar(f1, f2) : void +>bar : (g1: Func2, g2: Func2) => void +>f1 : Func1 +>f2 : Func1<"a"> + +bar(g1, g2); +>bar(g1, g2) : void +>bar : (g1: Func2, g2: Func2) => void +>g1 : Func2 +>g2 : Func2<"a"> + From 953153e565caa9eaad5572d1eac7cc7c997e8464 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Thu, 30 May 2019 11:12:25 -0700 Subject: [PATCH 174/384] Update user baselines (#31674) --- .../reference/user/chrome-devtools-frontend.log | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tests/baselines/reference/user/chrome-devtools-frontend.log b/tests/baselines/reference/user/chrome-devtools-frontend.log index d32422fb416..6b6b46ab180 100644 --- a/tests/baselines/reference/user/chrome-devtools-frontend.log +++ b/tests/baselines/reference/user/chrome-devtools-frontend.log @@ -3122,9 +3122,6 @@ node_modules/chrome-devtools-frontend/front_end/bindings/BreakpointManager.js(53 node_modules/chrome-devtools-frontend/front_end/bindings/BreakpointManager.js(655,51): error TS2339: Property 'valuesArray' does not exist on type 'Map'. node_modules/chrome-devtools-frontend/front_end/bindings/BreakpointManager.js(667,51): error TS2339: Property 'valuesArray' does not exist on type 'Map'. node_modules/chrome-devtools-frontend/front_end/bindings/BreakpointManager.js(674,79): error TS2345: Argument of type 'this' is not assignable to parameter of type '{ modelAdded(model: T): void; modelRemoved(model: T): void; }'. - Type 'Breakpoint' is not assignable to type '{ modelAdded(model: T): void; modelRemoved(model: T): void; }'. - Types of property 'modelAdded' are incompatible. - Type '(debuggerModel: DebuggerModel) => void' is not assignable to type '(model: T) => void'. node_modules/chrome-devtools-frontend/front_end/bindings/BreakpointManager.js(713,51): error TS2339: Property 'valuesArray' does not exist on type 'Map'. node_modules/chrome-devtools-frontend/front_end/bindings/BreakpointManager.js(787,14): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. node_modules/chrome-devtools-frontend/front_end/bindings/BreakpointManager.js(862,14): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type. @@ -6621,8 +6618,6 @@ node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapsho Type 'HeapSnapshotNode' is not assignable to type '{ itemIndex(): number; serialize(): any; }'. Property '_snapshot' does not exist on type '{ itemIndex(): number; serialize(): any; }'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2341,15): error TS2345: Argument of type 'HeapSnapshotNodeIndexProvider' is not assignable to parameter of type '{ itemForIndex(newIndex: number): { itemIndex(): number; serialize(): any; }; }'. - Types of property 'itemForIndex' are incompatible. - Type '(index: number) => HeapSnapshotNode' is not assignable to type '(newIndex: number) => { itemIndex(): number; serialize(): any; }'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2353,12): error TS2339: Property 'nodeIndex' does not exist on type 'void'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2354,16): error TS2339: Property 'id' does not exist on type 'void'. node_modules/chrome-devtools-frontend/front_end/heap_snapshot_worker/HeapSnapshot.js(2397,13): error TS2339: Property 'nodeIndex' does not exist on type 'void'. @@ -7707,9 +7702,6 @@ node_modules/chrome-devtools-frontend/front_end/network_log/NetworkLog.js(44,57) Type 'T' is not assignable to type 'NetworkManager'. node_modules/chrome-devtools-frontend/front_end/network_log/NetworkLog.js(99,59): error TS2345: Argument of type 'this' is not assignable to parameter of type '{ modelAdded(model: T): void; modelRemoved(model: T): void; }'. node_modules/chrome-devtools-frontend/front_end/network_log/NetworkLog.js(101,61): error TS2345: Argument of type 'this' is not assignable to parameter of type '{ modelAdded(model: T): void; modelRemoved(model: T): void; }'. - Type 'NetworkLog' is not assignable to type '{ modelAdded(model: T): void; modelRemoved(model: T): void; }'. - Types of property 'modelAdded' are incompatible. - Type '(networkManager: NetworkManager) => void' is not assignable to type '(model: T) => void'. node_modules/chrome-devtools-frontend/front_end/network_log/NetworkLog.js(123,24): error TS2694: Namespace 'Protocol' has no exported member 'Network'. node_modules/chrome-devtools-frontend/front_end/network_log/NetworkLog.js(154,49): error TS2694: Namespace 'NetworkLog.NetworkLog' has no exported member '_InitiatorInfo'. node_modules/chrome-devtools-frontend/front_end/network_log/NetworkLog.js(165,38): error TS2694: Namespace 'NetworkLog.NetworkLog' has no exported member '_InitiatorInfo'. @@ -10835,7 +10827,7 @@ node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(45,10 node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(46,24): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(54,43): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(69,55): error TS2339: Property 'runtime' does not exist on type 'Window'. -node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(85,5): error TS2739: Type '{ tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is missing the following properties from type '{ appendApplicableItems(locationName: string): void; appendView(view: { viewId(): string; title(): string; isCloseable(): boolean; isTransient(): boolean; toolbarItems(): Promise; widget(): Promise<...>; disposeView(): void; }, insertBefore?: { ...; }): void; showView(view: { ...; }, insertBefore?: { ...': appendApplicableItems, appendView, showView, removeView, widget +node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(85,5): error TS2322: Type '{ tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ appendApplicableItems(locationName: string): void; appendView(view: { viewId(): string; title(): string; isCloseable(): boolean; isTransient(): boolean; toolbarItems(): Promise; widget(): Promise<...>; disposeView(): void; }, insertBefore?: { ...; }): void; showView(view: { ...; }, insertBefore?: { ...'. node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(100,15): error TS2339: Property 'keyCode' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(119,31): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(121,42): error TS2339: Property 'createChild' does not exist on type 'Element'. @@ -11362,7 +11354,7 @@ node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(133,55): node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(208,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(227,52): error TS2339: Property '_instance' does not exist on type 'typeof WrapperView'. node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(242,40): error TS2339: Property '_instance' does not exist on type 'typeof WrapperView'. -node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(257,7): error TS2739: Type '{ tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is missing the following properties from type '{ appendApplicableItems(locationName: string): void; appendView(view: { viewId(): string; title(): string; isCloseable(): boolean; isTransient(): boolean; toolbarItems(): Promise; widget(): Promise<...>; disposeView(): void; }, insertBefore?: { ...; }): void; showView(view: { ...; }, insertBefore?: { ...': appendApplicableItems, appendView, showView, removeView, widget +node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(257,7): error TS2322: Type '{ tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ appendApplicableItems(locationName: string): void; appendView(view: { viewId(): string; title(): string; isCloseable(): boolean; isTransient(): boolean; toolbarItems(): Promise; widget(): Promise<...>; disposeView(): void; }, insertBefore?: { ...; }): void; showView(view: { ...; }, insertBefore?: { ...'. node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(277,20): error TS2339: Property 'window' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(289,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(330,22): error TS2694: Namespace 'Common' has no exported member 'Event'. @@ -12884,8 +12876,8 @@ node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(53,50): erro node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(69,40): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(80,24): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(92,51): error TS2339: Property 'runtime' does not exist on type 'Window'. -node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(116,7): error TS2739: Type '{ tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is missing the following properties from type '{ appendApplicableItems(locationName: string): void; appendView(view: { viewId(): string; title(): string; isCloseable(): boolean; isTransient(): boolean; toolbarItems(): Promise; widget(): Promise<...>; disposeView(): void; }, insertBefore?: { ...; }): void; showView(view: { ...; }, insertBefore?: { ...': appendApplicableItems, appendView, showView, removeView, widget -node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(118,7): error TS2739: Type '{ tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is missing the following properties from type '{ appendApplicableItems(locationName: string): void; appendView(view: { viewId(): string; title(): string; isCloseable(): boolean; isTransient(): boolean; toolbarItems(): Promise; widget(): Promise<...>; disposeView(): void; }, insertBefore?: { ...; }): void; showView(view: { ...; }, insertBefore?: { ...': appendApplicableItems, appendView, showView, removeView, widget +node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(116,7): error TS2322: Type '{ tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ appendApplicableItems(locationName: string): void; appendView(view: { viewId(): string; title(): string; isCloseable(): boolean; isTransient(): boolean; toolbarItems(): Promise; widget(): Promise<...>; disposeView(): void; }, insertBefore?: { ...; }): void; showView(view: { ...; }, insertBefore?: { ...'. +node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(118,7): error TS2322: Type '{ tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ appendApplicableItems(locationName: string): void; appendView(view: { viewId(): string; title(): string; isCloseable(): boolean; isTransient(): boolean; toolbarItems(): Promise; widget(): Promise<...>; disposeView(): void; }, insertBefore?: { ...; }): void; showView(view: { ...; }, insertBefore?: { ...'. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(247,73): error TS2339: Property 'altKey' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(247,89): error TS2339: Property 'shiftKey' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(254,17): error TS2339: Property 'keyCode' does not exist on type 'Event'. From 8948fe415f05e8fcfeacbbfec3130121c9b62028 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 30 May 2019 12:45:11 -0700 Subject: [PATCH 175/384] Rename declarationRange to declarationRangeIndex --- src/harness/fourslash.ts | 12 ++++++------ tests/cases/fourslash/tsxRename1.ts | 2 +- tests/cases/fourslash/tsxRename2.ts | 4 ++-- tests/cases/fourslash/tsxRename3.ts | 4 ++-- tests/cases/fourslash/tsxRename4.ts | 2 +- tests/cases/fourslash/tsxRename5.ts | 2 +- tests/cases/fourslash/tsxRename6.ts | 2 +- tests/cases/fourslash/tsxRename7.ts | 6 +++--- tests/cases/fourslash/tsxRename9.ts | 16 ++++++++-------- tests/cases/fourslash/untypedModuleImport.ts | 2 +- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index edbb485a30b..51e6c2dbe29 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -955,7 +955,7 @@ namespace FourSlash { const fullExpected = ts.map(parts, ({ definition, ranges }) => ({ definition: typeof definition === "string" ? definition : { ...definition, range: ts.createTextSpanFromRange(definition.range) }, references: ranges.map(r => { - const { isWriteAccess = false, isDefinition = false, isInString, declarationRange } = (r.marker && r.marker.data || {}) as { isWriteAccess?: boolean, isDefinition?: boolean, isInString?: true, declarationRange?: number }; + const { isWriteAccess = false, isDefinition = false, isInString, declarationRangeIndex } = (r.marker && r.marker.data || {}) as { isWriteAccess?: boolean, isDefinition?: boolean, isInString?: true, declarationRangeIndex?: number }; const result: ts.ReferenceEntry = { fileName: r.fileName, textSpan: ts.createTextSpanFromRange(r), @@ -963,8 +963,8 @@ namespace FourSlash { isDefinition, ...(isInString ? { isInString: true } : undefined), }; - if (declarationRange !== undefined) { - result.declarationSpan = ts.createTextSpanFromRange(this.getRanges()[declarationRange]); + if (declarationRangeIndex !== undefined) { + result.declarationSpan = ts.createTextSpanFromRange(this.getRanges()[declarationRangeIndex]); } return result; }), @@ -1194,9 +1194,9 @@ Actual: ${stringify(fullActual)}`); assert.deepEqual(sort(references), sort(ranges.map(rangeOrOptions => { const { range, ...prefixSuffixText } = "range" in rangeOrOptions ? rangeOrOptions : { range: rangeOrOptions }; const result: ts.RenameLocation = { fileName: range.fileName, textSpan: ts.createTextSpanFromRange(range), ...prefixSuffixText }; - const { declarationRange } = (range.marker && range.marker.data || {}) as { declarationRange?: number; }; - if (declarationRange !== undefined) { - result.declarationSpan = ts.createTextSpanFromRange(this.getRanges()[declarationRange]); + const { declarationRangeIndex } = (range.marker && range.marker.data || {}) as { declarationRangeIndex?: number; }; + if (declarationRangeIndex !== undefined) { + result.declarationSpan = ts.createTextSpanFromRange(this.getRanges()[declarationRangeIndex]); } return result; }))); diff --git a/tests/cases/fourslash/tsxRename1.ts b/tests/cases/fourslash/tsxRename1.ts index bdf2cf6d2ef..25a4032032d 100644 --- a/tests/cases/fourslash/tsxRename1.ts +++ b/tests/cases/fourslash/tsxRename1.ts @@ -4,7 +4,7 @@ //// declare module JSX { //// interface Element { } //// interface IntrinsicElements { -//// [|[|{| "declarationRange": 0 |}div|]: { +//// [|[|{| "declarationRangeIndex": 0 |}div|]: { //// name?: string; //// isOpen?: boolean; //// };|] diff --git a/tests/cases/fourslash/tsxRename2.ts b/tests/cases/fourslash/tsxRename2.ts index 7a578b3383d..e79e7746d52 100644 --- a/tests/cases/fourslash/tsxRename2.ts +++ b/tests/cases/fourslash/tsxRename2.ts @@ -5,13 +5,13 @@ //// interface Element { } //// interface IntrinsicElements { //// div: { -//// [|[|{| "declarationRange": 0 |}name|]?: string;|] +//// [|[|{| "declarationRangeIndex": 0 |}name|]?: string;|] //// isOpen?: boolean; //// }; //// span: { n: string; }; //// } //// } -//// var x =
; +//// var x =
; const rangesByText = test.rangesByText(); verify.rangesAreRenameLocations(rangesByText.get("name")); diff --git a/tests/cases/fourslash/tsxRename3.ts b/tests/cases/fourslash/tsxRename3.ts index 5a8d0d7a19d..7970c314f45 100644 --- a/tests/cases/fourslash/tsxRename3.ts +++ b/tests/cases/fourslash/tsxRename3.ts @@ -9,12 +9,12 @@ //// } //// class MyClass { //// props: { -//// [|[|{| "declarationRange": 0 |}name|]?: string;|] +//// [|[|{| "declarationRangeIndex": 0 |}name|]?: string;|] //// size?: number; //// } //// //// -//// var x = ; +//// var x = ; const rangesByText = test.rangesByText(); verify.rangesAreRenameLocations(rangesByText.get("name")); diff --git a/tests/cases/fourslash/tsxRename4.ts b/tests/cases/fourslash/tsxRename4.ts index 1a932768b17..cfd9b379fb7 100644 --- a/tests/cases/fourslash/tsxRename4.ts +++ b/tests/cases/fourslash/tsxRename4.ts @@ -9,7 +9,7 @@ //// div: {}; //// } ////} -////[|class [|{| "declarationRange": 0 |}MyClass|] {}|] +////[|class [|{| "declarationRangeIndex": 0 |}MyClass|] {}|] //// ////<[|MyClass|]>; ////<[|MyClass|]/>; diff --git a/tests/cases/fourslash/tsxRename5.ts b/tests/cases/fourslash/tsxRename5.ts index 5ccfcd61953..d57da4b083a 100644 --- a/tests/cases/fourslash/tsxRename5.ts +++ b/tests/cases/fourslash/tsxRename5.ts @@ -13,7 +13,7 @@ //// size?: number; //// } //// -//// [|var [|{| "declarationRange": 0 |}nn|]: string;|] +//// [|var [|{| "declarationRangeIndex": 0 |}nn|]: string;|] //// var x = ; const rangesByText = test.rangesByText(); diff --git a/tests/cases/fourslash/tsxRename6.ts b/tests/cases/fourslash/tsxRename6.ts index f8c2ab41ebf..3b0068d16b9 100644 --- a/tests/cases/fourslash/tsxRename6.ts +++ b/tests/cases/fourslash/tsxRename6.ts @@ -15,7 +15,7 @@ //// propString: string //// optional?: boolean //// } -//// [|declare function [|{| "declarationRange": 0 |}Opt|](attributes: OptionPropBag): JSX.Element;|] +//// [|declare function [|{| "declarationRangeIndex": 0 |}Opt|](attributes: OptionPropBag): JSX.Element;|] //// let opt = <[|Opt|] />; //// let opt1 = <[|Opt|] propx={100} propString />; //// let opt2 = <[|Opt|] propx={100} optional/>; diff --git a/tests/cases/fourslash/tsxRename7.ts b/tests/cases/fourslash/tsxRename7.ts index 8565487c240..57b5da71cfc 100644 --- a/tests/cases/fourslash/tsxRename7.ts +++ b/tests/cases/fourslash/tsxRename7.ts @@ -11,14 +11,14 @@ //// interface ElementAttributesProperty { props; } //// } //// interface OptionPropBag { -//// [|[|{| "declarationRange": 0 |}propx|]: number|] +//// [|[|{| "declarationRangeIndex": 0 |}propx|]: number|] //// propString: string //// optional?: boolean //// } //// declare function Opt(attributes: OptionPropBag): JSX.Element; //// let opt = ; -//// let opt1 = ; -//// let opt2 = ; +//// let opt1 = ; +//// let opt2 = ; //// let opt3 = ; const rangesByText = test.rangesByText(); diff --git a/tests/cases/fourslash/tsxRename9.ts b/tests/cases/fourslash/tsxRename9.ts index 763b9af68a2..8de7a1c6d86 100644 --- a/tests/cases/fourslash/tsxRename9.ts +++ b/tests/cases/fourslash/tsxRename9.ts @@ -15,19 +15,19 @@ //// className?: string; //// } //// interface ButtonProps extends ClickableProps { -//// [|[|{| "declarationRange": 0 |}onClick|](event?: React.MouseEvent): void;|] +//// [|[|{| "declarationRangeIndex": 0 |}onClick|](event?: React.MouseEvent): void;|] //// } //// interface LinkProps extends ClickableProps { -//// [|[|{| "declarationRange": 2 |}goTo|]: string;|] +//// [|[|{| "declarationRangeIndex": 2 |}goTo|]: string;|] //// } -//// [|declare function [|{| "declarationRange": 4 |}MainButton|](buttonProps: ButtonProps): JSX.Element;|] -//// [|declare function [|{| "declarationRange": 6 |}MainButton|](linkProps: LinkProps): JSX.Element;|] -//// [|declare function [|{| "declarationRange": 8 |}MainButton|](props: ButtonProps | LinkProps): JSX.Element;|] +//// [|declare function [|{| "declarationRangeIndex": 4 |}MainButton|](buttonProps: ButtonProps): JSX.Element;|] +//// [|declare function [|{| "declarationRangeIndex": 6 |}MainButton|](linkProps: LinkProps): JSX.Element;|] +//// [|declare function [|{| "declarationRangeIndex": 8 |}MainButton|](props: ButtonProps | LinkProps): JSX.Element;|] //// let opt = <[|MainButton|] />; //// let opt = <[|MainButton|] children="chidlren" />; -//// let opt = <[|MainButton|] [|[|{| "declarationRange": 13 |}onClick|]={()=>{}}|] />; -//// let opt = <[|MainButton|] [|[|{| "declarationRange": 16 |}onClick|]={()=>{}}|] [|ignore-prop|] />; -//// let opt = <[|MainButton|] [|[|{| "declarationRange": 20 |}goTo|]="goTo"|] />; +//// let opt = <[|MainButton|] [|[|{| "declarationRangeIndex": 13 |}onClick|]={()=>{}}|] />; +//// let opt = <[|MainButton|] [|[|{| "declarationRangeIndex": 16 |}onClick|]={()=>{}}|] [|ignore-prop|] />; +//// let opt = <[|MainButton|] [|[|{| "declarationRangeIndex": 20 |}goTo|]="goTo"|] />; //// let opt = <[|MainButton|] [|wrong|] />; const [ diff --git a/tests/cases/fourslash/untypedModuleImport.ts b/tests/cases/fourslash/untypedModuleImport.ts index e64d37d0e6c..783e020e3fc 100644 --- a/tests/cases/fourslash/untypedModuleImport.ts +++ b/tests/cases/fourslash/untypedModuleImport.ts @@ -4,7 +4,7 @@ ////{} // @Filename: a.ts -////[|import /*foo*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRange": 0 |}foo|] from /*fooModule*/"[|{| "isInString": true |}foo|]";|] +////[|import /*foo*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|] from /*fooModule*/"[|{| "isInString": true |}foo|]";|] ////[|foo|](); goTo.file("a.ts"); From f37ae23f7efb5e357746750785cda7daebbbf6d5 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 30 May 2019 13:17:57 -0700 Subject: [PATCH 176/384] More test fixes --- tests/cases/fourslash/tsxFindAllReferences1.ts | 12 ++++++++---- tests/cases/fourslash/tsxFindAllReferences10.ts | 12 ++++++++---- tests/cases/fourslash/tsxFindAllReferences2.ts | 10 +++++++--- tests/cases/fourslash/tsxFindAllReferences3.ts | 10 +++++++--- tests/cases/fourslash/tsxFindAllReferences4.ts | 10 +++++++--- tests/cases/fourslash/tsxFindAllReferences5.ts | 8 ++++++-- tests/cases/fourslash/tsxFindAllReferences7.ts | 12 ++++++++---- tests/cases/fourslash/tsxFindAllReferences8.ts | 12 ++++++++---- tests/cases/fourslash/tsxFindAllReferences9.ts | 7 ++++--- .../tsxFindAllReferencesUnionElementType1.ts | 5 +++-- .../tsxFindAllReferencesUnionElementType2.ts | 5 +++-- 11 files changed, 69 insertions(+), 34 deletions(-) diff --git a/tests/cases/fourslash/tsxFindAllReferences1.ts b/tests/cases/fourslash/tsxFindAllReferences1.ts index 550dd05606c..1602bc7dae9 100644 --- a/tests/cases/fourslash/tsxFindAllReferences1.ts +++ b/tests/cases/fourslash/tsxFindAllReferences1.ts @@ -4,16 +4,20 @@ //// declare module JSX { //// interface Element { } //// interface IntrinsicElements { -//// [|{| "isWriteAccess": true, "isDefinition": true |}div|]: { +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}div|]: { //// name?: string; //// isOpen?: boolean; -//// }; +//// };|] //// span: { n: string; }; //// } //// } //// var x = <[|div|] />; -verify.singleReferenceGroup(`(property) JSX.IntrinsicElements.div: { +const rangesByText = test.rangesByText(); +verify.singleReferenceGroup( + `(property) JSX.IntrinsicElements.div: { name?: string; isOpen?: boolean; -}`); +}`, + rangesByText.get("div") +); diff --git a/tests/cases/fourslash/tsxFindAllReferences10.ts b/tests/cases/fourslash/tsxFindAllReferences10.ts index 58459c7df1f..29e57b97bd2 100644 --- a/tests/cases/fourslash/tsxFindAllReferences10.ts +++ b/tests/cases/fourslash/tsxFindAllReferences10.ts @@ -15,7 +15,7 @@ //// className?: string; //// } //// interface ButtonProps extends ClickableProps { -//// [|{| "isDefinition": true |}onClick|](event?: React.MouseEvent): void; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}onClick|](event?: React.MouseEvent): void;|] //// } //// interface LinkProps extends ClickableProps { //// goTo: string; @@ -25,9 +25,13 @@ //// declare function MainButton(props: ButtonProps | LinkProps): JSX.Element; //// let opt = ; //// let opt = ; -//// let opt = {}} />; -//// let opt = {}} ignore-prop />; +//// let opt = {}}|] />; +//// let opt = {}}|] ignore-prop />; //// let opt = ; //// let opt = ; -verify.singleReferenceGroup("(method) ButtonProps.onClick(event?: any): void"); +const rangesByText = test.rangesByText(); +verify.singleReferenceGroup( + "(method) ButtonProps.onClick(event?: any): void", + rangesByText.get("onClick") +); diff --git a/tests/cases/fourslash/tsxFindAllReferences2.ts b/tests/cases/fourslash/tsxFindAllReferences2.ts index e7fda5ab308..d83cb426992 100644 --- a/tests/cases/fourslash/tsxFindAllReferences2.ts +++ b/tests/cases/fourslash/tsxFindAllReferences2.ts @@ -5,12 +5,16 @@ //// interface Element { } //// interface IntrinsicElements { //// div: { -//// [|{| "isWriteAccess": true, "isDefinition": true |}name|]?: string; +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}name|]?: string;|] //// isOpen?: boolean; //// }; //// span: { n: string; }; //// } //// } -//// var x =
; +//// var x =
; -verify.singleReferenceGroup("(property) name?: string"); +const rangesByText = test.rangesByText(); +verify.singleReferenceGroup( + "(property) name ?: string", + rangesByText.get("name") +); diff --git a/tests/cases/fourslash/tsxFindAllReferences3.ts b/tests/cases/fourslash/tsxFindAllReferences3.ts index e2f9215466a..c519d5da99b 100644 --- a/tests/cases/fourslash/tsxFindAllReferences3.ts +++ b/tests/cases/fourslash/tsxFindAllReferences3.ts @@ -9,11 +9,15 @@ //// } //// class MyClass { //// props: { -//// [|{| "isDefinition": true |}name|]?: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}name|]?: string;|] //// size?: number; //// } //// //// -//// var x = ; +//// var x = ; -verify.singleReferenceGroup("(property) name?: string"); +const rangesByText = test.rangesByText(); +verify.singleReferenceGroup( + "(property) name?: string", + rangesByText.get("name") +); diff --git a/tests/cases/fourslash/tsxFindAllReferences4.ts b/tests/cases/fourslash/tsxFindAllReferences4.ts index c932ea57f36..5d7ce7419bb 100644 --- a/tests/cases/fourslash/tsxFindAllReferences4.ts +++ b/tests/cases/fourslash/tsxFindAllReferences4.ts @@ -7,13 +7,17 @@ //// } //// interface ElementAttributesProperty { props } //// } -//// class [|{| "isWriteAccess": true, "isDefinition": true |}MyClass|] { +//// [|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}MyClass|] { //// props: { //// name?: string; //// size?: number; -//// } +//// }|] //// //// //// var x = <[|MyClass|] name='hello'>; -verify.singleReferenceGroup("class MyClass"); +const rangesByText = test.rangesByText(); +verify.singleReferenceGroup( + "class MyClass", + rangesByText.get("MyClass") +); diff --git a/tests/cases/fourslash/tsxFindAllReferences5.ts b/tests/cases/fourslash/tsxFindAllReferences5.ts index 9358dd73dc5..265b1a015f3 100644 --- a/tests/cases/fourslash/tsxFindAllReferences5.ts +++ b/tests/cases/fourslash/tsxFindAllReferences5.ts @@ -15,11 +15,15 @@ //// propString: string //// optional?: boolean //// } -//// declare function [|{| "isWriteAccess": true, "isDefinition": true |}Opt|](attributes: OptionPropBag): JSX.Element; +//// [|declare function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Opt|](attributes: OptionPropBag): JSX.Element;|] //// let opt = <[|Opt|] />; //// let opt1 = <[|Opt|] propx={100} propString />; //// let opt2 = <[|Opt|] propx={100} optional/>; //// let opt3 = <[|Opt|] wrong />; //// let opt4 = <[|Opt|] propx={100} propString="hi" />; -verify.singleReferenceGroup("function Opt(attributes: OptionPropBag): JSX.Element"); +const rangesByText = test.rangesByText(); +verify.singleReferenceGroup( + "function Opt(attributes: OptionPropBag): JSX.Element", + rangesByText.get("Opt") +); diff --git a/tests/cases/fourslash/tsxFindAllReferences7.ts b/tests/cases/fourslash/tsxFindAllReferences7.ts index 471cf747258..22c19e1cc29 100644 --- a/tests/cases/fourslash/tsxFindAllReferences7.ts +++ b/tests/cases/fourslash/tsxFindAllReferences7.ts @@ -11,14 +11,18 @@ //// interface ElementAttributesProperty { props; } //// } //// interface OptionPropBag { -//// [|{| "isDefinition": true |}propx|]: number +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}propx|]: number|] //// propString: string //// optional?: boolean //// } //// declare function Opt(attributes: OptionPropBag): JSX.Element; //// let opt = ; -//// let opt1 = ; -//// let opt2 = ; +//// let opt1 = ; +//// let opt2 = ; //// let opt3 = ; -verify.singleReferenceGroup("(property) OptionPropBag.propx: number"); +const rangesByText = test.rangesByText(); +verify.singleReferenceGroup( + "(property) OptionPropBag.propx: number", + rangesByText.get("propx") +); diff --git a/tests/cases/fourslash/tsxFindAllReferences8.ts b/tests/cases/fourslash/tsxFindAllReferences8.ts index 0c216488892..b509a9565a0 100644 --- a/tests/cases/fourslash/tsxFindAllReferences8.ts +++ b/tests/cases/fourslash/tsxFindAllReferences8.ts @@ -20,9 +20,9 @@ //// interface LinkProps extends ClickableProps { //// goTo: string; //// } -//// declare function [|{| "isWriteAccess": true, "isDefinition": true |}MainButton|](buttonProps: ButtonProps): JSX.Element; -//// declare function [|{| "isWriteAccess": true, "isDefinition": true |}MainButton|](linkProps: LinkProps): JSX.Element; -//// declare function [|{| "isWriteAccess": true, "isDefinition": true |}MainButton|](props: ButtonProps | LinkProps): JSX.Element; +//// [|declare function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}MainButton|](buttonProps: ButtonProps): JSX.Element;|] +//// [|declare function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}MainButton|](linkProps: LinkProps): JSX.Element;|] +//// [|declare function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}MainButton|](props: ButtonProps | LinkProps): JSX.Element;|] //// let opt = <[|MainButton|] />; //// let opt = <[|MainButton|] children="chidlren" />; //// let opt = <[|MainButton|] onClick={()=>{}} />; @@ -30,4 +30,8 @@ //// let opt = <[|MainButton|] goTo="goTo" />; //// let opt = <[|MainButton|] wrong />; -verify.singleReferenceGroup("function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)"); +const rangesByText = test.rangesByText(); +verify.singleReferenceGroup( + "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", + rangesByText.get("MainButton") +); diff --git a/tests/cases/fourslash/tsxFindAllReferences9.ts b/tests/cases/fourslash/tsxFindAllReferences9.ts index bb45ce590cf..e10eb420926 100644 --- a/tests/cases/fourslash/tsxFindAllReferences9.ts +++ b/tests/cases/fourslash/tsxFindAllReferences9.ts @@ -18,7 +18,7 @@ //// onClick(event?: React.MouseEvent): void; //// } //// interface LinkProps extends ClickableProps { -//// [|{| "isDefinition": true |}goTo|]: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}goTo|]: string;|] //// } //// declare function MainButton(buttonProps: ButtonProps): JSX.Element; //// declare function MainButton(linkProps: LinkProps): JSX.Element; @@ -27,8 +27,9 @@ //// let opt = ; //// let opt = {}} />; //// let opt = {}} ignore-prop />; -//// let opt = ; +//// let opt = ; //// let opt = ; //// let opt = ; -verify.singleReferenceGroup("(property) LinkProps.goTo: string"); +const rangesByText = test.rangesByText(); +verify.singleReferenceGroup("(property) LinkProps.goTo: string", rangesByText.get("goTo")); diff --git a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts index 87adbc11873..9da352c64b1 100644 --- a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts +++ b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts @@ -18,11 +18,12 @@ //// return

World

; //// } -//// var [|{| "isWriteAccess": true, "isDefinition": true |}SFCComp|] = SFC1 || SFC2; +//// [|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}SFCComp|] = SFC1 || SFC2;|] //// <[|SFCComp|] x={ "hi" } /> +const [, r1, r2] = test.ranges(); verify.singleReferenceGroup(`var SFCComp: ((prop: { x: number; }) => JSX.Element) | ((prop: { x: boolean; -}) => JSX.Element)`); +}) => JSX.Element)`, [r1, r2]); diff --git a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts index 2498c8bf996..80291feb451 100644 --- a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts +++ b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts @@ -17,7 +17,8 @@ //// private method() { } //// } -//// var [|{| "isWriteAccess": true, "isDefinition": true |}RCComp|] = RC1 || RC2; +//// [|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}RCComp|] = RC1 || RC2;|] //// <[|RCComp|] /> -verify.singleReferenceGroup("var RCComp: typeof RC1"); +const [, r1, r2 ] = test.ranges(); +verify.singleReferenceGroup("var RCComp: typeof RC1", [r1, r2]); From 2b36fdd08b9a2618ad8531904d9c19ecbb503a2c Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 30 May 2019 14:40:03 -0700 Subject: [PATCH 177/384] Add regression tests --- .../inferFromGenericFunctionReturnTypes3.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts b/tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts index 429d98b6a39..d14111c7a7a 100644 --- a/tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts +++ b/tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts @@ -182,3 +182,22 @@ enum State { A, B } type Foo = { state: State } declare function bar(f: () => T[]): T[]; let x: Foo[] = bar(() => !!true ? [{ state: State.A }] : [{ state: State.B }]); // Error + +// Repros from #31443 + +enum Enum { A, B } + +class ClassWithConvert { + constructor(val: T) { } + convert(converter: { to: (v: T) => T; }) { } +} + +function fn(arg: ClassWithConvert, f: () => ClassWithConvert) { } +fn(new ClassWithConvert(Enum.A), () => new ClassWithConvert(Enum.A)); + +type Func = (x: T) => T; + +declare function makeFoo(x: T): Func; +declare function baz(x: Func, y: Func): void; + +baz(makeFoo(Enum.A), makeFoo(Enum.A)); From c3ef035b022b64c692aa9b3c8e691a269a68fc32 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 30 May 2019 14:40:09 -0700 Subject: [PATCH 178/384] Accept new baselines --- ...FromGenericFunctionReturnTypes3.errors.txt | 19 +++++ .../inferFromGenericFunctionReturnTypes3.js | 32 ++++++++ ...ferFromGenericFunctionReturnTypes3.symbols | 81 +++++++++++++++++++ ...inferFromGenericFunctionReturnTypes3.types | 67 +++++++++++++++ 4 files changed, 199 insertions(+) diff --git a/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.errors.txt b/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.errors.txt index 7c79c63f78a..aea21ac2504 100644 --- a/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.errors.txt +++ b/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.errors.txt @@ -200,4 +200,23 @@ tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts(180,26): error TS23 !!! error TS2322: Types of property 'state' are incompatible. !!! error TS2322: Type 'State.B' is not assignable to type 'State.A'. !!! related TS6502 tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts:179:28: The expected type comes from the return type of this signature. + + // Repros from #31443 + + enum Enum { A, B } + + class ClassWithConvert { + constructor(val: T) { } + convert(converter: { to: (v: T) => T; }) { } + } + + function fn(arg: ClassWithConvert, f: () => ClassWithConvert) { } + fn(new ClassWithConvert(Enum.A), () => new ClassWithConvert(Enum.A)); + + type Func = (x: T) => T; + + declare function makeFoo(x: T): Func; + declare function baz(x: Func, y: Func): void; + + baz(makeFoo(Enum.A), makeFoo(Enum.A)); \ No newline at end of file diff --git a/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.js b/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.js index 99070e6ddcb..b6a2e890b11 100644 --- a/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.js +++ b/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.js @@ -179,6 +179,25 @@ enum State { A, B } type Foo = { state: State } declare function bar(f: () => T[]): T[]; let x: Foo[] = bar(() => !!true ? [{ state: State.A }] : [{ state: State.B }]); // Error + +// Repros from #31443 + +enum Enum { A, B } + +class ClassWithConvert { + constructor(val: T) { } + convert(converter: { to: (v: T) => T; }) { } +} + +function fn(arg: ClassWithConvert, f: () => ClassWithConvert) { } +fn(new ClassWithConvert(Enum.A), () => new ClassWithConvert(Enum.A)); + +type Func = (x: T) => T; + +declare function makeFoo(x: T): Func; +declare function baz(x: Func, y: Func): void; + +baz(makeFoo(Enum.A), makeFoo(Enum.A)); //// [inferFromGenericFunctionReturnTypes3.js] @@ -278,6 +297,19 @@ var State; State[State["B"] = 1] = "B"; })(State || (State = {})); let x = bar(() => !!true ? [{ state: State.A }] : [{ state: State.B }]); // Error +// Repros from #31443 +var Enum; +(function (Enum) { + Enum[Enum["A"] = 0] = "A"; + Enum[Enum["B"] = 1] = "B"; +})(Enum || (Enum = {})); +class ClassWithConvert { + constructor(val) { } + convert(converter) { } +} +function fn(arg, f) { } +fn(new ClassWithConvert(Enum.A), () => new ClassWithConvert(Enum.A)); +baz(makeFoo(Enum.A), makeFoo(Enum.A)); //// [inferFromGenericFunctionReturnTypes3.d.ts] diff --git a/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.symbols b/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.symbols index f89421cde07..ecf867a2bf7 100644 --- a/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.symbols +++ b/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.symbols @@ -459,3 +459,84 @@ let x: Foo[] = bar(() => !!true ? [{ state: State.A }] : [{ state: State.B }]); >State : Symbol(State, Decl(inferFromGenericFunctionReturnTypes3.ts, 174, 56)) >B : Symbol(State.B, Decl(inferFromGenericFunctionReturnTypes3.ts, 176, 15)) +// Repros from #31443 + +enum Enum { A, B } +>Enum : Symbol(Enum, Decl(inferFromGenericFunctionReturnTypes3.ts, 179, 79)) +>A : Symbol(Enum.A, Decl(inferFromGenericFunctionReturnTypes3.ts, 183, 11)) +>B : Symbol(Enum.B, Decl(inferFromGenericFunctionReturnTypes3.ts, 183, 14)) + +class ClassWithConvert { +>ClassWithConvert : Symbol(ClassWithConvert, Decl(inferFromGenericFunctionReturnTypes3.ts, 183, 18)) +>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 185, 23)) + + constructor(val: T) { } +>val : Symbol(val, Decl(inferFromGenericFunctionReturnTypes3.ts, 186, 14)) +>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 185, 23)) + + convert(converter: { to: (v: T) => T; }) { } +>convert : Symbol(ClassWithConvert.convert, Decl(inferFromGenericFunctionReturnTypes3.ts, 186, 25)) +>converter : Symbol(converter, Decl(inferFromGenericFunctionReturnTypes3.ts, 187, 10)) +>to : Symbol(to, Decl(inferFromGenericFunctionReturnTypes3.ts, 187, 22)) +>v : Symbol(v, Decl(inferFromGenericFunctionReturnTypes3.ts, 187, 28)) +>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 185, 23)) +>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 185, 23)) +} + +function fn(arg: ClassWithConvert, f: () => ClassWithConvert) { } +>fn : Symbol(fn, Decl(inferFromGenericFunctionReturnTypes3.ts, 188, 1)) +>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 190, 12)) +>arg : Symbol(arg, Decl(inferFromGenericFunctionReturnTypes3.ts, 190, 15)) +>ClassWithConvert : Symbol(ClassWithConvert, Decl(inferFromGenericFunctionReturnTypes3.ts, 183, 18)) +>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 190, 12)) +>f : Symbol(f, Decl(inferFromGenericFunctionReturnTypes3.ts, 190, 40)) +>ClassWithConvert : Symbol(ClassWithConvert, Decl(inferFromGenericFunctionReturnTypes3.ts, 183, 18)) +>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 190, 12)) + +fn(new ClassWithConvert(Enum.A), () => new ClassWithConvert(Enum.A)); +>fn : Symbol(fn, Decl(inferFromGenericFunctionReturnTypes3.ts, 188, 1)) +>ClassWithConvert : Symbol(ClassWithConvert, Decl(inferFromGenericFunctionReturnTypes3.ts, 183, 18)) +>Enum.A : Symbol(Enum.A, Decl(inferFromGenericFunctionReturnTypes3.ts, 183, 11)) +>Enum : Symbol(Enum, Decl(inferFromGenericFunctionReturnTypes3.ts, 179, 79)) +>A : Symbol(Enum.A, Decl(inferFromGenericFunctionReturnTypes3.ts, 183, 11)) +>ClassWithConvert : Symbol(ClassWithConvert, Decl(inferFromGenericFunctionReturnTypes3.ts, 183, 18)) +>Enum.A : Symbol(Enum.A, Decl(inferFromGenericFunctionReturnTypes3.ts, 183, 11)) +>Enum : Symbol(Enum, Decl(inferFromGenericFunctionReturnTypes3.ts, 179, 79)) +>A : Symbol(Enum.A, Decl(inferFromGenericFunctionReturnTypes3.ts, 183, 11)) + +type Func = (x: T) => T; +>Func : Symbol(Func, Decl(inferFromGenericFunctionReturnTypes3.ts, 191, 69)) +>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 193, 10)) +>x : Symbol(x, Decl(inferFromGenericFunctionReturnTypes3.ts, 193, 16)) +>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 193, 10)) +>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 193, 10)) + +declare function makeFoo(x: T): Func; +>makeFoo : Symbol(makeFoo, Decl(inferFromGenericFunctionReturnTypes3.ts, 193, 27)) +>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 195, 25)) +>x : Symbol(x, Decl(inferFromGenericFunctionReturnTypes3.ts, 195, 28)) +>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 195, 25)) +>Func : Symbol(Func, Decl(inferFromGenericFunctionReturnTypes3.ts, 191, 69)) +>T : Symbol(T, Decl(inferFromGenericFunctionReturnTypes3.ts, 195, 25)) + +declare function baz(x: Func, y: Func): void; +>baz : Symbol(baz, Decl(inferFromGenericFunctionReturnTypes3.ts, 195, 43)) +>U : Symbol(U, Decl(inferFromGenericFunctionReturnTypes3.ts, 196, 21)) +>x : Symbol(x, Decl(inferFromGenericFunctionReturnTypes3.ts, 196, 24)) +>Func : Symbol(Func, Decl(inferFromGenericFunctionReturnTypes3.ts, 191, 69)) +>U : Symbol(U, Decl(inferFromGenericFunctionReturnTypes3.ts, 196, 21)) +>y : Symbol(y, Decl(inferFromGenericFunctionReturnTypes3.ts, 196, 35)) +>Func : Symbol(Func, Decl(inferFromGenericFunctionReturnTypes3.ts, 191, 69)) +>U : Symbol(U, Decl(inferFromGenericFunctionReturnTypes3.ts, 196, 21)) + +baz(makeFoo(Enum.A), makeFoo(Enum.A)); +>baz : Symbol(baz, Decl(inferFromGenericFunctionReturnTypes3.ts, 195, 43)) +>makeFoo : Symbol(makeFoo, Decl(inferFromGenericFunctionReturnTypes3.ts, 193, 27)) +>Enum.A : Symbol(Enum.A, Decl(inferFromGenericFunctionReturnTypes3.ts, 183, 11)) +>Enum : Symbol(Enum, Decl(inferFromGenericFunctionReturnTypes3.ts, 179, 79)) +>A : Symbol(Enum.A, Decl(inferFromGenericFunctionReturnTypes3.ts, 183, 11)) +>makeFoo : Symbol(makeFoo, Decl(inferFromGenericFunctionReturnTypes3.ts, 193, 27)) +>Enum.A : Symbol(Enum.A, Decl(inferFromGenericFunctionReturnTypes3.ts, 183, 11)) +>Enum : Symbol(Enum, Decl(inferFromGenericFunctionReturnTypes3.ts, 179, 79)) +>A : Symbol(Enum.A, Decl(inferFromGenericFunctionReturnTypes3.ts, 183, 11)) + diff --git a/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.types b/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.types index fd83694a171..4c56070fd3c 100644 --- a/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.types +++ b/tests/baselines/reference/inferFromGenericFunctionReturnTypes3.types @@ -506,3 +506,70 @@ let x: Foo[] = bar(() => !!true ? [{ state: State.A }] : [{ state: State.B }]); >State : typeof State >B : State.B +// Repros from #31443 + +enum Enum { A, B } +>Enum : Enum +>A : Enum.A +>B : Enum.B + +class ClassWithConvert { +>ClassWithConvert : ClassWithConvert + + constructor(val: T) { } +>val : T + + convert(converter: { to: (v: T) => T; }) { } +>convert : (converter: { to: (v: T) => T; }) => void +>converter : { to: (v: T) => T; } +>to : (v: T) => T +>v : T +} + +function fn(arg: ClassWithConvert, f: () => ClassWithConvert) { } +>fn : (arg: ClassWithConvert, f: () => ClassWithConvert) => void +>arg : ClassWithConvert +>f : () => ClassWithConvert + +fn(new ClassWithConvert(Enum.A), () => new ClassWithConvert(Enum.A)); +>fn(new ClassWithConvert(Enum.A), () => new ClassWithConvert(Enum.A)) : void +>fn : (arg: ClassWithConvert, f: () => ClassWithConvert) => void +>new ClassWithConvert(Enum.A) : ClassWithConvert +>ClassWithConvert : typeof ClassWithConvert +>Enum.A : Enum.A +>Enum : typeof Enum +>A : Enum.A +>() => new ClassWithConvert(Enum.A) : () => ClassWithConvert +>new ClassWithConvert(Enum.A) : ClassWithConvert +>ClassWithConvert : typeof ClassWithConvert +>Enum.A : Enum.A +>Enum : typeof Enum +>A : Enum.A + +type Func = (x: T) => T; +>Func : Func +>x : T + +declare function makeFoo(x: T): Func; +>makeFoo : (x: T) => Func +>x : T + +declare function baz(x: Func, y: Func): void; +>baz : (x: Func, y: Func) => void +>x : Func +>y : Func + +baz(makeFoo(Enum.A), makeFoo(Enum.A)); +>baz(makeFoo(Enum.A), makeFoo(Enum.A)) : void +>baz : (x: Func, y: Func) => void +>makeFoo(Enum.A) : Func +>makeFoo : (x: T) => Func +>Enum.A : Enum.A +>Enum : typeof Enum +>A : Enum.A +>makeFoo(Enum.A) : Func +>makeFoo : (x: T) => Func +>Enum.A : Enum.A +>Enum : typeof Enum +>A : Enum.A + From bbfbf8fa952d7ac5d9a074071af41471cc3af6a5 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 30 May 2019 14:18:18 -0700 Subject: [PATCH 179/384] Use import export sepcifier as declaration for the property name of import export as well --- src/services/findAllReferences.ts | 31 ++++++++++++++----- .../fourslash/transitiveExportImports.ts | 10 +++--- .../fourslash/transitiveExportImports2.ts | 10 +++--- .../fourslash/transitiveExportImports3.ts | 10 +++--- .../cases/fourslash/tsxFindAllReferences2.ts | 2 +- 5 files changed, 39 insertions(+), 24 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 72ac25c2e21..f8606e2bf1c 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -27,16 +27,31 @@ namespace ts.FindAllReferences { readonly textSpan: TextSpan; } export function nodeEntry(node: Node, kind: NodeEntryKind = EntryKind.Node): NodeEntry { + return { + kind, + node: (node as NamedDeclaration).name || node, + declaration: getDeclarationForDeclarationSpanForNode(node) + }; + } + + function getDeclarationForDeclarationSpanForNode(node: Node): Node | undefined { + if (isDeclaration(node)) { + return getDeclarationForDeclarationSpan(node); + } + // TODO(shkamat):: // JSXOpeningElement or JSXElement for tagName ? - const declaration = getDeclarationForDeclarationSpan( - isDeclaration(node) ? - node : - node.parent && isDeclaration(node.parent) && node.parent.name === node ? - node.parent : - undefined - ); - return { kind, node: (node as NamedDeclaration).name || node, declaration }; + if (!node.parent || !isDeclaration(node.parent)) { + return undefined; + } + + if (node.parent.name === node || // node is name of declaration, use parent + // Property name of the import export specifier use import/export specifier + isImportOrExportSpecifier(node.parent) && node.parent.propertyName === node) { + return getDeclarationForDeclarationSpan(node.parent); + } + + return undefined; } export function getDeclarationForDeclarationSpan(node: NamedDeclaration | undefined): Node | undefined { diff --git a/tests/cases/fourslash/transitiveExportImports.ts b/tests/cases/fourslash/transitiveExportImports.ts index 9cdfb2e3a12..fb5480b28c8 100644 --- a/tests/cases/fourslash/transitiveExportImports.ts +++ b/tests/cases/fourslash/transitiveExportImports.ts @@ -1,22 +1,22 @@ /// // @Filename: a.ts -////class [|{| "isWriteAccess": true, "isDefinition": true |}A|] { -////} +////[|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}A|] { +////}|] ////export = [|A|]; // @Filename: b.ts -////export import [|{| "isWriteAccess": true, "isDefinition": true |}b|] = require('./a'); +////[|export import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}b|] = require('./a');|] // @Filename: c.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}b|] = require('./b'); +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}b|] = require('./b');|] ////var a = new [|b|]./**/[|b|](); goTo.marker(); verify.quickInfoExists(); verify.noErrors(); -const [a0, a1, b0, c0, c1, c2] = test.ranges(); +const [a0Def, a0, a1, b0Def, b0, c0Def, c0, c1, c2] = test.ranges(); const aRanges = [a0, a1]; const bRanges = [b0, c2]; const cRanges = [c0, c1]; diff --git a/tests/cases/fourslash/transitiveExportImports2.ts b/tests/cases/fourslash/transitiveExportImports2.ts index 7ec1e61c02b..8070ad73e04 100644 --- a/tests/cases/fourslash/transitiveExportImports2.ts +++ b/tests/cases/fourslash/transitiveExportImports2.ts @@ -1,20 +1,20 @@ /// // @Filename: a.ts -////namespace [|{| "isWriteAccess": true, "isDefinition": true |}A|] { +////[|namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}A|] { //// export const x = 0; -////} +////}|] // @Filename: b.ts -////export import [|{| "isWriteAccess": true, "isDefinition": true |}B|] = [|A|]; +////[|export import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}B|] = [|A|];|] ////[|B|].x; // @Filename: c.ts -////import { [|{| "isWriteAccess": true, "isDefinition": true |}B|] } from "./b"; +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}B|] } from "./b";|] verify.noErrors(); -const [A0, B0, A1, B1, B2] = test.ranges(); +const [A0Def, A0, B0Def, B0, A1, B1, B2Def, B2] = test.ranges(); const aRanges = [A0, A1]; const bRanges = [B0, B1]; const cRanges = [B2]; diff --git a/tests/cases/fourslash/transitiveExportImports3.ts b/tests/cases/fourslash/transitiveExportImports3.ts index c5d6dfe9afc..ab8c5e8ca1b 100644 --- a/tests/cases/fourslash/transitiveExportImports3.ts +++ b/tests/cases/fourslash/transitiveExportImports3.ts @@ -1,16 +1,16 @@ /// // @Filename: a.ts -////export function [|{| "isWriteAccess": true, "isDefinition": true |}f|]() {} +////[|export function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}f|]() {}|] // @Filename: b.ts -////export { [|f|] as [|{| "isWriteAccess": true, "isDefinition": true |}g|] } from "./a"; -////import { [|{| "isWriteAccess": true, "isDefinition": true |}f|] } from "./a"; -////import { [|{| "isWriteAccess": true, "isDefinition": true |}g|] } from "./b"; +////[|export { [|{| "declarationRangeIndex": 2 |}f|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}g|] } from "./a";|] +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}f|] } from "./a";|] +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 7 |}g|] } from "./b";|] verify.noErrors(); -const [f0, f1, g0, f2, g1] = test.ranges(); +const [f0Def, f0, f1Def, f1, g0, f2Def, f2, g1Def, g1] = test.ranges(); const af = { definition: "function f(): void", ranges: [f0, f1] }; const g0Group = { definition: "(alias) function g(): void\nexport g", ranges: [g0] }; diff --git a/tests/cases/fourslash/tsxFindAllReferences2.ts b/tests/cases/fourslash/tsxFindAllReferences2.ts index d83cb426992..f1b71e51811 100644 --- a/tests/cases/fourslash/tsxFindAllReferences2.ts +++ b/tests/cases/fourslash/tsxFindAllReferences2.ts @@ -15,6 +15,6 @@ const rangesByText = test.rangesByText(); verify.singleReferenceGroup( - "(property) name ?: string", + "(property) name?: string", rangesByText.get("name") ); From 8c443b148179ebfe954944f8661731b401e388f9 Mon Sep 17 00:00:00 2001 From: Benjamin Lichtman Date: Thu, 30 May 2019 15:05:53 -0700 Subject: [PATCH 180/384] Stop invalidating resolution when file stays open --- src/compiler/resolutionCache.ts | 5 +++++ src/compiler/watch.ts | 1 + src/server/project.ts | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index b82a5a78d71..ff09efb05ea 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -54,6 +54,7 @@ namespace ts { writeLog(s: string): void; maxNumberOfFilesToIterateForInvalidation?: number; getCurrentProgram(): Program | undefined; + fileIsOpen(filePath: Path): boolean; } interface DirectoryWatchesOfFailedLookup { @@ -713,6 +714,10 @@ namespace ts { if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) { return false; } + // prevent saving an open file from over-eagerly triggering invalidation + if (resolutionHost.fileIsOpen(fileOrDirectoryPath)) { + return; + } // Ignore emits from the program if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) { return false; diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index f9bf2a8468d..0faf9f0c175 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -691,6 +691,7 @@ namespace ts { hasChangedAutomaticTypeDirectiveNames = true; scheduleProgramUpdate(); }; + compilerHost.fileIsOpen = () => false; compilerHost.maxNumberOfFilesToIterateForInvalidation = host.maxNumberOfFilesToIterateForInvalidation; compilerHost.getCurrentProgram = getCurrentProgram; compilerHost.writeLog = writeLog; diff --git a/src/server/project.ts b/src/server/project.ts index 20cd5667dd9..e10a0988f71 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -457,6 +457,11 @@ namespace ts.server { return this.getTypeAcquisition().enable ? this.projectService.typingsInstaller.globalTypingsCacheLocation : undefined; } + /*@internal*/ + fileIsOpen(filePath: Path) { + return this.projectService.openFiles.has(filePath); + } + /*@internal*/ writeLog(s: string) { this.projectService.logger.info(s); From 1fe9a0ad4ed30abe67418cb58f5dd06eb23391a6 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 30 May 2019 15:20:41 -0700 Subject: [PATCH 181/384] Small fix to user PR script (#31679) --- scripts/open-user-pr.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/open-user-pr.ts b/scripts/open-user-pr.ts index 0a636c267b8..23e4bb951d7 100644 --- a/scripts/open-user-pr.ts +++ b/scripts/open-user-pr.ts @@ -9,7 +9,7 @@ function padNum(number: number) { } const userName = process.env.GH_USERNAME; -const reviewers = process.env.requesting_user ? [process.env.requesting_user] : ["weswigham", "sandersn", "RyanCavanaugh"]; +const reviewers = process.env.REQUESTING_USER ? [process.env.REQUESTING_USER] : ["weswigham", "sandersn", "RyanCavanaugh"]; const now = new Date(); const branchName = `user-update-${process.env.TARGET_FORK}-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}${process.env.TARGET_BRANCH ? "-" + process.env.TARGET_BRANCH : ""}`; const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`; @@ -36,14 +36,14 @@ gh.pulls.create({ head: `${userName}:${branchName}`, base: process.env.TARGET_BRANCH || "master", body: -`${process.env.source_issue ? `This test run was triggerd by a request on https://github.com/Microsoft/TypeScript/pull/${process.env.source_issue} `+"\n" : ""}Please review the diff and merge if no changes are unexpected. +`${process.env.SOURCE_ISSUE ? `This test run was triggerd by a request on https://github.com/Microsoft/TypeScript/pull/${process.env.SOURCE_ISSUE} `+"\n" : ""}Please review the diff and merge if no changes are unexpected. You can view the build log [here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary). cc ${reviewers.map(r => "@" + r).join(" ")}`, }).then(async r => { const num = r.data.number; console.log(`Pull request ${num} created.`); - if (!process.env.source_issue) { + if (!process.env.SOURCE_ISSUE) { await gh.pulls.createReviewRequest({ owner: process.env.TARGET_FORK, repo: "TypeScript", @@ -53,7 +53,7 @@ cc ${reviewers.map(r => "@" + r).join(" ")}`, } else { await gh.issues.createComment({ - number: +process.env.source_issue, + number: +process.env.SOURCE_ISSUE, owner: "Microsoft", repo: "TypeScript", body: `The user suite test run you requested has finished and _failed_. I've opened a [PR with the baseline diff from master](${r.data.html_url}).` From 08d8f97bb45697812df434411469c19c80e789ed Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 30 May 2019 16:06:49 -0700 Subject: [PATCH 182/384] Add comment --- src/compiler/checker.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e83137b87e8..4558a284f32 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -20857,7 +20857,9 @@ namespace ts { // Inferences made from return types have lower priority than all other inferences. inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, InferencePriority.ReturnType); // Create a type mapper for instantiating generic contextual types using the inferences made - // from the return type. + // from the return type. We need a separate inference pass here because (a) instantiation of + // the source type uses the outer context's return mapper (which excludes inferences made from + // outer arguments), and (b) we don't want any further inferences going into this context. const returnContext = createInferenceContext(signature.typeParameters!, signature, context.flags); const returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper); inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType); From a30cacb562bf5cf8cd7ae8ade77f72421dddc58a Mon Sep 17 00:00:00 2001 From: Benjamin Lichtman Date: Thu, 30 May 2019 16:56:27 -0700 Subject: [PATCH 183/384] Add test --- .../unittests/tsserver/resolutionCache.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/testRunner/unittests/tsserver/resolutionCache.ts b/src/testRunner/unittests/tsserver/resolutionCache.ts index 33b59e2faae..11b604bb20c 100644 --- a/src/testRunner/unittests/tsserver/resolutionCache.ts +++ b/src/testRunner/unittests/tsserver/resolutionCache.ts @@ -975,5 +975,33 @@ export const x = 10;` host.checkTimeoutQueueLength(0); }); }); + + describe("avoid unnecessary invalidation", () => { + it("failed lookup invalidation", () => { + const expectedNonRelativeDirectories = [`${projectLocation}/node_modules`, `${projectLocation}/src`]; + const module1Name = "module1"; + const module2Name = "module2"; + const fileContent = `import { module1 } from "${module1Name}";import { module2 } from "${module2Name}";`; + const file1: File = { + path: `${projectLocation}/src/file1.ts`, + content: fileContent + }; + const { module1, module2 } = getModules(`${projectLocation}/src/node_modules/module1/index.ts`, `${projectLocation}/node_modules/module2/index.ts`); + const files = [module1, module2, file1, configFile, libFile]; + const host = createServerHost(files); + const resolutionTrace = createHostModuleResolutionTrace(host); + const service = createProjectService(host); + service.openClientFile(file1.path); + const project = service.configuredProjects.get(configFile.path)!; + (project as ResolutionCacheHost).maxNumberOfFilesToIterateForInvalidation = 1; + const expectedTrace = getExpectedNonRelativeModuleResolutionTrace(host, file1, module1, module1Name); + getExpectedNonRelativeModuleResolutionTrace(host, file1, module2, module2Name, expectedTrace); + verifyTrace(resolutionTrace, expectedTrace); + verifyWatchesWithConfigFile(host, files, file1, expectedNonRelativeDirectories); + + host.invokeWatchedDirectoriesRecursiveCallback(projectLocation + "/src", "file1.ts"); + host.checkTimeoutQueueLengthAndRun(0); + }); + }); }); } From 6b92ccaffaa6ccd789b80f5e506c64cc9111a30d Mon Sep 17 00:00:00 2001 From: Benjamin Lichtman Date: Thu, 30 May 2019 17:22:12 -0700 Subject: [PATCH 184/384] Respond to CR --- src/compiler/resolutionCache.ts | 2 +- src/compiler/watch.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index ff09efb05ea..6e0384219a1 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -716,7 +716,7 @@ namespace ts { } // prevent saving an open file from over-eagerly triggering invalidation if (resolutionHost.fileIsOpen(fileOrDirectoryPath)) { - return; + return false; } // Ignore emits from the program if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) { diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 0faf9f0c175..dbc78fa5d4e 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -691,7 +691,7 @@ namespace ts { hasChangedAutomaticTypeDirectiveNames = true; scheduleProgramUpdate(); }; - compilerHost.fileIsOpen = () => false; + compilerHost.fileIsOpen = returnFalse; compilerHost.maxNumberOfFilesToIterateForInvalidation = host.maxNumberOfFilesToIterateForInvalidation; compilerHost.getCurrentProgram = getCurrentProgram; compilerHost.writeLog = writeLog; From cf1bceb9e4a90b2425ff46fee3a9b01c7fbb7c60 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 30 May 2019 17:35:10 -0700 Subject: [PATCH 185/384] Add tests --- tests/cases/compiler/implicitIndexSignatures.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/cases/compiler/implicitIndexSignatures.ts b/tests/cases/compiler/implicitIndexSignatures.ts index 2e36a91bada..2239ad8a8e2 100644 --- a/tests/cases/compiler/implicitIndexSignatures.ts +++ b/tests/cases/compiler/implicitIndexSignatures.ts @@ -43,3 +43,15 @@ function f4() { const v3 = getNumberIndexValue(o1); const v4 = getNumberIndexValue(o2); } + +function f5() { + enum E1 { A, B } + enum E2 { A = "A", B = "B" } + enum E3 { A = 0, B = "B" } + const v1 = getStringIndexValue(E1); + const v2 = getStringIndexValue(E2); + const v3 = getStringIndexValue(E3); + const v4 = getNumberIndexValue(E1); + const v5 = getNumberIndexValue(E2); + const v6 = getNumberIndexValue(E3); +} From 8bd6fd85db1b4952b7d43c7efadbc0f6278ad5ec Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 30 May 2019 17:35:17 -0700 Subject: [PATCH 186/384] Accept new baselines --- .../reference/implicitIndexSignatures.js | 35 +++++++++++ .../reference/implicitIndexSignatures.symbols | 49 +++++++++++++++ .../reference/implicitIndexSignatures.types | 59 +++++++++++++++++++ 3 files changed, 143 insertions(+) diff --git a/tests/baselines/reference/implicitIndexSignatures.js b/tests/baselines/reference/implicitIndexSignatures.js index 6403f1f1543..a20c63979da 100644 --- a/tests/baselines/reference/implicitIndexSignatures.js +++ b/tests/baselines/reference/implicitIndexSignatures.js @@ -44,6 +44,18 @@ function f4() { const v3 = getNumberIndexValue(o1); const v4 = getNumberIndexValue(o2); } + +function f5() { + enum E1 { A, B } + enum E2 { A = "A", B = "B" } + enum E3 { A = 0, B = "B" } + const v1 = getStringIndexValue(E1); + const v2 = getStringIndexValue(E2); + const v3 = getStringIndexValue(E3); + const v4 = getNumberIndexValue(E1); + const v5 = getNumberIndexValue(E2); + const v6 = getNumberIndexValue(E3); +} //// [implicitIndexSignatures.js] @@ -83,3 +95,26 @@ function f4() { var v3 = getNumberIndexValue(o1); var v4 = getNumberIndexValue(o2); } +function f5() { + var E1; + (function (E1) { + E1[E1["A"] = 0] = "A"; + E1[E1["B"] = 1] = "B"; + })(E1 || (E1 = {})); + var E2; + (function (E2) { + E2["A"] = "A"; + E2["B"] = "B"; + })(E2 || (E2 = {})); + var E3; + (function (E3) { + E3[E3["A"] = 0] = "A"; + E3["B"] = "B"; + })(E3 || (E3 = {})); + var v1 = getStringIndexValue(E1); + var v2 = getStringIndexValue(E2); + var v3 = getStringIndexValue(E3); + var v4 = getNumberIndexValue(E1); + var v5 = getNumberIndexValue(E2); + var v6 = getNumberIndexValue(E3); +} diff --git a/tests/baselines/reference/implicitIndexSignatures.symbols b/tests/baselines/reference/implicitIndexSignatures.symbols index 1c8f06acc11..6f3e68f5058 100644 --- a/tests/baselines/reference/implicitIndexSignatures.symbols +++ b/tests/baselines/reference/implicitIndexSignatures.symbols @@ -168,3 +168,52 @@ function f4() { >o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 39, 7)) } +function f5() { +>f5 : Symbol(f5, Decl(implicitIndexSignatures.ts, 44, 1)) + + enum E1 { A, B } +>E1 : Symbol(E1, Decl(implicitIndexSignatures.ts, 46, 15)) +>A : Symbol(E1.A, Decl(implicitIndexSignatures.ts, 47, 13)) +>B : Symbol(E1.B, Decl(implicitIndexSignatures.ts, 47, 16)) + + enum E2 { A = "A", B = "B" } +>E2 : Symbol(E2, Decl(implicitIndexSignatures.ts, 47, 20)) +>A : Symbol(E2.A, Decl(implicitIndexSignatures.ts, 48, 13)) +>B : Symbol(E2.B, Decl(implicitIndexSignatures.ts, 48, 22)) + + enum E3 { A = 0, B = "B" } +>E3 : Symbol(E3, Decl(implicitIndexSignatures.ts, 48, 32)) +>A : Symbol(E3.A, Decl(implicitIndexSignatures.ts, 49, 13)) +>B : Symbol(E3.B, Decl(implicitIndexSignatures.ts, 49, 20)) + + const v1 = getStringIndexValue(E1); +>v1 : Symbol(v1, Decl(implicitIndexSignatures.ts, 50, 9)) +>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13)) +>E1 : Symbol(E1, Decl(implicitIndexSignatures.ts, 46, 15)) + + const v2 = getStringIndexValue(E2); +>v2 : Symbol(v2, Decl(implicitIndexSignatures.ts, 51, 9)) +>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13)) +>E2 : Symbol(E2, Decl(implicitIndexSignatures.ts, 47, 20)) + + const v3 = getStringIndexValue(E3); +>v3 : Symbol(v3, Decl(implicitIndexSignatures.ts, 52, 9)) +>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13)) +>E3 : Symbol(E3, Decl(implicitIndexSignatures.ts, 48, 32)) + + const v4 = getNumberIndexValue(E1); +>v4 : Symbol(v4, Decl(implicitIndexSignatures.ts, 53, 9)) +>getNumberIndexValue : Symbol(getNumberIndexValue, Decl(implicitIndexSignatures.ts, 13, 68)) +>E1 : Symbol(E1, Decl(implicitIndexSignatures.ts, 46, 15)) + + const v5 = getNumberIndexValue(E2); +>v5 : Symbol(v5, Decl(implicitIndexSignatures.ts, 54, 9)) +>getNumberIndexValue : Symbol(getNumberIndexValue, Decl(implicitIndexSignatures.ts, 13, 68)) +>E2 : Symbol(E2, Decl(implicitIndexSignatures.ts, 47, 20)) + + const v6 = getNumberIndexValue(E3); +>v6 : Symbol(v6, Decl(implicitIndexSignatures.ts, 55, 9)) +>getNumberIndexValue : Symbol(getNumberIndexValue, Decl(implicitIndexSignatures.ts, 13, 68)) +>E3 : Symbol(E3, Decl(implicitIndexSignatures.ts, 48, 32)) +} + diff --git a/tests/baselines/reference/implicitIndexSignatures.types b/tests/baselines/reference/implicitIndexSignatures.types index afad7bed570..c302edba32f 100644 --- a/tests/baselines/reference/implicitIndexSignatures.types +++ b/tests/baselines/reference/implicitIndexSignatures.types @@ -196,3 +196,62 @@ function f4() { >o2 : { 0: string; 1: string; count: number; } } +function f5() { +>f5 : () => void + + enum E1 { A, B } +>E1 : E1 +>A : E1.A +>B : E1.B + + enum E2 { A = "A", B = "B" } +>E2 : E2 +>A : E2.A +>"A" : "A" +>B : E2.B +>"B" : "B" + + enum E3 { A = 0, B = "B" } +>E3 : E3 +>A : E3.A +>0 : 0 +>B : E3.B +>"B" : "B" + + const v1 = getStringIndexValue(E1); +>v1 : string | E1 +>getStringIndexValue(E1) : string | E1 +>getStringIndexValue : (map: { [x: string]: T; }) => T +>E1 : typeof E1 + + const v2 = getStringIndexValue(E2); +>v2 : E2 +>getStringIndexValue(E2) : E2 +>getStringIndexValue : (map: { [x: string]: T; }) => T +>E2 : typeof E2 + + const v3 = getStringIndexValue(E3); +>v3 : string | E3.A +>getStringIndexValue(E3) : string | E3.A +>getStringIndexValue : (map: { [x: string]: T; }) => T +>E3 : typeof E3 + + const v4 = getNumberIndexValue(E1); +>v4 : string +>getNumberIndexValue(E1) : string +>getNumberIndexValue : (map: { [x: number]: T; }) => T +>E1 : typeof E1 + + const v5 = getNumberIndexValue(E2); +>v5 : unknown +>getNumberIndexValue(E2) : unknown +>getNumberIndexValue : (map: { [x: number]: T; }) => T +>E2 : typeof E2 + + const v6 = getNumberIndexValue(E3); +>v6 : string +>getNumberIndexValue(E3) : string +>getNumberIndexValue : (map: { [x: number]: T; }) => T +>E3 : typeof E3 +} + From bb15df3e435e14a85b4a6dc15c000f7eb6af50af Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 30 May 2019 21:06:51 -0700 Subject: [PATCH 187/384] Fix lint error --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0fdb88110eb..8342dbc2291 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14600,7 +14600,7 @@ namespace ts { * with no call or construct signatures. */ function isObjectTypeWithInferableIndex(type: Type) { - return type.symbol && (type.symbol.flags & (SymbolFlags.ObjectLiteral | SymbolFlags.TypeLiteral | SymbolFlags.Enum| SymbolFlags.ValueModule)) !== 0 && + return type.symbol && (type.symbol.flags & (SymbolFlags.ObjectLiteral | SymbolFlags.TypeLiteral | SymbolFlags.Enum | SymbolFlags.ValueModule)) !== 0 && !typeHasCallOrConstructSignatures(type); } From 2fc1143fe728fed2e9ce298eaf360a44d1de2a53 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 31 May 2019 10:23:07 -0700 Subject: [PATCH 188/384] More tests --- tests/cases/fourslash/renameRest.ts | 6 ++++-- tests/cases/fourslash/renameStringPropertyNames.ts | 7 ++++--- tests/cases/fourslash/renameThis.ts | 6 +++--- tests/cases/fourslash/renameUMDModuleAlias1.ts | 5 +++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/cases/fourslash/renameRest.ts b/tests/cases/fourslash/renameRest.ts index 60fc1bbb227..da1f590dd70 100644 --- a/tests/cases/fourslash/renameRest.ts +++ b/tests/cases/fourslash/renameRest.ts @@ -1,11 +1,13 @@ /// ////interface Gen { //// x: number; -//// [|parent|]: Gen; +//// [|[|{| "declarationRangeIndex": 0 |}parent|]: Gen;|] //// millenial: string; ////} ////let t: Gen; ////var { x, ...rest } = t; ////rest.[|parent|]; -verify.rangesAreRenameLocations(); + +const rangesByText = test.rangesByText(); +verify.rangesAreRenameLocations(rangesByText.get("parent")); diff --git a/tests/cases/fourslash/renameStringPropertyNames.ts b/tests/cases/fourslash/renameStringPropertyNames.ts index 13863b043e7..8d34ee458ea 100644 --- a/tests/cases/fourslash/renameStringPropertyNames.ts +++ b/tests/cases/fourslash/renameStringPropertyNames.ts @@ -1,15 +1,16 @@ /// ////var o = { -//// [|prop|]: 0 +//// [|[|{| "declarationRangeIndex": 0 |}prop|]: 0|] ////}; //// ////o = { -//// "[|prop|]": 1 +//// [|"[|{| "declarationRangeIndex": 2 |}prop|]": 1|] ////}; //// ////o["[|prop|]"]; ////o['[|prop|]']; ////o.[|prop|]; -verify.rangesAreRenameLocations(); +const rangesByText = test.rangesByText(); +verify.rangesAreRenameLocations(rangesByText.get("prop")); diff --git a/tests/cases/fourslash/renameThis.ts b/tests/cases/fourslash/renameThis.ts index e626294bf46..7a209c0d6cc 100644 --- a/tests/cases/fourslash/renameThis.ts +++ b/tests/cases/fourslash/renameThis.ts @@ -1,12 +1,12 @@ /// -////function f([|this|]) { +////function f([|{| "declarationRangeIndex": 0 |}this|]) { //// return [|this|]; ////} ////this/**/; -////const _ = { [|this|]: 0 }.[|this|]; +////const _ = { [|[|{| "declarationRangeIndex": 2 |}this|]: 0|] }.[|this|]; -const [r0, r1, r2, r3] = test.ranges() +const [r0, r1, r2Def, r2, r3] = test.ranges() verify.rangesAreRenameLocations([r0, r1]); // Trying to rename a non-parameter 'this' should fail diff --git a/tests/cases/fourslash/renameUMDModuleAlias1.ts b/tests/cases/fourslash/renameUMDModuleAlias1.ts index c44e459b008..510e117007b 100644 --- a/tests/cases/fourslash/renameUMDModuleAlias1.ts +++ b/tests/cases/fourslash/renameUMDModuleAlias1.ts @@ -4,10 +4,11 @@ //// export function doThing(): string; //// export function doTheOtherThing(): void; -//// export as namespace [|myLib|]; +//// [|export as namespace [|{| "declarationRangeIndex": 0 |}myLib|];|] // @Filename: 1.ts //// /// //// [|myLib|].doThing(); -verify.rangesAreRenameLocations(); +const rangesByText = test.rangesByText(); +verify.rangesAreRenameLocations(rangesByText.get("myLib")); From aaa55923e8f8b03d39c6150ee7fdd9d0af522bec Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 31 May 2019 11:03:49 -0700 Subject: [PATCH 189/384] Permit assignment this.xxx when class has index signature --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8305443a19b..5814b2dcfbf 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -20192,7 +20192,7 @@ namespace ts { markAliasReferenced(parentSymbol, node); } if (!prop) { - const indexInfo = assignmentKind === AssignmentKind.None || !isGenericObjectType(leftType) ? getIndexInfoOfType(apparentType, IndexKind.String) : undefined; + const indexInfo = assignmentKind === AssignmentKind.None || !isGenericObjectType(leftType) || isThisTypeParameter(leftType) ? getIndexInfoOfType(apparentType, IndexKind.String) : undefined; if (!(indexInfo && indexInfo.type)) { if (isJSLiteralType(leftType)) { return anyType; From 59dc85797e22c49555b6bfdef8675c1d7b8c2206 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 31 May 2019 11:04:02 -0700 Subject: [PATCH 190/384] Add regression test --- tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts index 898648cea44..b242aa3de60 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts @@ -139,11 +139,12 @@ function fn4() { let y: ReadonlyArray[K] = 'abc'; } -// Repro from #31439 +// Repro from #31439 and #31691 export class c { [x: string]: string; constructor() { + this.a = "b"; this["a"] = "b"; } } From d99b73c6ca8299d9afaa9db43e842da84ad70cd5 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 31 May 2019 11:04:22 -0700 Subject: [PATCH 191/384] Accept new baselines --- .../keyofAndIndexedAccess2.errors.txt | 3 +- .../reference/keyofAndIndexedAccess2.js | 6 +- .../reference/keyofAndIndexedAccess2.symbols | 73 ++++++++++--------- .../reference/keyofAndIndexedAccess2.types | 9 ++- 4 files changed, 52 insertions(+), 39 deletions(-) diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt index 40ccd13dac4..fffeac41ff7 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccess2.errors.txt @@ -222,11 +222,12 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS23 let y: ReadonlyArray[K] = 'abc'; } - // Repro from #31439 + // Repro from #31439 and #31691 export class c { [x: string]: string; constructor() { + this.a = "b"; this["a"] = "b"; } } diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.js b/tests/baselines/reference/keyofAndIndexedAccess2.js index 7547a3f84c5..91cf2c89ff2 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.js +++ b/tests/baselines/reference/keyofAndIndexedAccess2.js @@ -137,11 +137,12 @@ function fn4() { let y: ReadonlyArray[K] = 'abc'; } -// Repro from #31439 +// Repro from #31439 and #31691 export class c { [x: string]: string; constructor() { + this.a = "b"; this["a"] = "b"; } } @@ -245,9 +246,10 @@ function fn4() { let x = 'abc'; let y = 'abc'; } -// Repro from #31439 +// Repro from #31439 and #31691 export class c { constructor() { + this.a = "b"; this["a"] = "b"; } } diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.symbols b/tests/baselines/reference/keyofAndIndexedAccess2.symbols index 91602f93e1d..4a7721ff801 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess2.symbols @@ -503,7 +503,7 @@ function fn4() { >K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 133, 13)) } -// Repro from #31439 +// Repro from #31439 and #31691 export class c { >c : Symbol(c, Decl(keyofAndIndexedAccess2.ts, 136, 1)) @@ -512,6 +512,9 @@ export class c { >x : Symbol(x, Decl(keyofAndIndexedAccess2.ts, 141, 3)) constructor() { + this.a = "b"; +>this : Symbol(c, Decl(keyofAndIndexedAccess2.ts, 136, 1)) + this["a"] = "b"; >this : Symbol(c, Decl(keyofAndIndexedAccess2.ts, 136, 1)) } @@ -520,44 +523,44 @@ export class c { // Repro from #31385 type Foo = { [key: string]: { [K in keyof T]: K }[keyof T] }; ->Foo : Symbol(Foo, Decl(keyofAndIndexedAccess2.ts, 145, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 149, 9)) ->key : Symbol(key, Decl(keyofAndIndexedAccess2.ts, 149, 17)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 149, 34)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 149, 9)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 149, 34)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 149, 9)) +>Foo : Symbol(Foo, Decl(keyofAndIndexedAccess2.ts, 146, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 150, 9)) +>key : Symbol(key, Decl(keyofAndIndexedAccess2.ts, 150, 17)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 150, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 150, 9)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 150, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 150, 9)) type Bar = { [key: string]: { [K in keyof T]: [K] }[keyof T] }; ->Bar : Symbol(Bar, Decl(keyofAndIndexedAccess2.ts, 149, 64)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 151, 9)) ->key : Symbol(key, Decl(keyofAndIndexedAccess2.ts, 151, 17)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 151, 34)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 151, 9)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 151, 34)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 151, 9)) +>Bar : Symbol(Bar, Decl(keyofAndIndexedAccess2.ts, 150, 64)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 152, 9)) +>key : Symbol(key, Decl(keyofAndIndexedAccess2.ts, 152, 17)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 152, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 152, 9)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 152, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 152, 9)) type Baz> = { [K in keyof Q]: T[Q[K]] }; ->Baz : Symbol(Baz, Decl(keyofAndIndexedAccess2.ts, 151, 66)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 153, 9)) ->Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 153, 11)) ->Foo : Symbol(Foo, Decl(keyofAndIndexedAccess2.ts, 145, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 153, 9)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 153, 35)) ->Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 153, 11)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 153, 9)) ->Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 153, 11)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 153, 35)) +>Baz : Symbol(Baz, Decl(keyofAndIndexedAccess2.ts, 152, 66)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 154, 9)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 154, 11)) +>Foo : Symbol(Foo, Decl(keyofAndIndexedAccess2.ts, 146, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 154, 9)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 154, 35)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 154, 11)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 154, 9)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 154, 11)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 154, 35)) type Qux> = { [K in keyof Q]: T[Q[K]["0"]] }; ->Qux : Symbol(Qux, Decl(keyofAndIndexedAccess2.ts, 153, 60)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 155, 9)) ->Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 155, 11)) ->Bar : Symbol(Bar, Decl(keyofAndIndexedAccess2.ts, 149, 64)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 155, 9)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 155, 35)) ->Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 155, 11)) ->T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 155, 9)) ->Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 155, 11)) ->K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 155, 35)) +>Qux : Symbol(Qux, Decl(keyofAndIndexedAccess2.ts, 154, 60)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 156, 9)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 156, 11)) +>Bar : Symbol(Bar, Decl(keyofAndIndexedAccess2.ts, 150, 64)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 156, 9)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 156, 35)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 156, 11)) +>T : Symbol(T, Decl(keyofAndIndexedAccess2.ts, 156, 9)) +>Q : Symbol(Q, Decl(keyofAndIndexedAccess2.ts, 156, 11)) +>K : Symbol(K, Decl(keyofAndIndexedAccess2.ts, 156, 35)) diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.types b/tests/baselines/reference/keyofAndIndexedAccess2.types index 45cf1d4bad5..a6d83154665 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.types +++ b/tests/baselines/reference/keyofAndIndexedAccess2.types @@ -499,7 +499,7 @@ function fn4() { >'abc' : "abc" } -// Repro from #31439 +// Repro from #31439 and #31691 export class c { >c : c @@ -508,6 +508,13 @@ export class c { >x : string constructor() { + this.a = "b"; +>this.a = "b" : "b" +>this.a : string +>this : this +>a : string +>"b" : "b" + this["a"] = "b"; >this["a"] = "b" : "b" >this["a"] : string From 15ce996cf5e513901308d17e94b841f82b48a2a1 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 31 May 2019 10:36:58 -0700 Subject: [PATCH 192/384] Export assignment identifier use ExportAssigment as declaration --- src/services/findAllReferences.ts | 6 ++++-- tests/cases/fourslash/renameReExportDefault.ts | 12 ++++++------ tests/cases/fourslash/transitiveExportImports.ts | 8 ++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index f8606e2bf1c..453fd31ac98 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -41,13 +41,15 @@ namespace ts.FindAllReferences { // TODO(shkamat):: // JSXOpeningElement or JSXElement for tagName ? - if (!node.parent || !isDeclaration(node.parent)) { + if (!node.parent || (!isDeclaration(node.parent) && !isExportAssignment(node.parent))) { return undefined; } if (node.parent.name === node || // node is name of declaration, use parent // Property name of the import export specifier use import/export specifier - isImportOrExportSpecifier(node.parent) && node.parent.propertyName === node) { + isImportOrExportSpecifier(node.parent) && node.parent.propertyName === node || + // Is assignment of export assignment + isExportAssignment(node.parent) && node.parent.expression === node) { return getDeclarationForDeclarationSpan(node.parent); } diff --git a/tests/cases/fourslash/renameReExportDefault.ts b/tests/cases/fourslash/renameReExportDefault.ts index 0eb5b81d209..0e00a269b37 100644 --- a/tests/cases/fourslash/renameReExportDefault.ts +++ b/tests/cases/fourslash/renameReExportDefault.ts @@ -2,17 +2,17 @@ // @Filename: /a.ts ////export { default } from "./b"; -////export { default as [|b|] } from "./b"; +////[|export { default as [|{| "declarationRangeIndex": 0 |}b|] } from "./b";|] ////export { default as bee } from "./b"; -////import { default as [|b|] } from "./b"; +////[|import { default as [|{| "declarationRangeIndex": 2 |}b|] } from "./b";|] ////import { default as bee } from "./b"; -////import [|b|] from "./b"; +////[|import [|{| "declarationRangeIndex": 4 |}b|] from "./b";|] // @Filename: /b.ts -////const [|b|] = 0; -////export default [|b|]; +////[|const [|{| "declarationRangeIndex": 6 |}b|] = 0;|] +////[|export default [|{| "declarationRangeIndex": 8 |}b|];|] -const [r0, r1, r2, r3, r4] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4Def, r4] = test.ranges(); verify.renameLocations(r0, [r0]); verify.renameLocations(r1, [r1]); verify.renameLocations(r2, [r2]); diff --git a/tests/cases/fourslash/transitiveExportImports.ts b/tests/cases/fourslash/transitiveExportImports.ts index fb5480b28c8..f492f28862a 100644 --- a/tests/cases/fourslash/transitiveExportImports.ts +++ b/tests/cases/fourslash/transitiveExportImports.ts @@ -3,20 +3,20 @@ // @Filename: a.ts ////[|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}A|] { ////}|] -////export = [|A|]; +////[|export = [|{| "declarationRangeIndex": 2 |}A|];|] // @Filename: b.ts -////[|export import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}b|] = require('./a');|] +////[|export import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}b|] = require('./a');|] // @Filename: c.ts -////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}b|] = require('./b');|] +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}b|] = require('./b');|] ////var a = new [|b|]./**/[|b|](); goTo.marker(); verify.quickInfoExists(); verify.noErrors(); -const [a0Def, a0, a1, b0Def, b0, c0Def, c0, c1, c2] = test.ranges(); +const [a0Def, a0, a1Def, a1, b0Def, b0, c0Def, c0, c1, c2] = test.ranges(); const aRanges = [a0, a1]; const bRanges = [b0, c2]; const cRanges = [c0, c1]; From 7ac5fa783bd41ee5b64517f1ad85402ee0a49233 Mon Sep 17 00:00:00 2001 From: Benjamin Lichtman Date: Fri, 31 May 2019 11:24:54 -0700 Subject: [PATCH 193/384] Refactor and add wildcard scenario --- src/compiler/resolutionCache.ts | 9 +++++---- src/server/editorServices.ts | 8 +++++++- src/testRunner/unittests/tsserver/projects.ts | 20 +++++++++++++++++++ .../unittests/tsserver/resolutionCache.ts | 3 ++- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 6e0384219a1..fb04d7b7a18 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -699,6 +699,11 @@ namespace ts { // If something to do with folder/file starting with "." in node_modules folder, skip it if (isPathIgnored(fileOrDirectoryPath)) return false; + // prevent saving an open file from over-eagerly triggering invalidation + if (resolutionHost.fileIsOpen(fileOrDirectoryPath)) { + return false; + } + // Some file or directory in the watching directory is created // Return early if it does not have any of the watching extension or not the custom failed lookup path const dirOfFileOrDirectory = getDirectoryPath(fileOrDirectoryPath); @@ -714,10 +719,6 @@ namespace ts { if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) { return false; } - // prevent saving an open file from over-eagerly triggering invalidation - if (resolutionHost.fileIsOpen(fileOrDirectoryPath)) { - return false; - } // Ignore emits from the program if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) { return false; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 6bfce902a04..b0a64432633 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1002,7 +1002,13 @@ namespace ts.server { directory, fileOrDirectory => { const fileOrDirectoryPath = this.toPath(fileOrDirectory); - project.getCachedDirectoryStructureHost().addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath); + const fileSystemResult = project.getCachedDirectoryStructureHost().addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath); + + // don't trigger callback on open, existing files + if (project.fileIsOpen(fileOrDirectoryPath) && fileSystemResult && fileSystemResult.fileExists) { + return; + } + if (isPathIgnored(fileOrDirectoryPath)) return; const configFilename = project.getConfigFilePath(); diff --git a/src/testRunner/unittests/tsserver/projects.ts b/src/testRunner/unittests/tsserver/projects.ts index ba1eae236a5..dcbff895f1d 100644 --- a/src/testRunner/unittests/tsserver/projects.ts +++ b/src/testRunner/unittests/tsserver/projects.ts @@ -1341,6 +1341,26 @@ var x = 10;` } }); + it("no project structure update on directory watch invoke on open file save", () => { + const projectRootPath = "/users/username/projects/project"; + const fileA: File = { + path: `${projectRootPath}/a.ts`, + content: "export const a = 10;" + }; + const config: File = { + path: `${projectRootPath}/tsconfig.json`, + content: "{}" + }; + const files = [fileA, config]; + const host = createServerHost(files); + const service = createProjectService(host); + service.openClientFile(fileA.path); + checkNumberOfProjects(service, { configuredProjects: 1 }); + + host.invokeWatchedDirectoriesRecursiveCallback(projectRootPath, "a.ts"); + host.checkTimeoutQueueLength(0); + }); + it("handles delayed directory watch invoke on file creation", () => { const projectRootPath = "/users/username/projects/project"; const fileB: File = { diff --git a/src/testRunner/unittests/tsserver/resolutionCache.ts b/src/testRunner/unittests/tsserver/resolutionCache.ts index 11b604bb20c..05cbf8b9388 100644 --- a/src/testRunner/unittests/tsserver/resolutionCache.ts +++ b/src/testRunner/unittests/tsserver/resolutionCache.ts @@ -977,7 +977,7 @@ export const x = 10;` }); describe("avoid unnecessary invalidation", () => { - it("failed lookup invalidation", () => { + it("unnecessary lookup invalidation on save", () => { const expectedNonRelativeDirectories = [`${projectLocation}/node_modules`, `${projectLocation}/src`]; const module1Name = "module1"; const module2Name = "module2"; @@ -999,6 +999,7 @@ export const x = 10;` verifyTrace(resolutionTrace, expectedTrace); verifyWatchesWithConfigFile(host, files, file1, expectedNonRelativeDirectories); + // invoke callback to simulate saving host.invokeWatchedDirectoriesRecursiveCallback(projectLocation + "/src", "file1.ts"); host.checkTimeoutQueueLengthAndRun(0); }); From bbd2d00b351614151d64d375d311e423fb4ee4b9 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 31 May 2019 11:32:25 -0700 Subject: [PATCH 194/384] More tests --- tests/cases/fourslash/renameObjectSpread.ts | 6 +++--- tests/cases/fourslash/renameObjectSpreadAssignment.ts | 6 +++--- .../cases/fourslash/renameParameterPropertyDeclaration1.ts | 5 +++-- .../cases/fourslash/renameParameterPropertyDeclaration2.ts | 5 +++-- .../cases/fourslash/renameParameterPropertyDeclaration3.ts | 5 +++-- .../cases/fourslash/renameParameterPropertyDeclaration4.ts | 4 ++-- .../cases/fourslash/renameParameterPropertyDeclaration5.ts | 5 +++-- .../renamePropertyAccessExpressionHeritageClause.ts | 5 +++-- 8 files changed, 23 insertions(+), 18 deletions(-) diff --git a/tests/cases/fourslash/renameObjectSpread.ts b/tests/cases/fourslash/renameObjectSpread.ts index f3af6e0280f..389de34cfc5 100644 --- a/tests/cases/fourslash/renameObjectSpread.ts +++ b/tests/cases/fourslash/renameObjectSpread.ts @@ -1,13 +1,13 @@ /// -////interface A1 { [|a|]: number }; -////interface A2 { [|a|]?: number }; +////interface A1 { [|[|{| "declarationRangeIndex": 0 |}a|]: number|] }; +////interface A2 { [|[|{| "declarationRangeIndex": 2 |}a|]?: number|] }; ////let a1: A1; ////let a2: A2; ////let a12 = { ...a1, ...a2 }; ////a12.[|a|]; -const [r0, r1, r2] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2] = test.ranges(); // A1 unions with A2, so rename A1.a and a12.a verify.renameLocations(r0, [r0, r2]); // A1 unions with A2, so rename A2.a and a12.a diff --git a/tests/cases/fourslash/renameObjectSpreadAssignment.ts b/tests/cases/fourslash/renameObjectSpreadAssignment.ts index 9d55e43afa5..c326a38ce6c 100644 --- a/tests/cases/fourslash/renameObjectSpreadAssignment.ts +++ b/tests/cases/fourslash/renameObjectSpreadAssignment.ts @@ -2,10 +2,10 @@ ////interface A1 { a: number }; ////interface A2 { a?: number }; -////let [|a1|]: A1; -////let [|a2|]: A2; +////[|let [|{| "declarationRangeIndex": 0 |}a1|]: A1;|] +////[|let [|{| "declarationRangeIndex": 2 |}a2|]: A2;|] ////let a12 = { ...[|a1|], ...[|a2|] }; -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2, r3] = test.ranges(); verify.rangesAreRenameLocations([r0, r2]); verify.rangesAreRenameLocations([r1, r3]); diff --git a/tests/cases/fourslash/renameParameterPropertyDeclaration1.ts b/tests/cases/fourslash/renameParameterPropertyDeclaration1.ts index 14f8a240bfb..90939afbaa0 100644 --- a/tests/cases/fourslash/renameParameterPropertyDeclaration1.ts +++ b/tests/cases/fourslash/renameParameterPropertyDeclaration1.ts @@ -1,10 +1,11 @@ /// //// class Foo { -//// constructor(private [|privateParam|]: number) { +//// constructor([|private [|{| "declarationRangeIndex": 0 |}privateParam|]: number|]) { //// let localPrivate = [|privateParam|]; //// this.[|privateParam|] += 10; //// } //// } -verify.rangesAreRenameLocations(); +const [rDef, ...rest] = test.ranges(); +verify.rangesAreRenameLocations(rest); diff --git a/tests/cases/fourslash/renameParameterPropertyDeclaration2.ts b/tests/cases/fourslash/renameParameterPropertyDeclaration2.ts index ce31ad6c9c5..a131106e4bf 100644 --- a/tests/cases/fourslash/renameParameterPropertyDeclaration2.ts +++ b/tests/cases/fourslash/renameParameterPropertyDeclaration2.ts @@ -1,10 +1,11 @@ /// //// class Foo { -//// constructor(public [|publicParam|]: number) { +//// constructor([|public [|{| "declarationRangeIndex": 0 |}publicParam|]: number|]) { //// let publicParam = [|publicParam|]; //// this.[|publicParam|] += 10; //// } //// } -verify.rangesAreRenameLocations(); +const [rDef, ...rest] = test.ranges(); +verify.rangesAreRenameLocations(rest); diff --git a/tests/cases/fourslash/renameParameterPropertyDeclaration3.ts b/tests/cases/fourslash/renameParameterPropertyDeclaration3.ts index 6291eff2605..73ab9b40c51 100644 --- a/tests/cases/fourslash/renameParameterPropertyDeclaration3.ts +++ b/tests/cases/fourslash/renameParameterPropertyDeclaration3.ts @@ -1,10 +1,11 @@ /// //// class Foo { -//// constructor(protected [|protectedParam|]: number) { +//// constructor([|protected [|{| "declarationRangeIndex": 0 |}protectedParam|]: number|]) { //// let protectedParam = [|protectedParam|]; //// this.[|protectedParam|] += 10; //// } //// } -verify.rangesAreRenameLocations(); +const [rDef, ...rest] = test.ranges(); +verify.rangesAreRenameLocations(rest); diff --git a/tests/cases/fourslash/renameParameterPropertyDeclaration4.ts b/tests/cases/fourslash/renameParameterPropertyDeclaration4.ts index 292c82a2d52..02cd24d64b5 100644 --- a/tests/cases/fourslash/renameParameterPropertyDeclaration4.ts +++ b/tests/cases/fourslash/renameParameterPropertyDeclaration4.ts @@ -1,10 +1,10 @@ /// //// class Foo { -//// constructor(protected { [|protectedParam|] }) { +//// constructor([|protected { [|{| "declarationRangeIndex": 0 |}protectedParam|] }|]) { //// let myProtectedParam = [|protectedParam|]; //// } //// } -const [r0, r1] = test.ranges(); +const [r0Def, r0, r1] = test.ranges(); verify.renameLocations([r0, r1], [{ range: r0, prefixText: "protectedParam: " }, r1]); diff --git a/tests/cases/fourslash/renameParameterPropertyDeclaration5.ts b/tests/cases/fourslash/renameParameterPropertyDeclaration5.ts index f989e7c3fd9..f92fd53b6f9 100644 --- a/tests/cases/fourslash/renameParameterPropertyDeclaration5.ts +++ b/tests/cases/fourslash/renameParameterPropertyDeclaration5.ts @@ -1,9 +1,10 @@ /// //// class Foo { -//// constructor(protected [ [|protectedParam|] ]) { +//// constructor([|protected [ [|{| "declarationRangeIndex": 0 |}protectedParam|] ]|]) { //// let myProtectedParam = [|protectedParam|]; //// } //// } -verify.rangesAreRenameLocations(); +const [rDef, ...rest] = test.ranges(); +verify.rangesAreRenameLocations(rest); diff --git a/tests/cases/fourslash/renamePropertyAccessExpressionHeritageClause.ts b/tests/cases/fourslash/renamePropertyAccessExpressionHeritageClause.ts index 04b741a4b97..ae6a1c70b90 100644 --- a/tests/cases/fourslash/renamePropertyAccessExpressionHeritageClause.ts +++ b/tests/cases/fourslash/renamePropertyAccessExpressionHeritageClause.ts @@ -2,9 +2,10 @@ //// class B {} //// function foo() { -//// return {[|B|]: B}; +//// return {[|[|{| "declarationRangeIndex": 0 |}B|]: B|]}; //// } //// class C extends (foo()).[|B|] {} //// class C1 extends foo().[|B|] {} -verify.rangesAreRenameLocations(); \ No newline at end of file +const ranges = test.rangesByText(); +verify.rangesAreRenameLocations(ranges.get("B")); \ No newline at end of file From 6c04a0d14e369075d63b7096712b406bcf0ad0cb Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 31 May 2019 11:33:36 -0700 Subject: [PATCH 195/384] For property name of binding element use binding element as preview node --- src/services/findAllReferences.ts | 8 ++++---- .../fourslash/renameObjectBindingElementPropertyName01.ts | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 453fd31ac98..743b8915ae0 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -40,15 +40,15 @@ namespace ts.FindAllReferences { } // TODO(shkamat):: - // JSXOpeningElement or JSXElement for tagName ? + // JSXOpeningElement or JSXElement for tagName ? if (!node.parent || (!isDeclaration(node.parent) && !isExportAssignment(node.parent))) { return undefined; } if (node.parent.name === node || // node is name of declaration, use parent - // Property name of the import export specifier use import/export specifier - isImportOrExportSpecifier(node.parent) && node.parent.propertyName === node || - // Is assignment of export assignment + // Property name of the import export specifier or binding pattern, use parent + ((isImportOrExportSpecifier(node.parent) || isBindingElement(node.parent)) + && node.parent.propertyName === node) || isExportAssignment(node.parent) && node.parent.expression === node) { return getDeclarationForDeclarationSpan(node.parent); } diff --git a/tests/cases/fourslash/renameObjectBindingElementPropertyName01.ts b/tests/cases/fourslash/renameObjectBindingElementPropertyName01.ts index 4ae87f19db5..526838995c3 100644 --- a/tests/cases/fourslash/renameObjectBindingElementPropertyName01.ts +++ b/tests/cases/fourslash/renameObjectBindingElementPropertyName01.ts @@ -1,11 +1,12 @@ /// ////interface I { -//// [|property1|]: number; +//// [|[|{| "declarationRangeIndex": 0 |}property1|]: number;|] //// property2: string; ////} //// ////var foo: I; -////var { [|property1|]: prop1 } = foo; +////[|var { [|{| "declarationRangeIndex": 2 |}property1|]: prop1 } = foo;|] -verify.rangesAreRenameLocations(); + +verify.rangesAreRenameLocations(test.rangesByText().get("property1")); From bcf7752c1f3d87b893c6de772f844fadc6f40bc6 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 31 May 2019 11:57:43 -0700 Subject: [PATCH 196/384] More tests --- tests/cases/fourslash/renameJsSpecialAssignmentRhs1.ts | 2 +- tests/cases/fourslash/renameJsSpecialAssignmentRhs2.ts | 2 +- .../cases/fourslash/renameLocationsForClassExpression01.ts | 7 ++++--- .../fourslash/renameLocationsForFunctionExpression01.ts | 7 ++++--- .../fourslash/renameLocationsForFunctionExpression02.ts | 7 ++++--- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/cases/fourslash/renameJsSpecialAssignmentRhs1.ts b/tests/cases/fourslash/renameJsSpecialAssignmentRhs1.ts index 013cfe34cd5..db3f1fc66e8 100644 --- a/tests/cases/fourslash/renameJsSpecialAssignmentRhs1.ts +++ b/tests/cases/fourslash/renameJsSpecialAssignmentRhs1.ts @@ -5,7 +5,7 @@ //// set: function (x) { //// this._x = x; //// }, -//// copy: function ([|x|]) { +//// copy: function ([|{| "declarationRangeIndex": 0 |}x|]) { //// this._x = [|x|].prop; //// } ////}; diff --git a/tests/cases/fourslash/renameJsSpecialAssignmentRhs2.ts b/tests/cases/fourslash/renameJsSpecialAssignmentRhs2.ts index 013cfe34cd5..db3f1fc66e8 100644 --- a/tests/cases/fourslash/renameJsSpecialAssignmentRhs2.ts +++ b/tests/cases/fourslash/renameJsSpecialAssignmentRhs2.ts @@ -5,7 +5,7 @@ //// set: function (x) { //// this._x = x; //// }, -//// copy: function ([|x|]) { +//// copy: function ([|{| "declarationRangeIndex": 0 |}x|]) { //// this._x = [|x|].prop; //// } ////}; diff --git a/tests/cases/fourslash/renameLocationsForClassExpression01.ts b/tests/cases/fourslash/renameLocationsForClassExpression01.ts index b0f2f509500..6379306608e 100644 --- a/tests/cases/fourslash/renameLocationsForClassExpression01.ts +++ b/tests/cases/fourslash/renameLocationsForClassExpression01.ts @@ -3,7 +3,7 @@ ////class Foo { ////} //// -////var x = class [|Foo|] { +////var x = [|class [|{| "declarationRangeIndex": 0 |}Foo|] { //// doIt() { //// return [|Foo|]; //// } @@ -11,7 +11,7 @@ //// static doItStatically() { //// return [|Foo|].y; //// } -////} +////}|] //// ////var y = class { //// getSomeName() { @@ -20,4 +20,5 @@ ////} ////var z = class Foo {} -verify.rangesAreRenameLocations(); +const [rDef, ...rest] = test.ranges(); +verify.rangesAreRenameLocations(rest); diff --git a/tests/cases/fourslash/renameLocationsForFunctionExpression01.ts b/tests/cases/fourslash/renameLocationsForFunctionExpression01.ts index 1e02e3f5284..e32a080683a 100644 --- a/tests/cases/fourslash/renameLocationsForFunctionExpression01.ts +++ b/tests/cases/fourslash/renameLocationsForFunctionExpression01.ts @@ -1,7 +1,8 @@ /// -////var x = function [|f|](g: any, h: any) { +////var x = [|function [|{| "declarationRangeIndex": 0 |}f|](g: any, h: any) { //// [|f|]([|f|], g); -////} +////}|] -verify.rangesAreRenameLocations(); +const [rDef, ...rest] = test.ranges(); +verify.rangesAreRenameLocations(rest); diff --git a/tests/cases/fourslash/renameLocationsForFunctionExpression02.ts b/tests/cases/fourslash/renameLocationsForFunctionExpression02.ts index a258bcd803d..ab835b5305c 100644 --- a/tests/cases/fourslash/renameLocationsForFunctionExpression02.ts +++ b/tests/cases/fourslash/renameLocationsForFunctionExpression02.ts @@ -3,11 +3,12 @@ ////function f() { //// ////} -////var x = function [|f|](g: any, h: any) { +////var x = [|function [|{| "declarationRangeIndex": 0 |}f|](g: any, h: any) { //// //// let helper = function f(): any { f(); } //// //// let foo = () => [|f|]([|f|], g); -////} +////}|] -verify.rangesAreRenameLocations(); +const [rDef, ...rest] = test.ranges(); +verify.rangesAreRenameLocations(rest); From cb2df757d72943eba31e28e3c9e4f230dff7620d Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 31 May 2019 13:42:15 -0700 Subject: [PATCH 197/384] Add initial edition of cherry-pick script (#31705) --- scripts/open-cherry-pick-pr.ts | 94 ++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 scripts/open-cherry-pick-pr.ts diff --git a/scripts/open-cherry-pick-pr.ts b/scripts/open-cherry-pick-pr.ts new file mode 100644 index 00000000000..0d8109bafea --- /dev/null +++ b/scripts/open-cherry-pick-pr.ts @@ -0,0 +1,94 @@ +/// +// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally +/// + +import Octokit = require("@octokit/rest"); +import {runSequence} from "./run-sequence"; +import fs = require("fs"); +import path = require("path"); + +const userName = process.env.GH_USERNAME; +const reviewers = process.env.REQUESTING_USER ? [process.env.REQUESTING_USER] : ["weswigham", "RyanCavanaugh"]; +const branchName = `pick/${process.env.SOURCE_ISSUE}/${process.env.TARGET_BRANCH}`; +const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`; + +async function main() { + const currentSha = runSequence([ + ["git", ["rev-parse", "HEAD"]] + ]); + const currentAuthor = runSequence([ + ["git", ["log", "-1", `--pretty="%aN <%aE>"`]] + ]) + let logText = runSequence([ + ["git", ["log", `master..${currentSha}`, `--pretty="%h %s%n%b"`]] + ]); + logText = `Cherry-pick PR #${process.env.SOURCE_ISSUE} into ${process.env.TARGET_BRANCH} + +Component commits: +${logText}` + const logpath = path.join(__dirname, "../", "logmessage.txt"); + runSequence([ + ["git", ["checkout", "-b", "temp-branch"]], + ["git", ["reset", "master", "--soft"]] + ]); + fs.writeFileSync(logpath, logText); + runSequence([ + ["git", ["commit", "-F", logpath, `--author="${currentAuthor}"`]] + ]); + fs.unlinkSync(logpath); + const squashSha = runSequence([ + ["git", ["rev-parse", "HEAD"]] + ]); + runSequence([ + ["git", ["checkout", process.env.TARGET_BRANCH]], // checkout the target branch + ["git", ["checkout", "-b", branchName]], // create a new branch + ["git", ["cherry-pick", squashSha]], // + ["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork + ["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch + ]); + + const gh = new Octokit(); + gh.authenticate({ + type: "token", + token: process.argv[2] + }); + const r = await gh.pulls.create({ + owner: "Microsoft", + repo: "TypeScript", + maintainer_can_modify: true, + title: `🤖 Cherry-pick PR #${process.env.SOURCE_ISSUE} into ${process.env.TARGET_BRANCH}`, + head: `${userName}:${branchName}`, + base: process.env.TARGET_BRANCH, + body: + `This cherry-pick was triggerd by a request on https://github.com/Microsoft/TypeScript/pull/${process.env.SOURCE_ISSUE} + Please review the diff and merge if no changes are unexpected. + You can view the cherry-pick log [here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary). + + cc ${reviewers.map(r => "@" + r).join(" ")}`, + }); + const num = r.data.number; + console.log(`Pull request ${num} created.`); + + await gh.issues.createComment({ + number: +process.env.SOURCE_ISSUE, + owner: "Microsoft", + repo: "TypeScript", + body: `Hey @${process.env.REQUESTING_USER}, I've opened #${num} for you.` + }); +} + +main().catch(async e => { + console.error(e); + process.exitCode = 1; + const gh = new Octokit(); + gh.authenticate({ + type: "token", + token: process.argv[2] + }); + await gh.issues.createComment({ + number: +process.env.SOURCE_ISSUE, + owner: "Microsoft", + repo: "TypeScript", + body: `Hey @${process.env.REQUESTING_USER}, I couldn't open a PR with the cherry-pick. ([You can check the log here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary)). You may need to squash and pick this PR into ${process.env.TARGET_BRANCH} manually.` + }); +}); \ No newline at end of file From 9703b3d6c12d969ee41ec916d421f900a7f10781 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 31 May 2019 12:34:08 -0700 Subject: [PATCH 198/384] Show property assignment for special property assignments in js files --- src/services/findAllReferences.ts | 27 ++++++++++++++++--- tests/cases/fourslash/renameJsExports01.ts | 7 ++--- tests/cases/fourslash/renameJsExports02.ts | 6 ++--- tests/cases/fourslash/renameJsExports03.ts | 12 ++++----- .../fourslash/renameJsPropertyAssignment.ts | 5 ++-- .../fourslash/renameJsPropertyAssignment2.ts | 5 ++-- .../fourslash/renameJsPropertyAssignment3.ts | 5 ++-- .../fourslash/renameJsPrototypeProperty01.ts | 7 ++--- .../fourslash/renameJsPrototypeProperty02.ts | 7 ++--- .../cases/fourslash/renameJsThisProperty01.ts | 7 ++--- .../cases/fourslash/renameJsThisProperty03.ts | 7 ++--- .../cases/fourslash/renameJsThisProperty05.ts | 7 ++--- .../cases/fourslash/renameJsThisProperty06.ts | 7 ++--- 13 files changed, 70 insertions(+), 39 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 743b8915ae0..b52777cb6fa 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -41,11 +41,27 @@ namespace ts.FindAllReferences { // TODO(shkamat):: // JSXOpeningElement or JSXElement for tagName ? - if (!node.parent || (!isDeclaration(node.parent) && !isExportAssignment(node.parent))) { + if (!node.parent) return undefined; + + if (!isDeclaration(node.parent) && !isExportAssignment(node.parent)) { + // Special property assignment in javascript + if (isInJSFile(node)) { + const binaryExpression = isBinaryExpression(node.parent) ? + node.parent : + isPropertyAccessExpression(node.parent) && + isBinaryExpression(node.parent.parent) && + node.parent.parent.left === node.parent ? + node.parent.parent : + undefined; + return binaryExpression && getAssignmentDeclarationKind(binaryExpression) !== AssignmentDeclarationKind.None ? + getDeclarationForDeclarationSpan(binaryExpression) : + undefined; + } return undefined; } - if (node.parent.name === node || // node is name of declaration, use parent + if (isConstructorDeclaration(node.parent) || + node.parent.name === node || // node is name of declaration, use parent // Property name of the import export specifier or binding pattern, use parent ((isImportOrExportSpecifier(node.parent) || isBindingElement(node.parent)) && node.parent.propertyName === node) || @@ -56,7 +72,7 @@ namespace ts.FindAllReferences { return undefined; } - export function getDeclarationForDeclarationSpan(node: NamedDeclaration | undefined): Node | undefined { + export function getDeclarationForDeclarationSpan(node: NamedDeclaration | BinaryExpression | undefined): Node | undefined { if (!node) return undefined; switch (node.kind) { case SyntaxKind.VariableDeclaration: @@ -84,6 +100,11 @@ namespace ts.FindAllReferences { undefined : node; + case SyntaxKind.BinaryExpression: + return isExpressionStatement(node.parent) ? + node.parent : + undefined; + // Not really interesting definition // TODO(shkamat):: Should we show whole object literal instead? case SyntaxKind.ShorthandPropertyAssignment: diff --git a/tests/cases/fourslash/renameJsExports01.ts b/tests/cases/fourslash/renameJsExports01.ts index e1b71d232a6..be5e4f6ea05 100644 --- a/tests/cases/fourslash/renameJsExports01.ts +++ b/tests/cases/fourslash/renameJsExports01.ts @@ -2,11 +2,12 @@ // @allowJs: true // @Filename: a.js -////exports.[|{| "isWriteAccess": true, "isDefinition": true |}area|] = function (r) { return r * r; } +////[|exports.[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}area|] = function (r) { return r * r; }|] // @Filename: b.js ////var mod = require('./a'); ////var t = mod./**/[|area|](10); -verify.singleReferenceGroup("(property) area: (r: any) => number"); -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.singleReferenceGroup("(property) area: (r: any) => number", ranges); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameJsExports02.ts b/tests/cases/fourslash/renameJsExports02.ts index 94c84980784..3628a9c8101 100644 --- a/tests/cases/fourslash/renameJsExports02.ts +++ b/tests/cases/fourslash/renameJsExports02.ts @@ -2,12 +2,12 @@ // @allowJs: true // @Filename: a.js -////module.exports = class [|{| "isWriteAccess": true, "isDefinition": true |}A|] {} +////module.exports = [|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}A|] {}|] // @Filename: b.js -////const [|{| "isWriteAccess": true, "isDefinition": true |}A|] = require("./a"); +////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}A|] = require("./a");|] -const [r0, r1] = test.ranges(); +const [rDef, r0, r1Def, r1] = test.ranges(); verify.referenceGroups(r0, [ { definition: "(local class) A", ranges: [r0] }, { definition: "const A: typeof A", ranges: [r1] } diff --git a/tests/cases/fourslash/renameJsExports03.ts b/tests/cases/fourslash/renameJsExports03.ts index c4378cfaa1a..308f3c55ada 100644 --- a/tests/cases/fourslash/renameJsExports03.ts +++ b/tests/cases/fourslash/renameJsExports03.ts @@ -2,16 +2,16 @@ // @allowJs: true // @Filename: a.js -////class [|{| "isWriteAccess": true, "isDefinition": true |}A|] { -//// [|constructor|]() { } -////} -////module.exports = [|A|]; +////[|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}A|] { +//// [|[|{| "declarationRangeIndex": 2 |}constructor|]() { }|] +////}|] +////[|module.exports = [|{| "declarationRangeIndex": 4 |}A|];|] // @Filename: b.js -////const [|{| "isWriteAccess": true, "isDefinition": true |}A|] = require("./a"); +////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}A|] = require("./a");|] ////new [|A|]; -const [r0, r1, r2, r3, r4] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4] = test.ranges(); verify.referenceGroups([r0, r2], [ { definition: "class A", ranges: [r0, r2] }, { definition: "const A: typeof A", ranges: [r3, r4] } diff --git a/tests/cases/fourslash/renameJsPropertyAssignment.ts b/tests/cases/fourslash/renameJsPropertyAssignment.ts index 87daae544e1..a764bc18fd9 100644 --- a/tests/cases/fourslash/renameJsPropertyAssignment.ts +++ b/tests/cases/fourslash/renameJsPropertyAssignment.ts @@ -4,7 +4,8 @@ // @Filename: a.js ////function bar() { ////} -////bar.[|foo|] = "foo"; +////[|bar.[|{| "declarationRangeIndex": 0 |}foo|] = "foo";|] ////console.log(bar.[|foo|]); -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameJsPropertyAssignment2.ts b/tests/cases/fourslash/renameJsPropertyAssignment2.ts index eaea2b9aa27..dbd1749b3ed 100644 --- a/tests/cases/fourslash/renameJsPropertyAssignment2.ts +++ b/tests/cases/fourslash/renameJsPropertyAssignment2.ts @@ -4,7 +4,8 @@ // @Filename: a.js ////class Minimatch { ////} -////Minimatch.[|staticProperty|] = "string"; +////[|Minimatch.[|{| "declarationRangeIndex": 0 |}staticProperty|] = "string";|] ////console.log(Minimatch.[|staticProperty|]); -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameJsPropertyAssignment3.ts b/tests/cases/fourslash/renameJsPropertyAssignment3.ts index cedf69c7eee..462fbd06c8c 100644 --- a/tests/cases/fourslash/renameJsPropertyAssignment3.ts +++ b/tests/cases/fourslash/renameJsPropertyAssignment3.ts @@ -4,7 +4,8 @@ // @Filename: a.js ////var C = class { ////} -////C.[|staticProperty|] = "string"; +////[|C.[|{| "declarationRangeIndex": 0 |}staticProperty|] = "string";|] ////console.log(C.[|staticProperty|]); -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameJsPrototypeProperty01.ts b/tests/cases/fourslash/renameJsPrototypeProperty01.ts index 1700f15619d..b171ccdf005 100644 --- a/tests/cases/fourslash/renameJsPrototypeProperty01.ts +++ b/tests/cases/fourslash/renameJsPrototypeProperty01.ts @@ -4,8 +4,9 @@ // @Filename: a.js ////function bar() { ////} -////bar.prototype.[|x|] = 10; +////[|bar.prototype.[|{| "declarationRangeIndex": 0 |}x|] = 10;|] ////var t = new bar(); -////t.[|x|] = 11; +////[|t.[|{| "declarationRangeIndex": 2 |}x|] = 11;|] -verify.rangesAreRenameLocations(); +const [r0Def, r0, r1Def, r1] = test.ranges(); +verify.rangesAreRenameLocations([r0, r1]); diff --git a/tests/cases/fourslash/renameJsPrototypeProperty02.ts b/tests/cases/fourslash/renameJsPrototypeProperty02.ts index 1700f15619d..b171ccdf005 100644 --- a/tests/cases/fourslash/renameJsPrototypeProperty02.ts +++ b/tests/cases/fourslash/renameJsPrototypeProperty02.ts @@ -4,8 +4,9 @@ // @Filename: a.js ////function bar() { ////} -////bar.prototype.[|x|] = 10; +////[|bar.prototype.[|{| "declarationRangeIndex": 0 |}x|] = 10;|] ////var t = new bar(); -////t.[|x|] = 11; +////[|t.[|{| "declarationRangeIndex": 2 |}x|] = 11;|] -verify.rangesAreRenameLocations(); +const [r0Def, r0, r1Def, r1] = test.ranges(); +verify.rangesAreRenameLocations([r0, r1]); diff --git a/tests/cases/fourslash/renameJsThisProperty01.ts b/tests/cases/fourslash/renameJsThisProperty01.ts index 5680dbf08fd..7cd55020e20 100644 --- a/tests/cases/fourslash/renameJsThisProperty01.ts +++ b/tests/cases/fourslash/renameJsThisProperty01.ts @@ -3,9 +3,10 @@ // @allowJs: true // @Filename: a.js ////function bar() { -//// this.[|x|] = 10; +//// [|this.[|{| "declarationRangeIndex": 0 |}x|] = 10;|] ////} ////var t = new bar(); -////t.[|x|] = 11; +////[|t.[|{| "declarationRangeIndex": 2 |}x|] = 11;|] -verify.rangesAreRenameLocations(); +const [r0Def, r0, r1Def, r1] = test.ranges(); +verify.rangesAreRenameLocations([r0, r1]); diff --git a/tests/cases/fourslash/renameJsThisProperty03.ts b/tests/cases/fourslash/renameJsThisProperty03.ts index 8633c61132c..da5fc01e57a 100644 --- a/tests/cases/fourslash/renameJsThisProperty03.ts +++ b/tests/cases/fourslash/renameJsThisProperty03.ts @@ -4,10 +4,11 @@ // @Filename: a.js ////class C { //// constructor(y) { -//// this.[|x|] = y; +//// [|this.[|{| "declarationRangeIndex": 0 |}x|] = y;|] //// } ////} ////var t = new C(12); -////t.[|x|] = 11; +////[|t.[|{| "declarationRangeIndex": 2 |}x|] = 11;|] -verify.rangesAreRenameLocations(); +const [rDef, r0, r1Def, r1] = test.ranges(); +verify.rangesAreRenameLocations([r0, r1]); diff --git a/tests/cases/fourslash/renameJsThisProperty05.ts b/tests/cases/fourslash/renameJsThisProperty05.ts index 861919ec777..95a514e0abc 100644 --- a/tests/cases/fourslash/renameJsThisProperty05.ts +++ b/tests/cases/fourslash/renameJsThisProperty05.ts @@ -7,8 +7,9 @@ //// this.x = y; //// } ////} -////C.prototype.[|z|] = 1; +////[|C.prototype.[|{| "declarationRangeIndex": 0 |}z|] = 1;|] ////var t = new C(12); -////t.[|z|] = 11; +////[|t.[|{| "declarationRangeIndex": 2 |}z|] = 11;|] -verify.rangesAreRenameLocations(); +const [r0Def, r0, r1Def, r1] = test.ranges(); +verify.rangesAreRenameLocations([r0, r1]); diff --git a/tests/cases/fourslash/renameJsThisProperty06.ts b/tests/cases/fourslash/renameJsThisProperty06.ts index 7269a50f4f0..e7ae3256139 100644 --- a/tests/cases/fourslash/renameJsThisProperty06.ts +++ b/tests/cases/fourslash/renameJsThisProperty06.ts @@ -7,8 +7,9 @@ //// this.x = y; //// } ////} -////C.prototype.[|z|] = 1; +////[|C.prototype.[|{| "declarationRangeIndex": 0 |}z|] = 1;|] ////var t = new C(12); -////t.[|z|] = 11; +////[|t.[|{| "declarationRangeIndex": 2 |}z|] = 11;|] -verify.rangesAreRenameLocations(); +const [r0Def, r0, r1Def, r1] = test.ranges(); +verify.rangesAreRenameLocations([r0, r1]); From 9a2957717e97f2c42024d1792ec1a31923e99a2b Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 31 May 2019 14:12:45 -0700 Subject: [PATCH 199/384] Strictify the cherry-pick pr script --- .gitignore | 1 + scripts/open-cherry-pick-pr.ts | 32 ++++++++++++++++++++------------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 9d0bb4d0c6f..04c397bb7e3 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ scripts/ior.js scripts/authors.js scripts/configurePrerelease.js scripts/open-user-pr.js +scripts/open-cherry-pick-pr.js scripts/processDiagnosticMessages.d.ts scripts/processDiagnosticMessages.js scripts/produceLKG.js diff --git a/scripts/open-cherry-pick-pr.ts b/scripts/open-cherry-pick-pr.ts index 0d8109bafea..8d8916d4294 100644 --- a/scripts/open-cherry-pick-pr.ts +++ b/scripts/open-cherry-pick-pr.ts @@ -3,7 +3,7 @@ /// import Octokit = require("@octokit/rest"); -import {runSequence} from "./run-sequence"; +const {runSequence} = require("./run-sequence"); import fs = require("fs"); import path = require("path"); @@ -13,6 +13,12 @@ const branchName = `pick/${process.env.SOURCE_ISSUE}/${process.env.TARGET_BRANCH const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`; async function main() { + if (!process.env.TARGET_BRANCH) { + throw new Error("Target branch not specified"); + } + if (!process.env.SOURCE_ISSUE) { + throw new Error("Source issue not specified"); + } const currentSha = runSequence([ ["git", ["rev-parse", "HEAD"]] ]); @@ -80,15 +86,17 @@ ${logText}` main().catch(async e => { console.error(e); process.exitCode = 1; - const gh = new Octokit(); - gh.authenticate({ - type: "token", - token: process.argv[2] - }); - await gh.issues.createComment({ - number: +process.env.SOURCE_ISSUE, - owner: "Microsoft", - repo: "TypeScript", - body: `Hey @${process.env.REQUESTING_USER}, I couldn't open a PR with the cherry-pick. ([You can check the log here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary)). You may need to squash and pick this PR into ${process.env.TARGET_BRANCH} manually.` - }); + if (process.env.SOURCE_ISSUE) { + const gh = new Octokit(); + gh.authenticate({ + type: "token", + token: process.argv[2] + }); + await gh.issues.createComment({ + number: +process.env.SOURCE_ISSUE, + owner: "Microsoft", + repo: "TypeScript", + body: `Hey @${process.env.REQUESTING_USER}, I couldn't open a PR with the cherry-pick. ([You can check the log here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary)). You may need to squash and pick this PR into ${process.env.TARGET_BRANCH} manually.` + }); + } }); \ No newline at end of file From 8813ceb3ceb87ce275d2a55daf6dc33e296bcf83 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 31 May 2019 14:24:49 -0700 Subject: [PATCH 200/384] Cant use stdio inherit and stash a result away --- scripts/run-sequence.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/run-sequence.js b/scripts/run-sequence.js index ef7a384af4c..f014cde1b91 100644 --- a/scripts/run-sequence.js +++ b/scripts/run-sequence.js @@ -5,12 +5,13 @@ const cp = require("child_process"); * @param {[string, string[]][]} tasks * @param {cp.SpawnSyncOptions} opts */ -function runSequence(tasks, opts = { timeout: 100000, shell: true, stdio: "inherit" }) { +function runSequence(tasks, opts = { timeout: 100000, shell: true }) { let lastResult; for (const task of tasks) { console.log(`${task[0]} ${task[1].join(" ")}`); const result = cp.spawnSync(task[0], task[1], opts); if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && result.stderr.toString()}`); + console.log(result.stdout && result.stdout.toString()); lastResult = result; } return lastResult && lastResult.stdout && lastResult.stdout.toString(); From 619648e8c27092eb691be3ade5fde9ce49fb18a4 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 31 May 2019 14:36:39 -0700 Subject: [PATCH 201/384] Trim whitespace, fetch origin master --- scripts/open-cherry-pick-pr.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/open-cherry-pick-pr.ts b/scripts/open-cherry-pick-pr.ts index 8d8916d4294..2bad1438d31 100644 --- a/scripts/open-cherry-pick-pr.ts +++ b/scripts/open-cherry-pick-pr.ts @@ -24,14 +24,17 @@ async function main() { ]); const currentAuthor = runSequence([ ["git", ["log", "-1", `--pretty="%aN <%aE>"`]] - ]) + ]); + runSequence([ + ["git", ["fetch", "origin", "master"]] + ]); let logText = runSequence([ - ["git", ["log", `master..${currentSha}`, `--pretty="%h %s%n%b"`]] + ["git", ["log", `origin/master..${currentSha.trim()}`, `--pretty="%h %s%n%b"`]] ]); logText = `Cherry-pick PR #${process.env.SOURCE_ISSUE} into ${process.env.TARGET_BRANCH} Component commits: -${logText}` +${logText.trim()}` const logpath = path.join(__dirname, "../", "logmessage.txt"); runSequence([ ["git", ["checkout", "-b", "temp-branch"]], @@ -39,7 +42,7 @@ ${logText}` ]); fs.writeFileSync(logpath, logText); runSequence([ - ["git", ["commit", "-F", logpath, `--author="${currentAuthor}"`]] + ["git", ["commit", "-F", logpath, `--author="${currentAuthor.trim()}"`]] ]); fs.unlinkSync(logpath); const squashSha = runSequence([ @@ -48,7 +51,7 @@ ${logText}` runSequence([ ["git", ["checkout", process.env.TARGET_BRANCH]], // checkout the target branch ["git", ["checkout", "-b", branchName]], // create a new branch - ["git", ["cherry-pick", squashSha]], // + ["git", ["cherry-pick", squashSha.trim()]], // ["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork ["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch ]); From 2cd3500197aee5aa2d474254f6995c9504ee649f Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 31 May 2019 14:45:06 -0700 Subject: [PATCH 202/384] origin/master because ref is fetched not pulled --- scripts/open-cherry-pick-pr.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/open-cherry-pick-pr.ts b/scripts/open-cherry-pick-pr.ts index 2bad1438d31..90ba25d5fb2 100644 --- a/scripts/open-cherry-pick-pr.ts +++ b/scripts/open-cherry-pick-pr.ts @@ -38,7 +38,7 @@ ${logText.trim()}` const logpath = path.join(__dirname, "../", "logmessage.txt"); runSequence([ ["git", ["checkout", "-b", "temp-branch"]], - ["git", ["reset", "master", "--soft"]] + ["git", ["reset", "origin/master", "--soft"]] ]); fs.writeFileSync(logpath, logText); runSequence([ From d3b6ba557ac97837ed1c419887dec39cc9acb834 Mon Sep 17 00:00:00 2001 From: Benjamin Lichtman Date: Fri, 31 May 2019 14:46:15 -0700 Subject: [PATCH 203/384] Change test instead of behavior --- src/server/editorServices.ts | 4 ++-- src/testRunner/unittests/tsserver/projects.ts | 8 ++++---- src/testRunner/unittests/tsserver/resolutionCache.ts | 2 +- src/testRunner/unittests/tsserver/syntaxOperations.ts | 5 +++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index b0a64432633..b868286ea51 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1002,10 +1002,10 @@ namespace ts.server { directory, fileOrDirectory => { const fileOrDirectoryPath = this.toPath(fileOrDirectory); - const fileSystemResult = project.getCachedDirectoryStructureHost().addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath); + project.getCachedDirectoryStructureHost().addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath); // don't trigger callback on open, existing files - if (project.fileIsOpen(fileOrDirectoryPath) && fileSystemResult && fileSystemResult.fileExists) { + if (project.fileIsOpen(fileOrDirectoryPath)) { return; } diff --git a/src/testRunner/unittests/tsserver/projects.ts b/src/testRunner/unittests/tsserver/projects.ts index dcbff895f1d..409ce5c525f 100644 --- a/src/testRunner/unittests/tsserver/projects.ts +++ b/src/testRunner/unittests/tsserver/projects.ts @@ -1343,7 +1343,7 @@ var x = 10;` it("no project structure update on directory watch invoke on open file save", () => { const projectRootPath = "/users/username/projects/project"; - const fileA: File = { + const file1: File = { path: `${projectRootPath}/a.ts`, content: "export const a = 10;" }; @@ -1351,13 +1351,13 @@ var x = 10;` path: `${projectRootPath}/tsconfig.json`, content: "{}" }; - const files = [fileA, config]; + const files = [file1, config]; const host = createServerHost(files); const service = createProjectService(host); - service.openClientFile(fileA.path); + service.openClientFile(file1.path); checkNumberOfProjects(service, { configuredProjects: 1 }); - host.invokeWatchedDirectoriesRecursiveCallback(projectRootPath, "a.ts"); + host.modifyFile(file1.path, file1.content, { invokeFileDeleteCreateAsPartInsteadOfChange: true }); host.checkTimeoutQueueLength(0); }); diff --git a/src/testRunner/unittests/tsserver/resolutionCache.ts b/src/testRunner/unittests/tsserver/resolutionCache.ts index 05cbf8b9388..768111f3bfe 100644 --- a/src/testRunner/unittests/tsserver/resolutionCache.ts +++ b/src/testRunner/unittests/tsserver/resolutionCache.ts @@ -1000,7 +1000,7 @@ export const x = 10;` verifyWatchesWithConfigFile(host, files, file1, expectedNonRelativeDirectories); // invoke callback to simulate saving - host.invokeWatchedDirectoriesRecursiveCallback(projectLocation + "/src", "file1.ts"); + host.modifyFile(file1.path, file1.content, { invokeFileDeleteCreateAsPartInsteadOfChange: true }); host.checkTimeoutQueueLengthAndRun(0); }); }); diff --git a/src/testRunner/unittests/tsserver/syntaxOperations.ts b/src/testRunner/unittests/tsserver/syntaxOperations.ts index 66a962d3625..d3127355191 100644 --- a/src/testRunner/unittests/tsserver/syntaxOperations.ts +++ b/src/testRunner/unittests/tsserver/syntaxOperations.ts @@ -60,13 +60,14 @@ describe("Test Suite 1", () => { const navBarResultUnitTest1 = navBarFull(session, unitTest1); host.deleteFile(unitTest1.path); - host.checkTimeoutQueueLengthAndRun(2); - checkProjectActualFiles(project, expectedFilesWithoutUnitTest1); + host.checkTimeoutQueueLengthAndRun(0); + checkProjectActualFiles(project, expectedFilesWithUnitTest1); session.executeCommandSeq({ command: protocol.CommandTypes.Close, arguments: { file: unitTest1.path } }); + host.checkTimeoutQueueLengthAndRun(2); checkProjectActualFiles(project, expectedFilesWithoutUnitTest1); const unitTest1WithChangedContent: File = { From 22348d8a0cec9a0a2483176d6b07bdd5fcf35e8b Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 31 May 2019 14:46:33 -0700 Subject: [PATCH 204/384] Reverse log order --- scripts/open-cherry-pick-pr.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/open-cherry-pick-pr.ts b/scripts/open-cherry-pick-pr.ts index 90ba25d5fb2..a757322596d 100644 --- a/scripts/open-cherry-pick-pr.ts +++ b/scripts/open-cherry-pick-pr.ts @@ -29,7 +29,7 @@ async function main() { ["git", ["fetch", "origin", "master"]] ]); let logText = runSequence([ - ["git", ["log", `origin/master..${currentSha.trim()}`, `--pretty="%h %s%n%b"`]] + ["git", ["log", `origin/master..${currentSha.trim()}`, `--pretty="%h %s%n%b"`, "--reverse"]] ]); logText = `Cherry-pick PR #${process.env.SOURCE_ISSUE} into ${process.env.TARGET_BRANCH} From a23ae4c7428ea6d7dcac012136d1a16aacb6ee76 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 31 May 2019 14:54:36 -0700 Subject: [PATCH 205/384] Dedent message so its not code-blocked --- scripts/open-cherry-pick-pr.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/open-cherry-pick-pr.ts b/scripts/open-cherry-pick-pr.ts index a757322596d..8bdeb05e4a2 100644 --- a/scripts/open-cherry-pick-pr.ts +++ b/scripts/open-cherry-pick-pr.ts @@ -70,10 +70,10 @@ ${logText.trim()}` base: process.env.TARGET_BRANCH, body: `This cherry-pick was triggerd by a request on https://github.com/Microsoft/TypeScript/pull/${process.env.SOURCE_ISSUE} - Please review the diff and merge if no changes are unexpected. - You can view the cherry-pick log [here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary). +Please review the diff and merge if no changes are unexpected. +You can view the cherry-pick log [here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary). - cc ${reviewers.map(r => "@" + r).join(" ")}`, +cc ${reviewers.map(r => "@" + r).join(" ")}`, }); const num = r.data.number; console.log(`Pull request ${num} created.`); From eb5c6970a3f5a329f0a797ae0b873849b92a7710 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Fri, 31 May 2019 15:56:04 -0700 Subject: [PATCH 206/384] Update user baselines (#31699) --- tests/baselines/reference/user/uglify-js.log | 68 ++++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/tests/baselines/reference/user/uglify-js.log b/tests/baselines/reference/user/uglify-js.log index 3c98006c52f..038bb1174cf 100644 --- a/tests/baselines/reference/user/uglify-js.log +++ b/tests/baselines/reference/user/uglify-js.log @@ -27,41 +27,41 @@ node_modules/uglify-js/lib/compress.js(2044,59): error TS2554: Expected 0 argume node_modules/uglify-js/lib/compress.js(2082,53): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[number, number, ...never[]]'. Type 'any[]' is missing the following properties from type '[number, number, ...never[]]': 0, 1 node_modules/uglify-js/lib/compress.js(2230,34): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(2942,42): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3395,38): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3408,33): error TS2322: Type '"f"' is not assignable to type 'boolean'. -node_modules/uglify-js/lib/compress.js(3542,33): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3595,29): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3612,29): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. -node_modules/uglify-js/lib/compress.js(3637,75): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3711,63): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3832,12): error TS2339: Property 'push' does not exist on type 'TreeTransformer'. -node_modules/uglify-js/lib/compress.js(3897,38): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(3918,24): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. -node_modules/uglify-js/lib/compress.js(3928,28): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. -node_modules/uglify-js/lib/compress.js(4097,21): error TS2403: Subsequent variable declarations must have the same type. Variable 'defs' must be of type 'Dictionary & { set: (key: any, val: any) => Dictionary & { set: ...; add: (key: any, val: any) => Dictionary & { set: ...; add: ...; get: (key: any) => any; del: (key: any) => Dictionary & { set: ...; ... 8 more ...; toObject: () => any; }; ... 5 more ...; toObject: () => any; }; ... 7 more ...; toObject: () => any;...', but here has type 'any'. -node_modules/uglify-js/lib/compress.js(4149,17): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead. -node_modules/uglify-js/lib/compress.js(4210,45): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(4320,33): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(4618,17): error TS2403: Subsequent variable declarations must have the same type. Variable 'body' must be of type 'any[]', but here has type 'any'. -node_modules/uglify-js/lib/compress.js(4702,37): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(4910,57): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[RegExp, (string | undefined)?]'. +node_modules/uglify-js/lib/compress.js(2949,42): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3402,38): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3415,33): error TS2322: Type '"f"' is not assignable to type 'boolean'. +node_modules/uglify-js/lib/compress.js(3549,33): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3602,29): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3619,29): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. +node_modules/uglify-js/lib/compress.js(3644,75): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3718,63): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3839,12): error TS2339: Property 'push' does not exist on type 'TreeTransformer'. +node_modules/uglify-js/lib/compress.js(3914,38): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(3935,24): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. +node_modules/uglify-js/lib/compress.js(3945,28): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. +node_modules/uglify-js/lib/compress.js(4114,21): error TS2403: Subsequent variable declarations must have the same type. Variable 'defs' must be of type 'Dictionary & { set: (key: any, val: any) => Dictionary & { set: ...; add: (key: any, val: any) => Dictionary & { set: ...; add: ...; get: (key: any) => any; del: (key: any) => Dictionary & { set: ...; ... 8 more ...; toObject: () => any; }; ... 5 more ...; toObject: () => any; }; ... 7 more ...; toObject: () => any;...', but here has type 'any'. +node_modules/uglify-js/lib/compress.js(4166,17): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead. +node_modules/uglify-js/lib/compress.js(4229,45): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(4340,33): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(4638,17): error TS2403: Subsequent variable declarations must have the same type. Variable 'body' must be of type 'any[]', but here has type 'any'. +node_modules/uglify-js/lib/compress.js(4722,37): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(4930,57): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[RegExp, (string | undefined)?]'. Property '0' is missing in type 'any[]' but required in type '[RegExp, (string | undefined)?]'. -node_modules/uglify-js/lib/compress.js(5074,45): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(5081,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'code' must be of type 'string', but here has type '{ get: () => string; toString: () => string; indent: () => void; indentation: () => number; current_width: () => number; should_break: () => boolean; has_parens: () => boolean; newline: () => void; print: (str: any) => void; ... 24 more ...; parent: (n: any) => any; }'. -node_modules/uglify-js/lib/compress.js(5085,36): error TS2532: Object is possibly 'undefined'. -node_modules/uglify-js/lib/compress.js(5090,41): error TS2339: Property 'get' does not exist on type 'string'. -node_modules/uglify-js/lib/compress.js(5594,18): error TS2454: Variable 'is_strict_comparison' is used before being assigned. -node_modules/uglify-js/lib/compress.js(6105,25): error TS2367: This condition will always return 'false' since the types 'boolean' and '"f"' have no overlap. -node_modules/uglify-js/lib/compress.js(6132,47): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(6205,39): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(6277,39): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(6283,41): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/compress.js(6728,43): error TS2454: Variable 'property' is used before being assigned. -node_modules/uglify-js/lib/compress.js(6743,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'. -node_modules/uglify-js/lib/compress.js(6746,46): error TS2339: Property 'has_side_effects' does not exist on type 'number'. -node_modules/uglify-js/lib/compress.js(6752,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'. -node_modules/uglify-js/lib/compress.js(6790,34): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(5094,45): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(5101,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'code' must be of type 'string', but here has type '{ get: () => string; toString: () => string; indent: () => void; indentation: () => number; current_width: () => number; should_break: () => boolean; has_parens: () => boolean; newline: () => void; print: (str: any) => void; ... 24 more ...; parent: (n: any) => any; }'. +node_modules/uglify-js/lib/compress.js(5105,36): error TS2532: Object is possibly 'undefined'. +node_modules/uglify-js/lib/compress.js(5110,41): error TS2339: Property 'get' does not exist on type 'string'. +node_modules/uglify-js/lib/compress.js(5623,18): error TS2454: Variable 'is_strict_comparison' is used before being assigned. +node_modules/uglify-js/lib/compress.js(6134,25): error TS2367: This condition will always return 'false' since the types 'boolean' and '"f"' have no overlap. +node_modules/uglify-js/lib/compress.js(6161,47): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(6234,39): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(6306,39): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(6312,41): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(6757,43): error TS2454: Variable 'property' is used before being assigned. +node_modules/uglify-js/lib/compress.js(6772,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'. +node_modules/uglify-js/lib/compress.js(6775,46): error TS2339: Property 'has_side_effects' does not exist on type 'number'. +node_modules/uglify-js/lib/compress.js(6781,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'value' must be of type 'number', but here has type 'any'. +node_modules/uglify-js/lib/compress.js(6819,34): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/minify.js(167,75): error TS2339: Property 'compress' does not exist on type 'Compressor'. node_modules/uglify-js/lib/mozilla-ast.js(566,33): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/output.js(235,25): error TS2554: Expected 0 arguments, but got 2. From b61813ea1d6c99438dfd267d34df9d74cb1fa265 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 31 May 2019 14:40:59 -0700 Subject: [PATCH 207/384] More test cases --- .../fourslash/renameForDefaultExport01.ts | 6 ++--- .../fourslash/renameForDefaultExport02.ts | 6 ++--- .../fourslash/renameForDefaultExport03.ts | 12 ++++----- .../cases/fourslash/renameImportAndExport.ts | 6 ++--- .../renameImportAndExportInDiffFiles.ts | 8 +++--- .../fourslash/renameImportAndShorthand.ts | 4 +-- .../renameImportNamespaceAndShorthand.ts | 4 +-- .../fourslash/renameImportOfExportEquals.ts | 16 +++++------ .../fourslash/renameImportOfExportEquals2.ts | 27 ++++++++++--------- .../cases/fourslash/renameImportOfReExport.ts | 8 +++--- .../fourslash/renameImportOfReExport2.ts | 6 ++--- tests/cases/fourslash/renameImportRequire.ts | 10 +++---- .../fourslash/renameInheritedProperties1.ts | 5 ++-- .../fourslash/renameInheritedProperties2.ts | 5 ++-- .../fourslash/renameInheritedProperties3.ts | 5 ++-- .../fourslash/renameInheritedProperties4.ts | 5 ++-- .../fourslash/renameInheritedProperties5.ts | 5 ++-- .../fourslash/renameInheritedProperties6.ts | 5 ++-- .../fourslash/renameInheritedProperties7.ts | 5 ++-- .../fourslash/renameInheritedProperties8.ts | 6 ++--- 20 files changed, 82 insertions(+), 72 deletions(-) diff --git a/tests/cases/fourslash/renameForDefaultExport01.ts b/tests/cases/fourslash/renameForDefaultExport01.ts index 1256a9698fa..04169d093e5 100644 --- a/tests/cases/fourslash/renameForDefaultExport01.ts +++ b/tests/cases/fourslash/renameForDefaultExport01.ts @@ -1,7 +1,7 @@ /// -////export default class [|DefaultExportedClass|] { -////} +////[|export default class [|{| "declarationRangeIndex": 0 |}DefaultExportedClass|] { +////}|] /////* //// * Commenting [|{| "inComment": true |}DefaultExportedClass|] //// */ @@ -10,5 +10,5 @@ //// ////var y = new [|DefaultExportedClass|]; -const ranges = test.ranges(); +const ranges = test.rangesByText().get("DefaultExportedClass"); verify.renameLocations(ranges.filter(r => !(r.marker && r.marker.data.inComment)), { findInComments: true, ranges }); diff --git a/tests/cases/fourslash/renameForDefaultExport02.ts b/tests/cases/fourslash/renameForDefaultExport02.ts index a6f6116ec1a..1b97657da67 100644 --- a/tests/cases/fourslash/renameForDefaultExport02.ts +++ b/tests/cases/fourslash/renameForDefaultExport02.ts @@ -1,8 +1,8 @@ /// -////export default function /*1*/[|DefaultExportedFunction|]() { +////[|export default function /*1*/[|{| "declarationRangeIndex": 0 |}DefaultExportedFunction|]() { //// return /*2*/[|DefaultExportedFunction|] -////} +////}|] /////** //// * Commenting [|{| "inComment": true |}DefaultExportedFunction|] //// */ @@ -11,5 +11,5 @@ //// ////var y = /*4*/[|DefaultExportedFunction|](); -const ranges = test.ranges(); +const ranges = test.rangesByText().get("DefaultExportedFunction"); verify.renameLocations(ranges.filter(r => !(r.marker && r.marker.data.inComment)), { findInComments: true, ranges }); diff --git a/tests/cases/fourslash/renameForDefaultExport03.ts b/tests/cases/fourslash/renameForDefaultExport03.ts index edc22bb0db0..f9f859d2396 100644 --- a/tests/cases/fourslash/renameForDefaultExport03.ts +++ b/tests/cases/fourslash/renameForDefaultExport03.ts @@ -1,10 +1,10 @@ /// -////function /*1*/[|f|]() { +////[|function /*1*/[|{| "declarationRangeIndex": 0 |}f|]() { //// return 100; -////} +////}|] //// -////export default /*2*/[|f|]; +////[|export default /*2*/[|{| "declarationRangeIndex": 2 |}f|];|] //// ////var x: typeof /*3*/[|f|]; //// @@ -13,9 +13,9 @@ /////** //// * Commenting [|{| "inComment": true |}f|] //// */ -////namespace /*5*/[|f|] { +////[|namespace /*5*/[|{| "declarationRangeIndex": 7 |}f|] { //// var local = 100; -////} +////}|] -const ranges = test.ranges(); +const ranges = test.rangesByText().get("f"); verify.renameLocations(ranges.filter(r => !(r.marker && r.marker.data.inComment)), { findInComments: true, ranges }); diff --git a/tests/cases/fourslash/renameImportAndExport.ts b/tests/cases/fourslash/renameImportAndExport.ts index 6a9cac061a4..bae23ec2d1a 100644 --- a/tests/cases/fourslash/renameImportAndExport.ts +++ b/tests/cases/fourslash/renameImportAndExport.ts @@ -1,8 +1,8 @@ /// -////import [|a|] from "module"; -////export { [|a|] }; +////[|import [|{| "declarationRangeIndex": 0 |}a|] from "module";|] +////[|export { [|{| "declarationRangeIndex": 2 |}a|] };|] -const [r0, r1] = test.ranges(); +const [r0Def, r0, r1Def, r1] = test.ranges(); verify.renameLocations(r0, [r0, { range: r1, suffixText: " as a" }]); verify.renameLocations(r1, [{ range: r1, prefixText: "a as " }]); diff --git a/tests/cases/fourslash/renameImportAndExportInDiffFiles.ts b/tests/cases/fourslash/renameImportAndExportInDiffFiles.ts index 28297fc7255..c2578a80849 100644 --- a/tests/cases/fourslash/renameImportAndExportInDiffFiles.ts +++ b/tests/cases/fourslash/renameImportAndExportInDiffFiles.ts @@ -1,13 +1,13 @@ /// // @Filename: a.ts -////export var [|{| "isDefinition": true |}a|]; +////[|export var [|{| "isDefinition": true, "declarationRangeIndex": 0 |}a|];|] // @Filename: b.ts -////import { [|{| "isWriteAccess": true, "isDefinition": true |}a|] } from './a'; -////export { [|{| "isWriteAccess": true, "isDefinition": true |}a|] }; +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}a|] } from './a';|] +////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}a|] };|] -const [r0, r1, r2] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2] = test.ranges(); const vars = { definition: "var a: any", ranges: [r0] }; const imports = { definition: "(alias) var a: any\nimport a", ranges: [r1, r2] }; verify.referenceGroups(r0, [vars, imports]); diff --git a/tests/cases/fourslash/renameImportAndShorthand.ts b/tests/cases/fourslash/renameImportAndShorthand.ts index 01be6650b3b..be3ee23fb10 100644 --- a/tests/cases/fourslash/renameImportAndShorthand.ts +++ b/tests/cases/fourslash/renameImportAndShorthand.ts @@ -1,7 +1,7 @@ /// -////import [|foo|] from 'bar'; +////[|import [|{| "declarationRangeIndex": 0 |}foo|] from 'bar';|] ////const bar = { [|foo|] }; -const [r0, r1] = test.ranges(); +const [r0Def, r0, r1] = test.ranges(); verify.renameLocations([r0, r1], [r0, { range: r1, prefixText: "foo: " }]); diff --git a/tests/cases/fourslash/renameImportNamespaceAndShorthand.ts b/tests/cases/fourslash/renameImportNamespaceAndShorthand.ts index e577d82d3ae..942d6a5ffde 100644 --- a/tests/cases/fourslash/renameImportNamespaceAndShorthand.ts +++ b/tests/cases/fourslash/renameImportNamespaceAndShorthand.ts @@ -1,7 +1,7 @@ /// -////import * as [|foo|] from 'bar'; +////[|import * as [|{| "declarationRangeIndex": 0 |}foo|] from 'bar';|] ////const bar = { [|foo|] }; -const [r0, r1] = test.ranges(); +const [r0Def, r0, r1] = test.ranges(); verify.renameLocations([r0, r1], [r0, { range: r1, prefixText: "foo: " }]); diff --git a/tests/cases/fourslash/renameImportOfExportEquals.ts b/tests/cases/fourslash/renameImportOfExportEquals.ts index 6dfe8270c6b..230c50d71fd 100644 --- a/tests/cases/fourslash/renameImportOfExportEquals.ts +++ b/tests/cases/fourslash/renameImportOfExportEquals.ts @@ -1,21 +1,21 @@ /// -////declare namespace [|{| "isWriteAccess": true, "isDefinition": true |}N|] { -//// export var [|{| "isWriteAccess": true, "isDefinition": true |}x|]: number; -////} +////[|declare namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}N|] { +//// [|export var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}x|]: number;|] +////}|] ////declare module "mod" { -//// export = [|N|]; +//// [|export = [|{| "declarationRangeIndex": 4 |}N|];|] ////} ////declare module "a" { -//// import * as [|{| "isWriteAccess": true, "isDefinition": true |}N|] from "mod"; -//// export { [|{| "isWriteAccess": true, "isDefinition": true |}N|] }; // Renaming N here would rename +//// [|import * as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}N|] from "mod";|] +//// [|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 8 |}N|] };|] // Renaming N here would rename ////} ////declare module "b" { -//// import { [|{| "isWriteAccess": true, "isDefinition": true |}N|] } from "a"; +//// [|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 10 |}N|] } from "a";|] //// export const y: typeof [|N|].[|x|]; ////} -const [N0, x0, N1, a0, a1, b0, b1, x1] = test.ranges(); +const [N0Def, N0, x0Def, x0, N1Def, N1, a0Def, a0, a1Def, a1, b0Def, b0, b1, x1] = test.ranges(); const nRanges = [N0, N1]; const aRanges = [a0, a1]; const bRanges = [b0, b1]; diff --git a/tests/cases/fourslash/renameImportOfExportEquals2.ts b/tests/cases/fourslash/renameImportOfExportEquals2.ts index dfb472caab8..67cb06b761b 100644 --- a/tests/cases/fourslash/renameImportOfExportEquals2.ts +++ b/tests/cases/fourslash/renameImportOfExportEquals2.ts @@ -1,27 +1,27 @@ /// -////declare namespace [|{| "isWriteAccess": true, "isDefinition": true |}N|] { +////[|declare namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}N|] { //// export var x: number; -////} +////}|] ////declare module "mod" { -//// export = [|N|]; +//// [|export = [|{| "declarationRangeIndex": 2 |}N|];|] ////} ////declare module "a" { -//// import * as [|{| "isWriteAccess": true, "isDefinition": true |}O|] from "mod"; -//// export { [|O|] as [|{| "isWriteAccess": true, "isDefinition": true |}P|] }; // Renaming N here would rename +//// [|import * as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}O|] from "mod";|] +//// [|export { [|{| "declarationRangeIndex": 6 |}O|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}P|] };|] // Renaming N here would rename ////} ////declare module "b" { -//// import { [|P|] as [|{| "isWriteAccess": true, "isDefinition": true |}Q|] } from "a"; +//// [|import { [|{| "declarationRangeIndex": 9 |}P|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 9 |}Q|] } from "a";|] //// export const y: typeof [|Q|].x; ////} verify.noErrors(); -const [N0, N1, O0, O1, P0, P1, Q0, Q1] = test.ranges(); -const nRanges = [N0, N1]; -const oRanges = [O0, O1]; -const pRanges = [P0, P1]; -const qRanges = [Q0, Q1]; +const ranges = test.rangesByText(); +const nRanges = ranges.get("N");// [N0, N1]; +const oRanges = ranges.get("O");// [O0, O1]; +const pRanges = ranges.get("P");//[P0, P1]; +const qRanges = ranges.get("Q");//[Q0, Q1]; const ns = { definition: "namespace N", ranges: nRanges }; const os = { definition: "(alias) namespace O\nimport O", ranges: oRanges }; @@ -33,4 +33,7 @@ verify.referenceGroups(oRanges, [os, ps, qs]); verify.referenceGroups(pRanges, [ps, qs]); verify.referenceGroups(qRanges, [qs]); -verify.rangesWithSameTextAreRenameLocations(); +verify.rangesAreRenameLocations(nRanges); +verify.rangesAreRenameLocations(oRanges); +verify.rangesAreRenameLocations(pRanges); +verify.rangesAreRenameLocations(qRanges); diff --git a/tests/cases/fourslash/renameImportOfReExport.ts b/tests/cases/fourslash/renameImportOfReExport.ts index ced67d43b9c..9d181b3892f 100644 --- a/tests/cases/fourslash/renameImportOfReExport.ts +++ b/tests/cases/fourslash/renameImportOfReExport.ts @@ -2,20 +2,20 @@ // @noLib: true ////declare module "a" { -//// export class [|{| "isWriteAccess": true, "isDefinition": true |}C|] {} +//// [|export class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}C|] {}|] ////} ////declare module "b" { -//// export { [|{| "isWriteAccess": true, "isDefinition": true |}C|] } from "a"; +//// [|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}C|] } from "a";|] ////} ////declare module "c" { -//// import { [|{| "isWriteAccess": true, "isDefinition": true |}C|] } from "b"; +//// [|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}C|] } from "b";|] //// export function f(c: [|C|]): void; ////} verify.noErrors(); const ranges = test.ranges(); -const [r0, r1, r2, r3] = ranges; +const [r0Def, r0, r1Def, r1, r2Def, r2, r3] = ranges; const importRanges = [r2, r3]; verify.renameLocations(r0, [r0, { range: r1, suffixText: " as C" }]); //, r1 verify.renameLocations(r1, [{ range: r1, prefixText: "C as " }, r2, r3]); diff --git a/tests/cases/fourslash/renameImportOfReExport2.ts b/tests/cases/fourslash/renameImportOfReExport2.ts index a6389d4aeb8..fe3926fbf9b 100644 --- a/tests/cases/fourslash/renameImportOfReExport2.ts +++ b/tests/cases/fourslash/renameImportOfReExport2.ts @@ -1,13 +1,13 @@ /// ////declare module "a" { -//// export class [|{| "isWriteAccess": true, "isDefinition": true |}C|] {} +//// [|export class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}C|] {}|] ////} ////declare module "b" { -//// export { [|C|] as [|{| "isWriteAccess": true, "isDefinition": true |}D|] } from "a"; +//// [|export { [|{| "declarationRangeIndex": 2 |}C|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}D|] } from "a";|] ////} ////declare module "c" { -//// import { [|{| "isWriteAccess": true, "isDefinition": true |}D|] } from "b"; +//// [|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}D|] } from "b";|] //// export function f(c: [|D|]): void; ////} diff --git a/tests/cases/fourslash/renameImportRequire.ts b/tests/cases/fourslash/renameImportRequire.ts index 915143263dd..11b729c72d6 100644 --- a/tests/cases/fourslash/renameImportRequire.ts +++ b/tests/cases/fourslash/renameImportRequire.ts @@ -1,16 +1,16 @@ /// // @Filename: /a.ts -////import [|e|] = require("mod4"); +////[|import [|{| "declarationRangeIndex": 0 |}e|] = require("mod4");|] ////[|e|]; ////a = { [|e|] }; -////export { [|e|] }; +////[|export { [|{| "declarationRangeIndex": 4 |}e|] };|] // @Filename: /b.ts -////import { [|e|] } from "./a"; -////export { [|e|] }; +////[|import { [|{| "declarationRangeIndex": 6 |}e|] } from "./a";|] +////[|export { [|{| "declarationRangeIndex": 8 |}e|] };|] -const [r0, r1, r2, r3, r4, r5] = test.ranges(); +const [r0Def, r0, r1, r2, r3Def, r3, r4Def, r4, r5Def, r5] = test.ranges(); verify.renameLocations([r0, r1, r2], [r0, r1, { range: r2, prefixText: "e: " }, { range: r3, suffixText: " as e" }]); verify.renameLocations(r3, [{ range: r3, prefixText: "e as " }, r4, { range: r5, suffixText: " as e" }]); verify.renameLocations(r4, [{ range: r4, prefixText: "e as " }, { range: r5, suffixText: " as e" }]); diff --git a/tests/cases/fourslash/renameInheritedProperties1.ts b/tests/cases/fourslash/renameInheritedProperties1.ts index b42335277a9..2cd8ec23781 100644 --- a/tests/cases/fourslash/renameInheritedProperties1.ts +++ b/tests/cases/fourslash/renameInheritedProperties1.ts @@ -1,10 +1,11 @@ /// //// class class1 extends class1 { -//// [|propName|]: string; +//// [|[|{| "declarationRangeIndex": 0 |}propName|]: string;|] //// } //// //// var v: class1; //// v.[|propName|]; -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameInheritedProperties2.ts b/tests/cases/fourslash/renameInheritedProperties2.ts index bcc4c5fc323..de6c6e14d15 100644 --- a/tests/cases/fourslash/renameInheritedProperties2.ts +++ b/tests/cases/fourslash/renameInheritedProperties2.ts @@ -1,10 +1,11 @@ /// //// class class1 extends class1 { -//// [|doStuff|]() { } +//// [|[|{| "declarationRangeIndex": 0 |}doStuff|]() { }|] //// } //// //// var v: class1; //// v.[|doStuff|](); -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameInheritedProperties3.ts b/tests/cases/fourslash/renameInheritedProperties3.ts index f1ec547d6ed..9d8e9b65476 100644 --- a/tests/cases/fourslash/renameInheritedProperties3.ts +++ b/tests/cases/fourslash/renameInheritedProperties3.ts @@ -1,10 +1,11 @@ /// //// interface interface1 extends interface1 { -//// [|propName|]: string; +//// [|[|{| "declarationRangeIndex": 0 |}propName|]: string;|] //// } //// //// var v: interface1; //// v.[|propName|]; -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameInheritedProperties4.ts b/tests/cases/fourslash/renameInheritedProperties4.ts index 42d9acfdb53..1fe0bc9de7b 100644 --- a/tests/cases/fourslash/renameInheritedProperties4.ts +++ b/tests/cases/fourslash/renameInheritedProperties4.ts @@ -1,10 +1,11 @@ /// //// interface interface1 extends interface1 { -//// [|doStuff|](): string; +//// [|[|{| "declarationRangeIndex": 0 |}doStuff|](): string;|] //// } //// //// var v: interface1; //// v.[|doStuff|](); -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameInheritedProperties5.ts b/tests/cases/fourslash/renameInheritedProperties5.ts index e153742d4ed..352201999a4 100644 --- a/tests/cases/fourslash/renameInheritedProperties5.ts +++ b/tests/cases/fourslash/renameInheritedProperties5.ts @@ -4,10 +4,11 @@ //// propC: number; //// } //// interface D extends C { -//// [|propD|]: string; +//// [|[|{| "declarationRangeIndex": 0 |}propD|]: string;|] //// } //// var d: D; //// d.[|propD|]; -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameInheritedProperties6.ts b/tests/cases/fourslash/renameInheritedProperties6.ts index 59318334cb0..5f997f3c664 100644 --- a/tests/cases/fourslash/renameInheritedProperties6.ts +++ b/tests/cases/fourslash/renameInheritedProperties6.ts @@ -4,9 +4,10 @@ //// propD: number; //// } //// interface D extends C { -//// [|propC|]: number; +//// [|[|{| "declarationRangeIndex": 0 |}propC|]: number;|] //// } //// var d: D; //// d.[|propC|]; -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameInheritedProperties7.ts b/tests/cases/fourslash/renameInheritedProperties7.ts index bc0521458f8..94becfd2e5b 100644 --- a/tests/cases/fourslash/renameInheritedProperties7.ts +++ b/tests/cases/fourslash/renameInheritedProperties7.ts @@ -1,7 +1,7 @@ /// //// class C extends D { -//// [|prop1|]: string; +//// [|[|{| "declarationRangeIndex": 0 |}prop1|]: string;|] //// } //// //// class D extends C { @@ -11,4 +11,5 @@ //// var c: C; //// c.[|prop1|]; -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameInheritedProperties8.ts b/tests/cases/fourslash/renameInheritedProperties8.ts index 7cde300bf0b..f27ded79dae 100644 --- a/tests/cases/fourslash/renameInheritedProperties8.ts +++ b/tests/cases/fourslash/renameInheritedProperties8.ts @@ -1,14 +1,14 @@ /// //// class C implements D { -//// [|prop1|]: string; +//// [|[|{| "declarationRangeIndex": 0 |}prop1|]: string;|] //// } //// //// interface D extends C { -//// [|prop1|]: string; +//// [|[|{| "declarationRangeIndex": 2 |}prop1|]: string;|] //// } //// //// var c: C; //// c.[|prop1|]; -verify.rangesAreRenameLocations(); +verify.rangesAreRenameLocations(test.rangesByText().get("prop1")); From dfb613c6d6efe76b1b5f9055bdb66cf198c5c83c Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 31 May 2019 16:00:54 -0700 Subject: [PATCH 208/384] Use for-of declaration list + expression as span for preview --- src/services/findAllReferences.ts | 30 ++++++++++++++----- src/services/goToDefinition.ts | 8 ++--- src/services/utilities.ts | 4 +-- ...renameDestructuringNestedBindingElement.ts | 8 ++--- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index b52777cb6fa..fd6d3a109d5 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -16,10 +16,15 @@ namespace ts.FindAllReferences { export const enum EntryKind { Span, Node, StringLiteral, SearchedLocalFoundProperty, SearchedPropertyFoundLocal } export type NodeEntryKind = EntryKind.Node | EntryKind.StringLiteral | EntryKind.SearchedLocalFoundProperty | EntryKind.SearchedPropertyFoundLocal; export type Entry = NodeEntry | SpanEntry; + export interface DeclarationNodeWithStartAndEnd { + start: Node; + end: Node; + } + export type DeclarationNode = Node | DeclarationNodeWithStartAndEnd; export interface NodeEntry { readonly kind: NodeEntryKind; readonly node: Node; - readonly declaration?: Node; + readonly declaration?: DeclarationNode; } export interface SpanEntry { readonly kind: EntryKind.Span; @@ -34,7 +39,11 @@ namespace ts.FindAllReferences { }; } - function getDeclarationForDeclarationSpanForNode(node: Node): Node | undefined { + export function isDeclarationNodeWithStartAndEnd(node: DeclarationNode): node is DeclarationNodeWithStartAndEnd { + return node && (node as Node).kind === undefined; + } + + function getDeclarationForDeclarationSpanForNode(node: Node): DeclarationNode | undefined { if (isDeclaration(node)) { return getDeclarationForDeclarationSpan(node); } @@ -72,7 +81,7 @@ namespace ts.FindAllReferences { return undefined; } - export function getDeclarationForDeclarationSpan(node: NamedDeclaration | BinaryExpression | undefined): Node | undefined { + export function getDeclarationForDeclarationSpan(node: NamedDeclaration | BinaryExpression | undefined): DeclarationNode | undefined { if (!node) return undefined; switch (node.kind) { case SyntaxKind.VariableDeclaration: @@ -80,6 +89,8 @@ namespace ts.FindAllReferences { node : isVariableStatement(node.parent.parent) ? node.parent.parent : + isForInOrOfStatement(node.parent.parent) ? + { start: node.parent.parent.initializer, end: node.parent.parent.expression } : node.parent; case SyntaxKind.BindingElement: @@ -257,7 +268,9 @@ namespace ts.FindAllReferences { displayParts }; if (declaration) { - result.declarationSpan = getTextSpan(declaration, sourceFile); + result.declarationSpan = isDeclarationNodeWithStartAndEnd(declaration) ? + getTextSpan(declaration.start, sourceFile, declaration.end) : + getTextSpan(declaration, sourceFile); } return result; } @@ -298,7 +311,9 @@ namespace ts.FindAllReferences { const sourceFile = entry.node.getSourceFile(); const result: DocumentSpan = { textSpan: getTextSpan(entry.node, sourceFile), fileName: sourceFile.fileName }; if (entry.declaration) { - result.declarationSpan = getTextSpan(entry.declaration, sourceFile); + result.declarationSpan = isDeclarationNodeWithStartAndEnd(entry.declaration) ? + getTextSpan(entry.declaration.start, sourceFile, entry.declaration.end) : + getTextSpan(entry.declaration, sourceFile); } return result; } @@ -392,10 +407,11 @@ namespace ts.FindAllReferences { return { fileName: documentSpan.fileName, span }; } - function getTextSpan(node: Node, sourceFile: SourceFile): TextSpan { + function getTextSpan(node: Node, sourceFile: SourceFile, endNode?: Node): TextSpan { let start = node.getStart(sourceFile); - let end = node.getEnd(); + let end = (endNode || node).getEnd(); if (node.kind === SyntaxKind.StringLiteral) { + Debug.assert(endNode === undefined); start += 1; end -= 1; } diff --git a/src/services/goToDefinition.ts b/src/services/goToDefinition.ts index 7a04184c5d9..f64a2469156 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -273,6 +273,7 @@ namespace ts.GoToDefinition { function createDefinitionInfoFromName(declaration: Declaration, symbolKind: ScriptElementKind, symbolName: string, containerName: string): DefinitionInfo { const name = getNameOfDeclaration(declaration) || declaration; const sourceFile = name.getSourceFile(); + const declarationNode = FindAllReferences.getDeclarationForDeclarationSpan(declaration)!; return { fileName: sourceFile.fileName, textSpan: createTextSpanFromNode(name, sourceFile), @@ -280,10 +281,9 @@ namespace ts.GoToDefinition { name: symbolName, containerKind: undefined!, // TODO: GH#18217 containerName, - declarationSpan: createTextSpanFromNode( - FindAllReferences.getDeclarationForDeclarationSpan(declaration)!, - sourceFile - ) + declarationSpan: FindAllReferences.isDeclarationNodeWithStartAndEnd(declarationNode) ? + createTextSpanFromNode(declarationNode.start, sourceFile, declarationNode.end) : + createTextSpanFromNode(declarationNode, sourceFile), }; } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 5506b45d380..35fca7f0e65 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1190,8 +1190,8 @@ namespace ts { return !!range && shouldBeReference === tripleSlashDirectivePrefixRegex.test(sourceFile.text.substring(range.pos, range.end)); } - export function createTextSpanFromNode(node: Node, sourceFile?: SourceFile): TextSpan { - return createTextSpanFromBounds(node.getStart(sourceFile), node.getEnd()); + export function createTextSpanFromNode(node: Node, sourceFile?: SourceFile, endNode?: Node): TextSpan { + return createTextSpanFromBounds(node.getStart(sourceFile), (endNode || node).getEnd()); } export function createTextRangeFromNode(node: Node, sourceFile: SourceFile): TextRange { diff --git a/tests/cases/fourslash/renameDestructuringNestedBindingElement.ts b/tests/cases/fourslash/renameDestructuringNestedBindingElement.ts index 6643382f6c9..f262f44c6f0 100644 --- a/tests/cases/fourslash/renameDestructuringNestedBindingElement.ts +++ b/tests/cases/fourslash/renameDestructuringNestedBindingElement.ts @@ -3,18 +3,18 @@ ////interface MultiRobot { //// name: string; //// skills: { -//// [|primary|]: string; +//// [|[|{| "declarationRangeIndex": 0|}primary|]: string;|] //// secondary: string; //// }; ////} ////let multiRobots: MultiRobot[]; -////for (let { skills: {[|primary|]: primaryA, secondary: secondaryA } } of multiRobots) { +////for ([|let { skills: {[|{| "declarationRangeIndex": 2|}primary|]: primaryA, secondary: secondaryA } } of multiRobots|]) { //// console.log(primaryA); ////} -////for (let { skills: {[|primary|], secondary } } of multiRobots) { +////for ([|let { skills: {[|{| "declarationRangeIndex": 4|}primary|], secondary } } of multiRobots|]) { //// console.log([|primary|]); ////} -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3] = test.ranges(); verify.renameLocations([r0, r1], [r0, r1, { range: r2, suffixText: ": primary" }]); verify.renameLocations([r2, r3], [{ range: r2, prefixText: "primary: " }, r3]); From 41ce98b440565de472a1f31909237be529d132d3 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 31 May 2019 16:11:08 -0700 Subject: [PATCH 209/384] Propagate saved variance flags from cached comparisons (#31688) * Propegate saved variance flags from cached comparisons * Propegate variance a bit more selectively * Add test * Remove now-redundant code * Fix misspelling and remove unneeded branch --- src/compiler/checker.ts | 28 +++- .../identicalTypesNoDifferByCheckOrder.js | 55 ++++++++ ...identicalTypesNoDifferByCheckOrder.symbols | 127 ++++++++++++++++++ .../identicalTypesNoDifferByCheckOrder.types | 88 ++++++++++++ .../identicalTypesNoDifferByCheckOrder.ts | 38 ++++++ 5 files changed, 330 insertions(+), 6 deletions(-) create mode 100644 tests/baselines/reference/identicalTypesNoDifferByCheckOrder.js create mode 100644 tests/baselines/reference/identicalTypesNoDifferByCheckOrder.symbols create mode 100644 tests/baselines/reference/identicalTypesNoDifferByCheckOrder.types create mode 100644 tests/cases/compiler/identicalTypesNoDifferByCheckOrder.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5814b2dcfbf..f79b80be9fc 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12981,6 +12981,18 @@ namespace ts { return result; } + function propagateSidebandVarianceFlags(typeArguments: readonly Type[], variances: VarianceFlags[]) { + for (let i = 0; i < variances.length; i++) { + const v = variances[i]; + if (v & VarianceFlags.Unmeasurable) { + instantiateType(typeArguments[i], reportUnmeasurableMarkers); + } + if (v & VarianceFlags.Unreliable) { + instantiateType(typeArguments[i], reportUnreliableMarkers); + } + } + } + // Determine if possibly recursive types are related. First, check if the result is already available in the global cache. // Second, check if we have already started a comparison of the given two types in which case we assume the result to be true. // Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are @@ -12998,6 +13010,16 @@ namespace ts { // as a failure, and should be updated as a reported failure by the bottom of this function. } else { + if (outofbandVarianceMarkerHandler) { + // We're in the middle of variance checking - integrate any unmeasurable/unreliable flags from this cached component + if (source.flags & (TypeFlags.Object | TypeFlags.Conditional) && source.aliasSymbol && + source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { + propagateSidebandVarianceFlags(source.aliasTypeArguments, getAliasVariances(source.aliasSymbol)); + } + if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (source).target === (target).target && length((source).typeArguments)) { + propagateSidebandVarianceFlags((source).typeArguments!, getVariances((source).target)); + } + } return related === RelationComparisonResult.Succeeded ? Ternary.True : Ternary.False; } } @@ -14070,12 +14092,6 @@ namespace ts { if (unreliable) { variance |= VarianceFlags.Unreliable; } - const covariantID = getRelationKey(typeWithSub, typeWithSuper, assignableRelation); - const contravariantID = getRelationKey(typeWithSuper, typeWithSub, assignableRelation); - // We delete the results of these checks, as we want them to actually be run, see the `Unmeasurable` variance we cache, - // And then fall back to a structural result. - assignableRelation.delete(covariantID); - assignableRelation.delete(contravariantID); } variances.push(variance); } diff --git a/tests/baselines/reference/identicalTypesNoDifferByCheckOrder.js b/tests/baselines/reference/identicalTypesNoDifferByCheckOrder.js new file mode 100644 index 00000000000..a88b29ce254 --- /dev/null +++ b/tests/baselines/reference/identicalTypesNoDifferByCheckOrder.js @@ -0,0 +1,55 @@ +//// [identicalTypesNoDifferByCheckOrder.ts] +interface SomeProps { + x?: string; + y?: number; + renderAs?: FunctionComponent1 +} + +type SomePropsX = Required> & Omit; + +interface SomePropsClone { + x?: string; + y?: number; + renderAs?: FunctionComponent2 +} + +type SomePropsCloneX = Required> & Omit; + +type Validator = {(): boolean, opt?: T}; +type WeakValidationMap = {[K in keyof T]?: null extends T[K] ? Validator : Validator}; + +interface FunctionComponent1

{ + (props: P & { children?: unknown }): void; + propTypes?: WeakValidationMap

; +} + +interface FunctionComponent2

{ + (props: P & { children?: unknown }): void; + propTypes?: WeakValidationMap

; +} + +function needsComponentOfSomeProps3(...x: SomePropsClone[]): void {} +const comp3: FunctionComponent2 = null as any; +needsComponentOfSomeProps3({ renderAs: comp3 }); + +function needsComponentOfSomeProps2(...x: SomeProps[]): void {} +const comp2: FunctionComponent1 = null as any; +needsComponentOfSomeProps2({ renderAs: comp2 }); + +//// [identicalTypesNoDifferByCheckOrder.js] +function needsComponentOfSomeProps3() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i] = arguments[_i]; + } +} +var comp3 = null; +needsComponentOfSomeProps3({ renderAs: comp3 }); +function needsComponentOfSomeProps2() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i] = arguments[_i]; + } +} +var comp2 = null; +needsComponentOfSomeProps2({ renderAs: comp2 }); diff --git a/tests/baselines/reference/identicalTypesNoDifferByCheckOrder.symbols b/tests/baselines/reference/identicalTypesNoDifferByCheckOrder.symbols new file mode 100644 index 00000000000..6850276d340 --- /dev/null +++ b/tests/baselines/reference/identicalTypesNoDifferByCheckOrder.symbols @@ -0,0 +1,127 @@ +=== tests/cases/compiler/identicalTypesNoDifferByCheckOrder.ts === +interface SomeProps { +>SomeProps : Symbol(SomeProps, Decl(identicalTypesNoDifferByCheckOrder.ts, 0, 0)) + + x?: string; +>x : Symbol(SomeProps.x, Decl(identicalTypesNoDifferByCheckOrder.ts, 0, 21)) + + y?: number; +>y : Symbol(SomeProps.y, Decl(identicalTypesNoDifferByCheckOrder.ts, 1, 15)) + + renderAs?: FunctionComponent1 +>renderAs : Symbol(SomeProps.renderAs, Decl(identicalTypesNoDifferByCheckOrder.ts, 2, 15)) +>FunctionComponent1 : Symbol(FunctionComponent1, Decl(identicalTypesNoDifferByCheckOrder.ts, 17, 120)) +>SomeProps : Symbol(SomeProps, Decl(identicalTypesNoDifferByCheckOrder.ts, 0, 0)) +} + +type SomePropsX = Required> & Omit; +>SomePropsX : Symbol(SomePropsX, Decl(identicalTypesNoDifferByCheckOrder.ts, 4, 1)) +>Required : Symbol(Required, Decl(lib.es5.d.ts, --, --)) +>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) +>SomeProps : Symbol(SomeProps, Decl(identicalTypesNoDifferByCheckOrder.ts, 0, 0)) +>Omit : Symbol(Omit, Decl(lib.es5.d.ts, --, --)) +>SomeProps : Symbol(SomeProps, Decl(identicalTypesNoDifferByCheckOrder.ts, 0, 0)) + +interface SomePropsClone { +>SomePropsClone : Symbol(SomePropsClone, Decl(identicalTypesNoDifferByCheckOrder.ts, 6, 72)) + + x?: string; +>x : Symbol(SomePropsClone.x, Decl(identicalTypesNoDifferByCheckOrder.ts, 8, 26)) + + y?: number; +>y : Symbol(SomePropsClone.y, Decl(identicalTypesNoDifferByCheckOrder.ts, 9, 15)) + + renderAs?: FunctionComponent2 +>renderAs : Symbol(SomePropsClone.renderAs, Decl(identicalTypesNoDifferByCheckOrder.ts, 10, 15)) +>FunctionComponent2 : Symbol(FunctionComponent2, Decl(identicalTypesNoDifferByCheckOrder.ts, 22, 1)) +>SomeProps : Symbol(SomeProps, Decl(identicalTypesNoDifferByCheckOrder.ts, 0, 0)) +} + +type SomePropsCloneX = Required> & Omit; +>SomePropsCloneX : Symbol(SomePropsCloneX, Decl(identicalTypesNoDifferByCheckOrder.ts, 12, 1)) +>Required : Symbol(Required, Decl(lib.es5.d.ts, --, --)) +>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) +>SomePropsClone : Symbol(SomePropsClone, Decl(identicalTypesNoDifferByCheckOrder.ts, 6, 72)) +>Omit : Symbol(Omit, Decl(lib.es5.d.ts, --, --)) +>SomePropsClone : Symbol(SomePropsClone, Decl(identicalTypesNoDifferByCheckOrder.ts, 6, 72)) + +type Validator = {(): boolean, opt?: T}; +>Validator : Symbol(Validator, Decl(identicalTypesNoDifferByCheckOrder.ts, 14, 87)) +>T : Symbol(T, Decl(identicalTypesNoDifferByCheckOrder.ts, 16, 15)) +>opt : Symbol(opt, Decl(identicalTypesNoDifferByCheckOrder.ts, 16, 33)) +>T : Symbol(T, Decl(identicalTypesNoDifferByCheckOrder.ts, 16, 15)) + +type WeakValidationMap = {[K in keyof T]?: null extends T[K] ? Validator : Validator}; +>WeakValidationMap : Symbol(WeakValidationMap, Decl(identicalTypesNoDifferByCheckOrder.ts, 16, 43)) +>T : Symbol(T, Decl(identicalTypesNoDifferByCheckOrder.ts, 17, 23)) +>K : Symbol(K, Decl(identicalTypesNoDifferByCheckOrder.ts, 17, 30)) +>T : Symbol(T, Decl(identicalTypesNoDifferByCheckOrder.ts, 17, 23)) +>T : Symbol(T, Decl(identicalTypesNoDifferByCheckOrder.ts, 17, 23)) +>K : Symbol(K, Decl(identicalTypesNoDifferByCheckOrder.ts, 17, 30)) +>Validator : Symbol(Validator, Decl(identicalTypesNoDifferByCheckOrder.ts, 14, 87)) +>T : Symbol(T, Decl(identicalTypesNoDifferByCheckOrder.ts, 17, 23)) +>K : Symbol(K, Decl(identicalTypesNoDifferByCheckOrder.ts, 17, 30)) +>Validator : Symbol(Validator, Decl(identicalTypesNoDifferByCheckOrder.ts, 14, 87)) +>T : Symbol(T, Decl(identicalTypesNoDifferByCheckOrder.ts, 17, 23)) +>K : Symbol(K, Decl(identicalTypesNoDifferByCheckOrder.ts, 17, 30)) + +interface FunctionComponent1

{ +>FunctionComponent1 : Symbol(FunctionComponent1, Decl(identicalTypesNoDifferByCheckOrder.ts, 17, 120)) +>P : Symbol(P, Decl(identicalTypesNoDifferByCheckOrder.ts, 19, 29)) + + (props: P & { children?: unknown }): void; +>props : Symbol(props, Decl(identicalTypesNoDifferByCheckOrder.ts, 20, 5)) +>P : Symbol(P, Decl(identicalTypesNoDifferByCheckOrder.ts, 19, 29)) +>children : Symbol(children, Decl(identicalTypesNoDifferByCheckOrder.ts, 20, 17)) + + propTypes?: WeakValidationMap

; +>propTypes : Symbol(FunctionComponent1.propTypes, Decl(identicalTypesNoDifferByCheckOrder.ts, 20, 46)) +>WeakValidationMap : Symbol(WeakValidationMap, Decl(identicalTypesNoDifferByCheckOrder.ts, 16, 43)) +>P : Symbol(P, Decl(identicalTypesNoDifferByCheckOrder.ts, 19, 29)) +} + +interface FunctionComponent2

{ +>FunctionComponent2 : Symbol(FunctionComponent2, Decl(identicalTypesNoDifferByCheckOrder.ts, 22, 1)) +>P : Symbol(P, Decl(identicalTypesNoDifferByCheckOrder.ts, 24, 29)) + + (props: P & { children?: unknown }): void; +>props : Symbol(props, Decl(identicalTypesNoDifferByCheckOrder.ts, 25, 5)) +>P : Symbol(P, Decl(identicalTypesNoDifferByCheckOrder.ts, 24, 29)) +>children : Symbol(children, Decl(identicalTypesNoDifferByCheckOrder.ts, 25, 17)) + + propTypes?: WeakValidationMap

; +>propTypes : Symbol(FunctionComponent2.propTypes, Decl(identicalTypesNoDifferByCheckOrder.ts, 25, 46)) +>WeakValidationMap : Symbol(WeakValidationMap, Decl(identicalTypesNoDifferByCheckOrder.ts, 16, 43)) +>P : Symbol(P, Decl(identicalTypesNoDifferByCheckOrder.ts, 24, 29)) +} + +function needsComponentOfSomeProps3(...x: SomePropsClone[]): void {} +>needsComponentOfSomeProps3 : Symbol(needsComponentOfSomeProps3, Decl(identicalTypesNoDifferByCheckOrder.ts, 27, 1)) +>x : Symbol(x, Decl(identicalTypesNoDifferByCheckOrder.ts, 29, 36)) +>SomePropsClone : Symbol(SomePropsClone, Decl(identicalTypesNoDifferByCheckOrder.ts, 6, 72)) + +const comp3: FunctionComponent2 = null as any; +>comp3 : Symbol(comp3, Decl(identicalTypesNoDifferByCheckOrder.ts, 30, 5)) +>FunctionComponent2 : Symbol(FunctionComponent2, Decl(identicalTypesNoDifferByCheckOrder.ts, 22, 1)) +>SomePropsCloneX : Symbol(SomePropsCloneX, Decl(identicalTypesNoDifferByCheckOrder.ts, 12, 1)) + +needsComponentOfSomeProps3({ renderAs: comp3 }); +>needsComponentOfSomeProps3 : Symbol(needsComponentOfSomeProps3, Decl(identicalTypesNoDifferByCheckOrder.ts, 27, 1)) +>renderAs : Symbol(renderAs, Decl(identicalTypesNoDifferByCheckOrder.ts, 31, 28)) +>comp3 : Symbol(comp3, Decl(identicalTypesNoDifferByCheckOrder.ts, 30, 5)) + +function needsComponentOfSomeProps2(...x: SomeProps[]): void {} +>needsComponentOfSomeProps2 : Symbol(needsComponentOfSomeProps2, Decl(identicalTypesNoDifferByCheckOrder.ts, 31, 48)) +>x : Symbol(x, Decl(identicalTypesNoDifferByCheckOrder.ts, 33, 36)) +>SomeProps : Symbol(SomeProps, Decl(identicalTypesNoDifferByCheckOrder.ts, 0, 0)) + +const comp2: FunctionComponent1 = null as any; +>comp2 : Symbol(comp2, Decl(identicalTypesNoDifferByCheckOrder.ts, 34, 5)) +>FunctionComponent1 : Symbol(FunctionComponent1, Decl(identicalTypesNoDifferByCheckOrder.ts, 17, 120)) +>SomePropsX : Symbol(SomePropsX, Decl(identicalTypesNoDifferByCheckOrder.ts, 4, 1)) + +needsComponentOfSomeProps2({ renderAs: comp2 }); +>needsComponentOfSomeProps2 : Symbol(needsComponentOfSomeProps2, Decl(identicalTypesNoDifferByCheckOrder.ts, 31, 48)) +>renderAs : Symbol(renderAs, Decl(identicalTypesNoDifferByCheckOrder.ts, 35, 28)) +>comp2 : Symbol(comp2, Decl(identicalTypesNoDifferByCheckOrder.ts, 34, 5)) + diff --git a/tests/baselines/reference/identicalTypesNoDifferByCheckOrder.types b/tests/baselines/reference/identicalTypesNoDifferByCheckOrder.types new file mode 100644 index 00000000000..e4c691c6b95 --- /dev/null +++ b/tests/baselines/reference/identicalTypesNoDifferByCheckOrder.types @@ -0,0 +1,88 @@ +=== tests/cases/compiler/identicalTypesNoDifferByCheckOrder.ts === +interface SomeProps { + x?: string; +>x : string | undefined + + y?: number; +>y : number | undefined + + renderAs?: FunctionComponent1 +>renderAs : FunctionComponent1 | undefined +} + +type SomePropsX = Required> & Omit; +>SomePropsX : SomePropsX + +interface SomePropsClone { + x?: string; +>x : string | undefined + + y?: number; +>y : number | undefined + + renderAs?: FunctionComponent2 +>renderAs : FunctionComponent2 | undefined +} + +type SomePropsCloneX = Required> & Omit; +>SomePropsCloneX : SomePropsCloneX + +type Validator = {(): boolean, opt?: T}; +>Validator : Validator +>opt : T | undefined + +type WeakValidationMap = {[K in keyof T]?: null extends T[K] ? Validator : Validator}; +>WeakValidationMap : WeakValidationMap +>null : null +>null : null + +interface FunctionComponent1

{ + (props: P & { children?: unknown }): void; +>props : P & { children?: unknown; } +>children : unknown + + propTypes?: WeakValidationMap

; +>propTypes : WeakValidationMap

| undefined +} + +interface FunctionComponent2

{ + (props: P & { children?: unknown }): void; +>props : P & { children?: unknown; } +>children : unknown + + propTypes?: WeakValidationMap

; +>propTypes : WeakValidationMap

| undefined +} + +function needsComponentOfSomeProps3(...x: SomePropsClone[]): void {} +>needsComponentOfSomeProps3 : (...x: SomePropsClone[]) => void +>x : SomePropsClone[] + +const comp3: FunctionComponent2 = null as any; +>comp3 : FunctionComponent2 +>null as any : any +>null : null + +needsComponentOfSomeProps3({ renderAs: comp3 }); +>needsComponentOfSomeProps3({ renderAs: comp3 }) : void +>needsComponentOfSomeProps3 : (...x: SomePropsClone[]) => void +>{ renderAs: comp3 } : { renderAs: FunctionComponent2; } +>renderAs : FunctionComponent2 +>comp3 : FunctionComponent2 + +function needsComponentOfSomeProps2(...x: SomeProps[]): void {} +>needsComponentOfSomeProps2 : (...x: SomeProps[]) => void +>x : SomeProps[] + +const comp2: FunctionComponent1 = null as any; +>comp2 : FunctionComponent1 +>null as any : any +>null : null + +needsComponentOfSomeProps2({ renderAs: comp2 }); +>needsComponentOfSomeProps2({ renderAs: comp2 }) : void +>needsComponentOfSomeProps2 : (...x: SomeProps[]) => void +>{ renderAs: comp2 } : { renderAs: FunctionComponent1; } +>renderAs : FunctionComponent1 +>comp2 : FunctionComponent1 + diff --git a/tests/cases/compiler/identicalTypesNoDifferByCheckOrder.ts b/tests/cases/compiler/identicalTypesNoDifferByCheckOrder.ts new file mode 100644 index 00000000000..fbdf373a407 --- /dev/null +++ b/tests/cases/compiler/identicalTypesNoDifferByCheckOrder.ts @@ -0,0 +1,38 @@ +// @strictNullChecks: true + +interface SomeProps { + x?: string; + y?: number; + renderAs?: FunctionComponent1 +} + +type SomePropsX = Required> & Omit; + +interface SomePropsClone { + x?: string; + y?: number; + renderAs?: FunctionComponent2 +} + +type SomePropsCloneX = Required> & Omit; + +type Validator = {(): boolean, opt?: T}; +type WeakValidationMap = {[K in keyof T]?: null extends T[K] ? Validator : Validator}; + +interface FunctionComponent1

{ + (props: P & { children?: unknown }): void; + propTypes?: WeakValidationMap

; +} + +interface FunctionComponent2

{ + (props: P & { children?: unknown }): void; + propTypes?: WeakValidationMap

; +} + +function needsComponentOfSomeProps3(...x: SomePropsClone[]): void {} +const comp3: FunctionComponent2 = null as any; +needsComponentOfSomeProps3({ renderAs: comp3 }); + +function needsComponentOfSomeProps2(...x: SomeProps[]): void {} +const comp2: FunctionComponent1 = null as any; +needsComponentOfSomeProps2({ renderAs: comp2 }); \ No newline at end of file From c0537d9bad3d1a190c023a1e1b75d6b04a7d1973 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 31 May 2019 16:19:27 -0700 Subject: [PATCH 210/384] More tests --- .../fourslash/renameDestructuringClassProperty.ts | 10 +++++----- .../fourslash/renameDestructuringDeclarationInFor.ts | 8 ++++---- .../fourslash/renameDestructuringDeclarationInForOf.ts | 8 ++++---- .../fourslash/renameDestructuringFunctionParameter.ts | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/cases/fourslash/renameDestructuringClassProperty.ts b/tests/cases/fourslash/renameDestructuringClassProperty.ts index ac708e55471..1cab702903f 100644 --- a/tests/cases/fourslash/renameDestructuringClassProperty.ts +++ b/tests/cases/fourslash/renameDestructuringClassProperty.ts @@ -1,22 +1,22 @@ /// ////class A { -//// [|foo|]: string; +//// [|[|{| "declarationRangeIndex": 0 |}foo|]: string;|] ////} ////class B { //// syntax1(a: A): void { -//// let { [|foo|] } = a; +//// [|let { [|{| "declarationRangeIndex": 2 |}foo|] } = a;|] //// } //// syntax2(a: A): void { -//// let { [|foo|]: foo } = a; +//// [|let { [|{| "declarationRangeIndex": 4 |}foo|]: foo } = a;|] //// } //// syntax11(a: A): void { -//// let { [|foo|] } = a; +//// [|let { [|{| "declarationRangeIndex": 6 |}foo|] } = a;|] //// [|foo|] = "newString"; //// } ////} -const [r0, r1, r2, r3, r4] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4] = test.ranges(); verify.renameLocations([r0, r2], [r0, { range: r1, suffixText: ": foo" }, r2, { range: r3, suffixText: ": foo" }]); verify.renameLocations(r1, [{ range: r1, prefixText: "foo: " }]); verify.renameLocations([r3, r4], [{ range: r3, prefixText: "foo: " }, r4]); diff --git a/tests/cases/fourslash/renameDestructuringDeclarationInFor.ts b/tests/cases/fourslash/renameDestructuringDeclarationInFor.ts index 02bc0f50826..bde0f348736 100644 --- a/tests/cases/fourslash/renameDestructuringDeclarationInFor.ts +++ b/tests/cases/fourslash/renameDestructuringDeclarationInFor.ts @@ -1,18 +1,18 @@ /// ////interface I { -//// [|property1|]: number; +//// [|[|{| "declarationRangeIndex": 0 |}property1|]: number;|] //// property2: string; ////} ////var elems: I[]; //// ////var p2: number, property1: number; -////for (let { [|property1|]: p2 } = elems[0]; p2 < 100; p2++) { +////for ([|let { [|{| "declarationRangeIndex": 2 |}property1|]: p2 } = elems[0]|]; p2 < 100; p2++) { ////} -////for (let { [|property1|] } = elems[0]; p2 < 100; p2++) { +////for ([|let { [|{| "declarationRangeIndex": 4 |}property1|] } = elems[0]|]; p2 < 100; p2++) { //// [|property1|] = p2; ////} -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3] = test.ranges(); verify.renameLocations([r0, r1], [r0, r1, { range: r2, suffixText: ": property1" }]); verify.renameLocations([r2, r3], [{ range: r2, prefixText: "property1: " }, r3]); diff --git a/tests/cases/fourslash/renameDestructuringDeclarationInForOf.ts b/tests/cases/fourslash/renameDestructuringDeclarationInForOf.ts index a8e21c83cf3..b2ad6e01b31 100644 --- a/tests/cases/fourslash/renameDestructuringDeclarationInForOf.ts +++ b/tests/cases/fourslash/renameDestructuringDeclarationInForOf.ts @@ -1,17 +1,17 @@ /// ////interface I { -//// [|property1|]: number; +//// [|[|{| "declarationRangeIndex": 0 |}property1|]: number;|] //// property2: string; ////} ////var elems: I[]; //// -////for (let { [|property1|] } of elems) { +////for ([|let { [|{| "declarationRangeIndex": 2 |}property1|] } of elems|]) { //// [|property1|]++; ////} -////for (let { [|property1|]: p2 } of elems) { +////for ([|let { [|{| "declarationRangeIndex": 5 |}property1|]: p2 } of elems|]) { ////} -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2, r3Def, r3] = test.ranges(); verify.renameLocations([r0, r3], [r0, { range: r1, suffixText: ": property1" }, r3]); verify.renameLocations([r1, r2], [{ range: r1, prefixText: "property1: " }, r2]); diff --git a/tests/cases/fourslash/renameDestructuringFunctionParameter.ts b/tests/cases/fourslash/renameDestructuringFunctionParameter.ts index d6a732176d2..79d2b40193b 100644 --- a/tests/cases/fourslash/renameDestructuringFunctionParameter.ts +++ b/tests/cases/fourslash/renameDestructuringFunctionParameter.ts @@ -1,10 +1,10 @@ /// -////function f({[|a|]}: {[|a|]}) { +////function f([|{[|{| "declarationRangeIndex": 0 |}a|]}: {[|{| "declarationRangeIndex": 2 |}a|]}|]) { //// f({[|a|]}); ////} -const [r0, r1, r2] = test.ranges(); +const [r0Def, r0, r1, r2] = test.ranges(); // renames the local verify.renameLocations([r0, r2], [{ range: r0, prefixText: "a: " }, { range: r2, prefixText: "a: " }]); // renames the property From 4fc5f6a5ff4f4894cb2868b952e9c7e55685a951 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 31 May 2019 16:40:22 -0700 Subject: [PATCH 211/384] When binding pattern contextually types x || y, x contextually types y --- src/compiler/checker.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5814b2dcfbf..bf83323741e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -18435,11 +18435,13 @@ namespace ts { } return contextSensitive === true ? getTypeOfExpression(left) : contextSensitive; case SyntaxKind.BarBarToken: - // When an || expression has a contextual type, the operands are contextually typed by that type. When an || - // expression has no contextual type, the right operand is contextually typed by the type of the left operand, - // except for the special case of Javascript declarations of the form `namespace.prop = namespace.prop || {}` + // When an || expression has a contextual type, the operands are contextually typed by that type, except + // when that type originates in a binding pattern, the right operand is contextually typed by the type of + // the left operand. When an || expression has no contextual type, the right operand is contextually typed + // by the type of the left operand, except for the special case of Javascript declarations of the form + // `namespace.prop = namespace.prop || {}`. const type = getContextualType(binaryExpression, contextFlags); - return !type && node === right && !isDefaultedExpandoInitializer(binaryExpression) ? + return node === right && (type && type.pattern || !type && !isDefaultedExpandoInitializer(binaryExpression)) ? getTypeOfExpression(left) : type; case SyntaxKind.AmpersandAmpersandToken: case SyntaxKind.CommaToken: From 5c7823c8b8d463ec0e3274741d357ea972b775b2 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 31 May 2019 16:52:11 -0700 Subject: [PATCH 212/384] Accept new baselines --- .../reference/initializedDestructuringAssignmentTypes.types | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/baselines/reference/initializedDestructuringAssignmentTypes.types b/tests/baselines/reference/initializedDestructuringAssignmentTypes.types index bb30a395cff..333fc5d92cc 100644 --- a/tests/baselines/reference/initializedDestructuringAssignmentTypes.types +++ b/tests/baselines/reference/initializedDestructuringAssignmentTypes.types @@ -9,7 +9,7 @@ const [, a = ''] = ''.match('') || []; >'' : "" >match : (regexp: string | RegExp) => RegExpMatchArray >'' : "" ->[] : [undefined?, ""?] +>[] : undefined[] a.toFixed() >a.toFixed() : any From d0795afb48f06cf5088d6331dbcf2700da0e9734 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 31 May 2019 16:53:46 -0700 Subject: [PATCH 213/384] Add regression tests --- .../compiler/destructuringAssignmentWithDefault.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/cases/compiler/destructuringAssignmentWithDefault.ts b/tests/cases/compiler/destructuringAssignmentWithDefault.ts index 45ade402eb8..ba00ea7ceee 100644 --- a/tests/cases/compiler/destructuringAssignmentWithDefault.ts +++ b/tests/cases/compiler/destructuringAssignmentWithDefault.ts @@ -2,3 +2,15 @@ const a: { x?: number } = { }; let x = 0; ({x = 1} = a); + +// Repro from #26235 + +function f1(options?: { color?: string, width?: number }) { + let { color, width } = options || {}; + ({ color, width } = options || {}); +} + +function f2(options?: [string?, number?]) { + let [str, num] = options || []; + [str, num] = options || []; +} From 0895fd6bdc723f1e69097499fa2173c0f1091c5e Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 31 May 2019 16:53:53 -0700 Subject: [PATCH 214/384] Accept new baselines --- .../destructuringAssignmentWithDefault.js | 23 +++++++++ ...destructuringAssignmentWithDefault.symbols | 34 ++++++++++++++ .../destructuringAssignmentWithDefault.types | 47 +++++++++++++++++++ 3 files changed, 104 insertions(+) diff --git a/tests/baselines/reference/destructuringAssignmentWithDefault.js b/tests/baselines/reference/destructuringAssignmentWithDefault.js index df4addf0269..4eedee050bd 100644 --- a/tests/baselines/reference/destructuringAssignmentWithDefault.js +++ b/tests/baselines/reference/destructuringAssignmentWithDefault.js @@ -2,6 +2,18 @@ const a: { x?: number } = { }; let x = 0; ({x = 1} = a); + +// Repro from #26235 + +function f1(options?: { color?: string, width?: number }) { + let { color, width } = options || {}; + ({ color, width } = options || {}); +} + +function f2(options?: [string?, number?]) { + let [str, num] = options || []; + [str, num] = options || []; +} //// [destructuringAssignmentWithDefault.js] @@ -9,3 +21,14 @@ var _a; var a = {}; var x = 0; (_a = a.x, x = _a === void 0 ? 1 : _a); +// Repro from #26235 +function f1(options) { + var _a; + var _b = options || {}, color = _b.color, width = _b.width; + (_a = options || {}, color = _a.color, width = _a.width); +} +function f2(options) { + var _a; + var _b = options || [], str = _b[0], num = _b[1]; + _a = options || [], str = _a[0], num = _a[1]; +} diff --git a/tests/baselines/reference/destructuringAssignmentWithDefault.symbols b/tests/baselines/reference/destructuringAssignmentWithDefault.symbols index b011834c4f0..071740ebdde 100644 --- a/tests/baselines/reference/destructuringAssignmentWithDefault.symbols +++ b/tests/baselines/reference/destructuringAssignmentWithDefault.symbols @@ -10,3 +10,37 @@ let x = 0; >x : Symbol(x, Decl(destructuringAssignmentWithDefault.ts, 2, 2)) >a : Symbol(a, Decl(destructuringAssignmentWithDefault.ts, 0, 5)) +// Repro from #26235 + +function f1(options?: { color?: string, width?: number }) { +>f1 : Symbol(f1, Decl(destructuringAssignmentWithDefault.ts, 2, 14)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 6, 12)) +>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 6, 23)) +>width : Symbol(width, Decl(destructuringAssignmentWithDefault.ts, 6, 39)) + + let { color, width } = options || {}; +>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 7, 9)) +>width : Symbol(width, Decl(destructuringAssignmentWithDefault.ts, 7, 16)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 6, 12)) + + ({ color, width } = options || {}); +>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 8, 6)) +>width : Symbol(width, Decl(destructuringAssignmentWithDefault.ts, 8, 13)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 6, 12)) +} + +function f2(options?: [string?, number?]) { +>f2 : Symbol(f2, Decl(destructuringAssignmentWithDefault.ts, 9, 1)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 11, 12)) + + let [str, num] = options || []; +>str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 12, 9)) +>num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 12, 13)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 11, 12)) + + [str, num] = options || []; +>str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 12, 9)) +>num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 12, 13)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 11, 12)) +} + diff --git a/tests/baselines/reference/destructuringAssignmentWithDefault.types b/tests/baselines/reference/destructuringAssignmentWithDefault.types index 6347ccd0188..34f377774b5 100644 --- a/tests/baselines/reference/destructuringAssignmentWithDefault.types +++ b/tests/baselines/reference/destructuringAssignmentWithDefault.types @@ -16,3 +16,50 @@ let x = 0; >1 : 1 >a : { x?: number | undefined; } +// Repro from #26235 + +function f1(options?: { color?: string, width?: number }) { +>f1 : (options?: { color?: string | undefined; width?: number | undefined; } | undefined) => void +>options : { color?: string | undefined; width?: number | undefined; } | undefined +>color : string | undefined +>width : number | undefined + + let { color, width } = options || {}; +>color : string | undefined +>width : number | undefined +>options || {} : { color?: string | undefined; width?: number | undefined; } +>options : { color?: string | undefined; width?: number | undefined; } | undefined +>{} : {} + + ({ color, width } = options || {}); +>({ color, width } = options || {}) : { color?: string | undefined; width?: number | undefined; } +>{ color, width } = options || {} : { color?: string | undefined; width?: number | undefined; } +>{ color, width } : { color: string | undefined; width: number | undefined; } +>color : string | undefined +>width : number | undefined +>options || {} : { color?: string | undefined; width?: number | undefined; } +>options : { color?: string | undefined; width?: number | undefined; } | undefined +>{} : {} +} + +function f2(options?: [string?, number?]) { +>f2 : (options?: [(string | undefined)?, (number | undefined)?] | undefined) => void +>options : [(string | undefined)?, (number | undefined)?] | undefined + + let [str, num] = options || []; +>str : string | undefined +>num : number | undefined +>options || [] : [(string | undefined)?, (number | undefined)?] +>options : [(string | undefined)?, (number | undefined)?] | undefined +>[] : [] + + [str, num] = options || []; +>[str, num] = options || [] : [(string | undefined)?, (number | undefined)?] +>[str, num] : [string | undefined, number | undefined] +>str : string | undefined +>num : number | undefined +>options || [] : [(string | undefined)?, (number | undefined)?] +>options : [(string | undefined)?, (number | undefined)?] | undefined +>[] : [] +} + From d548f6af70fced8f029b4d8fef85713774893099 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 1 Jun 2019 09:45:58 -0700 Subject: [PATCH 215/384] Consider object literals in unions to have properties of type 'undefined' --- src/compiler/checker.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index bf83323741e..781f24f5d5e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8016,10 +8016,13 @@ namespace ts { else if (isUnion) { const indexInfo = !isLateBoundName(name) && (isNumericLiteralName(name) && getIndexInfoOfType(type, IndexKind.Number) || getIndexInfoOfType(type, IndexKind.String)); if (indexInfo) { - checkFlags |= indexInfo.isReadonly ? CheckFlags.Readonly : 0; - checkFlags |= CheckFlags.WritePartial; + checkFlags |= CheckFlags.WritePartial | (indexInfo.isReadonly ? CheckFlags.Readonly : 0); indexTypes = append(indexTypes, isTupleType(type) ? getRestTypeOfTupleType(type) || undefinedType : indexInfo.type); } + else if (isObjectLiteralType(type)) { + checkFlags |= CheckFlags.WritePartial; + indexTypes = append(indexTypes, undefinedType); + } else { checkFlags |= CheckFlags.ReadPartial; } @@ -20181,7 +20184,8 @@ namespace ts { let propType: Type; const leftType = checkNonNullExpression(left); const parentSymbol = getNodeLinks(left).resolvedSymbol; - const apparentType = getApparentType(getWidenedType(leftType)); + // We widen array literals to get type any[] instead of undefined[] in non-strict mode + const apparentType = getApparentType(isEmptyArrayLiteralType(leftType) ? getWidenedType(leftType) : leftType); if (isTypeAny(apparentType) || apparentType === silentNeverType) { if (isIdentifier(left) && parentSymbol) { markAliasReferenced(parentSymbol, node); From 86040e069932260ede34c400160a44034c262f6b Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 1 Jun 2019 10:36:53 -0700 Subject: [PATCH 216/384] Add more tests --- .../destructuringAssignmentWithDefault.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/cases/compiler/destructuringAssignmentWithDefault.ts b/tests/cases/compiler/destructuringAssignmentWithDefault.ts index ba00ea7ceee..76b0e71c373 100644 --- a/tests/cases/compiler/destructuringAssignmentWithDefault.ts +++ b/tests/cases/compiler/destructuringAssignmentWithDefault.ts @@ -8,9 +8,25 @@ let x = 0; function f1(options?: { color?: string, width?: number }) { let { color, width } = options || {}; ({ color, width } = options || {}); + let x1 = (options || {}).color; + let x2 = (options || {})["color"]; } function f2(options?: [string?, number?]) { let [str, num] = options || []; [str, num] = options || []; + let x1 = (options || {})[0]; +} + +function f3(options?: { color: string, width: number }) { + let { color, width } = options || {}; + ({ color, width } = options || {}); + let x1 = (options || {}).color; + let x2 = (options || {})["color"]; +} + +function f4(options?: [string, number]) { + let [str, num] = options || []; + [str, num] = options || []; + let x1 = (options || {})[0]; } From 48d343b9852acd673c38ad0c43a93aada3935e79 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 1 Jun 2019 10:37:02 -0700 Subject: [PATCH 217/384] Accept new baselines --- .../destructuringAssignmentWithDefault.js | 32 ++++++ ...destructuringAssignmentWithDefault.symbols | 80 +++++++++++++-- .../destructuringAssignmentWithDefault.types | 99 +++++++++++++++++++ 3 files changed, 203 insertions(+), 8 deletions(-) diff --git a/tests/baselines/reference/destructuringAssignmentWithDefault.js b/tests/baselines/reference/destructuringAssignmentWithDefault.js index 4eedee050bd..b2b0c31654b 100644 --- a/tests/baselines/reference/destructuringAssignmentWithDefault.js +++ b/tests/baselines/reference/destructuringAssignmentWithDefault.js @@ -8,11 +8,27 @@ let x = 0; function f1(options?: { color?: string, width?: number }) { let { color, width } = options || {}; ({ color, width } = options || {}); + let x1 = (options || {}).color; + let x2 = (options || {})["color"]; } function f2(options?: [string?, number?]) { let [str, num] = options || []; [str, num] = options || []; + let x1 = (options || {})[0]; +} + +function f3(options?: { color: string, width: number }) { + let { color, width } = options || {}; + ({ color, width } = options || {}); + let x1 = (options || {}).color; + let x2 = (options || {})["color"]; +} + +function f4(options?: [string, number]) { + let [str, num] = options || []; + [str, num] = options || []; + let x1 = (options || {})[0]; } @@ -26,9 +42,25 @@ function f1(options) { var _a; var _b = options || {}, color = _b.color, width = _b.width; (_a = options || {}, color = _a.color, width = _a.width); + var x1 = (options || {}).color; + var x2 = (options || {})["color"]; } function f2(options) { var _a; var _b = options || [], str = _b[0], num = _b[1]; _a = options || [], str = _a[0], num = _a[1]; + var x1 = (options || {})[0]; +} +function f3(options) { + var _a; + var _b = options || {}, color = _b.color, width = _b.width; + (_a = options || {}, color = _a.color, width = _a.width); + var x1 = (options || {}).color; + var x2 = (options || {})["color"]; +} +function f4(options) { + var _a; + var _b = options || [], str = _b[0], num = _b[1]; + _a = options || [], str = _a[0], num = _a[1]; + var x1 = (options || {})[0]; } diff --git a/tests/baselines/reference/destructuringAssignmentWithDefault.symbols b/tests/baselines/reference/destructuringAssignmentWithDefault.symbols index 071740ebdde..eef4bdcd97a 100644 --- a/tests/baselines/reference/destructuringAssignmentWithDefault.symbols +++ b/tests/baselines/reference/destructuringAssignmentWithDefault.symbols @@ -27,20 +27,84 @@ function f1(options?: { color?: string, width?: number }) { >color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 8, 6)) >width : Symbol(width, Decl(destructuringAssignmentWithDefault.ts, 8, 13)) >options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 6, 12)) + + let x1 = (options || {}).color; +>x1 : Symbol(x1, Decl(destructuringAssignmentWithDefault.ts, 9, 7)) +>(options || {}).color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 6, 23)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 6, 12)) +>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 6, 23)) + + let x2 = (options || {})["color"]; +>x2 : Symbol(x2, Decl(destructuringAssignmentWithDefault.ts, 10, 7)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 6, 12)) +>"color" : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 6, 23)) } function f2(options?: [string?, number?]) { ->f2 : Symbol(f2, Decl(destructuringAssignmentWithDefault.ts, 9, 1)) ->options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 11, 12)) +>f2 : Symbol(f2, Decl(destructuringAssignmentWithDefault.ts, 11, 1)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 13, 12)) let [str, num] = options || []; ->str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 12, 9)) ->num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 12, 13)) ->options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 11, 12)) +>str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 14, 9)) +>num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 14, 13)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 13, 12)) [str, num] = options || []; ->str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 12, 9)) ->num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 12, 13)) ->options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 11, 12)) +>str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 14, 9)) +>num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 14, 13)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 13, 12)) + + let x1 = (options || {})[0]; +>x1 : Symbol(x1, Decl(destructuringAssignmentWithDefault.ts, 16, 7)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 13, 12)) +>0 : Symbol(0) +} + +function f3(options?: { color: string, width: number }) { +>f3 : Symbol(f3, Decl(destructuringAssignmentWithDefault.ts, 17, 1)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 19, 12)) +>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 19, 23)) +>width : Symbol(width, Decl(destructuringAssignmentWithDefault.ts, 19, 38)) + + let { color, width } = options || {}; +>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 20, 9)) +>width : Symbol(width, Decl(destructuringAssignmentWithDefault.ts, 20, 16)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 19, 12)) + + ({ color, width } = options || {}); +>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 21, 6)) +>width : Symbol(width, Decl(destructuringAssignmentWithDefault.ts, 21, 13)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 19, 12)) + + let x1 = (options || {}).color; +>x1 : Symbol(x1, Decl(destructuringAssignmentWithDefault.ts, 22, 7)) +>(options || {}).color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 19, 23)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 19, 12)) +>color : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 19, 23)) + + let x2 = (options || {})["color"]; +>x2 : Symbol(x2, Decl(destructuringAssignmentWithDefault.ts, 23, 7)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 19, 12)) +>"color" : Symbol(color, Decl(destructuringAssignmentWithDefault.ts, 19, 23)) +} + +function f4(options?: [string, number]) { +>f4 : Symbol(f4, Decl(destructuringAssignmentWithDefault.ts, 24, 1)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 26, 12)) + + let [str, num] = options || []; +>str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 27, 9)) +>num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 27, 13)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 26, 12)) + + [str, num] = options || []; +>str : Symbol(str, Decl(destructuringAssignmentWithDefault.ts, 27, 9)) +>num : Symbol(num, Decl(destructuringAssignmentWithDefault.ts, 27, 13)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 26, 12)) + + let x1 = (options || {})[0]; +>x1 : Symbol(x1, Decl(destructuringAssignmentWithDefault.ts, 29, 7)) +>options : Symbol(options, Decl(destructuringAssignmentWithDefault.ts, 26, 12)) +>0 : Symbol(0) } diff --git a/tests/baselines/reference/destructuringAssignmentWithDefault.types b/tests/baselines/reference/destructuringAssignmentWithDefault.types index 34f377774b5..379bfe8b3bd 100644 --- a/tests/baselines/reference/destructuringAssignmentWithDefault.types +++ b/tests/baselines/reference/destructuringAssignmentWithDefault.types @@ -40,6 +40,24 @@ function f1(options?: { color?: string, width?: number }) { >options || {} : { color?: string | undefined; width?: number | undefined; } >options : { color?: string | undefined; width?: number | undefined; } | undefined >{} : {} + + let x1 = (options || {}).color; +>x1 : string | undefined +>(options || {}).color : string | undefined +>(options || {}) : { color?: string | undefined; width?: number | undefined; } +>options || {} : { color?: string | undefined; width?: number | undefined; } +>options : { color?: string | undefined; width?: number | undefined; } | undefined +>{} : {} +>color : string | undefined + + let x2 = (options || {})["color"]; +>x2 : string | undefined +>(options || {})["color"] : string | undefined +>(options || {}) : { color?: string | undefined; width?: number | undefined; } +>options || {} : { color?: string | undefined; width?: number | undefined; } +>options : { color?: string | undefined; width?: number | undefined; } | undefined +>{} : {} +>"color" : "color" } function f2(options?: [string?, number?]) { @@ -61,5 +79,86 @@ function f2(options?: [string?, number?]) { >options || [] : [(string | undefined)?, (number | undefined)?] >options : [(string | undefined)?, (number | undefined)?] | undefined >[] : [] + + let x1 = (options || {})[0]; +>x1 : string | undefined +>(options || {})[0] : string | undefined +>(options || {}) : [(string | undefined)?, (number | undefined)?] | {} +>options || {} : [(string | undefined)?, (number | undefined)?] | {} +>options : [(string | undefined)?, (number | undefined)?] | undefined +>{} : {} +>0 : 0 +} + +function f3(options?: { color: string, width: number }) { +>f3 : (options?: { color: string; width: number; } | undefined) => void +>options : { color: string; width: number; } | undefined +>color : string +>width : number + + let { color, width } = options || {}; +>color : string | undefined +>width : number | undefined +>options || {} : { color: string; width: number; } | {} +>options : { color: string; width: number; } | undefined +>{} : {} + + ({ color, width } = options || {}); +>({ color, width } = options || {}) : { color: string; width: number; } | {} +>{ color, width } = options || {} : { color: string; width: number; } | {} +>{ color, width } : { color: string | undefined; width: number | undefined; } +>color : string | undefined +>width : number | undefined +>options || {} : { color: string; width: number; } | {} +>options : { color: string; width: number; } | undefined +>{} : {} + + let x1 = (options || {}).color; +>x1 : string | undefined +>(options || {}).color : string | undefined +>(options || {}) : { color: string; width: number; } | {} +>options || {} : { color: string; width: number; } | {} +>options : { color: string; width: number; } | undefined +>{} : {} +>color : string | undefined + + let x2 = (options || {})["color"]; +>x2 : string | undefined +>(options || {})["color"] : string | undefined +>(options || {}) : { color: string; width: number; } | {} +>options || {} : { color: string; width: number; } | {} +>options : { color: string; width: number; } | undefined +>{} : {} +>"color" : "color" +} + +function f4(options?: [string, number]) { +>f4 : (options?: [string, number] | undefined) => void +>options : [string, number] | undefined + + let [str, num] = options || []; +>str : string | undefined +>num : number | undefined +>options || [] : [] | [string, number] +>options : [string, number] | undefined +>[] : [] + + [str, num] = options || []; +>[str, num] = options || [] : [] | [string, number] +>[str, num] : [string | undefined, number | undefined] +>str : string | undefined +>num : number | undefined +>options || [] : [] | [string, number] +>options : [string, number] | undefined +>[] : [] + + let x1 = (options || {})[0]; +>x1 : string | undefined +>(options || {})[0] : string | undefined +>(options || {}) : [string, number] | {} +>options || {} : [string, number] | {} +>options : [string, number] | undefined +>{} : {} +>0 : 0 } From a658f728a9fe72a5f07bed2ffcd3174624414ce8 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Fri, 31 May 2019 17:47:19 -0400 Subject: [PATCH 218/384] Include the project filepath in the error message for files not being listed in the 'include' pattern. TS6307 --- src/compiler/diagnosticMessages.json | 4 ++-- src/compiler/program.ts | 2 +- src/testRunner/unittests/config/projectReferences.ts | 4 ++-- src/testRunner/unittests/tsbuild/resolveJsonModule.ts | 5 +++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 5d6dc7d6df4..fd750094296 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3956,7 +3956,7 @@ "category": "Error", "code": 6306 }, - "File '{0}' is not in project file list. Projects must list all files or use an 'include' pattern.": { + "File '{0}' is not in project '{1}' file list. Projects must list all files or use an 'include' pattern.": { "category": "Error", "code": 6307 }, @@ -4295,7 +4295,7 @@ "Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'.": { "category": "Error", "code": 7053 - }, + }, "No index signature with a parameter of type '{0}' was found on type '{1}'.": { "category": "Error", "code": 7054 diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 8e4cd48b5ba..f6b379682ec 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2773,7 +2773,7 @@ namespace ts { // Ignore file that is not emitted if (!sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect)) continue; if (rootPaths.indexOf(file.path) === -1) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName)); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_in_project_1_file_list_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName, options.configFilePath || "")); } } } diff --git a/src/testRunner/unittests/config/projectReferences.ts b/src/testRunner/unittests/config/projectReferences.ts index 3acffd7a8c6..8a29760857b 100644 --- a/src/testRunner/unittests/config/projectReferences.ts +++ b/src/testRunner/unittests/config/projectReferences.ts @@ -194,7 +194,7 @@ namespace ts { testProjectReferences(spec, "/primary/tsconfig.json", program => { const errs = program.getOptionsDiagnostics(); - assertHasError("Reports an error about b.ts not being in the list", errs, Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern); + assertHasError("Reports an error about b.ts not being in the list", errs, Diagnostics.File_0_is_not_in_project_1_file_list_Projects_must_list_all_files_or_use_an_include_pattern); }); }); @@ -344,7 +344,7 @@ namespace ts { }; testProjectReferences(spec, "/alpha/tsconfig.json", (program) => { assertHasError("Issues an error about the rootDir", program.getOptionsDiagnostics(), Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files); - assertHasError("Issues an error about the fileList", program.getOptionsDiagnostics(), Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern); + assertHasError("Issues an error about the fileList", program.getOptionsDiagnostics(), Diagnostics.File_0_is_not_in_project_1_file_list_Projects_must_list_all_files_or_use_an_include_pattern); }); }); }); diff --git a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts index 3fc50d72ea5..ef2b5a4a674 100644 --- a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts +++ b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts @@ -31,8 +31,9 @@ namespace ts { it("with resolveJsonModule and include only", () => { verifyProjectWithResolveJsonModule("/src/tsconfig_withInclude.json", [ - Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern, - "/src/src/hello.json" + Diagnostics.File_0_is_not_in_project_1_file_list_Projects_must_list_all_files_or_use_an_include_pattern, + "/src/src/hello.json", + "/src/tsconfig_withInclude.json" ]); }); From 30333e19e22e2fd6a1366289a4d92f1975946d7c Mon Sep 17 00:00:00 2001 From: csigs Date: Mon, 3 Jun 2019 16:10:14 +0000 Subject: [PATCH 219/384] LEGO: check in for master to temporary branch. --- .../diagnosticMessages.generated.json.lcl | 140 +++++++++--------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl index 0078e878dbc..6720bf0c191 100644 --- a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2881,7 +2881,7 @@ - + @@ -3667,7 +3667,7 @@ - + @@ -3685,7 +3685,7 @@ - + @@ -3694,7 +3694,7 @@ - + @@ -4369,7 +4369,7 @@ - + @@ -4399,7 +4399,7 @@ - + @@ -5242,7 +5242,7 @@ - + @@ -5251,7 +5251,7 @@ - + @@ -5935,7 +5935,7 @@ - + @@ -5971,7 +5971,7 @@ - + @@ -5980,7 +5980,7 @@ - + @@ -5998,7 +5998,7 @@ - + @@ -6007,7 +6007,7 @@ - + @@ -6016,7 +6016,7 @@ - + @@ -6025,7 +6025,7 @@ - + @@ -6043,7 +6043,7 @@ - + @@ -6052,7 +6052,7 @@ - + @@ -6061,7 +6061,7 @@ - + @@ -6070,7 +6070,7 @@ - + @@ -6079,7 +6079,7 @@ - + @@ -6088,7 +6088,7 @@ - + @@ -6106,7 +6106,7 @@ - + @@ -6115,7 +6115,7 @@ - + @@ -6133,7 +6133,7 @@ - + @@ -6142,7 +6142,7 @@ - + @@ -6169,7 +6169,7 @@ - + @@ -6178,7 +6178,7 @@ - + @@ -6187,7 +6187,7 @@ - + @@ -6196,7 +6196,7 @@ - + @@ -6577,7 +6577,7 @@ - + @@ -6586,7 +6586,7 @@ - + @@ -6595,7 +6595,7 @@ - + @@ -6676,7 +6676,7 @@ - + @@ -6685,7 +6685,7 @@ - + @@ -6703,7 +6703,7 @@ - + @@ -6712,7 +6712,7 @@ - + @@ -6730,7 +6730,7 @@ - + @@ -6739,7 +6739,7 @@ - + @@ -6757,7 +6757,7 @@ - + @@ -6766,7 +6766,7 @@ - + @@ -7090,7 +7090,7 @@ - + @@ -7099,7 +7099,7 @@ - + @@ -7108,7 +7108,7 @@ - + @@ -7117,7 +7117,7 @@ - + @@ -7147,7 +7147,7 @@ - + @@ -7156,7 +7156,7 @@ - + @@ -7165,7 +7165,7 @@ - + @@ -7174,7 +7174,7 @@ - + @@ -7183,7 +7183,7 @@ - + @@ -7192,7 +7192,7 @@ - + @@ -7210,7 +7210,7 @@ - + @@ -7219,7 +7219,7 @@ - + @@ -7237,7 +7237,7 @@ - + @@ -7246,7 +7246,7 @@ - + @@ -7264,7 +7264,7 @@ - + @@ -7273,7 +7273,7 @@ - + @@ -7291,7 +7291,7 @@ - + @@ -7300,7 +7300,7 @@ - + @@ -8692,7 +8692,7 @@ - + @@ -8701,7 +8701,7 @@ - + @@ -8710,7 +8710,7 @@ - + @@ -8719,7 +8719,7 @@ - + @@ -8728,7 +8728,7 @@ - + @@ -8737,7 +8737,7 @@ - + @@ -8746,7 +8746,7 @@ - + @@ -8755,7 +8755,7 @@ - + @@ -8764,7 +8764,7 @@ - + @@ -8839,7 +8839,7 @@ - + @@ -9676,7 +9676,7 @@ - + @@ -9685,7 +9685,7 @@ - + From 0fee3b023d021365235b537baf58792ccce6ab0c Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 3 Jun 2019 13:22:14 -0700 Subject: [PATCH 220/384] Handle destructuring assignments --- src/services/findAllReferences.ts | 27 ++++++++++++++----- .../renameDestructuringAssignment.ts | 6 ++--- .../renameDestructuringAssignmentInFor.ts | 10 +++---- .../renameDestructuringAssignmentInForOf.ts | 10 +++---- ...ructuringAssignmentNestedInArrayLiteral.ts | 10 +++---- ...enameDestructuringAssignmentNestedInFor.ts | 10 +++---- ...nameDestructuringAssignmentNestedInFor2.ts | 10 +++---- ...ameDestructuringAssignmentNestedInForOf.ts | 10 +++---- ...meDestructuringAssignmentNestedInForOf2.ts | 10 +++---- 9 files changed, 59 insertions(+), 44 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index fd6d3a109d5..c3a8cc15b08 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -81,7 +81,7 @@ namespace ts.FindAllReferences { return undefined; } - export function getDeclarationForDeclarationSpan(node: NamedDeclaration | BinaryExpression | undefined): DeclarationNode | undefined { + export function getDeclarationForDeclarationSpan(node: NamedDeclaration | BinaryExpression | ForInOrOfStatement | undefined): DeclarationNode | undefined { if (!node) return undefined; switch (node.kind) { case SyntaxKind.VariableDeclaration: @@ -90,8 +90,8 @@ namespace ts.FindAllReferences { isVariableStatement(node.parent.parent) ? node.parent.parent : isForInOrOfStatement(node.parent.parent) ? - { start: node.parent.parent.initializer, end: node.parent.parent.expression } : - node.parent; + getDeclarationForDeclarationSpan(node.parent.parent) : + node.parent; case SyntaxKind.BindingElement: return getDeclarationForDeclarationSpan(node.parent.parent as NamedDeclaration); @@ -114,12 +114,27 @@ namespace ts.FindAllReferences { case SyntaxKind.BinaryExpression: return isExpressionStatement(node.parent) ? node.parent : - undefined; + node; - // Not really interesting definition + case SyntaxKind.ForOfStatement: + case SyntaxKind.ForInStatement: + return { + start: (node as ForInOrOfStatement).initializer, + end: (node as ForInOrOfStatement).expression + }; + + case SyntaxKind.PropertyAssignment: // TODO(shkamat):: Should we show whole object literal instead? case SyntaxKind.ShorthandPropertyAssignment: - return undefined; + return isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent) ? + getDeclarationForDeclarationSpan( + findAncestor(node.parent, node => + isBinaryExpression(node) || isForInOrOfStatement(node) + ) as BinaryExpression | ForInOrOfStatement + ) : + node.kind === SyntaxKind.PropertyAssignment ? + node : + undefined; default: return node; diff --git a/tests/cases/fourslash/renameDestructuringAssignment.ts b/tests/cases/fourslash/renameDestructuringAssignment.ts index 89a44a3a9d9..7833f4166a2 100644 --- a/tests/cases/fourslash/renameDestructuringAssignment.ts +++ b/tests/cases/fourslash/renameDestructuringAssignment.ts @@ -1,10 +1,10 @@ /// ////interface I { -//// [|x|]: number; +//// [|[|{| "declarationRangeIndex": 0 |}x|]: number;|] ////} ////var a: I; ////var x; -////({ [|x|]: x } = a); +////([|{ [|{| "declarationRangeIndex": 2 |}x|]: x } = a|]); -verify.rangesAreRenameLocations(); +verify.rangesAreRenameLocations(test.rangesByText().get("x")); diff --git a/tests/cases/fourslash/renameDestructuringAssignmentInFor.ts b/tests/cases/fourslash/renameDestructuringAssignmentInFor.ts index 2c8ad51f486..0ed560bb3fb 100644 --- a/tests/cases/fourslash/renameDestructuringAssignmentInFor.ts +++ b/tests/cases/fourslash/renameDestructuringAssignmentInFor.ts @@ -1,20 +1,20 @@ /// ////interface I { -//// [|property1|]: number; +//// [|[|{| "declarationRangeIndex": 0 |}property1|]: number;|] //// property2: string; ////} ////var elems: I[]; //// -////var p2: number, [|property1|]: number; -////for ({ [|property1|] } = elems[0]; p2 < 100; p2++) { +////var p2: number, [|[|{| "declarationRangeIndex": 2 |}property1|]: number|]; +////for ([|{ [|{| "declarationRangeIndex": 4 |}property1|] } = elems[0]|]; p2 < 100; p2++) { //// p2 = [|property1|]++; ////} -////for ({ [|property1|]: p2 } = elems[0]; p2 < 100; p2++) { +////for ([|{ [|{| "declarationRangeIndex": 7 |}property1|]: p2 } = elems[0]|]; p2 < 100; p2++) { ////} verify.noErrors(); const ranges = test.ranges(); -const [r0, r1, r2, r3, r4] = ranges; +const [r0Def, r0, r1Def, r1, r2Def, r2, r3, r4Def, r4] = ranges; verify.renameLocations([r0, r4], [r0, { range: r2, suffixText: ": property1" }, r4]); verify.renameLocations([r1, r2, r3], [r1, { range: r2, prefixText: "property1: " }, r3]); diff --git a/tests/cases/fourslash/renameDestructuringAssignmentInForOf.ts b/tests/cases/fourslash/renameDestructuringAssignmentInForOf.ts index 38703a68b99..80bc064ac0b 100644 --- a/tests/cases/fourslash/renameDestructuringAssignmentInForOf.ts +++ b/tests/cases/fourslash/renameDestructuringAssignmentInForOf.ts @@ -1,20 +1,20 @@ /// ////interface I { -//// [|property1|]: number; +//// [|[|{| "declarationRangeIndex": 0 |}property1|]: number;|] //// property2: string; ////} ////var elems: I[]; //// -////var [|property1|]: number, p2: number; -////for ({ [|property1|] } of elems) { +////var [|[|{| "declarationRangeIndex": 2 |}property1|]: number|], p2: number; +////for ([|{ [|{| "declarationRangeIndex": 4 |}property1|] } of elems|]) { //// [|property1|]++; ////} -////for ({ [|property1|]: p2 } of elems) { +////for ([|{ [|{| "declarationRangeIndex": 7 |}property1|]: p2 } of elems|]) { ////} verify.noErrors(); const ranges = test.ranges(); -const [r0, r1, r2, r3, r4] = ranges; +const [r0Def, r0, r1Def, r1, r2Def, r2, r3, r4Def, r4] = ranges; verify.renameLocations([r0, r4], [r0, { range: r2, suffixText: ": property1" }, r4]); verify.renameLocations([r1, r2, r3], [r1, { range: r2, prefixText: "property1: " }, r3]); diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral.ts index 292aaf1bf6d..2b8b882407c 100644 --- a/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral.ts +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral.ts @@ -1,15 +1,15 @@ /// ////interface I { -//// [|property1|]: number; +//// [|[|{| "declarationRangeIndex": 0 |}property1|]: number;|] //// property2: string; ////} -////var elems: I[], p1: number, [|property1|]: number; -////[{ [|property1|]: p1 }] = elems; -////[{ [|property1|] }] = elems; +////var elems: I[], p1: number, [|[|{| "declarationRangeIndex": 2 |}property1|]: number|]; +////[|[{ [|{| "declarationRangeIndex": 4 |}property1|]: p1 }] = elems;|] +////[|[{ [|{| "declarationRangeIndex": 6 |}property1|] }] = elems;|] const ranges = test.ranges(); -const [r0, r1, r2, r3] = ranges; +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3] = ranges; verify.renameLocations([r0, r2], [r0, r2, { range: r3, suffixText: ": property1" }]); verify.renameLocations([r1, r3], [r1, { range: r3, prefixText: "property1: " }]); diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor.ts index e83487d15d2..5a2f4699942 100644 --- a/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor.ts +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor.ts @@ -3,20 +3,20 @@ ////interface MultiRobot { //// name: string; //// skills: { -//// [|primary|]: string; +//// [|[|{| "declarationRangeIndex": 0 |}primary|]: string;|] //// secondary: string; //// }; ////} -////let multiRobot: MultiRobot, [|primary|]: string, secondary: string, primaryA: string, secondaryA: string, i: number; -////for ({ skills: { [|primary|]: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +////let multiRobot: MultiRobot, [|[|{| "declarationRangeIndex": 2 |}primary|]: string|], secondary: string, primaryA: string, secondaryA: string, i: number; +////for ([|{ skills: { [|{| "declarationRangeIndex": 4 |}primary|]: primaryA, secondary: secondaryA } } = multiRobot|], i = 0; i < 1; i++) { //// primaryA; ////} -////for ({ skills: { [|primary|], secondary } } = multiRobot, i = 0; i < 1; i++) { +////for ([|{ skills: { [|{| "declarationRangeIndex": 6 |}primary|], secondary } } = multiRobot|], i = 0; i < 1; i++) { //// [|primary|]; ////} verify.noErrors(); const ranges = test.ranges(); -const [r0, r1, r2, r3, r4] = ranges; +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4] = ranges; verify.renameLocations([r0, r2], [r0, r2, { range: r3, suffixText: ": primary" }]); verify.renameLocations([r1, r3, r4], [r1, { range: r3, prefixText: "primary: " }, r4]); diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor2.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor2.ts index e83487d15d2..5a2f4699942 100644 --- a/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor2.ts +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor2.ts @@ -3,20 +3,20 @@ ////interface MultiRobot { //// name: string; //// skills: { -//// [|primary|]: string; +//// [|[|{| "declarationRangeIndex": 0 |}primary|]: string;|] //// secondary: string; //// }; ////} -////let multiRobot: MultiRobot, [|primary|]: string, secondary: string, primaryA: string, secondaryA: string, i: number; -////for ({ skills: { [|primary|]: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +////let multiRobot: MultiRobot, [|[|{| "declarationRangeIndex": 2 |}primary|]: string|], secondary: string, primaryA: string, secondaryA: string, i: number; +////for ([|{ skills: { [|{| "declarationRangeIndex": 4 |}primary|]: primaryA, secondary: secondaryA } } = multiRobot|], i = 0; i < 1; i++) { //// primaryA; ////} -////for ({ skills: { [|primary|], secondary } } = multiRobot, i = 0; i < 1; i++) { +////for ([|{ skills: { [|{| "declarationRangeIndex": 6 |}primary|], secondary } } = multiRobot|], i = 0; i < 1; i++) { //// [|primary|]; ////} verify.noErrors(); const ranges = test.ranges(); -const [r0, r1, r2, r3, r4] = ranges; +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4] = ranges; verify.renameLocations([r0, r2], [r0, r2, { range: r3, suffixText: ": primary" }]); verify.renameLocations([r1, r3, r4], [r1, { range: r3, prefixText: "primary: " }, r4]); diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf.ts index 6a9eb6235b7..7a7786d5a99 100644 --- a/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf.ts +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf.ts @@ -3,20 +3,20 @@ ////interface MultiRobot { //// name: string; //// skills: { -//// [|primary|]: string; +//// [|[|{| "declarationRangeIndex": 0 |}primary|]: string;|] //// secondary: string; //// }; ////} ////let multiRobots: MultiRobot[]; -////let [|primary|]: string, secondary: string, primaryA: string, secondaryA: string; -////for ({ skills: { [|primary|]: primaryA, secondary: secondaryA } } of multiRobots) { +////let [|[|{| "declarationRangeIndex": 2 |}primary|]: string|], secondary: string, primaryA: string, secondaryA: string; +////for ([|{ skills: { [|{| "declarationRangeIndex": 4 |}primary|]: primaryA, secondary: secondaryA } } of multiRobots|]) { //// primaryA; ////} -////for ({ skills: { [|primary|], secondary } } of multiRobots) { +////for ([|{ skills: { [|{| "declarationRangeIndex": 6 |}primary|], secondary } } of multiRobots|]) { //// [|primary|]; ////} verify.noErrors(); -const [r0, r1, r2, r3, r4] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4] = test.ranges(); verify.renameLocations([r0, r2], [r0, r2, { range: r3, suffixText: ": primary" }]); verify.renameLocations([r1, r3, r4], [r1, { range: r3, prefixText: "primary: " }, r4]) diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf2.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf2.ts index 7c5c288ea78..897c0ba871c 100644 --- a/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf2.ts +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf2.ts @@ -3,19 +3,19 @@ ////interface MultiRobot { //// name: string; //// skills: { -//// [|primary|]: string; +//// [|[|{| "declarationRangeIndex": 0 |}primary|]: string;|] //// secondary: string; //// }; ////} -////let multiRobots: MultiRobot[], [|primary|]: string; -////for ({ skills: { [|primary|]: primaryA, secondary: secondaryA } } of multiRobots) { +////let multiRobots: MultiRobot[], [|[|{| "declarationRangeIndex": 2 |}primary|]: string|]; +////for ([|{ skills: { [|{| "declarationRangeIndex": 4 |}primary|]: primaryA, secondary: secondaryA } } of multiRobots|]) { //// console.log(primaryA); ////} -////for ({ skills: { [|primary|], secondary } } of multiRobots) { +////for ([|{ skills: { [|{| "declarationRangeIndex": 6 |}primary|], secondary } } of multiRobots|]) { //// console.log([|primary|]); ////} const ranges = test.ranges(); -const [r0, r1, r2, r3, r4] = ranges; +const [r0Def, r0, r1Def, r1,r2Def, r2, r3Def, r3, r4] = ranges; verify.renameLocations([r0, r2], [r0, r2, { range: r3, suffixText: ": primary" }]); verify.renameLocations([r1, r3, r4], [r1, { range: r3, prefixText: "primary: " }, r4]); From 01bbc4de2e8ec4641323fd90b77b784eed732056 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 3 Jun 2019 13:49:42 -0700 Subject: [PATCH 221/384] More tests --- tests/cases/fourslash/renameCrossJsTs01.ts | 6 +++--- tests/cases/fourslash/renameDefaultImport.ts | 11 +++++------ .../fourslash/renameDefaultImportDifferentName.ts | 9 ++++----- tests/cases/fourslash/renameDefaultLibDontWork.ts | 4 ++-- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/tests/cases/fourslash/renameCrossJsTs01.ts b/tests/cases/fourslash/renameCrossJsTs01.ts index fbe0d4395cd..b4b3448d8c8 100644 --- a/tests/cases/fourslash/renameCrossJsTs01.ts +++ b/tests/cases/fourslash/renameCrossJsTs01.ts @@ -2,12 +2,12 @@ // @allowJs: true // @Filename: a.js -////exports.[|area|] = function (r) { return r * r; } +////[|exports.[|{| "declarationRangeIndex": 0 |}area|] = function (r) { return r * r; }|] // @Filename: b.ts -////import { [|area|] } from './a'; +////[|import { [|{| "declarationRangeIndex": 2 |}area|] } from './a';|] ////var t = [|area|](10); -const [r0, r1, r2] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2] = test.ranges(); verify.renameLocations(r0, [r0, r1, r2]); verify.renameLocations([r1, r2], [{ range: r1, prefixText: "area as " }, r2]); diff --git a/tests/cases/fourslash/renameDefaultImport.ts b/tests/cases/fourslash/renameDefaultImport.ts index a3a698ec4c4..9c2a2d67dc1 100644 --- a/tests/cases/fourslash/renameDefaultImport.ts +++ b/tests/cases/fourslash/renameDefaultImport.ts @@ -1,26 +1,25 @@ /// // @Filename: B.ts -////export default class /*1*/[|{| "isWriteAccess": true, "isDefinition": true |}B|] { +////[|export default class /*1*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}B|] { //// test() { //// } -////} +////}|] // @Filename: A.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}B|] from "./B"; +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}B|] from "./B";|] ////let b = new [|B|](); ////b.test(); goTo.marker("1"); verify.occurrencesAtPositionCount(1); -const ranges = test.ranges(); -const [C, B0, B1] = ranges; +const [CDef, C, B0Def, B0, B1] = test.ranges();; const classes = { definition: "class B", ranges: [C] }; const imports = { definition: "(alias) class B\nimport B", ranges: [B0, B1] }; verify.referenceGroups(C, [classes, imports]); verify.referenceGroups([B0, B1], [imports, classes]); -verify.renameLocations(C, ranges); +verify.renameLocations(C, [C, B0, B1]); verify.rangesAreRenameLocations([B0, B1]); diff --git a/tests/cases/fourslash/renameDefaultImportDifferentName.ts b/tests/cases/fourslash/renameDefaultImportDifferentName.ts index 11473ade501..8c05efe3add 100644 --- a/tests/cases/fourslash/renameDefaultImportDifferentName.ts +++ b/tests/cases/fourslash/renameDefaultImportDifferentName.ts @@ -1,21 +1,20 @@ /// // @Filename: B.ts -////export default class /*1*/[|{| "isWriteAccess": true, "isDefinition": true |}C|] { +////[|export default class /*1*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}C|] { //// test() { //// } -////} +////}|] // @Filename: A.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}B|] from "./B"; +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}B|] from "./B";|] ////let b = new [|B|](); ////b.test(); goTo.marker("1"); verify.occurrencesAtPositionCount(1); -const ranges = test.ranges(); -const [C, B0, B1] = ranges; +const [CDef, C, B0Def, B0, B1] = test.ranges(); const bRanges = [B0, B1]; const classes = { definition: "class C", ranges: [C] }; const imports = { definition: "(alias) class B\nimport B", ranges: [B0, B1] }; diff --git a/tests/cases/fourslash/renameDefaultLibDontWork.ts b/tests/cases/fourslash/renameDefaultLibDontWork.ts index 5d2cfb43eb4..02d7e1d19ea 100644 --- a/tests/cases/fourslash/renameDefaultLibDontWork.ts +++ b/tests/cases/fourslash/renameDefaultLibDontWork.ts @@ -4,8 +4,8 @@ // "test" is a comment on the default library. // @Filename: file1.ts -//// var [|test|] = "foo"; +//// [|var [|{| "declarationRangeIndex": 0 |}test|] = "foo";|] //// console.log([|test|]); -const ranges = test.ranges(); +const [r0Def, ...ranges] = test.ranges(); verify.renameLocations(ranges[0], { findInComments: true, ranges }); \ No newline at end of file From e41533acc700248ba3c6854549bcd443eae9bdf5 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 3 Jun 2019 14:06:30 -0700 Subject: [PATCH 222/384] Handle computed property names --- src/services/findAllReferences.ts | 13 ++++++---- .../renameContextuallyTypedProperties.ts | 24 +++++++++---------- .../renameContextuallyTypedProperties2.ts | 24 +++++++++---------- 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index c3a8cc15b08..8ef72440bcc 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -62,11 +62,16 @@ namespace ts.FindAllReferences { node.parent.parent.left === node.parent ? node.parent.parent : undefined; - return binaryExpression && getAssignmentDeclarationKind(binaryExpression) !== AssignmentDeclarationKind.None ? - getDeclarationForDeclarationSpan(binaryExpression) : - undefined; + if (binaryExpression && getAssignmentDeclarationKind(binaryExpression) !== AssignmentDeclarationKind.None) { + return getDeclarationForDeclarationSpan(binaryExpression); + } } - return undefined; + + // Handle computed property name + const propertyName = findAncestor(node, isComputedPropertyName); + return propertyName ? + getDeclarationForDeclarationSpan(propertyName.parent) : + undefined; } if (isConstructorDeclaration(node.parent) || diff --git a/tests/cases/fourslash/renameContextuallyTypedProperties.ts b/tests/cases/fourslash/renameContextuallyTypedProperties.ts index 4ce3c2b0738..118c53be2b7 100644 --- a/tests/cases/fourslash/renameContextuallyTypedProperties.ts +++ b/tests/cases/fourslash/renameContextuallyTypedProperties.ts @@ -1,58 +1,58 @@ /// ////interface I { -//// [|prop1|]: () => void; +//// [|[|{| "declarationRangeIndex": 0 |}prop1|]: () => void;|] //// prop2(): void; ////} //// ////var o1: I = { -//// [|prop1|]() { }, +//// [|[|{| "declarationRangeIndex": 2 |}prop1|]() { }|], //// prop2() { } ////}; //// ////var o2: I = { -//// [|prop1|]: () => { }, +//// [|[|{| "declarationRangeIndex": 4 |}prop1|]: () => { }|], //// prop2: () => { } ////}; //// ////var o3: I = { -//// get [|prop1|]() { return () => { }; }, +//// [|get [|{| "declarationRangeIndex": 6 |}prop1|]() { return () => { }; }|], //// get prop2() { return () => { }; } ////}; //// ////var o4: I = { -//// set [|prop1|](v) { }, +//// [|set [|{| "declarationRangeIndex": 8 |}prop1|](v) { }|], //// set prop2(v) { } ////}; //// ////var o5: I = { -//// "[|prop1|]"() { }, +//// [|"[|{| "declarationRangeIndex": 10 |}prop1|]"() { }|], //// "prop2"() { } ////}; //// ////var o6: I = { -//// "[|prop1|]": function () { }, +//// [|"[|{| "declarationRangeIndex": 12 |}prop1|]": function () { }|], //// "prop2": function () { } ////}; //// ////var o7: I = { -//// ["[|prop1|]"]: function () { }, +//// [|["[|{| "declarationRangeIndex": 14 |}prop1|]"]: function () { }|], //// ["prop2"]: function () { } ////}; //// ////var o8: I = { -//// ["[|prop1|]"]() { }, +//// [|["[|{| "declarationRangeIndex": 16 |}prop1|]"]() { }|], //// ["prop2"]() { } ////}; //// ////var o9: I = { -//// get ["[|prop1|]"]() { return () => { }; }, +//// [|get ["[|{| "declarationRangeIndex": 18 |}prop1|]"]() { return () => { }; }|], //// get ["prop2"]() { return () => { }; } ////}; //// ////var o10: I = { -//// set ["[|prop1|]"](v) { }, +//// [|set ["[|{| "declarationRangeIndex": 20 |}prop1|]"](v) { }|], //// set ["prop2"](v) { } ////}; -verify.rangesAreRenameLocations(); +verify.rangesAreRenameLocations(test.rangesByText().get("prop1")); diff --git a/tests/cases/fourslash/renameContextuallyTypedProperties2.ts b/tests/cases/fourslash/renameContextuallyTypedProperties2.ts index 01e638395a0..5439a2215d2 100644 --- a/tests/cases/fourslash/renameContextuallyTypedProperties2.ts +++ b/tests/cases/fourslash/renameContextuallyTypedProperties2.ts @@ -2,57 +2,57 @@ ////interface I { //// prop1: () => void; -//// [|prop2|](): void; +//// [|[|{| "declarationRangeIndex": 0 |}prop2|](): void;|] ////} //// ////var o1: I = { //// prop1() { }, -//// [|prop2|]() { } +//// [|[|{| "declarationRangeIndex": 2 |}prop2|]() { }|] ////}; //// ////var o2: I = { //// prop1: () => { }, -//// [|prop2|]: () => { } +//// [|[|{| "declarationRangeIndex": 4 |}prop2|]: () => { }|] ////}; //// ////var o3: I = { //// get prop1() { return () => { }; }, -//// get [|prop2|]() { return () => { }; } +//// [|get [|{| "declarationRangeIndex": 6 |}prop2|]() { return () => { }; }|] ////}; //// ////var o4: I = { //// set prop1(v) { }, -//// set [|prop2|](v) { } +//// [|set [|{| "declarationRangeIndex": 8 |}prop2|](v) { }|] ////}; //// ////var o5: I = { //// "prop1"() { }, -//// "[|prop2|]"() { } +//// [|"[|{| "declarationRangeIndex": 10 |}prop2|]"() { }|] ////}; //// ////var o6: I = { //// "prop1": function () { }, -//// "[|prop2|]": function () { } +//// [|"[|{| "declarationRangeIndex": 12 |}prop2|]": function () { }|] ////}; //// ////var o7: I = { //// ["prop1"]: function () { }, -//// ["[|prop2|]"]: function () { } +//// [|["[|{| "declarationRangeIndex": 14 |}prop2|]"]: function () { }|] ////}; //// ////var o8: I = { //// ["prop1"]() { }, -//// ["[|prop2|]"]() { } +//// [|["[|{| "declarationRangeIndex": 16 |}prop2|]"]() { }|] ////}; //// ////var o9: I = { //// get ["prop1"]() { return () => { }; }, -//// get ["[|prop2|]"]() { return () => { }; } +//// [|get ["[|{| "declarationRangeIndex": 18 |}prop2|]"]() { return () => { }; }|] ////}; //// ////var o10: I = { //// set ["prop1"](v) { }, -//// set ["[|prop2|]"](v) { } +//// [|set ["[|{| "declarationRangeIndex": 20 |}prop2|]"](v) { }|] ////}; -verify.rangesAreRenameLocations(); +verify.rangesAreRenameLocations(test.rangesByText().get("prop2")); From 49c44f650a8b4880d459b423c1c4d25e05e3af6d Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 3 Jun 2019 15:24:35 -0700 Subject: [PATCH 223/384] Add script for pack response postback (#31748) --- package.json | 3 ++ scripts/post-vsts-artifact-comment.js | 64 +++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 scripts/post-vsts-artifact-comment.js diff --git a/package.json b/package.json index ae67f3166b5..965c0c3bb32 100644 --- a/package.json +++ b/package.json @@ -48,11 +48,13 @@ "@types/mocha": "latest", "@types/ms": "latest", "@types/node": "8.5.5", + "@types/node-fetch": "^2.3.4", "@types/q": "latest", "@types/source-map-support": "latest", "@types/through2": "latest", "@types/travis-fold": "latest", "@types/xml2js": "^0.4.0", + "azure-devops-node-api": "^8.0.0", "browser-resolve": "^1.11.2", "browserify": "latest", "chai": "latest", @@ -74,6 +76,7 @@ "mocha": "latest", "mocha-fivemat-progress-reporter": "latest", "ms": "latest", + "node-fetch": "^2.6.0", "plugin-error": "latest", "pretty-hrtime": "^1.0.3", "prex": "^0.4.3", diff --git a/scripts/post-vsts-artifact-comment.js b/scripts/post-vsts-artifact-comment.js new file mode 100644 index 00000000000..6d84294bcfe --- /dev/null +++ b/scripts/post-vsts-artifact-comment.js @@ -0,0 +1,64 @@ +// @ts-check +/// +// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally +const Octokit = require("@octokit/rest"); +const ado = require("azure-devops-node-api"); +const { default: fetch } = require("node-fetch"); + +async function main() { + if (!process.env.SOURCE_ISSUE) { + throw new Error("No source issue specified"); + } + if (!process.env.BUILD_BUILDID) { + throw new Error("No build ID specified"); + } + // The pipelines API does _not_ make getting the direct URL to a specific file _within_ an artifact trivial + const cli = new ado.WebApi("https://typescript.visualstudio.com/defaultcollection", ado.getHandlerFromToken("")); // Empty token, anon auth + const build = await cli.getBuildApi(); + const artifact = await build.getArtifact("typescript", +process.env.BUILD_BUILDID, "tgz"); + const updatedUrl = new URL(artifact.resource.url); + updatedUrl.search = `artifactName=tgz&fileId=${artifact.resource.data}&fileName=manifest`; + const resp = await (await fetch(`${updatedUrl}`)).json(); + const file = resp.items[0]; + const tgzUrl = new URL(artifact.resource.url); + tgzUrl.search = `artifactName=tgz&fileId=${file.blob.id}&fileName=${file.path}`; + const link = "" + tgzUrl; + const gh = new Octokit(); + gh.authenticate({ + type: "token", + token: process.argv[2] + }); + await gh.issues.createComment({ + number: +process.env.SOURCE_ISSUE, + owner: "Microsoft", + repo: "TypeScript", + body: `Hey @${process.env.REQUESTING_USER}, I've packed this into [an installable tgz](${link}). You can install it for testing by referencing it in your \`package.json\` like so: +\`\`\` +{ + "devDependencies": { + "typescript": "${link}" + } +} +\`\`\` +and then running \`npm install\`. +` + }); +} + +main().catch(async e => { + console.error(e); + process.exitCode = 1; + if (process.env.SOURCE_ISSUE) { + const gh = new Octokit(); + gh.authenticate({ + type: "token", + token: process.argv[2] + }); + await gh.issues.createComment({ + number: +process.env.SOURCE_ISSUE, + owner: "Microsoft", + repo: "TypeScript", + body: `Hey @${process.env.REQUESTING_USER}, something went wrong when looking for the build artifact. ([You can check the log here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary)).` + }); + } +}); \ No newline at end of file From 9da05243ff7ba9a2776d5a52118d680348b1454d Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 3 Jun 2019 16:06:35 -0700 Subject: [PATCH 224/384] Rewire experimental update script to handle PR triggers --- scripts/update-experimental-branches.js | 110 +++++++++++++----------- 1 file changed, 59 insertions(+), 51 deletions(-) diff --git a/scripts/update-experimental-branches.js b/scripts/update-experimental-branches.js index c112cf1a367..8af4df95cb9 100644 --- a/scripts/update-experimental-branches.js +++ b/scripts/update-experimental-branches.js @@ -1,66 +1,74 @@ // @ts-check /// const Octokit = require("@octokit/rest"); -const {runSequence} = require("./run-sequence"); +const { runSequence } = require("./run-sequence"); + +// The first is used by bot-based kickoffs, the second by automatic triggers +const triggeredPR = process.env.SOURCE_ISSUE || process.env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER; /** - * This program should be invoked as `node ./scripts/update-experimental-branches [Branch2] [...]` + * This program should be invoked as `node ./scripts/update-experimental-branches [PR2] [...]` + * The order PR numbers are passed controls the order in which they are merged together. + * TODO: the following is racey - if two experiment-enlisted PRs trigger simultaneously and witness one another in an unupdated state, they'll both produce + * a new experimental branch, but each will be missing a change from the other. There's no _great_ way to fix this beyond setting the maximum concurrency + * of this task to 1 (so only one job is allowed to update experiments at a time). */ async function main() { - const branchesRaw = process.argv[3]; - const branches = process.argv.slice(3); - if (!branches.length) { - throw new Error(`No experimental branches, aborting...`); + const prnums = process.argv.slice(3); + if (!prnums.length) { + return; // No enlisted PRs, nothing to update } - console.log(`Performing experimental branch updating and merging for branches ${branchesRaw}`); + if (!prnums.some(n => n === triggeredPR)) { + return; // Only have work to do for enlisted PRs + } + console.log(`Performing experimental branch updating and merging for pull requests ${prnums.join(", ")}`); + + const userName = process.env.GH_USERNAME; + const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`; + + // Forcibly cleanup workspace + runSequence([ + ["git", ["clean", "-fdx"]], + ["git", ["checkout", "."]], + ["git", ["checkout", "master"]], + ["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork + ["git", ["fetch", "origin", "master:master"]], + ]); const gh = new Octokit(); gh.authenticate({ type: "token", token: process.argv[2] }); - - // Fetch all relevant refs - runSequence([ - ["git", ["fetch", "origin", "master:master", ...branches.map(b => `${b}:${b}`)]] - ]) - - // Forcibly cleanup workspace - runSequence([ - ["git", ["clean", "-fdx"]], - ["git", ["checkout", "."]], - ["git", ["checkout", "master"]], - ]); - - // Update branches - for (const branch of branches) { - // Checkout, then get the merge base - const mergeBase = runSequence([ - ["git", ["checkout", branch]], - ["git", ["merge-base", branch, "master"]], - ]); - // Simulate the merge and abort if there are conflicts - const mergeTree = runSequence([ - ["git", ["merge-tree", mergeBase, branch, "master"]] - ]); - if (mergeTree.indexOf(`===${"="}===`)) { // 7 equals is the center of the merge conflict marker - const res = await gh.pulls.list({owner: "Microsoft", repo: "TypeScript", base: branch}); - if (res && res.data && res.data[0]) { - const pr = res.data[0]; - await gh.issues.createComment({ - owner: "Microsoft", - repo: "TypeScript", - number: pr.number, - body: `This PR is configured as an experiment, and currently has merge conflicts with master - please rebase onto master and fix the conflicts.` - }); + for (const numRaw of prnums) { + const num = +numRaw; + if (num) { + // PR number rather than branch name - lookup info + const inputPR = await gh.pulls.get({ owner: "Microsoft", repo: "TypeScript", number: num }); + // GH calculates the rebaseable-ness of a PR into its target, so we can just use that here + if (!inputPR.data.rebaseable) { + if (+triggeredPR === num) { + await gh.issues.createComment({ + owner: "Microsoft", + repo: "TypeScript", + number: num, + body: `This PR is configured as an experiment, and currently has merge conflicts with master - please rebase onto master and fix the conflicts.` + }); + throw new Error(`Merge conflict detected in PR ${num} with master`); + } + return; // A PR is currently in conflict, give up } - throw new Error(`Merge conflict detected on branch ${branch} with master`); + runSequence([ + ["git", ["fetch", "origin", `pull/${num}/head:${num}`]], + ["git", ["checkout", `${num}`]], + ["git", ["rebase", "master"]], + ["git", ["push", "-f", "-u", "fork", `${num}`]], // Keep a rebased copy of this branch in our fork + ]); + + } + else { + throw new Error(`Invalid PR number: ${numRaw}`); } - // Merge is good - apply a rebase and (force) push - runSequence([ - ["git", ["rebase", "master"]], - ["git", ["push", "-f", "-u", "origin", branch]], - ]); } // Return to `master` and make a new `experimental` branch @@ -71,17 +79,17 @@ async function main() { ]); // Merge each branch into `experimental` (which, if there is a conflict, we now know is from inter-experiment conflict) - for (const branch of branches) { + for (const branch of prnums) { // Find the merge base const mergeBase = runSequence([ ["git", ["merge-base", branch, "experimental"]], ]); // Simulate the merge and abort if there are conflicts const mergeTree = runSequence([ - ["git", ["merge-tree", mergeBase, branch, "experimental"]] + ["git", ["merge-tree", mergeBase.trim(), branch, "experimental"]] ]); if (mergeTree.indexOf(`===${"="}===`)) { // 7 equals is the center of the merge conflict marker - throw new Error(`Merge conflict detected on branch ${branch} with other experiment`); + throw new Error(`Merge conflict detected involving PR ${branch} with other experiment`); } // Merge (always producing a merge commit) runSequence([ @@ -90,7 +98,7 @@ async function main() { } // Every branch merged OK, force push the replacement `experimental` branch runSequence([ - ["git", ["push", "-f", "-u", "origin", "experimental"]], + ["git", ["push", "-f", "-u", "fork", "experimental"]], ]); } From 34624a0587e34696ea8702a4697677e5ff3e9039 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 3 Jun 2019 14:13:47 -0700 Subject: [PATCH 225/384] More Tests --- tests/cases/fourslash/localGetReferences.ts | 42 +++++++++++++++---- tests/cases/fourslash/referenceToClass.ts | 7 ++-- .../cases/fourslash/referencesBloomFilters.ts | 6 +-- .../fourslash/referencesBloomFilters2.ts | 6 +-- .../fourslash/referencesBloomFilters3.ts | 4 +- .../cases/fourslash/referencesForAmbients.ts | 14 +++---- .../cases/fourslash/referencesForAmbients2.ts | 4 +- .../fourslash/referencesForClassLocal.ts | 4 +- .../fourslash/referencesForClassMembers.ts | 8 ++-- ...esForClassMembersExtendingAbstractClass.ts | 8 ++-- ...cesForClassMembersExtendingGenericClass.ts | 8 ++-- .../fourslash/referencesForClassParameter.ts | 4 +- ...ontextuallyTypedObjectLiteralProperties.ts | 18 ++++---- ...ncesForContextuallyTypedUnionProperties.ts | 20 ++++----- ...cesForContextuallyTypedUnionProperties2.ts | 16 +++---- tests/cases/fourslash/referencesForEnums.ts | 6 +-- .../fourslash/referencesForExportedValues.ts | 4 +- .../referencesForExternalModuleNames.ts | 6 +-- .../referencesForFunctionOverloads.ts | 8 ++-- .../referencesForFunctionParameter.ts | 4 +- tests/cases/fourslash/referencesForGlobals.ts | 4 +- .../cases/fourslash/referencesForGlobals2.ts | 6 +-- .../cases/fourslash/referencesForGlobals3.ts | 6 +-- .../cases/fourslash/referencesForGlobals4.ts | 6 +-- .../cases/fourslash/referencesForGlobals5.ts | 4 +- .../referencesForGlobalsInExternalModule.ts | 10 ++--- .../referencesForIllegalAssignment.ts | 4 +- tests/cases/fourslash/referencesForImports.ts | 6 +-- .../fourslash/referencesForIndexProperty.ts | 4 +- .../fourslash/referencesForIndexProperty3.ts | 4 +- .../referencesForInheritedProperties.ts | 13 +++--- .../referencesForInheritedProperties2.ts | 13 +++--- .../referencesForInheritedProperties3.ts | 4 +- .../referencesForInheritedProperties4.ts | 4 +- .../referencesForInheritedProperties5.ts | 8 ++-- .../referencesForInheritedProperties6.ts | 9 ++-- .../referencesForInheritedProperties7.ts | 14 +++---- .../referencesForInheritedProperties8.ts | 8 ++-- .../referencesForInheritedProperties9.ts | 6 +-- .../referencesForMergedDeclarations.ts | 14 +++---- .../referencesForMergedDeclarations2.ts | 4 +- .../referencesForMergedDeclarations3.ts | 10 ++--- .../referencesForMergedDeclarations4.ts | 10 ++--- .../referencesForMergedDeclarations5.ts | 12 +++--- .../referencesForMergedDeclarations6.ts | 6 +-- .../referencesForMergedDeclarations7.ts | 10 ++--- .../referencesForMergedDeclarations8.ts | 4 +- ...eferencesForNumericLiteralPropertyNames.ts | 8 ++-- .../referencesForObjectLiteralProperties.ts | 5 ++- .../cases/fourslash/referencesForOverrides.ts | 34 +++++++-------- .../referencesForPropertiesOfGenericType.ts | 5 ++- tests/cases/fourslash/referencesForStatic.ts | 5 ++- ...rencesForStaticsAndMembersWithSameNames.ts | 14 +++---- ...referencesForStringLiteralPropertyNames.ts | 8 ++-- ...eferencesForStringLiteralPropertyNames2.ts | 4 +- ...eferencesForStringLiteralPropertyNames3.ts | 7 ++-- ...eferencesForStringLiteralPropertyNames4.ts | 4 +- ...eferencesForStringLiteralPropertyNames5.ts | 4 +- ...eferencesForStringLiteralPropertyNames7.ts | 10 ++--- .../fourslash/referencesForUnionProperties.ts | 8 ++-- tests/cases/fourslash/remoteGetReferences.ts | 30 ++++++++++--- .../fourslash/renameAcrossMultipleProjects.ts | 5 ++- tests/cases/fourslash/renameAlias.ts | 5 ++- tests/cases/fourslash/renameAlias2.ts | 5 ++- tests/cases/fourslash/renameAlias3.ts | 5 ++- .../fourslash/renameAliasExternalModule.ts | 5 ++- .../fourslash/renameAliasExternalModule2.ts | 8 ++-- .../fourslash/renameAliasExternalModule3.ts | 5 ++- .../fourslash/renameCommentsAndStrings1.ts | 7 ++-- .../fourslash/renameCommentsAndStrings2.ts | 6 +-- .../fourslash/renameCommentsAndStrings3.ts | 6 +-- .../fourslash/renameCommentsAndStrings4.ts | 6 +-- 72 files changed, 331 insertions(+), 278 deletions(-) diff --git a/tests/cases/fourslash/localGetReferences.ts b/tests/cases/fourslash/localGetReferences.ts index a434a6b0820..401599368af 100644 --- a/tests/cases/fourslash/localGetReferences.ts +++ b/tests/cases/fourslash/localGetReferences.ts @@ -3,15 +3,15 @@ // @Filename: localGetReferences_1.ts ////// Comment Refence Test: g/*1*/lobalVar ////// References to a variable declared in global. -////var [|{| "isWriteAccess": true, "isDefinition": true |}globalVar|]: number = 2; +////[|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}globalVar|]: number = 2;|] //// ////class fooCls { //// // References to static variable declared in a class. -//// static [|{| "isWriteAccess": true, "isDefinition": true |}clsSVar|] = 1; +//// [|static [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}clsSVar|] = 1;|] //// // References to a variable declared in a class. -//// [|{| "isWriteAccess": true, "isDefinition": true |}clsVar|] = 1; +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}clsVar|] = 1;|] //// -//// constructor (public [|{| "isWriteAccess": true, "isDefinition": true |}clsParam|]: number) { +//// constructor ([|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}clsParam|]: number|]) { //// //Increments //// [|{| "isWriteAccess": true |}globalVar|]++; //// this.[|{| "isWriteAccess": true |}clsVar|]++; @@ -23,9 +23,9 @@ ////} //// ////// References to a function parameter. -////function [|{| "isWriteAccess": true, "isDefinition": true |}foo|]([|{| "isWriteAccess": true, "isDefinition": true |}x|]: number) { +////[|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 12 |}foo|]([|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 14 |}x|]: number|]) { //// // References to a variable declared in a function. -//// var [|{| "isWriteAccess": true, "isDefinition": true |}fnVar|] = 1; +//// [|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 16 |}fnVar|] = 1;|] //// //// //Increments //// fooCls.[|{| "isWriteAccess": true |}clsSVar|]++; @@ -35,7 +35,7 @@ //// //// //Return //// return [|{| "isWriteAccess": true |}x|]++; -////} +////}|] //// ////module modTest { //// //Declare @@ -85,7 +85,7 @@ /////*3*/err = err++; /////*4*/ //////Shadowed fn Parameter -////function shdw([|{| "isWriteAccess": true, "isDefinition": true, "shadow": true |}globalVar|]: number) { +////function shdw([|[|{| "isWriteAccess": true, "isDefinition": true, "shadow": true, "declarationRangeIndex": 39 |}globalVar|]: number|]) { //// //Increments //// [|{| "isWriteAccess": true, "shadow": true |}globalVar|]++; //// return [|{| "shadow": true |}globalVar|]; @@ -117,7 +117,7 @@ ////array.forEach( //// //// -////function([|{| "isWriteAccess": true, "isDefinition": true |}str|]) { +////function([|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 43 |}str|]) { //// //// //// @@ -198,6 +198,30 @@ goTo.marker("4"); verify.noReferences(); test.rangesByText().forEach((ranges, text) => { + switch (text) { + case "var globalVar: number = 2;": + case "static clsSVar = 1;": + case "clsVar = 1;": + case "public clsParam: number": + case `function foo(x: number) { + // References to a variable declared in a function. + var fnVar = 1; + + //Increments + fooCls.clsSVar++; + globalVar++; + modTest.modVar++; + fnVar++; + + //Return + return x++; +}`: + case "x: number": + case "var fnVar = 1;": + case "globalVar: number": + return; + } + if (text === "globalVar") { verify.singleReferenceGroup("(parameter) globalVar: number", ranges.filter(isShadow)); verify.singleReferenceGroup("var globalVar: number", ranges.filter(r => !isShadow(r))); diff --git a/tests/cases/fourslash/referenceToClass.ts b/tests/cases/fourslash/referenceToClass.ts index d74f24703d2..c1623313d84 100644 --- a/tests/cases/fourslash/referenceToClass.ts +++ b/tests/cases/fourslash/referenceToClass.ts @@ -3,10 +3,10 @@ // Class references should work across file and not find local variables. // @Filename: referenceToClass_1.ts -////class [|{| "isWriteAccess": true, "isDefinition": true |}foo|] { +////[|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|] { //// public n: [|foo|]; //// public foo: number; -////} +////}|] //// ////class bar { //// public n: [|foo|]; @@ -20,4 +20,5 @@ // @Filename: referenceToClass_2.ts ////var k: [|foo|]; -verify.singleReferenceGroup("class foo"); +const [rDef, ...ranges] = test.ranges(); +verify.singleReferenceGroup("class foo", ranges); diff --git a/tests/cases/fourslash/referencesBloomFilters.ts b/tests/cases/fourslash/referencesBloomFilters.ts index 1b96ef6f1c9..908339d6dce 100644 --- a/tests/cases/fourslash/referencesBloomFilters.ts +++ b/tests/cases/fourslash/referencesBloomFilters.ts @@ -3,7 +3,7 @@ // Ensure BloomFilter building logic is correct, by having one reference per file // @Filename: declaration.ts -////var container = { [|{| "isWriteAccess": true, "isDefinition": true |}searchProp|] : 1 }; +////var container = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}searchProp|] : 1|] }; // @Filename: expression.ts ////function blah() { return (1 + 2 + container.[|searchProp|]()) === 2; }; @@ -12,6 +12,6 @@ ////function blah2() { container["[|searchProp|]"] }; // @Filename: redeclaration.ts -////container = { "[|{| "isWriteAccess": true, "isDefinition": true |}searchProp|]" : 18 }; +////container = { [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}searchProp|]" : 18|] }; -verify.singleReferenceGroup("(property) searchProp: number"); +verify.singleReferenceGroup("(property) searchProp: number", test.rangesByText().get("searchProp")); diff --git a/tests/cases/fourslash/referencesBloomFilters2.ts b/tests/cases/fourslash/referencesBloomFilters2.ts index 6f1dfa16e80..36890b2b87c 100644 --- a/tests/cases/fourslash/referencesBloomFilters2.ts +++ b/tests/cases/fourslash/referencesBloomFilters2.ts @@ -3,7 +3,7 @@ // Ensure BloomFilter building logic is correct, by having one reference per file // @Filename: declaration.ts -////var container = { [|{| "isWriteAccess": true, "isDefinition": true |}42|]: 1 }; +////var container = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}42|]: 1|] }; // @Filename: expression.ts ////function blah() { return (container[[|42|]]) === 2; }; @@ -12,6 +12,6 @@ ////function blah2() { container["[|42|]"] }; // @Filename: redeclaration.ts -////container = { "[|{| "isWriteAccess": true, "isDefinition": true |}42|]" : 18 }; +////container = { [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}42|]" : 18|] }; -verify.singleReferenceGroup("(property) 42: number"); +verify.singleReferenceGroup("(property) 42: number", test.rangesByText().get("42")); diff --git a/tests/cases/fourslash/referencesBloomFilters3.ts b/tests/cases/fourslash/referencesBloomFilters3.ts index d7d335cde02..9d871047e86 100644 --- a/tests/cases/fourslash/referencesBloomFilters3.ts +++ b/tests/cases/fourslash/referencesBloomFilters3.ts @@ -4,9 +4,9 @@ // @Filename: declaration.ts -////enum Test { "[|{| "isWriteAccess": true, "isDefinition": true |}42|]" = 1 }; +////enum Test { [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}42|]" = 1|] }; // @Filename: expression.ts ////(Test[[|42|]]); -verify.singleReferenceGroup('(enum member) Test["42"] = 1'); +verify.singleReferenceGroup('(enum member) Test["42"] = 1', test.rangesByText().get("42")); diff --git a/tests/cases/fourslash/referencesForAmbients.ts b/tests/cases/fourslash/referencesForAmbients.ts index 89036befce3..77ff23cab98 100644 --- a/tests/cases/fourslash/referencesForAmbients.ts +++ b/tests/cases/fourslash/referencesForAmbients.ts @@ -1,20 +1,20 @@ /// -////declare module "[|{| "isWriteAccess": true, "isDefinition": true |}foo|]" { -//// var [|{| "isWriteAccess": true, "isDefinition": true |}f|]: number; -////} +////[|declare module "[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|]" { +//// [|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}f|]: number;|] +////}|] //// -////declare module "[|{| "isWriteAccess": true, "isDefinition": true |}bar|]" { -//// export import [|{| "isWriteAccess": true, "isDefinition": true |}foo|] = require("[|foo|]"); +////[|declare module "[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}bar|]" { +//// [|export import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}foo|] = require("[|foo|]");|] //// var f2: typeof [|foo|].[|f|]; -////} +////}|] //// ////declare module "baz" { //// import bar = require("[|bar|]"); //// var f2: typeof bar.[|foo|]; ////} -const [moduleFoo0, f0, moduleBar0, foo0, moduleFoo1, foo1, f1, moduleBar1, foo2] = test.ranges(); +const [moduleFoo0Def, moduleFoo0, f0Def, f0, moduleBar0Def, moduleBar0, foo0Def, foo0, moduleFoo1, foo1, f1, moduleBar1, foo2] = test.ranges(); verify.singleReferenceGroup('module "foo"', [moduleFoo0, moduleFoo1]); verify.singleReferenceGroup('module "bar"', [moduleBar0, moduleBar1]); verify.singleReferenceGroup('(alias) module "foo"\nimport foo = require("foo")', [foo0, foo1, foo2]); diff --git a/tests/cases/fourslash/referencesForAmbients2.ts b/tests/cases/fourslash/referencesForAmbients2.ts index 8654d90f854..3ec5b88a0a6 100644 --- a/tests/cases/fourslash/referencesForAmbients2.ts +++ b/tests/cases/fourslash/referencesForAmbients2.ts @@ -2,7 +2,7 @@ // @Filename: /defA.ts ////declare module "a" { -//// export type [|{| "isWriteAccess": true, "isDefinition": true |}T|] = number; +//// [|export type [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}T|] = number;|] ////} // @Filename: /defB.ts @@ -18,4 +18,4 @@ ////} verify.noErrors(); -verify.singleReferenceGroup("type T = number"); +verify.singleReferenceGroup("type T = number", test.rangesByText().get("T")); diff --git a/tests/cases/fourslash/referencesForClassLocal.ts b/tests/cases/fourslash/referencesForClassLocal.ts index 9e2576413f2..6897f069245 100644 --- a/tests/cases/fourslash/referencesForClassLocal.ts +++ b/tests/cases/fourslash/referencesForClassLocal.ts @@ -5,7 +5,7 @@ ////var n = 14; //// ////class foo { -//// private [|{| "isWriteAccess": true, "isDefinition": true |}n|] = 0; +//// [|private [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}n|] = 0;|] //// //// public bar() { //// this.[|{| "isWriteAccess": true |}n|] = 9; @@ -20,4 +20,4 @@ //// } ////} -verify.singleReferenceGroup("(property) foo.n: number"); +verify.singleReferenceGroup("(property) foo.n: number", test.rangesByText().get("n")); diff --git a/tests/cases/fourslash/referencesForClassMembers.ts b/tests/cases/fourslash/referencesForClassMembers.ts index e60c03524a1..bdee20544d7 100644 --- a/tests/cases/fourslash/referencesForClassMembers.ts +++ b/tests/cases/fourslash/referencesForClassMembers.ts @@ -1,12 +1,12 @@ /// ////class Base { -//// [|{| "isDefinition": true |}a|]: number; -//// [|{| "isWriteAccess": true, "isDefinition": true |}method|](): void { } +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}a|]: number;|] +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}method|](): void { }|] ////} ////class MyClass extends Base { -//// [|{| "isDefinition": true |}a|]; -//// [|{| "isWriteAccess": true, "isDefinition": true |}method|]() { } +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 4 |}a|];|] +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}method|]() { }|] ////} //// ////var c: MyClass; diff --git a/tests/cases/fourslash/referencesForClassMembersExtendingAbstractClass.ts b/tests/cases/fourslash/referencesForClassMembersExtendingAbstractClass.ts index 12df996629d..95405ccb0c4 100644 --- a/tests/cases/fourslash/referencesForClassMembersExtendingAbstractClass.ts +++ b/tests/cases/fourslash/referencesForClassMembersExtendingAbstractClass.ts @@ -1,12 +1,12 @@ /// ////abstract class Base { -//// abstract [|{| "isDefinition": true |}a|]: number; -//// abstract [|{| "isDefinition": true |}method|](): void; +//// [|abstract [|{| "isDefinition": true, "declarationRangeIndex": 0 |}a|]: number;|] +//// [|abstract [|{| "isDefinition": true, "declarationRangeIndex": 2 |}method|](): void;|] ////} ////class MyClass extends Base { -//// [|{| "isDefinition": true |}a|]; -//// [|{| "isWriteAccess": true, "isDefinition": true |}method|]() { } +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 4 |}a|];|] +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}method|]() { }|] ////} //// ////var c: MyClass; diff --git a/tests/cases/fourslash/referencesForClassMembersExtendingGenericClass.ts b/tests/cases/fourslash/referencesForClassMembersExtendingGenericClass.ts index 103b66ff74b..bfa6b8d6fb5 100644 --- a/tests/cases/fourslash/referencesForClassMembersExtendingGenericClass.ts +++ b/tests/cases/fourslash/referencesForClassMembersExtendingGenericClass.ts @@ -1,12 +1,12 @@ /// ////class Base { -//// [|{| "isDefinition": true |}a|]: this; -//// [|{| "isWriteAccess": true, "isDefinition": true |}method|](a?:T, b?:U): this { } +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}a|]: this;|] +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}method|](a?:T, b?:U): this { }|] ////} ////class MyClass extends Base { -//// [|{| "isDefinition": true |}a|]; -//// [|{| "isWriteAccess": true, "isDefinition": true |}method|]() { } +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 4 |}a|];|] +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}method|]() { }|] ////} //// ////var c: MyClass; diff --git a/tests/cases/fourslash/referencesForClassParameter.ts b/tests/cases/fourslash/referencesForClassParameter.ts index ec1e1bb2f0e..53cfba57c14 100644 --- a/tests/cases/fourslash/referencesForClassParameter.ts +++ b/tests/cases/fourslash/referencesForClassParameter.ts @@ -7,7 +7,7 @@ ////class p { } //// ////class foo { -//// constructor (public [|{| "isWriteAccess": true, "isDefinition": true |}p|]: any) { +//// constructor ([|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}p|]: any|]) { //// } //// //// public f(p) { @@ -19,4 +19,4 @@ ////var n = new foo(undefined); ////n.[|{| "isWriteAccess": true |}p|] = null; -verify.singleReferenceGroup("(property) foo.p: any"); +verify.singleReferenceGroup("(property) foo.p: any", test.rangesByText().get("p")); diff --git a/tests/cases/fourslash/referencesForContextuallyTypedObjectLiteralProperties.ts b/tests/cases/fourslash/referencesForContextuallyTypedObjectLiteralProperties.ts index 67f09a9dcd1..9c510e4a097 100644 --- a/tests/cases/fourslash/referencesForContextuallyTypedObjectLiteralProperties.ts +++ b/tests/cases/fourslash/referencesForContextuallyTypedObjectLiteralProperties.ts @@ -1,28 +1,28 @@ /// -////interface IFoo { [|{| "isDefinition": true |}xy|]: number; } +////interface IFoo { [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}xy|]: number;|] } //// ////// Assignment -////var a1: IFoo = { [|{| "isWriteAccess": true, "isDefinition": true |}xy|]: 0 }; -////var a2: IFoo = { [|{| "isWriteAccess": true, "isDefinition": true |}xy|]: 0 }; +////var a1: IFoo = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}xy|]: 0|] }; +////var a2: IFoo = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}xy|]: 0|] }; //// ////// Function call ////function consumer(f: IFoo) { } -////consumer({ [|{| "isWriteAccess": true, "isDefinition": true |}xy|]: 1 }); +////consumer({ [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}xy|]: 1|] }); //// ////// Type cast -////var c = { [|{| "isWriteAccess": true, "isDefinition": true |}xy|]: 0 }; +////var c = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 8 |}xy|]: 0|] }; //// ////// Array literal -////var ar: IFoo[] = [{ [|{| "isWriteAccess": true, "isDefinition": true |}xy|]: 1 }, { [|{| "isWriteAccess": true, "isDefinition": true |}xy|]: 2 }]; +////var ar: IFoo[] = [{ [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 10 |}xy|]: 1|] }, { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 12 |}xy|]: 2|] }]; //// ////// Nested object literal -////var ob: { ifoo: IFoo } = { ifoo: { [|{| "isWriteAccess": true, "isDefinition": true |}xy|]: 0 } }; +////var ob: { ifoo: IFoo } = { ifoo: { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 14 |}xy|]: 0|] } }; //// ////// Widened type -////var w: IFoo = { [|{| "isWriteAccess": true, "isDefinition": true, "type": "undefined" |}xy|]: undefined }; +////var w: IFoo = { [|[|{| "isWriteAccess": true, "isDefinition": true, "type": "undefined", "declarationRangeIndex": 16 |}xy|]: undefined|] }; //// ////// Untped -- should not be included ////var u = { xy: 0 }; -verify.singleReferenceGroup("(property) IFoo.xy: number"); +verify.singleReferenceGroup("(property) IFoo.xy: number", test.rangesByText().get("xy")); diff --git a/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties.ts b/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties.ts index b0bb5d62b4d..da1adb8f98d 100644 --- a/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties.ts +++ b/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties.ts @@ -2,39 +2,39 @@ ////interface A { //// a: number; -//// [|{| "isDefinition": true |}common|]: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}common|]: string;|] ////} //// ////interface B { //// b: number; -//// [|{| "isDefinition": true |}common|]: number; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}common|]: number;|] ////} //// ////// Assignment -////var v1: A | B = { a: 0, [|{| "isWriteAccess": true, "isDefinition": true, "type": "string" |}common|]: "" }; -////var v2: A | B = { b: 0, [|{| "isWriteAccess": true, "isDefinition": true, "type": "number" |}common|]: 3 }; +////var v1: A | B = { a: 0, [|[|{| "isWriteAccess": true, "isDefinition": true, "type": "string", "declarationRangeIndex": 4 |}common|]: ""|] }; +////var v2: A | B = { b: 0, [|[|{| "isWriteAccess": true, "isDefinition": true, "type": "number", "declarationRangeIndex": 6 |}common|]: 3|] }; //// ////// Function call ////function consumer(f: A | B) { } -////consumer({ a: 0, b: 0, [|{| "isWriteAccess": true, "isDefinition": true, "type": "number" |}common|]: 1 }); +////consumer({ a: 0, b: 0, [|[|{| "isWriteAccess": true, "isDefinition": true, "type": "number", "declarationRangeIndex": 8 |}common|]: 1|] }); //// ////// Type cast -////var c = { [|{| "isWriteAccess": true, "isDefinition": true, "type": "number" |}common|]: 0, b: 0 }; +////var c = { [|[|{| "isWriteAccess": true, "isDefinition": true, "type": "number", "declarationRangeIndex": 10 |}common|]: 0|], b: 0 }; //// ////// Array literal -////var ar: Array = [{ a: 0, [|{| "isWriteAccess": true, "isDefinition": true, "type": "string" |}common|]: "" }, { b: 0, [|{| "isWriteAccess": true, "isDefinition": true, "type": "number" |}common|]: 0 }]; +////var ar: Array = [{ a: 0, [|[|{| "isWriteAccess": true, "isDefinition": true, "type": "string", "declarationRangeIndex": 12 |}common|]: ""|] }, { b: 0, [|[|{| "isWriteAccess": true, "isDefinition": true, "type": "number", "declarationRangeIndex": 14 |}common|]: 0|] }]; //// ////// Nested object literal -////var ob: { aorb: A|B } = { aorb: { b: 0, [|{| "isWriteAccess": true, "isDefinition": true, "type": "number" |}common|]: 0 } }; +////var ob: { aorb: A|B } = { aorb: { b: 0, [|[|{| "isWriteAccess": true, "isDefinition": true, "type": "number", "declarationRangeIndex": 16 |}common|]: 0|] } }; //// ////// Widened type -////var w: A|B = { a:0, [|{| "isWriteAccess": true, "isDefinition": true, "type": "undefined" |}common|]: undefined }; +////var w: A|B = { a:0, [|[|{| "isWriteAccess": true, "isDefinition": true, "type": "undefined", "declarationRangeIndex": 18 |}common|]: undefined|] }; //// ////// Untped -- should not be included ////var u1 = { a: 0, b: 0, common: "" }; ////var u2 = { b: 0, common: 0 }; -const [aCommon, bCommon, ...unionRefs] = test.ranges(); +const [aCommon, bCommon, ...unionRefs] = test.rangesByText().get("common"); verify.referenceGroups(aCommon, [ { definition: "(property) A.common: string", ranges: [aCommon] }, { definition: "(property) common: string | number", ranges: unionRefs }, diff --git a/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties2.ts b/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties2.ts index a9741d3e39d..850561acf5c 100644 --- a/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties2.ts +++ b/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties2.ts @@ -6,32 +6,32 @@ ////} //// ////interface B { -//// [|{| "isDefinition": true |}b|]: number; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}b|]: number;|] //// common: number; ////} //// ////// Assignment ////var v1: A | B = { a: 0, common: "" }; -////var v2: A | B = { [|{| "isWriteAccess": true, "isDefinition": true, "type": "number" |}b|]: 0, common: 3 }; +////var v2: A | B = { [|[|{| "isWriteAccess": true, "isDefinition": true, "type": "number", "declarationRangeIndex": 2 |}b|]: 0|], common: 3 }; //// ////// Function call ////function consumer(f: A | B) { } -////consumer({ a: 0, [|{| "isWriteAccess": true, "isDefinition": true, "type": "number" |}b|]: 0, common: 1 }); +////consumer({ a: 0, [|[|{| "isWriteAccess": true, "isDefinition": true, "type": "number", "declarationRangeIndex": 4 |}b|]: 0|], common: 1 }); //// ////// Type cast -////var c = { common: 0, [|{| "isWriteAccess": true, "isDefinition": true, "type": "number" |}b|]: 0 }; +////var c = { common: 0, [|[|{| "isWriteAccess": true, "isDefinition": true, "type": "number", "declarationRangeIndex": 6 |}b|]: 0|] }; //// ////// Array literal -////var ar: Array = [{ a: 0, common: "" }, { [|{| "isWriteAccess": true, "isDefinition": true, "type": "number" |}b|]: 0, common: 0 }]; +////var ar: Array = [{ a: 0, common: "" }, { [|[|{| "isWriteAccess": true, "isDefinition": true, "type": "number", "declarationRangeIndex": 8 |}b|]: 0|], common: 0 }]; //// ////// Nested object literal -////var ob: { aorb: A|B } = { aorb: { [|{| "isWriteAccess": true, "isDefinition": true, "type": "number" |}b|]: 0, common: 0 } }; +////var ob: { aorb: A|B } = { aorb: { [|[|{| "isWriteAccess": true, "isDefinition": true, "type": "number", "declarationRangeIndex": 10 |}b|]: 0|], common: 0 } }; //// ////// Widened type -////var w: A|B = { [|{| "isWriteAccess": true, "isDefinition": true, "type": "undefined" |}b|]:undefined, common: undefined }; +////var w: A|B = { [|[|{| "isWriteAccess": true, "isDefinition": true, "type": "undefined", "declarationRangeIndex": 12 |}b|]:undefined|], common: undefined }; //// ////// Untped -- should not be included ////var u1 = { a: 0, b: 0, common: "" }; ////var u2 = { b: 0, common: 0 }; -verify.singleReferenceGroup("(property) B.b: number"); +verify.singleReferenceGroup("(property) B.b: number", test.rangesByText().get("b")); diff --git a/tests/cases/fourslash/referencesForEnums.ts b/tests/cases/fourslash/referencesForEnums.ts index af4fec8aae8..2b948613704 100644 --- a/tests/cases/fourslash/referencesForEnums.ts +++ b/tests/cases/fourslash/referencesForEnums.ts @@ -1,9 +1,9 @@ /// ////enum E { -//// [|{| "isWriteAccess": true, "isDefinition": true |}value1|] = 1, -//// "[|{| "isWriteAccess": true, "isDefinition": true |}value2|]" = [|value1|], -//// [|{| "isWriteAccess": true, "isDefinition": true |}111|] = 11 +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}value1|] = 1|], +//// [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}value2|]" = [|value1|]|], +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}111|] = 11|] ////} //// ////E.[|value1|]; diff --git a/tests/cases/fourslash/referencesForExportedValues.ts b/tests/cases/fourslash/referencesForExportedValues.ts index ff00f844260..787440606fd 100644 --- a/tests/cases/fourslash/referencesForExportedValues.ts +++ b/tests/cases/fourslash/referencesForExportedValues.ts @@ -1,7 +1,7 @@ /// ////module M { -//// export var [|{| "isWriteAccess": true, "isDefinition": true |}variable|] = 0; +//// [|export var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}variable|] = 0;|] //// //// // local use //// var x = [|variable|]; @@ -10,4 +10,4 @@ ////// external use ////M.[|variable|] -verify.singleReferenceGroup("var M.variable: number"); +verify.singleReferenceGroup("var M.variable: number", test.rangesByText().get("variable")); diff --git a/tests/cases/fourslash/referencesForExternalModuleNames.ts b/tests/cases/fourslash/referencesForExternalModuleNames.ts index 90db189e04a..2929391228e 100644 --- a/tests/cases/fourslash/referencesForExternalModuleNames.ts +++ b/tests/cases/fourslash/referencesForExternalModuleNames.ts @@ -1,11 +1,11 @@ /// // @Filename: referencesForGlobals_1.ts -////declare module "[|{| "isWriteAccess": true, "isDefinition": true |}foo|]" { +////[|declare module "[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|]" { //// var f: number; -////} +////}|] // @Filename: referencesForGlobals_2.ts ////import f = require("[|foo|]"); -verify.singleReferenceGroup('module "foo"'); +verify.singleReferenceGroup('module "foo"', test.rangesByText().get("foo")); diff --git a/tests/cases/fourslash/referencesForFunctionOverloads.ts b/tests/cases/fourslash/referencesForFunctionOverloads.ts index 2a1ea032e20..b086014a050 100644 --- a/tests/cases/fourslash/referencesForFunctionOverloads.ts +++ b/tests/cases/fourslash/referencesForFunctionOverloads.ts @@ -2,9 +2,9 @@ // Function overloads should be highlighted together. -////function [|{| "isDefinition": true |}foo|](x: string); -////function [|{| "isWriteAccess": true, "isDefinition": true |}foo|](x: string, y: number) { +////[|function [|{| "isDefinition": true, "declarationRangeIndex": 0 |}foo|](x: string);|] +////[|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}foo|](x: string, y: number) { //// [|foo|]('', 43); -////} +////}|] -verify.singleReferenceGroup("function foo(x: string): any"); +verify.singleReferenceGroup("function foo(x: string): any", test.rangesByText().get("foo")); diff --git a/tests/cases/fourslash/referencesForFunctionParameter.ts b/tests/cases/fourslash/referencesForFunctionParameter.ts index 24582a68e08..267965e7044 100644 --- a/tests/cases/fourslash/referencesForFunctionParameter.ts +++ b/tests/cases/fourslash/referencesForFunctionParameter.ts @@ -3,9 +3,9 @@ ////var x; ////var n; //// -////function n(x: number, [|{| "isWriteAccess": true, "isDefinition": true |}n|]: number) { +////function n(x: number, [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}n|]: number|]) { //// [|{| "isWriteAccess": true |}n|] = 32; //// x = [|n|]; ////} -verify.singleReferenceGroup("(parameter) n: number"); +verify.singleReferenceGroup("(parameter) n: number", test.rangesByText().get("n")); diff --git a/tests/cases/fourslash/referencesForGlobals.ts b/tests/cases/fourslash/referencesForGlobals.ts index dc5bc4deb6f..43cac1876be 100644 --- a/tests/cases/fourslash/referencesForGlobals.ts +++ b/tests/cases/fourslash/referencesForGlobals.ts @@ -3,7 +3,7 @@ // Global variable reference. // @Filename: referencesForGlobals_1.ts -////var [|{| "isWriteAccess": true, "isDefinition": true |}global|] = 2; +////[|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}global|] = 2;|] //// ////class foo { //// constructor (public global) { } @@ -25,4 +25,4 @@ // @Filename: referencesForGlobals_2.ts ////var m = [|global|]; -verify.singleReferenceGroup("var global: number"); +verify.singleReferenceGroup("var global: number", test.rangesByText().get("global")); diff --git a/tests/cases/fourslash/referencesForGlobals2.ts b/tests/cases/fourslash/referencesForGlobals2.ts index e08be585c7a..d2b5c093f50 100644 --- a/tests/cases/fourslash/referencesForGlobals2.ts +++ b/tests/cases/fourslash/referencesForGlobals2.ts @@ -3,11 +3,11 @@ // Global class reference. // @Filename: referencesForGlobals_1.ts -////class [|{| "isWriteAccess": true, "isDefinition": true |}globalClass|] { +////[|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}globalClass|] { //// public f() { } -////} +////}|] // @Filename: referencesForGlobals_2.ts ////var c = [|globalClass|](); -verify.singleReferenceGroup("class globalClass"); +verify.singleReferenceGroup("class globalClass", test.rangesByText().get("globalClass")); diff --git a/tests/cases/fourslash/referencesForGlobals3.ts b/tests/cases/fourslash/referencesForGlobals3.ts index 38edddc8255..5ade69a8841 100644 --- a/tests/cases/fourslash/referencesForGlobals3.ts +++ b/tests/cases/fourslash/referencesForGlobals3.ts @@ -3,11 +3,11 @@ // Global interface reference. // @Filename: referencesForGlobals_1.ts -////interface [|{| "isWriteAccess": true, "isDefinition": true |}globalInterface|] { +////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}globalInterface|] { //// f(); -////} +////}|] // @Filename: referencesForGlobals_2.ts ////var i: [|globalInterface|]; -verify.singleReferenceGroup("interface globalInterface"); +verify.singleReferenceGroup("interface globalInterface", test.rangesByText().get("globalInterface")); diff --git a/tests/cases/fourslash/referencesForGlobals4.ts b/tests/cases/fourslash/referencesForGlobals4.ts index b8356461699..cba70e1f441 100644 --- a/tests/cases/fourslash/referencesForGlobals4.ts +++ b/tests/cases/fourslash/referencesForGlobals4.ts @@ -3,11 +3,11 @@ // Global module reference. // @Filename: referencesForGlobals_1.ts -////module [|{| "isWriteAccess": true, "isDefinition": true |}globalModule|] { +////[|module [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}globalModule|] { //// export f() { }; -////} +////}|] // @Filename: referencesForGlobals_2.ts ////var m = [|globalModule|]; -verify.singleReferenceGroup("namespace globalModule"); +verify.singleReferenceGroup("namespace globalModule", test.rangesByText().get("globalModule")); diff --git a/tests/cases/fourslash/referencesForGlobals5.ts b/tests/cases/fourslash/referencesForGlobals5.ts index 0d205b4b9b2..34a46148d8a 100644 --- a/tests/cases/fourslash/referencesForGlobals5.ts +++ b/tests/cases/fourslash/referencesForGlobals5.ts @@ -7,9 +7,9 @@ //// export var x; ////} //// -////import [|{| "isWriteAccess": true, "isDefinition": true |}globalAlias|] = globalModule; +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}globalAlias|] = globalModule;|] // @Filename: referencesForGlobals_2.ts ////var m = [|globalAlias|]; -verify.singleReferenceGroup("(alias) namespace globalAlias\nimport globalAlias = globalModule"); +verify.singleReferenceGroup("(alias) namespace globalAlias\nimport globalAlias = globalModule", test.rangesByText().get("globalAlias")); diff --git a/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts b/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts index 7bfbb0ff881..f4b9d07117c 100644 --- a/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts +++ b/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts @@ -2,18 +2,18 @@ // Global variable reference. -////var [|{| "isWriteAccess": true, "isDefinition": true |}topLevelVar|] = 2; +////[|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}topLevelVar|] = 2;|] ////var topLevelVar2 = [|topLevelVar|]; //// -////class [|{| "isWriteAccess": true, "isDefinition": true |}topLevelClass|] { } +////[|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}topLevelClass|] { }|] ////var c = new [|topLevelClass|](); //// -////interface [|{| "isWriteAccess": true, "isDefinition": true |}topLevelInterface|] { } +////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}topLevelInterface|] { }|] ////var i: [|topLevelInterface|]; //// -////module [|{| "isWriteAccess": true, "isDefinition": true |}topLevelModule|] { +////[|module [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 9 |}topLevelModule|] { //// export var x; -////} +////}|] ////var x = [|topLevelModule|].x; //// ////export = x; diff --git a/tests/cases/fourslash/referencesForIllegalAssignment.ts b/tests/cases/fourslash/referencesForIllegalAssignment.ts index f65cd5bf1a6..a0c0a610bc5 100644 --- a/tests/cases/fourslash/referencesForIllegalAssignment.ts +++ b/tests/cases/fourslash/referencesForIllegalAssignment.ts @@ -2,7 +2,7 @@ ////f/*1*/oo = fo/*2*/o; -////var [|{| "isWriteAccess": true, "isDefinition": true |}bar|] = function () { }; +////[|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}bar|] = function () { };|] ////[|{| "isWriteAccess": true |}bar|] = [|bar|] + 1; goTo.marker("1"); @@ -11,4 +11,4 @@ verify.noReferences(); goTo.marker("2"); verify.noReferences(); -verify.singleReferenceGroup("var bar: () => void"); +verify.singleReferenceGroup("var bar: () => void", test.rangesByText().get("bar")); diff --git a/tests/cases/fourslash/referencesForImports.ts b/tests/cases/fourslash/referencesForImports.ts index 54cbb0f1155..0b763b09775 100644 --- a/tests/cases/fourslash/referencesForImports.ts +++ b/tests/cases/fourslash/referencesForImports.ts @@ -5,11 +5,11 @@ //// export = $; ////} -////import [|{| "isWriteAccess": true, "isDefinition": true |}$|] = require("jquery"); +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}$|] = require("jquery");|] ////[|$|]("a"); -////import [|{| "isWriteAccess": true, "isDefinition": true |}$|] = require("jquery"); +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}$|] = require("jquery");|] -const [r0, r1, r2] = test.ranges(); +const [r0Def, r0, r1, r2Def, r2] = test.ranges(); verify.singleReferenceGroup('import $ = require("jquery")', [r0, r1]); verify.singleReferenceGroup('import $ = require("jquery")', [r2]); diff --git a/tests/cases/fourslash/referencesForIndexProperty.ts b/tests/cases/fourslash/referencesForIndexProperty.ts index 4bc0b3620ea..4d21e1d6aef 100644 --- a/tests/cases/fourslash/referencesForIndexProperty.ts +++ b/tests/cases/fourslash/referencesForIndexProperty.ts @@ -3,8 +3,8 @@ // References a class property using string index access ////class Foo { -//// [|{| "isDefinition": true |}property|]: number; -//// [|{| "isWriteAccess": true, "isDefinition": true |}method|](): void { } +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}property|]: number;|] +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}method|](): void { }|] ////} //// ////var f: Foo; diff --git a/tests/cases/fourslash/referencesForIndexProperty3.ts b/tests/cases/fourslash/referencesForIndexProperty3.ts index 69417700ed0..2d0d4fec089 100644 --- a/tests/cases/fourslash/referencesForIndexProperty3.ts +++ b/tests/cases/fourslash/referencesForIndexProperty3.ts @@ -3,7 +3,7 @@ // References to a property of the apparent type using string indexer ////interface Object { -//// [|{| "isDefinition": true |}toMyString|](); +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}toMyString|]();|] ////} //// ////var y: Object; @@ -12,4 +12,4 @@ ////var x = {}; ////x["[|toMyString|]"](); -verify.singleReferenceGroup("(method) Object.toMyString(): any"); +verify.singleReferenceGroup("(method) Object.toMyString(): any", test.rangesByText().get("toMyString")); diff --git a/tests/cases/fourslash/referencesForInheritedProperties.ts b/tests/cases/fourslash/referencesForInheritedProperties.ts index 88d7ea7537d..47e642d01e2 100644 --- a/tests/cases/fourslash/referencesForInheritedProperties.ts +++ b/tests/cases/fourslash/referencesForInheritedProperties.ts @@ -1,17 +1,17 @@ /// ////interface interface1 { -//// [|{| "isDefinition": true |}doStuff|](): void; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}doStuff|](): void;|] ////} //// ////interface interface2 extends interface1{ -//// [|{| "isDefinition": true |}doStuff|](): void; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}doStuff|](): void;|] ////} //// ////class class1 implements interface2 { -//// [|{| "isWriteAccess": true, "isDefinition": true |}doStuff|]() { +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}doStuff|]() { //// -//// } +//// }|] ////} //// ////class class2 extends class1 { @@ -21,9 +21,8 @@ ////var v: class2; ////v.[|doStuff|](); -const ranges = test.ranges(); -const [r0, r1, r2, r3] = ranges; -verify.referenceGroups(ranges, [ +const [r0Def, r0, r1Def, r1, r2Def, r2, r3] = test.ranges(); +verify.referenceGroups([r0, r1, r2, r3], [ { definition: "(method) interface1.doStuff(): void", ranges: [r0] }, { definition: "(method) interface2.doStuff(): void", ranges: [r1] }, { definition: "(method) class1.doStuff(): void", ranges: [r2, r3] } diff --git a/tests/cases/fourslash/referencesForInheritedProperties2.ts b/tests/cases/fourslash/referencesForInheritedProperties2.ts index 712c7f2ecf2..31b875f4509 100644 --- a/tests/cases/fourslash/referencesForInheritedProperties2.ts +++ b/tests/cases/fourslash/referencesForInheritedProperties2.ts @@ -3,20 +3,20 @@ // extends statement in a diffrent declaration ////interface interface1 { -//// [|{| "isDefinition": true |}doStuff|](): void; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}doStuff|](): void;|] ////} //// ////interface interface2 { -//// [|{| "isDefinition": true |}doStuff|](): void; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}doStuff|](): void;|] ////} //// ////interface interface2 extends interface1 { ////} //// ////class class1 implements interface2 { -//// [|{| "isWriteAccess": true, "isDefinition": true |}doStuff|]() { +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}doStuff|]() { //// -//// } +//// }|] ////} //// ////class class2 extends class1 { @@ -26,9 +26,8 @@ ////var v: class2; ////v.[|doStuff|](); -const ranges = test.ranges(); -const [r0, r1, r2, r3] = ranges; -verify.referenceGroups(ranges, [ +const [r0Def, r0, r1Def, r1, r2Def, r2, r3] = test.ranges(); +verify.referenceGroups([r0, r1, r2, r3], [ { definition: "(method) interface1.doStuff(): void", ranges: [r0] }, { definition: "(method) interface2.doStuff(): void", ranges: [r1] }, { definition: "(method) class1.doStuff(): void", ranges: [r2, r3] } diff --git a/tests/cases/fourslash/referencesForInheritedProperties3.ts b/tests/cases/fourslash/referencesForInheritedProperties3.ts index 0eabc6cda9e..42de1905874 100644 --- a/tests/cases/fourslash/referencesForInheritedProperties3.ts +++ b/tests/cases/fourslash/referencesForInheritedProperties3.ts @@ -1,8 +1,8 @@ /// //// interface interface1 extends interface1 { -//// [|{| "isDefinition": true |}doStuff|](): void; -//// [|{| "isDefinition": true |}propName|]: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}doStuff|](): void;|] +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}propName|]: string;|] //// } //// //// var v: interface1; diff --git a/tests/cases/fourslash/referencesForInheritedProperties4.ts b/tests/cases/fourslash/referencesForInheritedProperties4.ts index f6a7d48f9d1..5c00529cd1b 100644 --- a/tests/cases/fourslash/referencesForInheritedProperties4.ts +++ b/tests/cases/fourslash/referencesForInheritedProperties4.ts @@ -1,8 +1,8 @@ /// //// class class1 extends class1 { -//// [|{| "isWriteAccess": true, "isDefinition": true |}doStuff|]() { } -//// [|{| "isDefinition": true |}propName|]: string; +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}doStuff|]() { }|] +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}propName|]: string;|] //// } //// //// var c: class1; diff --git a/tests/cases/fourslash/referencesForInheritedProperties5.ts b/tests/cases/fourslash/referencesForInheritedProperties5.ts index 232b654c63f..c86b8d01b85 100644 --- a/tests/cases/fourslash/referencesForInheritedProperties5.ts +++ b/tests/cases/fourslash/referencesForInheritedProperties5.ts @@ -1,12 +1,12 @@ /// //// interface interface1 extends interface1 { -//// [|{| "isDefinition": true |}doStuff|](): void; -//// [|{| "isDefinition": true |}propName|]: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}doStuff|](): void;|] +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}propName|]: string;|] //// } //// interface interface2 extends interface1 { -//// [|{| "isDefinition": true |}doStuff|](): void; -//// [|{| "isDefinition": true |}propName|]: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 4 |}doStuff|](): void;|] +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 6 |}propName|]: string;|] //// } //// //// var v: interface1; diff --git a/tests/cases/fourslash/referencesForInheritedProperties6.ts b/tests/cases/fourslash/referencesForInheritedProperties6.ts index a84a6a0b296..c71a17119f9 100644 --- a/tests/cases/fourslash/referencesForInheritedProperties6.ts +++ b/tests/cases/fourslash/referencesForInheritedProperties6.ts @@ -1,18 +1,17 @@ /// ////class class1 extends class1 { -//// [|{| "isWriteAccess": true, "isDefinition": true |}doStuff|]() { } +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}doStuff|]() { }|] ////} ////class class2 extends class1 { -//// [|{| "isWriteAccess": true, "isDefinition": true |}doStuff|]() { } +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}doStuff|]() { }|] ////} //// ////var v: class2; ////v.[|doStuff|](); -const ranges = test.ranges(); -const [m0, m1, m2] = ranges; -verify.referenceGroups(ranges, [ +const [m0Def, m0, m1Def, m1, m2] = test.ranges(); +verify.referenceGroups([m0, m1, m2], [ { definition: "(method) class1.doStuff(): void", ranges: [m0] }, { definition: "(method) class2.doStuff(): void", ranges: [m1, m2] } ]); diff --git a/tests/cases/fourslash/referencesForInheritedProperties7.ts b/tests/cases/fourslash/referencesForInheritedProperties7.ts index 25402d36b6e..a2efe171339 100644 --- a/tests/cases/fourslash/referencesForInheritedProperties7.ts +++ b/tests/cases/fourslash/referencesForInheritedProperties7.ts @@ -1,23 +1,23 @@ /// //// class class1 extends class1 { -//// [|{| "isWriteAccess": true, "isDefinition": true |}doStuff|]() { } -//// [|{| "isDefinition": true |}propName|]: string; +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}doStuff|]() { }|] +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}propName|]: string;|] //// } //// interface interface1 extends interface1 { -//// [|{| "isDefinition": true |}doStuff|](): void; -//// [|{| "isDefinition": true |}propName|]: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 4 |}doStuff|](): void;|] +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 6 |}propName|]: string;|] //// } //// class class2 extends class1 implements interface1 { -//// [|{| "isWriteAccess": true, "isDefinition": true |}doStuff|]() { } -//// [|{| "isDefinition": true |}propName|]: string; +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 8 |}doStuff|]() { }|] +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 10 |}propName|]: string;|] //// } //// //// var v: class2; //// v.[|doStuff|](); //// v.[|propName|]; -const [r0, r1, r2, r3, r4, r5, r6, r7] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4Def, r4, r5Def, r5, r6, r7] = test.ranges(); const c1DoStuff = { definition: "(method) class1.doStuff(): void", ranges: [r0] }; const c2DoStuff = { definition: "(method) class2.doStuff(): void", ranges: [r4, r6] }; const c1PropName = { definition: "(property) class1.propName: string", ranges: [r1] }; diff --git a/tests/cases/fourslash/referencesForInheritedProperties8.ts b/tests/cases/fourslash/referencesForInheritedProperties8.ts index 331a90f9181..86aa3500a1c 100644 --- a/tests/cases/fourslash/referencesForInheritedProperties8.ts +++ b/tests/cases/fourslash/referencesForInheritedProperties8.ts @@ -1,17 +1,17 @@ /// //// interface C extends D { -//// [|{| "isDefinition": true |}propD|]: number; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}propD|]: number;|] //// } //// interface D extends C { -//// [|{| "isDefinition": true |}propD|]: string; -//// [|{| "isDefinition": true |}propC|]: number; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}propD|]: string;|] +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 4 |}propC|]: number;|] //// } //// var d: D; //// d.[|propD|]; //// d.[|propC|]; -const [d0, d1, c0, d2, c1] = test.ranges(); +const [d0Def, d0, d1Def, d1, c0Def, c0, d2, c1] = test.ranges(); verify.referenceGroups([d0, d1, d2], [ { definition: "(property) C.propD: number", ranges: [d0] }, { definition: "(property) D.propD: string", ranges: [d1, d2] }, diff --git a/tests/cases/fourslash/referencesForInheritedProperties9.ts b/tests/cases/fourslash/referencesForInheritedProperties9.ts index 3648be2f989..5bbcefb7753 100644 --- a/tests/cases/fourslash/referencesForInheritedProperties9.ts +++ b/tests/cases/fourslash/referencesForInheritedProperties9.ts @@ -1,16 +1,16 @@ /// //// class D extends C { -//// [|{| "isDefinition": true |}prop1|]: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}prop1|]: string;|] //// } //// //// class C extends D { -//// [|{| "isDefinition": true |}prop1|]: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}prop1|]: string;|] //// } //// //// var c: C; //// c.[|prop1|]; -const [r0, r1, r2] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2] = test.ranges(); verify.singleReferenceGroup("(property) D.prop1: string", [r0]); verify.singleReferenceGroup("(property) C.prop1: string", [r1, r2]); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations.ts b/tests/cases/fourslash/referencesForMergedDeclarations.ts index 5346a85f24f..3fb29fe0c7d 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations.ts @@ -1,20 +1,20 @@ /// -////interface [|{| "isWriteAccess": true, "isDefinition": true |}Foo|] { -////} +////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Foo|] { +////}|] //// -////module [|{| "isWriteAccess": true, "isDefinition": true |}Foo|] { +////[|module [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}Foo|] { //// export interface Bar { } -////} +////}|] //// -////function [|{| "isWriteAccess": true, "isDefinition": true |}Foo|](): void { -////} +////[|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}Foo|](): void { +////}|] //// ////var f1: [|Foo|].Bar; ////var f2: [|Foo|]; ////[|Foo|].bind(this); -const [type1, namespace1, value1, namespace2, type2, value2] = test.ranges(); +const [type1Def, type1, namespace1Def, namespace1, value1Def, value1, namespace2, type2, value2] = test.ranges(); verify.singleReferenceGroup("interface Foo\nnamespace Foo", [type1, type2]); verify.singleReferenceGroup("namespace Foo", [namespace1, namespace2]); verify.singleReferenceGroup("namespace Foo\nfunction Foo(): void", [value1, value2]); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations2.ts b/tests/cases/fourslash/referencesForMergedDeclarations2.ts index 1a4bc59c9b2..24ea93b30d5 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations2.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations2.ts @@ -6,7 +6,7 @@ //// ////function ATest() { } //// -////import [|{| "isWriteAccess": true, "isDefinition": true |}alias|] = ATest; // definition +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}alias|] = ATest;|] // definition //// ////var a: [|alias|].Bar; // namespace ////[|alias|].call(this); // value @@ -15,4 +15,4 @@ verify.singleReferenceGroup([ "(alias) function alias(): void", "(alias) namespace alias", "import alias = ATest" -].join("\n")); +].join("\n"), test.rangesByText().get("alias")); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations3.ts b/tests/cases/fourslash/referencesForMergedDeclarations3.ts index 27c442b5bcc..4013c5bd49b 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations3.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations3.ts @@ -2,16 +2,16 @@ // class and uninstantiated module -////class [|{| "isWriteAccess": true, "isDefinition": true |}testClass|] { +////[|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}testClass|] { //// static staticMethod() { } //// method() { } -////} +////}|] //// -////module [|{| "isWriteAccess": true, "isDefinition": true |}testClass|] { +////[|module [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}testClass|] { //// export interface Bar { //// //// } -////} +////}|] //// ////var c1: [|testClass|]; ////var c2: [|testClass|].Bar; @@ -20,7 +20,7 @@ ////[|testClass|].bind(this); ////new [|testClass|](); -const [class0, module0, class1, module1, class2, class3, class4, class5] = test.ranges(); +const [class0Def, class0, module0Def, module0, class1, module1, class2, class3, class4, class5] = test.ranges(); verify.singleReferenceGroup("class testClass\nnamespace testClass", [module0, module1]); const classes = [class0, class1, class2, class3, class4, class5]; verify.referenceGroups(classes, [{ definition: "class testClass\nnamespace testClass", ranges: classes }]); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations4.ts b/tests/cases/fourslash/referencesForMergedDeclarations4.ts index 14189120197..f67f2aa62e4 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations4.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations4.ts @@ -2,17 +2,17 @@ // class and instantiated module -////class [|{| "isWriteAccess": true, "isDefinition": true |}testClass|] { +////[|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}testClass|] { //// static staticMethod() { } //// method() { } -////} +////}|] //// -////module [|{| "isWriteAccess": true, "isDefinition": true |}testClass|] { +////[|module [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}testClass|] { //// export interface Bar { //// //// } //// export var s = 0; -////} +////}|] //// ////var c1: [|testClass|]; ////var c2: [|testClass|].Bar; @@ -22,4 +22,4 @@ ////[|testClass|].s; ////new [|testClass|](); -verify.singleReferenceGroup("class testClass\nnamespace testClass"); +verify.singleReferenceGroup("class testClass\nnamespace testClass", test.rangesByText().get("testClass")); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations5.ts b/tests/cases/fourslash/referencesForMergedDeclarations5.ts index 40b43eb6819..6b3e7a8c766 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations5.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations5.ts @@ -1,14 +1,14 @@ /// -////interface [|{| "isWriteAccess": true, "isDefinition": true |}Foo|] { } -////module [|{| "isWriteAccess": true, "isDefinition": true |}Foo|] { export interface Bar { } } -////function [|{| "isWriteAccess": true, "isDefinition": true |}Foo|]() { } +////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Foo|] { }|] +////[|module [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}Foo|] { export interface Bar { } }|] +////[|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}Foo|]() { }|] //// -////export = [|Foo|]; +////[|export = [|{| "declarationRangeIndex": 6 |}Foo|];|] const ranges = test.ranges(); -const [r0, r1, r2, r3] = ranges; +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3] = ranges; verify.referenceGroups(r0, [{ definition: "interface Foo\nnamespace Foo", ranges: [r0, r3] }]); verify.referenceGroups(r1, [{ definition: "namespace Foo", ranges: [r1, r3] }]); verify.referenceGroups(r2, [{ definition: "namespace Foo\nfunction Foo(): void", ranges: [r2, r3] }]); -verify.referenceGroups(r3, [{ definition: "interface Foo\nnamespace Foo\nfunction Foo(): void", ranges }]); +verify.referenceGroups(r3, [{ definition: "interface Foo\nnamespace Foo\nfunction Foo(): void", ranges: [r0, r1, r2, r3] }]); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations6.ts b/tests/cases/fourslash/referencesForMergedDeclarations6.ts index 79ee0128ab6..91fc90f8e8f 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations6.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations6.ts @@ -1,13 +1,13 @@ /// ////interface Foo { } -////module [|{| "isWriteAccess": true, "isDefinition": true |}Foo|] { +////[|module [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Foo|] { //// export interface Bar { } //// export module Bar { export interface Baz { } } //// export function Bar() { } -////} +////}|] //// ////// module ////import a1 = [|Foo|]; -verify.singleReferenceGroup("namespace Foo"); +verify.singleReferenceGroup("namespace Foo", test.rangesByText().get("Foo")); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations7.ts b/tests/cases/fourslash/referencesForMergedDeclarations7.ts index c119992c8bc..8a35ead235c 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations7.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations7.ts @@ -2,17 +2,17 @@ ////interface Foo { } ////module Foo { -//// export interface [|{| "isWriteAccess": true, "isDefinition": true |}Bar|] { } -//// export module [|{| "isWriteAccess": true, "isDefinition": true |}Bar|] { export interface Baz { } } -//// export function [|{| "isWriteAccess": true, "isDefinition": true |}Bar|]() { } +//// [|export interface [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Bar|] { }|] +//// [|export module [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}Bar|] { export interface Baz { } }|] +//// [|export function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}Bar|]() { }|] ////} //// ////// module, value and type ////import a2 = Foo.[|Bar|]; const ranges = test.ranges(); -const [r0, r1, r2, r3] = ranges; +const [r0Def, r0, r1Def, r1, r2Def, r2, r3] = ranges; verify.referenceGroups(r0, [{ definition: "interface Foo.Bar\nnamespace Foo.Bar", ranges: [r0, r3] }]); verify.referenceGroups(r1, [{ definition: "namespace Foo.Bar", ranges: [r1, r3] }]); verify.referenceGroups(r2, [{ definition: "namespace Foo.Bar\nfunction Foo.Bar(): void", ranges: [r2, r3] }]); -verify.referenceGroups(r3, [{ definition: "interface Foo.Bar\nnamespace Foo.Bar\nfunction Foo.Bar(): void", ranges }]); +verify.referenceGroups(r3, [{ definition: "interface Foo.Bar\nnamespace Foo.Bar\nfunction Foo.Bar(): void", ranges: [r0, r1, r2, r3] }]); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations8.ts b/tests/cases/fourslash/referencesForMergedDeclarations8.ts index 4b4716c08a5..4485cd8d0de 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations8.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations8.ts @@ -3,11 +3,11 @@ ////interface Foo { } ////module Foo { //// export interface Bar { } -//// export module [|{| "isWriteAccess": true, "isDefinition": true |}Bar|] { export interface Baz { } } +//// [|export module [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Bar|] { export interface Baz { } }|] //// export function Bar() { } ////} //// ////// module ////import a3 = Foo.[|Bar|].Baz; -verify.singleReferenceGroup("namespace Foo.Bar"); +verify.singleReferenceGroup("namespace Foo.Bar", test.rangesByText().get("Bar")); diff --git a/tests/cases/fourslash/referencesForNumericLiteralPropertyNames.ts b/tests/cases/fourslash/referencesForNumericLiteralPropertyNames.ts index 1f28714daa1..1a9998be1e5 100644 --- a/tests/cases/fourslash/referencesForNumericLiteralPropertyNames.ts +++ b/tests/cases/fourslash/referencesForNumericLiteralPropertyNames.ts @@ -1,12 +1,12 @@ /// ////class Foo { -//// public [|{| "isDefinition": true |}12|]: any; +//// [|public [|{| "isDefinition": true, "declarationRangeIndex": 0 |}12|]: any;|] ////} //// ////var x: Foo; ////x[[|12|]]; -////x = { "[|{| "isWriteAccess": true, "isDefinition": true |}12|]": 0 }; -////x = { [|{| "isWriteAccess": true, "isDefinition": true |}12|]: 0 }; +////x = { [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}12|]": 0|] }; +////x = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}12|]: 0|] }; -verify.singleReferenceGroup("(property) Foo[12]: any"); +verify.singleReferenceGroup("(property) Foo[12]: any", test.rangesByText().get("12")); diff --git a/tests/cases/fourslash/referencesForObjectLiteralProperties.ts b/tests/cases/fourslash/referencesForObjectLiteralProperties.ts index 804faaebe6e..ed365a63706 100644 --- a/tests/cases/fourslash/referencesForObjectLiteralProperties.ts +++ b/tests/cases/fourslash/referencesForObjectLiteralProperties.ts @@ -2,10 +2,11 @@ // References to an object literal property -////var x = { [|{| "isWriteAccess": true, "isDefinition": true |}add|]: 0, b: "string" }; +////var x = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}add|]: 0|], b: "string" }; ////x["[|add|]"]; ////x.[|add|]; ////var y = x; ////y.[|add|]; -verify.singleReferenceGroup("(property) add: number"); +const [rDef, ...ranges] = test.ranges(); +verify.singleReferenceGroup("(property) add: number", ranges); diff --git a/tests/cases/fourslash/referencesForOverrides.ts b/tests/cases/fourslash/referencesForOverrides.ts index d5d9ea0a6b6..f0dcc3e3621 100644 --- a/tests/cases/fourslash/referencesForOverrides.ts +++ b/tests/cases/fourslash/referencesForOverrides.ts @@ -3,59 +3,59 @@ ////module FindRef3 { //// module SimpleClassTest { //// export class Foo { -//// public [|{| "isWriteAccess": true, "isDefinition": true |}foo|](): void { -//// } +//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|](): void { +//// }|] //// } //// export class Bar extends Foo { -//// public [|{| "isWriteAccess": true, "isDefinition": true |}foo|](): void { -//// } +//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}foo|](): void { +//// }|] //// } //// } //// //// module SimpleInterfaceTest { //// export interface IFoo { -//// [|{| "isDefinition": true |}ifoo|](): void; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 4 |}ifoo|](): void;|] //// } //// export interface IBar extends IFoo { -//// [|{| "isDefinition": true |}ifoo|](): void; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 6 |}ifoo|](): void;|] //// } //// } //// //// module SimpleClassInterfaceTest { //// export interface IFoo { -//// [|{| "isDefinition": true |}icfoo|](): void; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 8 |}icfoo|](): void;|] //// } //// export class Bar implements IFoo { -//// public [|{| "isWriteAccess": true, "isDefinition": true |}icfoo|](): void { -//// } +//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 10 |}icfoo|](): void { +//// }|] //// } //// } //// //// module Test { //// export interface IBase { -//// [|{| "isDefinition": true |}field|]: string; -//// [|{| "isDefinition": true |}method|](): void; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 12 |}field|]: string;|] +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 14 |}method|](): void;|] //// } //// //// export interface IBlah extends IBase { -//// [|{| "isDefinition": true |}field|]: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 16 |}field|]: string;|] //// } //// //// export interface IBlah2 extends IBlah { -//// [|{| "isDefinition": true |}field|]: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 18 |}field|]: string;|] //// } //// //// export interface IDerived extends IBlah2 { -//// [|{| "isDefinition": true |}method|](): void; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 20 |}method|](): void;|] //// } //// //// export class Bar implements IDerived { -//// public [|{| "isDefinition": true |}field|]: string; -//// public [|{| "isWriteAccess": true, "isDefinition": true |}method|](): void { } +//// [|public [|{| "isDefinition": true, "declarationRangeIndex": 22 |}field|]: string;|] +//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 24 |}method|](): void { }|] //// } //// //// export class BarBlah extends Bar { -//// public [|{| "isDefinition": true |}field|]: string; +//// [|public [|{| "isDefinition": true, "declarationRangeIndex": 26 |}field|]: string;|] //// } //// } //// diff --git a/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts b/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts index be00bb7593f..7fc42dce34e 100644 --- a/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts +++ b/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts @@ -1,7 +1,7 @@ /// ////interface IFoo { -//// [|{| "isDefinition": true |}doSomething|](v: T): T; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}doSomething|](v: T): T;|] ////} //// ////var x: IFoo; @@ -10,4 +10,5 @@ ////var y: IFoo; ////y.[|doSomething|](12); -verify.singleReferenceGroup("(method) IFoo.doSomething(v: T): T"); +const [rDef, ...ranges] = test.ranges(); +verify.singleReferenceGroup("(method) IFoo.doSomething(v: T): T", ranges); diff --git a/tests/cases/fourslash/referencesForStatic.ts b/tests/cases/fourslash/referencesForStatic.ts index 1c82d2fde6c..7bc1ec13e9c 100644 --- a/tests/cases/fourslash/referencesForStatic.ts +++ b/tests/cases/fourslash/referencesForStatic.ts @@ -6,7 +6,7 @@ ////var n = 43; //// ////class foo { -//// static [|{| "isWriteAccess": true, "isDefinition": true |}n|] = ''; +//// [|static [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}n|] = '';|] //// //// public bar() { //// foo.[|{| "isWriteAccess": true |}n|] = "'"; @@ -30,4 +30,5 @@ // @Filename: referencesOnStatic_2.ts ////var q = foo.[|n|]; -verify.singleReferenceGroup("(property) foo.n: string"); +const [rDef, ...ranges] = test.ranges(); +verify.singleReferenceGroup("(property) foo.n: string", ranges); diff --git a/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts b/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts index 816b866421a..146fc87581c 100644 --- a/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts +++ b/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts @@ -3,13 +3,13 @@ ////module FindRef4 { //// module MixedStaticsClassTest { //// export class Foo { -//// [|{| "isDefinition": true |}bar|]: Foo; -//// static [|{| "isDefinition": true |}bar|]: Foo; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}bar|]: Foo;|] +//// [|static [|{| "isDefinition": true, "declarationRangeIndex": 2 |}bar|]: Foo;|] //// -//// public [|{| "isWriteAccess": true, "isDefinition": true |}foo|](): void { -//// } -//// public static [|{| "isWriteAccess": true, "isDefinition": true |}foo|](): void { -//// } +//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}foo|](): void { +//// }|] +//// [|public static [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}foo|](): void { +//// }|] //// } //// } //// @@ -25,7 +25,7 @@ //// } ////} -const [fooBar, fooStaticBar, fooFoo, fooStaticFoo, xFoo, xBar, staticFoo, staticBar] = test.ranges(); +const [fooBarDef, fooBar, fooStaticBarDef, fooStaticBar, fooFooDef, fooFoo, fooStaticFooDef, fooStaticFoo, xFoo, xBar, staticFoo, staticBar] = test.ranges(); // References to a member method with the same name as a static. verify.singleReferenceGroup("(method) MixedStaticsClassTest.Foo.foo(): void", [fooFoo, xFoo]); diff --git a/tests/cases/fourslash/referencesForStringLiteralPropertyNames.ts b/tests/cases/fourslash/referencesForStringLiteralPropertyNames.ts index 88c9a74bc6e..036637ec75f 100644 --- a/tests/cases/fourslash/referencesForStringLiteralPropertyNames.ts +++ b/tests/cases/fourslash/referencesForStringLiteralPropertyNames.ts @@ -1,13 +1,13 @@ /// ////class Foo { -//// public "[|{| "isDefinition": true |}ss|]": any; +//// [|public "[|{| "isDefinition": true, "declarationRangeIndex": 0 |}ss|]": any;|] ////} //// ////var x: Foo; ////x.[|ss|]; ////x["[|ss|]"]; -////x = { "[|{| "isWriteAccess": true, "isDefinition": true |}ss|]": 0 }; -////x = { [|{| "isWriteAccess": true, "isDefinition": true |}ss|]: 0 }; +////x = { [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}ss|]": 0|] }; +////x = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}ss|]: 0|] }; -verify.singleReferenceGroup('(property) Foo["ss"]: any'); +verify.singleReferenceGroup('(property) Foo["ss"]: any', test.rangesByText().get("ss")); diff --git a/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts b/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts index ce5d474b9dc..cc142bebb69 100644 --- a/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts +++ b/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts @@ -1,10 +1,10 @@ /// ////class Foo { -//// "[|{| "isWriteAccess": true, "isDefinition": true |}blah|]"() { return 0; } +//// [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}blah|]"() { return 0; }|] ////} //// ////var x: Foo; ////x.[|blah|]; -verify.singleReferenceGroup('(method) Foo["blah"](): number'); +verify.singleReferenceGroup('(method) Foo["blah"](): number', test.rangesByText().get("blah")); diff --git a/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts b/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts index 22fa6b30cbc..050503a1e34 100644 --- a/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts +++ b/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts @@ -1,11 +1,12 @@ /// ////class Foo2 { -//// get "[|{| "isWriteAccess": true, "isDefinition": true |}42|]"() { return 0; } -//// set [|{| "isWriteAccess": true, "isDefinition": true |}42|](n) { } +//// [|get "[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}42|]"() { return 0; }|] +//// [|set [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}42|](n) { }|] ////} //// ////var y: Foo2; ////y[[|42|]]; -verify.singleReferenceGroup('(property) Foo2["42"]: number'); + +verify.singleReferenceGroup('(property) Foo2["42"]: number', test.rangesByText().get("42")); diff --git a/tests/cases/fourslash/referencesForStringLiteralPropertyNames4.ts b/tests/cases/fourslash/referencesForStringLiteralPropertyNames4.ts index a7589ba29a0..b4503030213 100644 --- a/tests/cases/fourslash/referencesForStringLiteralPropertyNames4.ts +++ b/tests/cases/fourslash/referencesForStringLiteralPropertyNames4.ts @@ -1,10 +1,10 @@ /// -////var x = { "[|{| "isWriteAccess": true, "isDefinition": true |}someProperty|]": 0 } +////var x = { [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}someProperty|]": 0|] } ////x["[|someProperty|]"] = 3; ////x.[|{| "isWriteAccess": true |}someProperty|] = 5; -const ranges = test.ranges(); +const [rDef, ...ranges] = test.ranges(); const [r0, r1, r2] = ranges; verify.referenceGroups(r0, [{ definition: '(property) "someProperty": number', ranges }]); verify.referenceGroups([r1, r2], [ diff --git a/tests/cases/fourslash/referencesForStringLiteralPropertyNames5.ts b/tests/cases/fourslash/referencesForStringLiteralPropertyNames5.ts index 22d35006c25..fc2174df21a 100644 --- a/tests/cases/fourslash/referencesForStringLiteralPropertyNames5.ts +++ b/tests/cases/fourslash/referencesForStringLiteralPropertyNames5.ts @@ -1,10 +1,10 @@ /// -////var x = { "[|{| "isWriteAccess": true, "isDefinition": true |}someProperty|]": 0 } +////var x = { [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}someProperty|]": 0|] } ////x["[|someProperty|]"] = 3; ////x.[|{| "isWriteAccess": true, "isDefinition": false |}someProperty|] = 5; -const ranges = test.ranges(); +const [r0Def, ...ranges] = test.ranges(); const [r0, r1, r2] = ranges; verify.referenceGroups(r0, [{ definition: '(property) "someProperty": number', ranges }]); verify.referenceGroups([r1, r2], [ diff --git a/tests/cases/fourslash/referencesForStringLiteralPropertyNames7.ts b/tests/cases/fourslash/referencesForStringLiteralPropertyNames7.ts index 98a6dc2ac47..4f6cd66fc73 100644 --- a/tests/cases/fourslash/referencesForStringLiteralPropertyNames7.ts +++ b/tests/cases/fourslash/referencesForStringLiteralPropertyNames7.ts @@ -4,13 +4,13 @@ // @allowJs: true // @checkJs: true -////var x = { "[|{| "isWriteAccess": true, "isDefinition": true |}someProperty|]": 0 } +////var x = { [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}someProperty|]": 0|] } ////x["[|someProperty|]"] = 3; -////x.[|{| "isWriteAccess": true, "isDefinition": true |}someProperty|] = 5; +////[|x.[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}someProperty|] = 5;|] -const ranges = test.ranges(); -const [r0, r1, r2] = ranges; +const [r0Def, r0, r1, r2Def, r2] = test.ranges(); +const ranges = [r0, r1, r2]; verify.referenceGroups(r0, [{ definition: '(property) "someProperty": number', ranges }]); verify.referenceGroups([r1, r2], [ - { definition: '(property) "someProperty": number', ranges: [r0, r1, r2] }, + { definition: '(property) "someProperty": number', ranges }, ]); diff --git a/tests/cases/fourslash/referencesForUnionProperties.ts b/tests/cases/fourslash/referencesForUnionProperties.ts index 7efff1aabd0..afaf78eb995 100644 --- a/tests/cases/fourslash/referencesForUnionProperties.ts +++ b/tests/cases/fourslash/referencesForUnionProperties.ts @@ -1,16 +1,16 @@ /// ////interface One { -//// common: { [|{| "isDefinition": true |}a|]: number; }; +//// common: { [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}a|]: number;|] }; ////} //// ////interface Base { -//// [|{| "isDefinition": true |}a|]: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}a|]: string;|] //// b: string; ////} //// ////interface HasAOrB extends Base { -//// [|{| "isDefinition": true |}a|]: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 4 |}a|]: string;|] //// b: string; ////} //// @@ -22,7 +22,7 @@ //// ////x.common.[|a|]; -const [one, base, hasAOrB, x] = test.ranges(); +const [oneDef, one, baseDef, base, hasAOrBDef, hasAOrB, x] = test.ranges(); verify.referenceGroups(one, [ { definition: "(property) a: number", ranges: [one] }, { definition: "(property) a: string | number", ranges: [x] }, diff --git a/tests/cases/fourslash/remoteGetReferences.ts b/tests/cases/fourslash/remoteGetReferences.ts index c9b8c3b4e2f..0c4e63d75f2 100644 --- a/tests/cases/fourslash/remoteGetReferences.ts +++ b/tests/cases/fourslash/remoteGetReferences.ts @@ -119,12 +119,12 @@ ////}); // @Filename: remoteGetReferences_2.ts -////var [|{| "isWriteAccess": true, "isDefinition": true |}remoteglobalVar|]: number = 2; +////[|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 10 |}remoteglobalVar|]: number = 2;|] //// -////class [|{| "isWriteAccess": true, "isDefinition": true |}remotefooCls|] { +////[|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 12 |}remotefooCls|] { //// //Declare -//// [|{| "isWriteAccess": true, "isDefinition": true |}remoteclsVar|] = 1; -//// static [|{| "isWriteAccess": true, "isDefinition": true |}remoteclsSVar|] = 1; +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 14 |}remoteclsVar|] = 1;|] +//// [|static [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 16 |}remoteclsSVar|] = 1;|] //// //// constructor(public remoteclsParam: number) { //// //Increments @@ -134,7 +134,7 @@ //// this.remoteclsParam++; //// remotemodTest.remotemodVar++; //// } -////} +////}|] //// ////function remotefoo(remotex: number) { //// //Declare @@ -178,6 +178,26 @@ ////} test.rangesByText().forEach((ranges, text) => { + // Definitions + if (text === "var remoteglobalVar: number = 2;" || + text === `class remotefooCls { + //Declare + remoteclsVar = 1; + static remoteclsSVar = 1; + + constructor(public remoteclsParam: number) { + //Increments + remoteglobalVar++; + this.remoteclsVar++; + remotefooCls.remoteclsSVar++; + this.remoteclsParam++; + remotemodTest.remotemodVar++; + } +}` || + text == "remoteclsVar = 1;" || + text === "static remoteclsSVar = 1;" + ) return; + const definition = (() => { switch (text) { case "remotefooCls": return "class remotefooCls"; diff --git a/tests/cases/fourslash/renameAcrossMultipleProjects.ts b/tests/cases/fourslash/renameAcrossMultipleProjects.ts index 2cc5824a843..272fe2bb393 100644 --- a/tests/cases/fourslash/renameAcrossMultipleProjects.ts +++ b/tests/cases/fourslash/renameAcrossMultipleProjects.ts @@ -1,7 +1,7 @@ /// //@Filename: a.ts -////var [|x|]: number; +////[|var [|{| "declarationRangeIndex": 0 |}x|]: number;|] //@Filename: b.ts /////// @@ -11,4 +11,5 @@ /////// ////[|x|]++; -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameAlias.ts b/tests/cases/fourslash/renameAlias.ts index 3869b1522b5..18b9ff47010 100644 --- a/tests/cases/fourslash/renameAlias.ts +++ b/tests/cases/fourslash/renameAlias.ts @@ -1,7 +1,8 @@ /// ////module SomeModule { export class SomeClass { } } -////import [|M|] = SomeModule; +////[|import [|{| "declarationRangeIndex": 0 |}M|] = SomeModule;|] ////import C = [|M|].SomeClass; -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameAlias2.ts b/tests/cases/fourslash/renameAlias2.ts index f97121f5f7d..4559976af80 100644 --- a/tests/cases/fourslash/renameAlias2.ts +++ b/tests/cases/fourslash/renameAlias2.ts @@ -1,7 +1,8 @@ /// -////module [|SomeModule|] { export class SomeClass { } } +////[|module [|{| "declarationRangeIndex": 0 |}SomeModule|] { export class SomeClass { } }|] ////import M = [|SomeModule|]; ////import C = M.SomeClass; -verify.rangesAreRenameLocations(); \ No newline at end of file +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); \ No newline at end of file diff --git a/tests/cases/fourslash/renameAlias3.ts b/tests/cases/fourslash/renameAlias3.ts index af3bafef115..70e3446dbe0 100644 --- a/tests/cases/fourslash/renameAlias3.ts +++ b/tests/cases/fourslash/renameAlias3.ts @@ -1,7 +1,8 @@ /// -////module SomeModule { export class [|SomeClass|] { } } +////module SomeModule { [|export class [|{| "declarationRangeIndex": 0 |}SomeClass|] { }|] } ////import M = SomeModule; ////import C = M.[|SomeClass|]; -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameAliasExternalModule.ts b/tests/cases/fourslash/renameAliasExternalModule.ts index 49cc6396717..8d753febc2b 100644 --- a/tests/cases/fourslash/renameAliasExternalModule.ts +++ b/tests/cases/fourslash/renameAliasExternalModule.ts @@ -5,7 +5,8 @@ ////export = SomeModule; // @Filename: b.ts -////import [|M|] = require("./a"); +////[|import [|{| "declarationRangeIndex": 0 |}M|] = require("./a");|] ////import C = [|M|].SomeClass; -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameAliasExternalModule2.ts b/tests/cases/fourslash/renameAliasExternalModule2.ts index 8416d12f4b2..e5e772179f5 100644 --- a/tests/cases/fourslash/renameAliasExternalModule2.ts +++ b/tests/cases/fourslash/renameAliasExternalModule2.ts @@ -1,13 +1,13 @@ /// // @Filename: a.ts -////module [|SomeModule|] { export class SomeClass { } } -////export = [|SomeModule|]; +////[|module [|{| "declarationRangeIndex": 0 |}SomeModule|] { export class SomeClass { } }|] +////[|export = [|{| "declarationRangeIndex": 2 |}SomeModule|];|] // @Filename: b.ts -////import [|M|] = require("./a"); +////[|import [|{| "declarationRangeIndex": 4 |}M|] = require("./a");|] ////import C = [|M|].SomeClass; -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3] = test.ranges(); verify.rangesAreRenameLocations([r0, r1]); verify.rangesAreRenameLocations([r2, r3]); diff --git a/tests/cases/fourslash/renameAliasExternalModule3.ts b/tests/cases/fourslash/renameAliasExternalModule3.ts index 53b28e7983e..6966b94b8a6 100644 --- a/tests/cases/fourslash/renameAliasExternalModule3.ts +++ b/tests/cases/fourslash/renameAliasExternalModule3.ts @@ -1,11 +1,12 @@ /// // @Filename: a.ts -////module SomeModule { export class [|SomeClass|] { } } +////module SomeModule { [|export class [|{| "declarationRangeIndex": 0 |}SomeClass|] { }|] } ////export = SomeModule; // @Filename: b.ts ////import M = require("./a"); ////import C = M.[|SomeClass|]; -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameCommentsAndStrings1.ts b/tests/cases/fourslash/renameCommentsAndStrings1.ts index cd350e3046c..7d3f5890b7d 100644 --- a/tests/cases/fourslash/renameCommentsAndStrings1.ts +++ b/tests/cases/fourslash/renameCommentsAndStrings1.ts @@ -2,9 +2,10 @@ /////// -////function [|Bar|]() { +////[|function [|{| "declarationRangeIndex": 0 |}Bar|]() { //// // This is a reference to Bar in a comment. //// "this is a reference to Bar in a string" -////} +////}|] -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/renameCommentsAndStrings2.ts b/tests/cases/fourslash/renameCommentsAndStrings2.ts index e31c3b76900..85e748988d9 100644 --- a/tests/cases/fourslash/renameCommentsAndStrings2.ts +++ b/tests/cases/fourslash/renameCommentsAndStrings2.ts @@ -2,10 +2,10 @@ /////// -////function [|Bar|]() { +////[|function [|{| "declarationRangeIndex": 0 |}Bar|]() { //// // This is a reference to Bar in a comment. //// "this is a reference to [|Bar|] in a string" -////} +////}|] -const ranges = test.ranges(); +const [rDef, ...ranges] = test.ranges(); verify.renameLocations(ranges[0], { findInStrings: true, ranges }) diff --git a/tests/cases/fourslash/renameCommentsAndStrings3.ts b/tests/cases/fourslash/renameCommentsAndStrings3.ts index 7d88ddf2438..c2d8482adbe 100644 --- a/tests/cases/fourslash/renameCommentsAndStrings3.ts +++ b/tests/cases/fourslash/renameCommentsAndStrings3.ts @@ -2,10 +2,10 @@ /////// -////function [|Bar|]() { +////[|function [|{| "declarationRangeIndex": 0 |}Bar|]() { //// // This is a reference to [|Bar|] in a comment. //// "this is a reference to Bar in a string" -////} +////}|] -const ranges = test.ranges(); +const [rDef, ...ranges] = test.ranges(); verify.renameLocations(ranges[0], { findInComments: true, ranges }); diff --git a/tests/cases/fourslash/renameCommentsAndStrings4.ts b/tests/cases/fourslash/renameCommentsAndStrings4.ts index eab53149d6d..0e04f22bde6 100644 --- a/tests/cases/fourslash/renameCommentsAndStrings4.ts +++ b/tests/cases/fourslash/renameCommentsAndStrings4.ts @@ -2,7 +2,7 @@ /////// -////function [|Bar|]() { +////[|function [|{| "declarationRangeIndex": 0 |}Bar|]() { //// // This is a reference to [|Bar|] in a comment. //// "this is a reference to [|Bar|] in a string"; //// `Foo [|Bar|] Baz.`; @@ -10,7 +10,7 @@ //// const Bar = 0; //// `[|Bar|] ba ${Bar} bara [|Bar|] berbobo ${Bar} araura [|Bar|] ara!`; //// } -////} +////}|] -const ranges = test.ranges(); +const [rDef, ...ranges] = test.ranges(); verify.renameLocations(ranges[0], { findInStrings: true, findInComments: true, ranges }); From 424f2c9e006cb1489d109f7877c30bc9a4b7a3e6 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 4 Jun 2019 12:24:34 -0700 Subject: [PATCH 226/384] More tests --- src/harness/fourslash.ts | 8 ++++---- tests/cases/fourslash/fourslash.ts | 2 +- tests/cases/fourslash/javaScriptClass2.ts | 6 +++--- tests/cases/fourslash/jsDocServices.ts | 11 ++++++----- .../fourslash/jsdocTypedefTagSemanticMeaning0.ts | 6 +++--- .../fourslash/jsdocTypedefTagSemanticMeaning1.ts | 4 ++-- tests/cases/fourslash/jsdocTypedefTagServices.ts | 13 +++++++------ tests/cases/fourslash/jsxSpreadReference.ts | 5 +++-- .../referenceInParameterPropertyDeclaration.ts | 8 +++++--- 9 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 51e6c2dbe29..5610eaf1510 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -2709,8 +2709,8 @@ Actual: ${stringify(fullActual)}`); return this.languageService.getDocumentHighlights(this.activeFile.fileName, this.currentCaretPosition, filesToSearch); } - public verifyRangesAreOccurrences(isWriteAccess?: boolean) { - const ranges = this.getRanges(); + public verifyRangesAreOccurrences(isWriteAccess?: boolean, ranges?: Range[]) { + ranges = ranges || this.getRanges(); for (const r of ranges) { this.goToRangeStart(r); this.verifyOccurrencesAtPositionListCount(ranges.length); @@ -4084,8 +4084,8 @@ namespace FourSlashInterface { this.state.verifyOccurrencesAtPositionListCount(expectedCount); } - public rangesAreOccurrences(isWriteAccess?: boolean) { - this.state.verifyRangesAreOccurrences(isWriteAccess); + public rangesAreOccurrences(isWriteAccess?: boolean, ranges?: FourSlash.Range[]) { + this.state.verifyRangesAreOccurrences(isWriteAccess, ranges); } public rangesWithSameTextAreRenameLocations() { diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index fa9cdd61c2f..b01f8842dee 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -228,7 +228,7 @@ declare namespace FourSlashInterface { */ referenceGroups(starts: ArrayOrSingle | ArrayOrSingle, parts: ReadonlyArray): void; singleReferenceGroup(definition: ReferencesDefinition, ranges?: Range[]): void; - rangesAreOccurrences(isWriteAccess?: boolean): void; + rangesAreOccurrences(isWriteAccess?: boolean, ranges?: Range[]): void; rangesWithSameTextAreRenameLocations(): void; rangesAreRenameLocations(options?: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges?: Range[] }); findReferencesDefinitionDisplayPartsAtCaretAre(expected: ts.SymbolDisplayPart[]): void; diff --git a/tests/cases/fourslash/javaScriptClass2.ts b/tests/cases/fourslash/javaScriptClass2.ts index dcdac24c7b8..130976dfe57 100644 --- a/tests/cases/fourslash/javaScriptClass2.ts +++ b/tests/cases/fourslash/javaScriptClass2.ts @@ -6,12 +6,12 @@ // @Filename: Foo.js //// class Foo { //// constructor() { -//// this.[|union|] = 'foo'; -//// this.[|union|] = 100; +//// [|this.[|{| "declarationRangeIndex": 0 |}union|] = 'foo';|] +//// [|this.[|{| "declarationRangeIndex": 2 |}union|] = 100;|] //// } //// method() { return this.[|union|]; } //// } //// var x = new Foo(); //// x.[|union|]; -verify.rangesAreRenameLocations(); +verify.rangesAreRenameLocations(test.rangesByText().get("union")); diff --git a/tests/cases/fourslash/jsDocServices.ts b/tests/cases/fourslash/jsDocServices.ts index df1e985f876..75c8957b5eb 100644 --- a/tests/cases/fourslash/jsDocServices.ts +++ b/tests/cases/fourslash/jsDocServices.ts @@ -7,11 +7,12 @@ /////** //// * @param /*use*/[|foo|] I pity the foo //// */ -////function f([|/*def*/{| "isWriteAccess": true, "isDefinition": true |}foo|]: I) { +////function f([|[|/*def*/{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 1 |}foo|]: I|]) { //// return [|foo|]; ////} -const ranges = test.ranges(); +const [r0, r1Def, r1, r2] = test.ranges(); +const ranges = [r0, r1, r2]; goTo.marker("use"); verify.goToDefinitionIs("def"); verify.goToType("use", "I"); @@ -19,6 +20,6 @@ verify.goToType("use", "I"); goTo.marker("use"); verify.quickInfoIs("(parameter) foo: I", "I pity the foo"); -verify.singleReferenceGroup("(parameter) foo: I"); -verify.rangesAreDocumentHighlights(); -verify.rangesAreRenameLocations(); +verify.singleReferenceGroup("(parameter) foo: I", ranges); +verify.rangesAreDocumentHighlights(ranges); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning0.ts b/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning0.ts index c45f4aadc80..5cde088e8b2 100644 --- a/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning0.ts +++ b/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning0.ts @@ -3,14 +3,14 @@ // @allowJs: true // @Filename: a.js -/////** @typedef {number} [|{| "isWriteAccess": true, "isDefinition": true |}T|] */ +/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}T|]|] */ -////const [|{| "isWriteAccess": true, "isDefinition": true |}T|] = 1; +////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}T|] = 1;|] /////** @type {[|T|]} */ ////const n = [|T|]; -const [t0, v0, t1, v1] = test.ranges(); +const [t0Def, t0, v0Def, v0, t1, v1] = test.ranges(); verify.singleReferenceGroup("type T = number", [t0, t1]); verify.singleReferenceGroup("const T: 1", [v0, v1]); diff --git a/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning1.ts b/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning1.ts index f052d4bd870..60bef778045 100644 --- a/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning1.ts +++ b/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning1.ts @@ -4,9 +4,9 @@ // @Filename: a.js /////** @typedef {number} */ -////const [|{| "isWriteAccess": true, "isDefinition": true |}T|] = 1; +////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}T|] = 1;|] /////** @type {[|T|]} */ ////const n = [|T|]; -verify.singleReferenceGroup("type T = number\nconst T: 1"); +verify.singleReferenceGroup("type T = number\nconst T: 1", test.rangesByText().get("T")); diff --git a/tests/cases/fourslash/jsdocTypedefTagServices.ts b/tests/cases/fourslash/jsdocTypedefTagServices.ts index e4b262c3ee4..282569dfb91 100644 --- a/tests/cases/fourslash/jsdocTypedefTagServices.ts +++ b/tests/cases/fourslash/jsdocTypedefTagServices.ts @@ -5,9 +5,9 @@ /////** //// * Doc comment -//// * @typedef /*def*/[|{| "isWriteAccess": true, "isDefinition": true |}Product|] +//// * [|@typedef /*def*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Product|] //// * @property {string} title -//// */ +//// |]*/ /////** //// * @type {[|/*use*/Product|]} @@ -18,11 +18,12 @@ const desc = `type Product = { title: string; }`; +const [r0Def, ...ranges] = test.ranges(); verify.quickInfoAt("use", desc, "Doc comment"); verify.goToDefinition("use", "def"); -verify.rangesAreOccurrences(); -verify.rangesAreDocumentHighlights(); -verify.singleReferenceGroup(desc); -verify.rangesAreRenameLocations(); +verify.rangesAreOccurrences(/*isWriteAccesss*/ undefined, ranges); +verify.rangesAreDocumentHighlights(ranges); +verify.singleReferenceGroup(desc, ranges); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/jsxSpreadReference.ts b/tests/cases/fourslash/jsxSpreadReference.ts index 915dbdcecdf..3b8b9e9425a 100644 --- a/tests/cases/fourslash/jsxSpreadReference.ts +++ b/tests/cases/fourslash/jsxSpreadReference.ts @@ -14,8 +14,9 @@ //// } //// } //// -//// var [|/*dst*/nn|]: {name?: string; size?: number}; +//// [|var [|/*dst*/{| "declarationRangeIndex": 0 |}nn|]: {name?: string; size?: number};|] //// var x = ; verify.goToDefinition("src", "dst"); -verify.rangesAreRenameLocations(); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/referenceInParameterPropertyDeclaration.ts b/tests/cases/fourslash/referenceInParameterPropertyDeclaration.ts index 63494352ff4..c2c633926d5 100644 --- a/tests/cases/fourslash/referenceInParameterPropertyDeclaration.ts +++ b/tests/cases/fourslash/referenceInParameterPropertyDeclaration.ts @@ -2,9 +2,9 @@ // @Filename: file1.ts //// class Foo { -//// constructor(private [|{| "isWriteAccess": true, "isDefinition": true, "type": "number" |}privateParam|]: number, -//// public [|{| "isWriteAccess": true, "isDefinition": true, "type": "string" |}publicParam|]: string, -//// protected [|{| "isWriteAccess": true, "isDefinition": true, "type": "boolean" |}protectedParam|]: boolean) { +//// constructor([|private [|{| "isWriteAccess": true, "isDefinition": true, "type": "number", "declarationRangeIndex": 0 |}privateParam|]: number|], +//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "type": "string", "declarationRangeIndex": 2 |}publicParam|]: string|], +//// [|protected [|{| "isWriteAccess": true, "isDefinition": true, "type": "boolean", "declarationRangeIndex": 4 |}protectedParam|]: boolean|]) { //// //// let localPrivate = [|privateParam|]; //// this.[|{| "isWriteAccess": true |}privateParam|] += 10; @@ -18,6 +18,8 @@ //// } test.rangesByText().forEach((ranges, text) => { + if (text !== "privateParam" && text !== "publicParam" && text !== "protectedParam") return; + const [r0, r1, r2] = ranges; const type = r0.marker.data.type; verify.referenceGroups(ranges, [ From eaeeb06f9a22e88af7a590599c8be9483839cc59 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 4 Jun 2019 13:45:22 -0700 Subject: [PATCH 227/384] Handle when declarationSpan from declarationNode is undefined --- src/services/goToDefinition.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/services/goToDefinition.ts b/src/services/goToDefinition.ts index f64a2469156..05bd62e363f 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -273,18 +273,21 @@ namespace ts.GoToDefinition { function createDefinitionInfoFromName(declaration: Declaration, symbolKind: ScriptElementKind, symbolName: string, containerName: string): DefinitionInfo { const name = getNameOfDeclaration(declaration) || declaration; const sourceFile = name.getSourceFile(); - const declarationNode = FindAllReferences.getDeclarationForDeclarationSpan(declaration)!; - return { + const result: DefinitionInfo = { fileName: sourceFile.fileName, textSpan: createTextSpanFromNode(name, sourceFile), kind: symbolKind, name: symbolName, containerKind: undefined!, // TODO: GH#18217 containerName, - declarationSpan: FindAllReferences.isDeclarationNodeWithStartAndEnd(declarationNode) ? - createTextSpanFromNode(declarationNode.start, sourceFile, declarationNode.end) : - createTextSpanFromNode(declarationNode, sourceFile), }; + const declarationNode = FindAllReferences.getDeclarationForDeclarationSpan(declaration); + if (declarationNode) { + result.declarationSpan = FindAllReferences.isDeclarationNodeWithStartAndEnd(declarationNode) ? + createTextSpanFromNode(declarationNode.start, sourceFile, declarationNode.end) : + createTextSpanFromNode(declarationNode, sourceFile); + } + return result; } function createDefinitionFromSignatureDeclaration(typeChecker: TypeChecker, decl: SignatureDeclaration): DefinitionInfo { From cc1cb54e4bce8c71cd61c53f903a712f96b3dfa2 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 4 Jun 2019 13:58:27 -0700 Subject: [PATCH 228/384] More tests --- tests/cases/fourslash/findAllRefsUnionProperty.ts | 10 +++++----- .../findAllRefsWithLeadingUnderscoreNames1.ts | 4 ++-- .../findAllRefsWithLeadingUnderscoreNames2.ts | 4 ++-- .../findAllRefsWithLeadingUnderscoreNames3.ts | 4 ++-- .../findAllRefsWithLeadingUnderscoreNames4.ts | 4 ++-- .../findAllRefsWithLeadingUnderscoreNames5.ts | 4 ++-- .../findAllRefsWithLeadingUnderscoreNames6.ts | 4 ++-- .../findAllRefsWithLeadingUnderscoreNames7.ts | 6 +++--- .../findAllRefsWithLeadingUnderscoreNames8.ts | 6 +++--- .../findAllRefsWithLeadingUnderscoreNames9.ts | 6 +++--- .../findAllRefsWithShorthandPropertyAssignment.ts | 6 +++--- .../findAllRefsWithShorthandPropertyAssignment2.ts | 6 +++--- .../findAllRefs_importType_exportEquals.ts | 10 +++++----- tests/cases/fourslash/findAllRefs_importType_js.ts | 6 +++--- .../findAllRefs_importType_meaningAtLocation.ts | 6 +++--- .../fourslash/findAllRefs_importType_named.ts | 6 +++--- tests/cases/fourslash/findAllRefs_jsEnum.ts | 4 ++-- .../findReferencesAcrossMultipleProjects.ts | 4 ++-- tests/cases/fourslash/findReferencesAfterEdit.ts | 6 +++--- tests/cases/fourslash/findReferencesJSXTagName.ts | 8 ++++---- tests/cases/fourslash/findReferencesJSXTagName2.ts | 4 ++-- tests/cases/fourslash/findReferencesJSXTagName3.ts | 9 ++++----- .../getOccurrencesIsDefinitionOfArrowFunction.ts | 4 ++-- .../getOccurrencesIsDefinitionOfBindingPattern.ts | 4 ++-- .../fourslash/getOccurrencesIsDefinitionOfClass.ts | 6 +++--- ...getOccurrencesIsDefinitionOfComputedProperty.ts | 4 ++-- .../fourslash/getOccurrencesIsDefinitionOfEnum.ts | 6 +++--- .../getOccurrencesIsDefinitionOfExport.ts | 6 +++--- .../getOccurrencesIsDefinitionOfFunction.ts | 6 +++--- .../getOccurrencesIsDefinitionOfInterface.ts | 6 +++--- ...OccurrencesIsDefinitionOfInterfaceClassMerge.ts | 14 +++++++------- .../getOccurrencesIsDefinitionOfNamespace.ts | 6 +++--- ...OccurrencesIsDefinitionOfNumberNamedProperty.ts | 4 ++-- .../getOccurrencesIsDefinitionOfParameter.ts | 4 ++-- ...OccurrencesIsDefinitionOfStringNamedProperty.ts | 4 ++-- .../getOccurrencesIsDefinitionOfTypeAlias.ts | 4 ++-- .../getOccurrencesIsDefinitionOfVariable.ts | 4 ++-- 37 files changed, 104 insertions(+), 105 deletions(-) diff --git a/tests/cases/fourslash/findAllRefsUnionProperty.ts b/tests/cases/fourslash/findAllRefsUnionProperty.ts index 3b7813f638b..61f4df03047 100644 --- a/tests/cases/fourslash/findAllRefsUnionProperty.ts +++ b/tests/cases/fourslash/findAllRefsUnionProperty.ts @@ -1,11 +1,11 @@ /// ////type T = -//// | { [|{| "isDefinition": true |}type|]: "a", [|{| "isDefinition": true |}prop|]: number } -//// | { [|{| "isDefinition": true |}type|]: "b", [|{| "isDefinition": true |}prop|]: string }; +//// | { [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}type|]: "a",|] [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}prop|]: number|] } +//// | { [|[|{| "isDefinition": true, "declarationRangeIndex": 4 |}type|]: "b",|] [|[|{| "isDefinition": true, "declarationRangeIndex": 6 |}prop|]: string|] }; ////const tt: T = { -//// [|{| "isWriteAccess": true, "isDefinition": true |}type|]: "a", -//// [|{| "isWriteAccess": true, "isDefinition": true |}prop|]: 0, +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 8 |}type|]: "a"|], +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 10 |}prop|]: 0|], ////}; ////declare const t: T; ////if (t.[|type|] === "a") { @@ -14,7 +14,7 @@ //// t.[|type|]; ////} -const [t0, p0, t1, p1, t2, p2, t3, t4, t5] = test.ranges(); +const [t0Def, t0, p0Def, p0, t1Def, t1, p1Def, p1, t2Def, t2, p2Def, p2, t3, t4, t5] = test.ranges(); const a = { definition: { text: '(property) type: "a"', range: t0 }, ranges: [t0, t2, t4] }; const b = { definition: { text: '(property) type: "b"', range: t1 }, ranges: [t1, t5] }; diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts index 4a1bf374c05..2ae0cc4ac71 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts @@ -1,10 +1,10 @@ /// ////class Foo { -//// public [|{| "isWriteAccess": true, "isDefinition": true |}_bar|]() { return 0; } +//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}_bar|]() { return 0; }|] ////} //// ////var x: Foo; ////x.[|_bar|]; -verify.singleReferenceGroup("(method) Foo._bar(): number"); +verify.singleReferenceGroup("(method) Foo._bar(): number", test.rangesByText().get("_bar")); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts index ec120254fde..038e66449d4 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts @@ -1,10 +1,10 @@ /// ////class Foo { -//// public [|{| "isWriteAccess": true, "isDefinition": true |}__bar|]() { return 0; } +//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}__bar|]() { return 0; }|] ////} //// ////var x: Foo; ////x.[|__bar|]; -verify.singleReferenceGroup("(method) Foo.__bar(): number"); +verify.singleReferenceGroup("(method) Foo.__bar(): number", test.rangesByText().get("__bar")); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts index e6f46b128e7..9c7815dea01 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts @@ -1,10 +1,10 @@ /// ////class Foo { -//// public [|{| "isWriteAccess": true, "isDefinition": true |}___bar|]() { return 0; } +//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}___bar|]() { return 0; }|] ////} //// ////var x: Foo; ////x.[|___bar|]; -verify.singleReferenceGroup("(method) Foo.___bar(): number"); +verify.singleReferenceGroup("(method) Foo.___bar(): number", test.rangesByText().get("___bar")); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts index 593d61f3fbe..5c6566a8a0f 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts @@ -1,10 +1,10 @@ /// ////class Foo { -//// public [|{| "isWriteAccess": true, "isDefinition": true |}____bar|]() { return 0; } +//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}____bar|]() { return 0; }|] ////} //// ////var x: Foo; ////x.[|____bar|]; -verify.singleReferenceGroup("(method) Foo.____bar(): number"); +verify.singleReferenceGroup("(method) Foo.____bar(): number", test.rangesByText().get("____bar")); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts index cf171662596..f3c807483cd 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts @@ -3,7 +3,7 @@ ////class Foo { //// public _bar; //// public __bar; -//// public [|{| "isDefinition": true |}___bar|]; +//// [|public [|{| "isDefinition": true, "declarationRangeIndex": 0 |}___bar|];|] //// public ____bar; ////} //// @@ -13,4 +13,4 @@ ////x.[|___bar|]; ////x.____bar; -verify.singleReferenceGroup("(property) Foo.___bar: any"); +verify.singleReferenceGroup("(property) Foo.___bar: any", test.rangesByText().get("___bar")); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts index 77197480eb1..be8859c01a0 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts @@ -2,7 +2,7 @@ ////class Foo { //// public _bar; -//// public [|{| "isDefinition": true |}__bar|]; +//// [|public [|{| "isDefinition": true, "declarationRangeIndex": 0 |}__bar|];|] //// public ___bar; //// public ____bar; ////} @@ -13,4 +13,4 @@ ////x.___bar; ////x.____bar; -verify.singleReferenceGroup("(property) Foo.__bar: any"); +verify.singleReferenceGroup("(property) Foo.__bar: any", test.rangesByText().get("__bar")); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts index dac42f4fc7c..b6de0be25c9 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts @@ -1,7 +1,7 @@ /// -////function [|{| "isWriteAccess": true, "isDefinition": true |}__foo|]() { +////[|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}__foo|]() { //// [|__foo|](); -////} +////}|] -verify.singleReferenceGroup("function __foo(): void"); +verify.singleReferenceGroup("function __foo(): void", test.rangesByText().get("__foo")); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts index 8c92275e27f..945fa91e6d6 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts @@ -1,7 +1,7 @@ /// -////(function [|{| "isWriteAccess": true, "isDefinition": true |}__foo|]() { +////([|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}__foo|]() { //// [|__foo|](); -////}) +////}|]) -verify.singleReferenceGroup("(local function) __foo(): void"); +verify.singleReferenceGroup("(local function) __foo(): void", test.rangesByText().get("__foo")); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts index bc5799e61cf..2ff0420cc16 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts @@ -1,7 +1,7 @@ /// -////(function [|{| "isWriteAccess": true, "isDefinition": true |}___foo|]() { +////([|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}___foo|]() { //// [|___foo|](); -////}) +////}|]) -verify.singleReferenceGroup("(local function) ___foo(): void"); +verify.singleReferenceGroup("(local function) ___foo(): void", test.rangesByText().get("___foo")); diff --git a/tests/cases/fourslash/findAllRefsWithShorthandPropertyAssignment.ts b/tests/cases/fourslash/findAllRefsWithShorthandPropertyAssignment.ts index b25c08cd692..490b87d624d 100644 --- a/tests/cases/fourslash/findAllRefsWithShorthandPropertyAssignment.ts +++ b/tests/cases/fourslash/findAllRefsWithShorthandPropertyAssignment.ts @@ -1,12 +1,12 @@ /// -//// var [|{| "isWriteAccess": true, "isDefinition": true |}name|] = "Foo"; +//// [|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}name|] = "Foo";|] //// //// var obj = { [|{| "isWriteAccess": true, "isDefinition": true |}name|] }; -//// var obj1 = { [|{| "isWriteAccess": true, "isDefinition": true |}name|]:[|name|] }; +//// var obj1 = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}name|]:[|name|]|] }; //// obj.[|name|]; -const [r0, r1, r2, r3, r4] = test.ranges(); +const [r0Def, r0, r1, r2Def, r2, r3, r4] = test.ranges(); verify.referenceGroups([r0, r3], [{ definition: "var name: string", ranges: [r0, r1, r3] }]); verify.referenceGroups(r1, [ { definition: "var name: string", ranges: [r0, r1, r3] }, diff --git a/tests/cases/fourslash/findAllRefsWithShorthandPropertyAssignment2.ts b/tests/cases/fourslash/findAllRefsWithShorthandPropertyAssignment2.ts index f19640698cd..39804714464 100644 --- a/tests/cases/fourslash/findAllRefsWithShorthandPropertyAssignment2.ts +++ b/tests/cases/fourslash/findAllRefsWithShorthandPropertyAssignment2.ts @@ -1,15 +1,15 @@ /// -//// var [|{| "isWriteAccess": true, "isDefinition": true |}dx|] = "Foo"; +//// [|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}dx|] = "Foo";|] //// -//// module M { export var [|{| "isDefinition": true |}dx|]; } +//// module M { [|export var [|{| "isDefinition": true, "declarationRangeIndex": 2 |}dx|];|] } //// module M { //// var z = 100; //// export var y = { [|{| "isWriteAccess": true, "isDefinition": true |}dx|], z }; //// } //// M.y.[|dx|]; -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2, r3] = test.ranges(); verify.singleReferenceGroup("var dx: string", [r0]); verify.referenceGroups(r1, [{ definition: "var M.dx: any", ranges: [r1, r2] }]); verify.referenceGroups(r2, [ diff --git a/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts b/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts index 3734b7a2e88..0d60c153ce9 100644 --- a/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts +++ b/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts @@ -1,11 +1,11 @@ /// // @Filename: /a.ts -////type [|{| "isWriteAccess": true, "isDefinition": true |}T|] = number; -////namespace [|{| "isWriteAccess": true, "isDefinition": true |}T|] { +////[|type [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}T|] = number;|] +////[|namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}T|] { //// export type U = string; -////} -////[|export|] = [|T|]; +////}|] +////[|[|export|] = [|{| "declarationRangeIndex": 4 |}T|];|] // @Filename: /b.ts ////const x: import("[|./[|a|]|]") = 0; @@ -13,7 +13,7 @@ verify.noErrors(); -const [r0, r1, rExport, r2, r3, r3b, r4, r4b] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, rExport, r2, r3, r3b, r4, r4b] = test.ranges(); verify.referenceGroups(r0, [{ definition: "type T = number\nnamespace T", ranges: [r0, r2, r3] }]); verify.referenceGroups(r1, [{ definition: "namespace T", ranges: [r1, r2] }]); const t: FourSlashInterface.ReferenceGroup = { definition: "type T = number\nnamespace T", ranges: [r0, r1, r2, r3] }; diff --git a/tests/cases/fourslash/findAllRefs_importType_js.ts b/tests/cases/fourslash/findAllRefs_importType_js.ts index b1f612c8e45..79f99da90a4 100644 --- a/tests/cases/fourslash/findAllRefs_importType_js.ts +++ b/tests/cases/fourslash/findAllRefs_importType_js.ts @@ -4,8 +4,8 @@ // @checkJs: true // @Filename: /a.js -////[|module|].exports = class [|{| "isWriteAccess": true, "isDefinition": true |}C|] {}; -////module.exports.[|{| "isWriteAccess": true, "isDefinition": true |}D|] = class [|{| "isWriteAccess": true, "isDefinition": true |}D|] {}; +////[|[|{| "declarationRangeIndex": 0 |}module|].exports = [|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}C|] {}|];|] +////[|module.exports.[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}D|] = [|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}D|] {}|];|] // @Filename: /b.js /////** @type {import("[|./a|]")} */ @@ -17,7 +17,7 @@ verify.noErrors(); // TODO: GH#24025 -const [rModule, r0, r1, r2, r3, r4, r5] = test.ranges(); +const [rModuleDef, rModule, r0Def, r0, r1Def, r1, r2Def, r2, r3, r4, r5] = test.ranges(); verify.referenceGroups(rModule, [{ definition: 'module "/a"', ranges: [r3, r4, rModule] }]); verify.referenceGroups(r0, [ { definition: "(local class) C", ranges: [r0] }, diff --git a/tests/cases/fourslash/findAllRefs_importType_meaningAtLocation.ts b/tests/cases/fourslash/findAllRefs_importType_meaningAtLocation.ts index 4c79999a866..367a6f0febd 100644 --- a/tests/cases/fourslash/findAllRefs_importType_meaningAtLocation.ts +++ b/tests/cases/fourslash/findAllRefs_importType_meaningAtLocation.ts @@ -1,13 +1,13 @@ /// // @Filename: /a.ts -////export type [|{| "isWriteAccess": true, "isDefinition": true |}T|] = 0; -////export const [|{| "isWriteAccess": true, "isDefinition": true |}T|] = 0; +////[|export type [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}T|] = 0;|] +////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}T|] = 0;|] // @Filename: /b.ts ////const x: import("./a").[|T|] = 0; ////const x: typeof import("./a").[|T|] = 0; -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2, r3] = test.ranges(); verify.singleReferenceGroup("type T = 0", [r0, r2]); verify.singleReferenceGroup("const T: 0", [r1, r3]); diff --git a/tests/cases/fourslash/findAllRefs_importType_named.ts b/tests/cases/fourslash/findAllRefs_importType_named.ts index ed4d4a1427b..ae3b7585764 100644 --- a/tests/cases/fourslash/findAllRefs_importType_named.ts +++ b/tests/cases/fourslash/findAllRefs_importType_named.ts @@ -1,13 +1,13 @@ /// // @Filename: /a.ts -////export type [|{| "isWriteAccess": true, "isDefinition": true |}T|] = number; -////export type [|{| "isWriteAccess": true, "isDefinition": true |}U|] = string; +////[|export type [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}T|] = number;|] +////[|export type [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}U|] = string;|] // @Filename: /b.ts ////const x: import("./a").[|T|] = 0; ////const x: import("./a").[|U|] = 0; -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2, r3] = test.ranges(); verify.singleReferenceGroup("type T = number", [r0, r2]); verify.singleReferenceGroup("type U = string", [r1, r3]); diff --git a/tests/cases/fourslash/findAllRefs_jsEnum.ts b/tests/cases/fourslash/findAllRefs_jsEnum.ts index c77b24256bf..79c007c2947 100644 --- a/tests/cases/fourslash/findAllRefs_jsEnum.ts +++ b/tests/cases/fourslash/findAllRefs_jsEnum.ts @@ -4,7 +4,7 @@ // @Filename: /a.js /////** @enum {string} */ -////const [|{| "isWriteAccess": true, "isDefinition": true |}E|] = { A: "" }; +////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}E|] = { A: "" };|] ////[|E|]["A"]; /////** @type {[|E|]} */ ////const e = [|E|].A; @@ -13,4 +13,4 @@ verify.singleReferenceGroup( `enum E const E: { A: string; -}`); +}`, test.rangesByText().get("E")); diff --git a/tests/cases/fourslash/findReferencesAcrossMultipleProjects.ts b/tests/cases/fourslash/findReferencesAcrossMultipleProjects.ts index 2141399705f..b94b8629620 100644 --- a/tests/cases/fourslash/findReferencesAcrossMultipleProjects.ts +++ b/tests/cases/fourslash/findReferencesAcrossMultipleProjects.ts @@ -1,7 +1,7 @@ /// //@Filename: a.ts -////var [|{| "isDefinition": true |}x|]: number; +////[|var [|{| "isDefinition": true, "declarationRangeIndex": 0 |}x|]: number;|] //@Filename: b.ts /////// @@ -11,4 +11,4 @@ /////// ////[|{| "isWriteAccess": true |}x|]++; -verify.singleReferenceGroup("var x: number"); +verify.singleReferenceGroup("var x: number", test.rangesByText().get("x")); diff --git a/tests/cases/fourslash/findReferencesAfterEdit.ts b/tests/cases/fourslash/findReferencesAfterEdit.ts index 3787617692a..9a8717eb1e3 100644 --- a/tests/cases/fourslash/findReferencesAfterEdit.ts +++ b/tests/cases/fourslash/findReferencesAfterEdit.ts @@ -2,7 +2,7 @@ // @Filename: a.ts ////interface A { -//// [|{| "isDefinition": true |}foo|]: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}foo|]: string;|] ////} // @Filename: b.ts @@ -12,9 +12,9 @@ //// x.[|foo|] ////} -verify.singleReferenceGroup("(property) A.foo: string"); +verify.singleReferenceGroup("(property) A.foo: string", test.rangesByText().get("foo")); goTo.marker(""); edit.insert("\n"); -verify.singleReferenceGroup("(property) A.foo: string"); +verify.singleReferenceGroup("(property) A.foo: string", test.rangesByText().get("foo")); diff --git a/tests/cases/fourslash/findReferencesJSXTagName.ts b/tests/cases/fourslash/findReferencesJSXTagName.ts index 8547ad8b330..ec011671c9e 100644 --- a/tests/cases/fourslash/findReferencesJSXTagName.ts +++ b/tests/cases/fourslash/findReferencesJSXTagName.ts @@ -1,17 +1,17 @@ /// // @Filename: index.tsx -////import { [|{| "isWriteAccess": true, "isDefinition": true |}SubmissionComp|] } from "./RedditSubmission" +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}SubmissionComp|] } from "./RedditSubmission"|] ////function displaySubreddit(subreddit: string) { //// let components = submissions //// .map((value, index) => <[|SubmissionComp|] key={ index } elementPosition= { index } {...value.data} />); ////} // @Filename: RedditSubmission.ts -////export const [|{| "isWriteAccess": true, "isDefinition": true |}SubmissionComp|] = (submission: SubmissionProps) => -////

; +////export const [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}SubmissionComp|] = (submission: SubmissionProps) => +////
; -const [r0, r1, r2] = test.ranges(); +const [r0Def, r0, r1, r2Def, r2] = test.ranges(); const imports = { definition: "(alias) const SubmissionComp: (submission: any) => any\nimport SubmissionComp", ranges: [r0, r1] }; const def = { definition: "const SubmissionComp: (submission: any) => any", ranges: [r2] }; verify.referenceGroups([r0, r1], [imports, def]); diff --git a/tests/cases/fourslash/findReferencesJSXTagName2.ts b/tests/cases/fourslash/findReferencesJSXTagName2.ts index a8882b60088..46133d8e339 100644 --- a/tests/cases/fourslash/findReferencesJSXTagName2.ts +++ b/tests/cases/fourslash/findReferencesJSXTagName2.ts @@ -1,9 +1,9 @@ /// // @Filename: index.tsx -////const [|{| "isWriteAccess": true, "isDefinition": true |}obj|] = {Component: () =>
}; +////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}obj|] = {Component: () =>
};|] ////const element = <[|obj|].Component/>; verify.singleReferenceGroup(`const obj: { Component: () => any; -}`); +}`, test.rangesByText().get("obj")); diff --git a/tests/cases/fourslash/findReferencesJSXTagName3.ts b/tests/cases/fourslash/findReferencesJSXTagName3.ts index 58715ade2fa..afd90562777 100644 --- a/tests/cases/fourslash/findReferencesJSXTagName3.ts +++ b/tests/cases/fourslash/findReferencesJSXTagName3.ts @@ -6,22 +6,21 @@ ////namespace JSX { //// export interface Element { } //// export interface IntrinsicElements { -//// [|{| "isDefinition": true |}div|]: any; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}div|]: any;|] //// } ////} //// -////const [|{| "isWriteAccess": true, "isDefinition": true |}Comp|] = () => +////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}Comp|] = () => //// <[|div|]> //// Some content //// <[|div|]>More content -//// ; +//// ;|] //// ////const x = <[|Comp|]> //// Content ////; -const ranges = test.ranges(); -const [d0, c0, d1, d2, d3, d4, c1, c2] = test.ranges(); +const [d0Def, d0, c0Def, c0, d1, d2, d3, d4, c1, c2] = test.ranges(); const allD = [d0, d1, d2, d3, d4]; const allC = [c0, c1, c2]; diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts index b1acb76ad2c..a50b2ca1149 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts @@ -1,5 +1,5 @@ /// -////var [|{| "isWriteAccess": true, "isDefinition": true |}f|] = x => x + 1; +////[|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}f|] = x => x + 1;|] ////[|f|](12); -verify.singleReferenceGroup("var f: (x: any) => any"); +verify.singleReferenceGroup("var f: (x: any) => any", test.rangesByText().get("f")); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfBindingPattern.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfBindingPattern.ts index 32fec74d162..44a7c70e001 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfBindingPattern.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfBindingPattern.ts @@ -1,8 +1,8 @@ /// -////const { [|{| "isWriteAccess": true, "isDefinition": true |}x|], y } = { [|{| "isWriteAccess": true, "isDefinition": true |}x|]: 1, y: 2 }; +////[|const { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|], y } = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}x|]: 1|], y: 2 };|] ////const z = [|x|]; -const [r0, r1, r2] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2] = test.ranges(); const local = { definition: "const x: number", ranges: [r0, r2] }; const prop = { definition: "(property) x: number", ranges: [r1] }; verify.referenceGroups(r0, [local, prop]); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts index 302ed5ce6f5..add271f14e4 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts @@ -1,10 +1,10 @@ /// -////class [|{| "isWriteAccess": true, "isDefinition": true |}C|] { +////[|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}C|] { //// n: number; //// constructor() { //// this.n = 12; //// } -////} +////}|] ////let c = new [|C|](); -verify.singleReferenceGroup("class C"); +verify.singleReferenceGroup("class C", test.rangesByText().get("C")); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts index 88ab38e5428..d67dfe74c95 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts @@ -1,6 +1,6 @@ /// -////let o = { ["[|{| "isWriteAccess": true, "isDefinition": true |}foo|]"]: 12 }; +////let o = { [|["[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|]"]: 12|] }; ////let y = o.[|foo|]; ////let z = o['[|foo|]']; -verify.singleReferenceGroup('(property) ["foo"]: number'); +verify.singleReferenceGroup('(property) ["foo"]: number', test.rangesByText().get("foo")); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts index 325674d8ee7..d1721c3b88b 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts @@ -1,8 +1,8 @@ /// -////enum [|{| "isWriteAccess": true, "isDefinition": true |}E|] { +////[|enum [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}E|] { //// First, //// Second -////} +////}|] ////let first = [|E|].First; -verify.singleReferenceGroup("enum E"); +verify.singleReferenceGroup("enum E", test.rangesByText().get("E")); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfExport.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfExport.ts index e31bc46eae6..1f0439b8d50 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfExport.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfExport.ts @@ -1,12 +1,12 @@ /// // @Filename: m.ts -////export var [|{| "isWriteAccess": true, "isDefinition": true |}x|] = 12; +////[|export var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] = 12;|] // @Filename: main.ts -////import { [|{| "isWriteAccess": true, "isDefinition": true |}x|] } from "./m"; +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}x|] } from "./m";|] ////const y = [|x|]; const ranges = test.ranges(); -const [r0, r1, r2] = ranges; +const [r0Def, r0, r1Def, r1, r2] = ranges; const defs = { definition: "var x: number", ranges: [r0] }; const imports = { definition: "(alias) var x: number\nimport x", ranges: [r1, r2] }; verify.referenceGroups(r0, [defs, imports]); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts index 4c91bc08ef8..71746119230 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts @@ -1,6 +1,6 @@ /// -////function [|{| "isWriteAccess": true, "isDefinition": true |}func|](x: number) { -////} +////[|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}func|](x: number) { +////}|] ////[|func|](x) -verify.singleReferenceGroup("function func(x: number): void"); +verify.singleReferenceGroup("function func(x: number): void", test.rangesByText().get("func")); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts index 826890c4da9..57c96da1e8b 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts @@ -1,7 +1,7 @@ /// -////interface [|{| "isWriteAccess": true, "isDefinition": true |}I|] { +////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}I|] { //// p: number; -////} +////}|] ////let i: [|I|] = { p: 12 }; -verify.singleReferenceGroup("interface I"); +verify.singleReferenceGroup("interface I", test.rangesByText().get("I")); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts index 0e363a216eb..2ec89979df4 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts @@ -1,16 +1,16 @@ /// -////interface [|{| "isWriteAccess": true, "isDefinition": true |}Numbers|] { +////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Numbers|] { //// p: number; -////} -////interface [|{| "isWriteAccess": true, "isDefinition": true |}Numbers|] { +////}|] +////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}Numbers|] { //// m: number; -////} -////class [|{| "isWriteAccess": true, "isDefinition": true |}Numbers|] { +////}|] +////[|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}Numbers|] { //// f(n: number) { //// return this.p + this.m + n; //// } -////} +////}|] ////let i: [|Numbers|] = new [|Numbers|](); ////let x = i.f(i.p + i.m); -verify.singleReferenceGroup("class Numbers\ninterface Numbers"); +verify.singleReferenceGroup("class Numbers\ninterface Numbers", test.rangesByText().get("Numbers")); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts index 04d00e6c19f..0fc07b3bb6b 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts @@ -1,7 +1,7 @@ /// -////namespace [|{| "isWriteAccess": true, "isDefinition": true |}Numbers|] { +////[|namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Numbers|] { //// export var n = 12; -////} +////}|] ////let x = [|Numbers|].n + 1; -verify.singleReferenceGroup("namespace Numbers"); +verify.singleReferenceGroup("namespace Numbers", test.rangesByText().get("Numbers")); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts index 33bdad09e1a..249d768bf11 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts @@ -1,5 +1,5 @@ /// -////let o = { [|{| "isWriteAccess": true, "isDefinition": true |}1|]: 12 }; +////let o = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}1|]: 12|] }; ////let y = o[[|1|]]; -verify.singleReferenceGroup("(property) 1: number"); +verify.singleReferenceGroup("(property) 1: number", test.rangesByText().get("1")); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts index 8afa67bfe64..b18fc51f8eb 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts @@ -1,6 +1,6 @@ /// -////function f([|{| "isWriteAccess": true, "isDefinition": true |}x|]: number) { +////function f([|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|]: number|]) { //// return [|x|] + 1 ////} -verify.singleReferenceGroup("(parameter) x: number"); +verify.singleReferenceGroup("(parameter) x: number", test.rangesByText().get("x")); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts index cf88d476fef..7ca03f00482 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts @@ -1,5 +1,5 @@ /// -////let o = { "[|{| "isWriteAccess": true, "isDefinition": true |}x|]": 12 }; +////let o = { [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|]": 12|] }; ////let y = o.[|x|]; -verify.singleReferenceGroup('(property) "x": number'); +verify.singleReferenceGroup('(property) "x": number', test.rangesByText().get("x")); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts index 18a4ec0396c..cf69914507b 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts @@ -1,5 +1,5 @@ /// -////type [|{| "isWriteAccess": true, "isDefinition": true |}Alias|]= number; +////[|type [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Alias|]= number;|] ////let n: [|Alias|] = 12; -verify.singleReferenceGroup("type Alias = number"); +verify.singleReferenceGroup("type Alias = number", test.rangesByText().get("Alias")); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts index 2faf5b53e1b..b3a3ab4cc17 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts @@ -1,5 +1,5 @@ /// -////var [|{| "isWriteAccess": true, "isDefinition": true |}x|] = 0; +////[|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] = 0;|] ////var assignmentRightHandSide = [|x|]; ////var assignmentRightHandSide2 = 1 + [|x|]; //// @@ -17,4 +17,4 @@ ////[|{| "isWriteAccess": true |}x|] += 1; ////[|{| "isWriteAccess": true |}x|] <<= 1; -verify.singleReferenceGroup("var x: number"); +verify.singleReferenceGroup("var x: number", test.rangesByText().get("x")); From 004488c0c923f3d1e6519621acaa4969b3e52c57 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 4 Jun 2019 15:21:31 -0700 Subject: [PATCH 229/384] Set declaration span only if its not same as own span --- src/services/findAllReferences.ts | 33 ++++++++----------- src/services/goToDefinition.ts | 11 +++---- tests/cases/fourslash/localGetReferences.ts | 2 +- .../renameDestructuringFunctionParameter.ts | 2 +- .../renameJsSpecialAssignmentRhs1.ts | 2 +- .../renameJsSpecialAssignmentRhs2.ts | 2 +- tests/cases/fourslash/renameThis.ts | 2 +- 7 files changed, 24 insertions(+), 30 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 8ef72440bcc..14e47b2c4d1 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -111,11 +111,6 @@ namespace ts.FindAllReferences { case SyntaxKind.ImportClause: return node.parent; - case SyntaxKind.JsxAttribute: - return (node as JsxAttribute).initializer === undefined ? - undefined : - node; - case SyntaxKind.BinaryExpression: return isExpressionStatement(node.parent) ? node.parent : @@ -129,7 +124,6 @@ namespace ts.FindAllReferences { }; case SyntaxKind.PropertyAssignment: - // TODO(shkamat):: Should we show whole object literal instead? case SyntaxKind.ShorthandPropertyAssignment: return isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent) ? getDeclarationForDeclarationSpan( @@ -137,15 +131,24 @@ namespace ts.FindAllReferences { isBinaryExpression(node) || isForInOrOfStatement(node) ) as BinaryExpression | ForInOrOfStatement ) : - node.kind === SyntaxKind.PropertyAssignment ? - node : - undefined; + node; default: return node; } } + export function setDeclarationSpan(span: DocumentSpan, sourceFile: SourceFile, declaration?: DeclarationNode) { + if (declaration) { + const declarationSpan = isDeclarationNodeWithStartAndEnd(declaration) ? + getTextSpan(declaration.start, sourceFile, declaration.end) : + getTextSpan(declaration, sourceFile); + if (declarationSpan.start !== span.textSpan.start || declarationSpan.length !== span.textSpan.length) { + span.declarationSpan = declarationSpan; + } + } + } + export interface Options { readonly findInStrings?: boolean; readonly findInComments?: boolean; @@ -287,11 +290,7 @@ namespace ts.FindAllReferences { textSpan: getTextSpan(isComputedPropertyName(node) ? node.expression : node, sourceFile), displayParts }; - if (declaration) { - result.declarationSpan = isDeclarationNodeWithStartAndEnd(declaration) ? - getTextSpan(declaration.start, sourceFile, declaration.end) : - getTextSpan(declaration, sourceFile); - } + setDeclarationSpan(result, sourceFile, declaration); return result; } @@ -330,11 +329,7 @@ namespace ts.FindAllReferences { else { const sourceFile = entry.node.getSourceFile(); const result: DocumentSpan = { textSpan: getTextSpan(entry.node, sourceFile), fileName: sourceFile.fileName }; - if (entry.declaration) { - result.declarationSpan = isDeclarationNodeWithStartAndEnd(entry.declaration) ? - getTextSpan(entry.declaration.start, sourceFile, entry.declaration.end) : - getTextSpan(entry.declaration, sourceFile); - } + setDeclarationSpan(result, sourceFile, entry.declaration); return result; } } diff --git a/src/services/goToDefinition.ts b/src/services/goToDefinition.ts index 05bd62e363f..4970ae573bf 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -281,12 +281,11 @@ namespace ts.GoToDefinition { containerKind: undefined!, // TODO: GH#18217 containerName, }; - const declarationNode = FindAllReferences.getDeclarationForDeclarationSpan(declaration); - if (declarationNode) { - result.declarationSpan = FindAllReferences.isDeclarationNodeWithStartAndEnd(declarationNode) ? - createTextSpanFromNode(declarationNode.start, sourceFile, declarationNode.end) : - createTextSpanFromNode(declarationNode, sourceFile); - } + FindAllReferences.setDeclarationSpan( + result, + sourceFile, + FindAllReferences.getDeclarationForDeclarationSpan(declaration) + ); return result; } diff --git a/tests/cases/fourslash/localGetReferences.ts b/tests/cases/fourslash/localGetReferences.ts index 401599368af..dd783693987 100644 --- a/tests/cases/fourslash/localGetReferences.ts +++ b/tests/cases/fourslash/localGetReferences.ts @@ -117,7 +117,7 @@ ////array.forEach( //// //// -////function([|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 43 |}str|]) { +////function([|{| "isWriteAccess": true, "isDefinition": true |}str|]) { //// //// //// diff --git a/tests/cases/fourslash/renameDestructuringFunctionParameter.ts b/tests/cases/fourslash/renameDestructuringFunctionParameter.ts index 79d2b40193b..80d82512ac5 100644 --- a/tests/cases/fourslash/renameDestructuringFunctionParameter.ts +++ b/tests/cases/fourslash/renameDestructuringFunctionParameter.ts @@ -1,6 +1,6 @@ /// -////function f([|{[|{| "declarationRangeIndex": 0 |}a|]}: {[|{| "declarationRangeIndex": 2 |}a|]}|]) { +////function f([|{[|{| "declarationRangeIndex": 0 |}a|]}: {[|a|]}|]) { //// f({[|a|]}); ////} diff --git a/tests/cases/fourslash/renameJsSpecialAssignmentRhs1.ts b/tests/cases/fourslash/renameJsSpecialAssignmentRhs1.ts index db3f1fc66e8..013cfe34cd5 100644 --- a/tests/cases/fourslash/renameJsSpecialAssignmentRhs1.ts +++ b/tests/cases/fourslash/renameJsSpecialAssignmentRhs1.ts @@ -5,7 +5,7 @@ //// set: function (x) { //// this._x = x; //// }, -//// copy: function ([|{| "declarationRangeIndex": 0 |}x|]) { +//// copy: function ([|x|]) { //// this._x = [|x|].prop; //// } ////}; diff --git a/tests/cases/fourslash/renameJsSpecialAssignmentRhs2.ts b/tests/cases/fourslash/renameJsSpecialAssignmentRhs2.ts index db3f1fc66e8..013cfe34cd5 100644 --- a/tests/cases/fourslash/renameJsSpecialAssignmentRhs2.ts +++ b/tests/cases/fourslash/renameJsSpecialAssignmentRhs2.ts @@ -5,7 +5,7 @@ //// set: function (x) { //// this._x = x; //// }, -//// copy: function ([|{| "declarationRangeIndex": 0 |}x|]) { +//// copy: function ([|x|]) { //// this._x = [|x|].prop; //// } ////}; diff --git a/tests/cases/fourslash/renameThis.ts b/tests/cases/fourslash/renameThis.ts index 7a209c0d6cc..82bfae820dc 100644 --- a/tests/cases/fourslash/renameThis.ts +++ b/tests/cases/fourslash/renameThis.ts @@ -1,6 +1,6 @@ /// -////function f([|{| "declarationRangeIndex": 0 |}this|]) { +////function f([|this|]) { //// return [|this|]; ////} ////this/**/; From c5578a2b4318d38f102956b00ae375ba9b05b616 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Tue, 4 Jun 2019 19:08:34 -0400 Subject: [PATCH 230/384] Update error message as requested by @danielrosenwasser --- src/compiler/diagnosticMessages.json | 2 +- src/compiler/program.ts | 2 +- src/testRunner/unittests/config/projectReferences.ts | 4 ++-- src/testRunner/unittests/tsbuild/resolveJsonModule.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index fd750094296..b209a878804 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3956,7 +3956,7 @@ "category": "Error", "code": 6306 }, - "File '{0}' is not in project '{1}' file list. Projects must list all files or use an 'include' pattern.": { + "File '{0}' is not listed within the file list of project '{1}'. Projects must list all files or use an 'include' pattern.": { "category": "Error", "code": 6307 }, diff --git a/src/compiler/program.ts b/src/compiler/program.ts index f6b379682ec..2b62da72d24 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2773,7 +2773,7 @@ namespace ts { // Ignore file that is not emitted if (!sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect)) continue; if (rootPaths.indexOf(file.path) === -1) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_in_project_1_file_list_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName, options.configFilePath || "")); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName, options.configFilePath || "")); } } } diff --git a/src/testRunner/unittests/config/projectReferences.ts b/src/testRunner/unittests/config/projectReferences.ts index 8a29760857b..709c2956e5a 100644 --- a/src/testRunner/unittests/config/projectReferences.ts +++ b/src/testRunner/unittests/config/projectReferences.ts @@ -194,7 +194,7 @@ namespace ts { testProjectReferences(spec, "/primary/tsconfig.json", program => { const errs = program.getOptionsDiagnostics(); - assertHasError("Reports an error about b.ts not being in the list", errs, Diagnostics.File_0_is_not_in_project_1_file_list_Projects_must_list_all_files_or_use_an_include_pattern); + assertHasError("Reports an error about b.ts not being in the list", errs, Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern); }); }); @@ -344,7 +344,7 @@ namespace ts { }; testProjectReferences(spec, "/alpha/tsconfig.json", (program) => { assertHasError("Issues an error about the rootDir", program.getOptionsDiagnostics(), Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files); - assertHasError("Issues an error about the fileList", program.getOptionsDiagnostics(), Diagnostics.File_0_is_not_in_project_1_file_list_Projects_must_list_all_files_or_use_an_include_pattern); + assertHasError("Issues an error about the fileList", program.getOptionsDiagnostics(), Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern); }); }); }); diff --git a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts index ef2b5a4a674..63f83a0ddb0 100644 --- a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts +++ b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts @@ -31,7 +31,7 @@ namespace ts { it("with resolveJsonModule and include only", () => { verifyProjectWithResolveJsonModule("/src/tsconfig_withInclude.json", [ - Diagnostics.File_0_is_not_in_project_1_file_list_Projects_must_list_all_files_or_use_an_include_pattern, + Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, "/src/src/hello.json", "/src/tsconfig_withInclude.json" ]); From 35c049949fbf5c1302db1549a3e14ac60d80bab0 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 5 Jun 2019 12:38:15 -0700 Subject: [PATCH 231/384] More tests --- .../fourslash/findAllRefsOnDecorators.ts | 6 ++-- .../fourslash/findAllRefsOnDefinition.ts | 6 ++-- .../fourslash/findAllRefsOnDefinition2.ts | 4 +-- .../fourslash/findAllRefsOnImportAliases.ts | 10 +++---- .../findAllRefsOnPrivateParameterProperty1.ts | 4 +-- ...indAllRefsParameterPropertyDeclaration1.ts | 4 +-- ...indAllRefsParameterPropertyDeclaration2.ts | 4 +-- ...indAllRefsParameterPropertyDeclaration3.ts | 4 +-- ...arameterPropertyDeclaration_inheritance.ts | 6 ++-- .../findAllRefsPrefixSuffixPreference.ts | 12 ++++---- ...sPropertyContextuallyTypedByTypeParam01.ts | 8 ++--- .../fourslash/findAllRefsReExportLocal.ts | 10 +++---- ...findAllRefsReExportRightNameWrongSymbol.ts | 12 ++++---- .../fourslash/findAllRefsReExportStar.ts | 6 ++-- .../fourslash/findAllRefsReExport_broken.ts | 4 +-- .../fourslash/findAllRefsReExport_broken2.ts | 4 +-- tests/cases/fourslash/findAllRefsReExports.ts | 29 +++++++++++++------ .../cases/fourslash/findAllRefsReExports2.ts | 6 ++-- ...efsRedeclaredPropertyInDerivedInterface.ts | 13 ++++----- .../findAllRefsRenameImportWithSameName.ts | 6 ++-- .../cases/fourslash/findAllRefsRootSymbols.ts | 8 ++--- .../cases/fourslash/findAllRefsThisKeyword.ts | 4 +-- tests/cases/fourslash/findAllRefsTypedef.ts | 6 ++-- .../findAllRefsTypedef_importType.ts | 4 +-- .../fourslash/findAllRefsTypeofImport.ts | 4 +-- 25 files changed, 97 insertions(+), 87 deletions(-) diff --git a/tests/cases/fourslash/findAllRefsOnDecorators.ts b/tests/cases/fourslash/findAllRefsOnDecorators.ts index 95bf1072014..aa8c0e0c9d2 100644 --- a/tests/cases/fourslash/findAllRefsOnDecorators.ts +++ b/tests/cases/fourslash/findAllRefsOnDecorators.ts @@ -1,9 +1,9 @@ /// // @Filename: a.ts -////function [|{| "isWriteAccess": true, "isDefinition": true |}decorator|](target) { +////[|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}decorator|](target) { //// return target; -////} +////}|] ////[|decorator|](); // @Filename: b.ts @@ -13,4 +13,4 @@ //// method() {} ////} -verify.singleReferenceGroup("function decorator(target: any): any"); +verify.singleReferenceGroup("function decorator(target: any): any", test.rangesByText().get("decorator")); diff --git a/tests/cases/fourslash/findAllRefsOnDefinition.ts b/tests/cases/fourslash/findAllRefsOnDefinition.ts index 91582b92884..da7640224e2 100644 --- a/tests/cases/fourslash/findAllRefsOnDefinition.ts +++ b/tests/cases/fourslash/findAllRefsOnDefinition.ts @@ -7,9 +7,9 @@ //// //// } //// -//// public [|{| "isWriteAccess": true, "isDefinition": true |}start|](){ +//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}start|](){ //// return this; -//// } +//// }|] //// //// public stop(){ //// return this; @@ -23,4 +23,4 @@ ////second.[|start|](); ////second.stop(); -verify.singleReferenceGroup("(method) Test.start(): this"); +verify.singleReferenceGroup("(method) Test.start(): this", test.rangesByText().get("start")); diff --git a/tests/cases/fourslash/findAllRefsOnDefinition2.ts b/tests/cases/fourslash/findAllRefsOnDefinition2.ts index 9a0fd390c1e..b300213150a 100644 --- a/tests/cases/fourslash/findAllRefsOnDefinition2.ts +++ b/tests/cases/fourslash/findAllRefsOnDefinition2.ts @@ -3,7 +3,7 @@ //@Filename: findAllRefsOnDefinition2-import.ts ////export module Test{ //// -//// export interface [|{| "isWriteAccess": true, "isDefinition": true |}start|] { } +//// [|export interface [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}start|] { }|] //// //// export interface stop { } ////} @@ -14,4 +14,4 @@ ////var start: Second.Test.[|start|]; ////var stop: Second.Test.stop; -verify.singleReferenceGroup("interface Test.start"); +verify.singleReferenceGroup("interface Test.start", test.rangesByText().get("start")); diff --git a/tests/cases/fourslash/findAllRefsOnImportAliases.ts b/tests/cases/fourslash/findAllRefsOnImportAliases.ts index 17f947ffdc3..88d9bfa3f3a 100644 --- a/tests/cases/fourslash/findAllRefsOnImportAliases.ts +++ b/tests/cases/fourslash/findAllRefsOnImportAliases.ts @@ -1,19 +1,19 @@ /// //@Filename: a.ts -////export class [|{| "isWriteAccess": true, "isDefinition": true |}Class|] { -////} +////[|export class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Class|] { +////}|] //@Filename: b.ts -////import { [|{| "isWriteAccess": true, "isDefinition": true |}Class|] } from "./a"; +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}Class|] } from "./a";|] //// ////var c = new [|Class|](); //@Filename: c.ts -////export { [|{| "isWriteAccess": true, "isDefinition": true |}Class|] } from "./a"; +////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}Class|] } from "./a";|] const ranges = test.ranges(); -const [r0, r1, r2, r3] = ranges; +const [r0Def, r0, r1Def, r1, r2, r3Def, r3] = ranges; const classes = { definition: "class Class", ranges: [r0] }; const imports = { definition: "(alias) class Class\nimport Class", ranges: [r1, r2] }; const reExports = { definition: "(alias) class Class\nexport Class", ranges: [r3] }; diff --git a/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts b/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts index df33f2888e6..d438a87717d 100644 --- a/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts +++ b/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts @@ -1,7 +1,7 @@ /// ////class ABCD { -//// constructor(private x: number, public y: number, private [|{| "isWriteAccess": true, "isDefinition": true |}z|]: number) { +//// constructor(private x: number, public y: number, [|private [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}z|]: number|]) { //// } //// //// func() { @@ -9,4 +9,4 @@ //// } ////} -verify.singleReferenceGroup("(property) ABCD.z: number"); +verify.singleReferenceGroup("(property) ABCD.z: number", test.rangesByText().get("z")); diff --git a/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration1.ts b/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration1.ts index 89bb40b6830..49812d2810f 100644 --- a/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration1.ts +++ b/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration1.ts @@ -1,13 +1,13 @@ /// //// class Foo { -//// constructor(private [|{| "isWriteAccess": true, "isDefinition": true |}privateParam|]: number) { +//// constructor([|private [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}privateParam|]: number|]) { //// let localPrivate = [|privateParam|]; //// this.[|{| "isWriteAccess": true |}privateParam|] += 10; //// } //// } -const ranges = test.ranges(); +const [rDef, ...ranges] = test.ranges(); const [r0, r1, r2] = ranges; verify.referenceGroups(ranges, [ { definition: "(property) Foo.privateParam: number", ranges: [r0, r2] }, diff --git a/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration2.ts b/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration2.ts index 519ca74c5c4..7ee352cfcde 100644 --- a/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration2.ts +++ b/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration2.ts @@ -1,13 +1,13 @@ /// //// class Foo { -//// constructor(public [|{| "isWriteAccess": true, "isDefinition": true |}publicParam|]: number) { +//// constructor([|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}publicParam|]: number|]) { //// let localPublic = [|publicParam|]; //// this.[|{| "isWriteAccess": true |}publicParam|] += 10; //// } //// } -const ranges = test.ranges(); +const [rDef, ...ranges] = test.ranges(); const [r0, r1, r2] = ranges; verify.referenceGroups(ranges, [ { definition: "(property) Foo.publicParam: number", ranges: [r0, r2] }, diff --git a/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration3.ts b/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration3.ts index 7addc2ba7a0..3d58989a0f3 100644 --- a/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration3.ts +++ b/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration3.ts @@ -1,13 +1,13 @@ /// //// class Foo { -//// constructor(protected [|{| "isWriteAccess": true, "isDefinition": true |}protectedParam|]: number) { +//// constructor([|protected [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}protectedParam|]: number|]) { //// let localProtected = [|protectedParam|]; //// this.[|{| "isWriteAccess": true |}protectedParam|] += 10; //// } //// } -const ranges = test.ranges(); +const [rDef, ...ranges] = test.ranges(); const [r0, r1, r2] = ranges; verify.referenceGroups(ranges, [ { definition: "(property) Foo.protectedParam: number", ranges: [r0, r2] }, diff --git a/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration_inheritance.ts b/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration_inheritance.ts index 9d7cfd51185..e8998dbbf70 100644 --- a/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration_inheritance.ts +++ b/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration_inheritance.ts @@ -1,17 +1,17 @@ /// ////class C { -//// constructor(public [|{| "isWriteAccess": true, "isDefinition": true |}x|]: string) { +//// constructor([|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|]: string|]) { //// [|x|]; //// } ////} ////class D extends C { -//// constructor(public [|{| "isWriteAccess": true, "isDefinition": true |}x|]: string) { +//// constructor([|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}x|]: string|]) { //// super([|x|]); //// } ////} -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1, r2Def, r2, r3] = test.ranges(); verify.referenceGroups(r0, [ { definition: "(property) C.x: string", ranges: [r0] }, { definition: "(parameter) x: string", ranges: [r1] }, diff --git a/tests/cases/fourslash/findAllRefsPrefixSuffixPreference.ts b/tests/cases/fourslash/findAllRefsPrefixSuffixPreference.ts index 3745eff4e5d..1d920552375 100644 --- a/tests/cases/fourslash/findAllRefsPrefixSuffixPreference.ts +++ b/tests/cases/fourslash/findAllRefsPrefixSuffixPreference.ts @@ -2,22 +2,22 @@ // @Filename: /file1.ts ////declare function log(s: string | number): void; -////const [|{| "isWriteAccess": true, "isDefinition": true |}q|] = 1; -////export { [|{| "isWriteAccess": true, "isDefinition": true |}q|] }; +////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}q|] = 1;|] +////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}q|] };|] ////const x = { -//// [|{| "isWriteAccess": true, "isDefinition": true |}z|]: 'value' +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}z|]: 'value'|] ////} -////const { [|{| "isWriteAccess": true, "isDefinition": true |}z|] } = x; +////[|const { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}z|] } = x;|] ////log([|z|]); // @Filename: /file2.ts ////declare function log(s: string | number): void; -////import { [|{| "isWriteAccess": true, "isDefinition": true |}q|] } from "./file1"; +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 9 |}q|] } from "./file1";|] ////log([|q|] + 1); verify.noErrors(); -const [q0, q1, z0, z1, z2, q2, q3] = test.ranges(); +const [q0Def, q0, q1Def, q1, z0Def, z0, z1Def, z1, z2, q2Def, q2, q3] = test.ranges(); const qFile1Ranges = [q0, q1]; const qFile2Ranges = [q2, q3]; const qFile1ReferenceGroup: FourSlashInterface.ReferenceGroup = { diff --git a/tests/cases/fourslash/findAllRefsPropertyContextuallyTypedByTypeParam01.ts b/tests/cases/fourslash/findAllRefsPropertyContextuallyTypedByTypeParam01.ts index d4aefb58ac3..8b8a82c169f 100644 --- a/tests/cases/fourslash/findAllRefsPropertyContextuallyTypedByTypeParam01.ts +++ b/tests/cases/fourslash/findAllRefsPropertyContextuallyTypedByTypeParam01.ts @@ -1,12 +1,12 @@ /// ////interface IFoo { -//// [|{| "isDefinition": true |}a|]: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}a|]: string;|] ////} ////class C { //// method() { //// var x: T = { -//// [|{| "isWriteAccess": true, "isDefinition": true |}a|]: "" +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}a|]: ""|] //// }; //// x.[|a|]; //// } @@ -14,7 +14,7 @@ //// //// ////var x: IFoo = { -//// [|{| "isWriteAccess": true, "isDefinition": true |}a|]: "ss" +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}a|]: "ss"|] ////}; -verify.singleReferenceGroup("(property) IFoo.a: string"); +verify.singleReferenceGroup("(property) IFoo.a: string", test.rangesByText().get("a")); diff --git a/tests/cases/fourslash/findAllRefsReExportLocal.ts b/tests/cases/fourslash/findAllRefsReExportLocal.ts index 502c7fdde46..e7601fd072b 100644 --- a/tests/cases/fourslash/findAllRefsReExportLocal.ts +++ b/tests/cases/fourslash/findAllRefsReExportLocal.ts @@ -3,17 +3,17 @@ // @noLib: true // @Filename: /a.ts -////var [|{| "isDefinition": true |}x|]; -////export { [|{| "isWriteAccess": true, "isDefinition": true |}x|] }; -////export { [|x|] as [|{| "isWriteAccess": true, "isDefinition": true |}y|] }; +////[|var [|{| "isDefinition": true, "declarationRangeIndex": 0 |}x|];|] +////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}x|] };|] +////[|export { [|{| "declarationRangeIndex": 4 |}x|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}y|] };|] // @Filename: /b.ts -////import { [|{| "isWriteAccess": true, "isDefinition": true |}x|], [|{| "isWriteAccess": true, "isDefinition": true |}y|] } from "./a"; +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 7 |}x|], [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 7 |}y|] } from "./a";|] ////[|x|]; [|y|]; verify.noErrors(); -const [ax0, ax1, ax2, ay, bx0, by0, bx1, by1] = test.ranges(); +const [ax0Def, ax0, ax1Def, ax1, ax2Def, ax2, ay, bx0Def, bx0, by0, bx1, by1] = test.ranges(); const axRanges = [ax0, ax1, ax2]; const bxRanges = [bx0, bx1]; const byRanges = [by0, by1]; diff --git a/tests/cases/fourslash/findAllRefsReExportRightNameWrongSymbol.ts b/tests/cases/fourslash/findAllRefsReExportRightNameWrongSymbol.ts index c44bdd2fffc..8649f8b3b3d 100644 --- a/tests/cases/fourslash/findAllRefsReExportRightNameWrongSymbol.ts +++ b/tests/cases/fourslash/findAllRefsReExportRightNameWrongSymbol.ts @@ -1,21 +1,21 @@ /// // @Filename: /a.ts -////export const [|{| "isWriteAccess": true, "isDefinition": true |}x|] = 0; +////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] = 0;|] // @Filename: /b.ts -////export const [|{| "isWriteAccess": true, "isDefinition": true |}x|] = 0; +////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}x|] = 0;|] //@Filename: /c.ts -////export { [|{| "isWriteAccess": true, "isDefinition": true |}x|] } from "./b"; -////import { [|{| "isWriteAccess": true, "isDefinition": true |}x|] } from "./a"; +////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}x|] } from "./b";|] +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}x|] } from "./a";|] ////[|x|]; // @Filename: /d.ts -////import { [|{| "isWriteAccess": true, "isDefinition": true |}x|] } from "./c"; +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 9 |}x|] } from "./c";|] verify.noErrors(); -const [a, b, cFromB, cFromA, cUse, d] = test.ranges(); +const [aDef, a, bDef, b, cFromBDef, cFromB, cFromADef, cFromA, cUse, dDef, d] = test.ranges(); const cFromARanges = [cFromA, cUse]; const aGroup = { definition: "const x: 0", ranges: [a] }; diff --git a/tests/cases/fourslash/findAllRefsReExportStar.ts b/tests/cases/fourslash/findAllRefsReExportStar.ts index a82f91cc5b0..759ef38cabe 100644 --- a/tests/cases/fourslash/findAllRefsReExportStar.ts +++ b/tests/cases/fourslash/findAllRefsReExportStar.ts @@ -1,17 +1,17 @@ /// // @Filename: /a.ts -////export function [|{| "isWriteAccess": true, "isDefinition": true |}foo|](): void {} +////[|export function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|](): void {}|] // @Filename: /b.ts ////export * from "./a"; // @Filename: /c.ts -////import { [|{| "isWriteAccess": true, "isDefinition": true |}foo|] } from "./b"; +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}foo|] } from "./b";|] verify.noErrors(); const ranges = test.ranges(); -const [r0, r1] = ranges; +const [r0Def, r0, r1Def, r1] = ranges; const a = { definition: "function foo(): void", ranges: [r0] }; const c = { definition: "(alias) function foo(): void\nimport foo", ranges: [r1] }; verify.referenceGroups(r0, [a, c]); diff --git a/tests/cases/fourslash/findAllRefsReExport_broken.ts b/tests/cases/fourslash/findAllRefsReExport_broken.ts index 92e4fcaa57c..3e57c60bdec 100644 --- a/tests/cases/fourslash/findAllRefsReExport_broken.ts +++ b/tests/cases/fourslash/findAllRefsReExport_broken.ts @@ -1,6 +1,6 @@ /// // @Filename: /a.ts -////export { [|{| "isWriteAccess": true, "isDefinition": true |}x|] }; +////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] };|] -verify.singleReferenceGroup("export x"); +verify.singleReferenceGroup("export x", test.rangesByText().get("x")); diff --git a/tests/cases/fourslash/findAllRefsReExport_broken2.ts b/tests/cases/fourslash/findAllRefsReExport_broken2.ts index 1a6649465fb..bb8291403f8 100644 --- a/tests/cases/fourslash/findAllRefsReExport_broken2.ts +++ b/tests/cases/fourslash/findAllRefsReExport_broken2.ts @@ -1,6 +1,6 @@ /// // @Filename: /a.ts -////export { [|{| "isWriteAccess": true, "isDefinition": true |}x|] } from "nonsense"; +////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] } from "nonsense";|] -verify.singleReferenceGroup("export x"); +verify.singleReferenceGroup("export x", test.rangesByText().get("x")); diff --git a/tests/cases/fourslash/findAllRefsReExports.ts b/tests/cases/fourslash/findAllRefsReExports.ts index 89e65d5bb37..69f2cff209c 100644 --- a/tests/cases/fourslash/findAllRefsReExports.ts +++ b/tests/cases/fourslash/findAllRefsReExports.ts @@ -1,26 +1,36 @@ /// // @Filename: /a.ts -////export function [|{| "isWriteAccess": true, "isDefinition": true |}foo|](): void {} +////[|export function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|](): void {}|] // @Filename: /b.ts -////export { [|foo|] as [|{| "isWriteAccess": true, "isDefinition": true |}bar|] } from "./a"; +////[|export { [|{| "declarationRangeIndex": 2 |}foo|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}bar|] } from "./a";|] // @Filename: /c.ts -////export { [|foo|] as [|{| "isWriteAccess": true, "isDefinition": true |}default|] } from "./a"; +////[|export { [|{| "declarationRangeIndex": 5 |}foo|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}default|] } from "./a";|] // @Filename: /d.ts -////export { [|{| "isWriteAccess": true, "isDefinition": true |}default|] } from "./c"; +////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 8 |}default|] } from "./c";|] // @Filename: /e.ts -////import { [|{| "isWriteAccess": true, "isDefinition": true |}bar|] } from "./b"; -////import [|{| "isWriteAccess": true, "isDefinition": true |}baz|] from "./c"; -////import { [|default|] as [|{| "isWriteAccess": true, "isDefinition": true |}bang|] } from "./c"; -////import [|{| "isWriteAccess": true, "isDefinition": true |}boom|] from "./d"; +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 10 |}bar|] } from "./b";|] +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 12 |}baz|] from "./c";|] +////[|import { [|{| "declarationRangeIndex": 14 |}default|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 14 |}bang|] } from "./c";|] +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 17 |}boom|] from "./d";|] ////[|bar|](); [|baz|](); [|bang|](); [|boom|](); verify.noErrors(); -const [foo0, foo1, bar0, foo2, defaultC, defaultD, bar1, baz0, defaultE, bang0, boom0, bar2, baz1, bang1, boom1] = test.ranges(); +const [ + foo0Def, foo0, + foo1Def, foo1, bar0, + foo2Def, foo2, defaultC, + defaultDDef, defaultD, + bar1Def, bar1, + baz0Def, baz0, + defaultEDef, defaultE, bang0, + boom0Def, boom0, + bar2, baz1, bang1, boom1 +] = test.ranges(); const a = { definition: "function foo(): void", ranges: [foo0, foo1, foo2] }; const b = { definition: "(alias) function bar(): void\nexport bar", ranges: [bar0] }; const c = { definition: "(alias) function foo(): void\nexport default", ranges: [defaultC, defaultE] }; @@ -43,6 +53,7 @@ verify.referenceGroups([bang0, bang1], [eBang]); verify.referenceGroups([boom0, boom1], [eBoom, d, a, b, eBar, c, eBaz, eBang]); test.rangesByText().forEach((ranges, text) => { + if (text.indexOf("export") === 0 || text.indexOf("import") === 0) return; switch (text) { case "default": for (const range of ranges) { diff --git a/tests/cases/fourslash/findAllRefsReExports2.ts b/tests/cases/fourslash/findAllRefsReExports2.ts index 31aa07fa29e..018bc6f6e08 100644 --- a/tests/cases/fourslash/findAllRefsReExports2.ts +++ b/tests/cases/fourslash/findAllRefsReExports2.ts @@ -1,13 +1,13 @@ /// // @Filename: /a.ts -////export function [|{| "isWriteAccess": true, "isDefinition": true |}foo|](): void {} +////[|export function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|](): void {}|] // @Filename: /b.ts -////import { [|foo|] as [|{| "isWriteAccess": true, "isDefinition": true |}oof|] } from "./a"; +////[|import { [|{| "declarationRangeIndex": 2 |}foo|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}oof|] } from "./a";|] verify.noErrors(); -const [r0, r1, r2] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2] = test.ranges(); verify.referenceGroups(r0, [ { definition: "function foo(): void", ranges: [r0, r1] }, { definition: "(alias) function oof(): void\nimport oof", ranges: [r2] } diff --git a/tests/cases/fourslash/findAllRefsRedeclaredPropertyInDerivedInterface.ts b/tests/cases/fourslash/findAllRefsRedeclaredPropertyInDerivedInterface.ts index dff05b219be..7afa3d2ef03 100644 --- a/tests/cases/fourslash/findAllRefsRedeclaredPropertyInDerivedInterface.ts +++ b/tests/cases/fourslash/findAllRefsRedeclaredPropertyInDerivedInterface.ts @@ -3,17 +3,16 @@ // @noLib: true ////interface A { -//// readonly [|{| "isDefinition": true |}x|]: number | string; +//// [|readonly [|{| "isDefinition": true, "declarationRangeIndex": 0 |}x|]: number | string;|] ////} ////interface B extends A { -//// readonly [|{| "isDefinition": true |}x|]: number; +//// [|readonly [|{| "isDefinition": true, "declarationRangeIndex": 2 |}x|]: number;|] ////} -////const a: A = { [|{| "isWriteAccess": true, "isDefinition": true |}x|]: 0 }; -////const b: B = { [|{| "isWriteAccess": true, "isDefinition": true |}x|]: 0 }; +////const a: A = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}x|]: 0|] }; +////const b: B = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}x|]: 0|] }; -const ranges = test.ranges(); -const [r0, r1, r2, r3] = ranges; -verify.referenceGroups(ranges, [ +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3] = test.ranges(); +verify.referenceGroups([r0, r1, r2, r3], [ { definition: "(property) A.x: string | number", ranges: [r0, r2] }, { definition: "(property) B.x: number", ranges: [r1, r3] }, ]); diff --git a/tests/cases/fourslash/findAllRefsRenameImportWithSameName.ts b/tests/cases/fourslash/findAllRefsRenameImportWithSameName.ts index 38c3aaf9398..b161c467d73 100644 --- a/tests/cases/fourslash/findAllRefsRenameImportWithSameName.ts +++ b/tests/cases/fourslash/findAllRefsRenameImportWithSameName.ts @@ -1,14 +1,14 @@ /// // @Filename: /a.ts -////export const [|{| "isWriteAccess": true, "isDefinition": true |}x|] = 0; +////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] = 0;|] //@Filename: /b.ts -////import { [|x|] as [|{| "isWriteAccess": true, "isDefinition": true |}x|] } from "./a"; +////[|import { [|{| "declarationRangeIndex": 2 |}x|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}x|] } from "./a";|] ////[|x|]; verify.noErrors(); -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2, r3] = test.ranges(); const aRanges = [r0, r1]; const bRanges = [r2, r3]; const aGroup = { definition: "const x: 0", ranges: aRanges }; diff --git a/tests/cases/fourslash/findAllRefsRootSymbols.ts b/tests/cases/fourslash/findAllRefsRootSymbols.ts index 18fbb8e212c..3718562cb7f 100644 --- a/tests/cases/fourslash/findAllRefsRootSymbols.ts +++ b/tests/cases/fourslash/findAllRefsRootSymbols.ts @@ -1,11 +1,11 @@ /// -////interface I { [|{| "isDefinition": true |}x|]: {}; } -////interface J { [|{| "isDefinition": true |}x|]: {}; } -////declare const o: (I | J) & { [|{| "isWriteAccess": true, "isDefinition": true |}x|]: string }; +////interface I { [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}x|]: {};|] } +////interface J { [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}x|]: {};|] } +////declare const o: (I | J) & { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}x|]: string|] }; ////o.[|x|]; -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3] = test.ranges(); const i = { definition: "(property) I.x: {}", ranges: [r0] }; const j = { definition: "(property) J.x: {}", ranges: [r1] }; const anon = { definition: "(property) x: string", ranges: [r2] }; diff --git a/tests/cases/fourslash/findAllRefsThisKeyword.ts b/tests/cases/fourslash/findAllRefsThisKeyword.ts index b0045e91bc1..25601011ad2 100644 --- a/tests/cases/fourslash/findAllRefsThisKeyword.ts +++ b/tests/cases/fourslash/findAllRefsThisKeyword.ts @@ -21,10 +21,10 @@ //// } ////} ////// These are *not* real uses of the 'this' keyword, they are identifiers. -////const x = { [|{| "isWriteAccess": true, "isDefinition": true |}this|]: 0 } +////const x = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 9 |}this|]: 0|] } ////x.[|this|]; -const [glob, f0, f1, g0, g1, x, y, constructor, method, propDef, propUse] = test.ranges(); +const [glob, f0, f1, g0, g1, x, y, constructor, method, propDefDef, propDef, propUse] = test.ranges(); verify.singleReferenceGroup("this: typeof globalThis", [glob]); verify.singleReferenceGroup("(parameter) this: any", [f0, f1]); verify.singleReferenceGroup("(parameter) this: any", [g0, g1]); diff --git a/tests/cases/fourslash/findAllRefsTypedef.ts b/tests/cases/fourslash/findAllRefsTypedef.ts index 2e7d8601656..3ca4e51cacd 100644 --- a/tests/cases/fourslash/findAllRefsTypedef.ts +++ b/tests/cases/fourslash/findAllRefsTypedef.ts @@ -5,11 +5,11 @@ // @Filename: /a.js /////** //// * @typedef I {Object} -//// * @prop [|{| "isDefinition": true |}p|] {number} -//// */ +//// * [|@prop [|{| "isDefinition": true, "declarationRangeIndex": 0 |}p|] {number} +//// |]*/ //// /////** @type {I} */ ////let x; ////x.[|p|]; -verify.singleReferenceGroup("(property) p: number"); +verify.singleReferenceGroup("(property) p: number", test.rangesByText().get("p")); diff --git a/tests/cases/fourslash/findAllRefsTypedef_importType.ts b/tests/cases/fourslash/findAllRefsTypedef_importType.ts index ddd0cb7c966..aad77aeb712 100644 --- a/tests/cases/fourslash/findAllRefsTypedef_importType.ts +++ b/tests/cases/fourslash/findAllRefsTypedef_importType.ts @@ -4,11 +4,11 @@ // @Filename: /a.js ////module.exports = 0; -/////** @typedef {number} [|{| "isWriteAccess": true, "isDefinition": true |}Foo|] */ +/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Foo|]|] */ ////const dummy = 0; // @Filename: /b.js /////** @type {import('./a').[|Foo|]} */ ////const x = 0; -verify.singleReferenceGroup("type Foo = number"); +verify.singleReferenceGroup("type Foo = number", test.rangesByText().get("Foo")); diff --git a/tests/cases/fourslash/findAllRefsTypeofImport.ts b/tests/cases/fourslash/findAllRefsTypeofImport.ts index 77bd2d51a8c..133d2275a31 100644 --- a/tests/cases/fourslash/findAllRefsTypeofImport.ts +++ b/tests/cases/fourslash/findAllRefsTypeofImport.ts @@ -1,8 +1,8 @@ /// // @Filename: /a.ts -////export const [|{| "isWriteAccess": true, "isDefinition": true |}x|] = 0; +////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] = 0;|] ////declare const a: typeof import("./a"); ////a.[|x|]; -verify.singleReferenceGroup("const x: 0"); +verify.singleReferenceGroup("const x: 0", test.rangesByText().get("x")); From edffcce785044047b49669746c285f41958ff2a4 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 5 Jun 2019 13:45:03 -0700 Subject: [PATCH 232/384] Take optional texts to verify parameter for rangesWithSameTextAreRenameLocations --- src/harness/fourslash.ts | 13 +++++++--- .../fourslash/findAllRefsOnImportAliases2.ts | 8 +++--- tests/cases/fourslash/fourslash.ts | 2 +- tests/cases/fourslash/javaScriptClass2.ts | 2 +- tests/cases/fourslash/jsxSpreadReference.ts | 3 +-- .../fourslash/renameAcrossMultipleProjects.ts | 3 +-- tests/cases/fourslash/renameAlias.ts | 3 +-- tests/cases/fourslash/renameAlias2.ts | 3 +-- tests/cases/fourslash/renameAlias3.ts | 3 +-- .../fourslash/renameAliasExternalModule.ts | 3 +-- .../fourslash/renameAliasExternalModule3.ts | 3 +-- .../fourslash/renameCommentsAndStrings1.ts | 3 +-- .../renameContextuallyTypedProperties.ts | 2 +- .../renameContextuallyTypedProperties2.ts | 2 +- .../renameDestructuringAssignment.ts | 2 +- .../fourslash/renameImportOfExportEquals2.ts | 5 +--- .../fourslash/renameInheritedProperties1.ts | 3 +-- .../fourslash/renameInheritedProperties2.ts | 3 +-- .../fourslash/renameInheritedProperties3.ts | 3 +-- .../fourslash/renameInheritedProperties4.ts | 3 +-- .../fourslash/renameInheritedProperties5.ts | 3 +-- .../fourslash/renameInheritedProperties6.ts | 3 +-- .../fourslash/renameInheritedProperties7.ts | 3 +-- .../fourslash/renameInheritedProperties8.ts | 2 +- .../fourslash/renameJsPropertyAssignment.ts | 3 +-- .../fourslash/renameJsPropertyAssignment2.ts | 3 +-- .../fourslash/renameJsPropertyAssignment3.ts | 3 +-- .../fourslash/renameJsPrototypeProperty01.ts | 3 +-- .../fourslash/renameJsPrototypeProperty02.ts | 3 +-- .../cases/fourslash/renameJsThisProperty01.ts | 3 +-- .../cases/fourslash/renameJsThisProperty03.ts | 3 +-- .../cases/fourslash/renameJsThisProperty05.ts | 3 +-- .../cases/fourslash/renameJsThisProperty06.ts | 3 +-- .../renameLocationsForClassExpression01.ts | 3 +-- .../renameLocationsForFunctionExpression01.ts | 3 +-- .../renameLocationsForFunctionExpression02.ts | 3 +-- ...enameObjectBindingElementPropertyName01.ts | 2 +- .../renameParameterPropertyDeclaration1.ts | 3 +-- .../renameParameterPropertyDeclaration2.ts | 3 +-- .../renameParameterPropertyDeclaration3.ts | 3 +-- .../renameParameterPropertyDeclaration5.ts | 3 +-- ...ePropertyAccessExpressionHeritageClause.ts | 3 +-- tests/cases/fourslash/renameRest.ts | 4 +-- .../fourslash/renameStringPropertyNames.ts | 3 +-- .../cases/fourslash/renameUMDModuleAlias1.ts | 3 +-- tests/cases/fourslash/tsxRename1.ts | 3 +-- tests/cases/fourslash/tsxRename2.ts | 3 +-- tests/cases/fourslash/tsxRename3.ts | 3 +-- tests/cases/fourslash/tsxRename4.ts | 5 +--- tests/cases/fourslash/tsxRename5.ts | 3 +-- tests/cases/fourslash/tsxRename6.ts | 4 +-- tests/cases/fourslash/tsxRename7.ts | 3 +-- tests/cases/fourslash/tsxRename9.ts | 26 +++++-------------- 53 files changed, 70 insertions(+), 126 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 5610eaf1510..ace3df96daa 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -2720,8 +2720,13 @@ Actual: ${stringify(fullActual)}`); } } - public verifyRangesWithSameTextAreRenameLocations() { - this.rangesByText().forEach(ranges => this.verifyRangesAreRenameLocations(ranges)); + public verifyRangesWithSameTextAreRenameLocations(...texts: string[]) { + if (texts.length) { + texts.forEach(text => this.verifyRangesAreRenameLocations(this.rangesByText().get(text)!)); + } + else { + this.rangesByText().forEach(ranges => this.verifyRangesAreRenameLocations(ranges)); + } } public verifyRangesWithSameTextAreDocumentHighlights() { @@ -4088,8 +4093,8 @@ namespace FourSlashInterface { this.state.verifyRangesAreOccurrences(isWriteAccess, ranges); } - public rangesWithSameTextAreRenameLocations() { - this.state.verifyRangesWithSameTextAreRenameLocations(); + public rangesWithSameTextAreRenameLocations(...texts: string[]) { + this.state.verifyRangesWithSameTextAreRenameLocations(...texts); } public rangesAreRenameLocations(options?: FourSlash.Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges?: FourSlash.Range[] }) { diff --git a/tests/cases/fourslash/findAllRefsOnImportAliases2.ts b/tests/cases/fourslash/findAllRefsOnImportAliases2.ts index 7be887c6af2..6faccc01dc9 100644 --- a/tests/cases/fourslash/findAllRefsOnImportAliases2.ts +++ b/tests/cases/fourslash/findAllRefsOnImportAliases2.ts @@ -1,14 +1,14 @@ /// //@Filename: a.ts -////export class [|{| "isWriteAccess": true, "isDefinition": true |}Class|] {} +////[|export class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Class|] {}|] //@Filename: b.ts -////import { [|Class|] as [|{| "isWriteAccess": true, "isDefinition": true |}C2|] } from "./a"; +////[|import { [|{| "declarationRangeIndex": 2 |}Class|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}C2|] } from "./a";|] ////var c = new [|C2|](); //@Filename: c.ts -////export { [|Class|] as [|{| "isWriteAccess": true, "isDefinition": true |}C3|] } from "./a"; +////[|export { [|{| "declarationRangeIndex": 6 |}Class|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}C3|] } from "./a";|] const ranges = test.rangesByText(); const classRanges = ranges.get("Class"); @@ -26,4 +26,4 @@ verify.referenceGroups(c2Ranges, [c2s]) verify.referenceGroups(c3Ranges, [c3s]); -verify.rangesWithSameTextAreRenameLocations(); +verify.rangesWithSameTextAreRenameLocations("Class", "C2", "C3"); diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index b01f8842dee..249d6d909c1 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -229,7 +229,7 @@ declare namespace FourSlashInterface { referenceGroups(starts: ArrayOrSingle | ArrayOrSingle, parts: ReadonlyArray): void; singleReferenceGroup(definition: ReferencesDefinition, ranges?: Range[]): void; rangesAreOccurrences(isWriteAccess?: boolean, ranges?: Range[]): void; - rangesWithSameTextAreRenameLocations(): void; + rangesWithSameTextAreRenameLocations(...texts: string[]): void; rangesAreRenameLocations(options?: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges?: Range[] }); findReferencesDefinitionDisplayPartsAtCaretAre(expected: ts.SymbolDisplayPart[]): void; noSignatureHelp(...markers: string[]): void; diff --git a/tests/cases/fourslash/javaScriptClass2.ts b/tests/cases/fourslash/javaScriptClass2.ts index 130976dfe57..d13a7727214 100644 --- a/tests/cases/fourslash/javaScriptClass2.ts +++ b/tests/cases/fourslash/javaScriptClass2.ts @@ -14,4 +14,4 @@ //// var x = new Foo(); //// x.[|union|]; -verify.rangesAreRenameLocations(test.rangesByText().get("union")); +verify.rangesWithSameTextAreRenameLocations("union"); diff --git a/tests/cases/fourslash/jsxSpreadReference.ts b/tests/cases/fourslash/jsxSpreadReference.ts index 3b8b9e9425a..310b5cbadb4 100644 --- a/tests/cases/fourslash/jsxSpreadReference.ts +++ b/tests/cases/fourslash/jsxSpreadReference.ts @@ -18,5 +18,4 @@ //// var x = ; verify.goToDefinition("src", "dst"); -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("nn"); diff --git a/tests/cases/fourslash/renameAcrossMultipleProjects.ts b/tests/cases/fourslash/renameAcrossMultipleProjects.ts index 272fe2bb393..adad26a957a 100644 --- a/tests/cases/fourslash/renameAcrossMultipleProjects.ts +++ b/tests/cases/fourslash/renameAcrossMultipleProjects.ts @@ -11,5 +11,4 @@ /////// ////[|x|]++; -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("x"); diff --git a/tests/cases/fourslash/renameAlias.ts b/tests/cases/fourslash/renameAlias.ts index 18b9ff47010..58dfc4c460e 100644 --- a/tests/cases/fourslash/renameAlias.ts +++ b/tests/cases/fourslash/renameAlias.ts @@ -4,5 +4,4 @@ ////[|import [|{| "declarationRangeIndex": 0 |}M|] = SomeModule;|] ////import C = [|M|].SomeClass; -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("M"); diff --git a/tests/cases/fourslash/renameAlias2.ts b/tests/cases/fourslash/renameAlias2.ts index 4559976af80..25540f45304 100644 --- a/tests/cases/fourslash/renameAlias2.ts +++ b/tests/cases/fourslash/renameAlias2.ts @@ -4,5 +4,4 @@ ////import M = [|SomeModule|]; ////import C = M.SomeClass; -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); \ No newline at end of file +verify.rangesWithSameTextAreRenameLocations("SomeModule"); \ No newline at end of file diff --git a/tests/cases/fourslash/renameAlias3.ts b/tests/cases/fourslash/renameAlias3.ts index 70e3446dbe0..d20b58c75e8 100644 --- a/tests/cases/fourslash/renameAlias3.ts +++ b/tests/cases/fourslash/renameAlias3.ts @@ -4,5 +4,4 @@ ////import M = SomeModule; ////import C = M.[|SomeClass|]; -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("SomeClass"); diff --git a/tests/cases/fourslash/renameAliasExternalModule.ts b/tests/cases/fourslash/renameAliasExternalModule.ts index 8d753febc2b..71bce0dd282 100644 --- a/tests/cases/fourslash/renameAliasExternalModule.ts +++ b/tests/cases/fourslash/renameAliasExternalModule.ts @@ -8,5 +8,4 @@ ////[|import [|{| "declarationRangeIndex": 0 |}M|] = require("./a");|] ////import C = [|M|].SomeClass; -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("M"); diff --git a/tests/cases/fourslash/renameAliasExternalModule3.ts b/tests/cases/fourslash/renameAliasExternalModule3.ts index 6966b94b8a6..1d2df353a3f 100644 --- a/tests/cases/fourslash/renameAliasExternalModule3.ts +++ b/tests/cases/fourslash/renameAliasExternalModule3.ts @@ -8,5 +8,4 @@ ////import M = require("./a"); ////import C = M.[|SomeClass|]; -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("SomeClass"); diff --git a/tests/cases/fourslash/renameCommentsAndStrings1.ts b/tests/cases/fourslash/renameCommentsAndStrings1.ts index 7d3f5890b7d..cef7088b09c 100644 --- a/tests/cases/fourslash/renameCommentsAndStrings1.ts +++ b/tests/cases/fourslash/renameCommentsAndStrings1.ts @@ -7,5 +7,4 @@ //// "this is a reference to Bar in a string" ////}|] -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("Bar"); diff --git a/tests/cases/fourslash/renameContextuallyTypedProperties.ts b/tests/cases/fourslash/renameContextuallyTypedProperties.ts index 118c53be2b7..4b5b03dbe94 100644 --- a/tests/cases/fourslash/renameContextuallyTypedProperties.ts +++ b/tests/cases/fourslash/renameContextuallyTypedProperties.ts @@ -55,4 +55,4 @@ //// set ["prop2"](v) { } ////}; -verify.rangesAreRenameLocations(test.rangesByText().get("prop1")); +verify.rangesWithSameTextAreRenameLocations("prop1"); diff --git a/tests/cases/fourslash/renameContextuallyTypedProperties2.ts b/tests/cases/fourslash/renameContextuallyTypedProperties2.ts index 5439a2215d2..44bc668fd25 100644 --- a/tests/cases/fourslash/renameContextuallyTypedProperties2.ts +++ b/tests/cases/fourslash/renameContextuallyTypedProperties2.ts @@ -55,4 +55,4 @@ //// [|set ["[|{| "declarationRangeIndex": 20 |}prop2|]"](v) { }|] ////}; -verify.rangesAreRenameLocations(test.rangesByText().get("prop2")); +verify.rangesWithSameTextAreRenameLocations("prop2"); diff --git a/tests/cases/fourslash/renameDestructuringAssignment.ts b/tests/cases/fourslash/renameDestructuringAssignment.ts index 7833f4166a2..cc4a9eb6fe1 100644 --- a/tests/cases/fourslash/renameDestructuringAssignment.ts +++ b/tests/cases/fourslash/renameDestructuringAssignment.ts @@ -7,4 +7,4 @@ ////var x; ////([|{ [|{| "declarationRangeIndex": 2 |}x|]: x } = a|]); -verify.rangesAreRenameLocations(test.rangesByText().get("x")); +verify.rangesWithSameTextAreRenameLocations("x"); diff --git a/tests/cases/fourslash/renameImportOfExportEquals2.ts b/tests/cases/fourslash/renameImportOfExportEquals2.ts index 67cb06b761b..df915f45fb7 100644 --- a/tests/cases/fourslash/renameImportOfExportEquals2.ts +++ b/tests/cases/fourslash/renameImportOfExportEquals2.ts @@ -33,7 +33,4 @@ verify.referenceGroups(oRanges, [os, ps, qs]); verify.referenceGroups(pRanges, [ps, qs]); verify.referenceGroups(qRanges, [qs]); -verify.rangesAreRenameLocations(nRanges); -verify.rangesAreRenameLocations(oRanges); -verify.rangesAreRenameLocations(pRanges); -verify.rangesAreRenameLocations(qRanges); +verify.rangesWithSameTextAreRenameLocations("N", "O", "P", "Q"); \ No newline at end of file diff --git a/tests/cases/fourslash/renameInheritedProperties1.ts b/tests/cases/fourslash/renameInheritedProperties1.ts index 2cd8ec23781..784d77cb609 100644 --- a/tests/cases/fourslash/renameInheritedProperties1.ts +++ b/tests/cases/fourslash/renameInheritedProperties1.ts @@ -7,5 +7,4 @@ //// var v: class1; //// v.[|propName|]; -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("propName"); diff --git a/tests/cases/fourslash/renameInheritedProperties2.ts b/tests/cases/fourslash/renameInheritedProperties2.ts index de6c6e14d15..632ff0b30ca 100644 --- a/tests/cases/fourslash/renameInheritedProperties2.ts +++ b/tests/cases/fourslash/renameInheritedProperties2.ts @@ -7,5 +7,4 @@ //// var v: class1; //// v.[|doStuff|](); -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("doStuff"); diff --git a/tests/cases/fourslash/renameInheritedProperties3.ts b/tests/cases/fourslash/renameInheritedProperties3.ts index 9d8e9b65476..511bf8e0a01 100644 --- a/tests/cases/fourslash/renameInheritedProperties3.ts +++ b/tests/cases/fourslash/renameInheritedProperties3.ts @@ -7,5 +7,4 @@ //// var v: interface1; //// v.[|propName|]; -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("propName"); diff --git a/tests/cases/fourslash/renameInheritedProperties4.ts b/tests/cases/fourslash/renameInheritedProperties4.ts index 1fe0bc9de7b..e3ac0da7e63 100644 --- a/tests/cases/fourslash/renameInheritedProperties4.ts +++ b/tests/cases/fourslash/renameInheritedProperties4.ts @@ -7,5 +7,4 @@ //// var v: interface1; //// v.[|doStuff|](); -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("doStuff"); diff --git a/tests/cases/fourslash/renameInheritedProperties5.ts b/tests/cases/fourslash/renameInheritedProperties5.ts index 352201999a4..2c6340eaab2 100644 --- a/tests/cases/fourslash/renameInheritedProperties5.ts +++ b/tests/cases/fourslash/renameInheritedProperties5.ts @@ -9,6 +9,5 @@ //// var d: D; //// d.[|propD|]; -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("propD"); diff --git a/tests/cases/fourslash/renameInheritedProperties6.ts b/tests/cases/fourslash/renameInheritedProperties6.ts index 5f997f3c664..a07587bb9ff 100644 --- a/tests/cases/fourslash/renameInheritedProperties6.ts +++ b/tests/cases/fourslash/renameInheritedProperties6.ts @@ -9,5 +9,4 @@ //// var d: D; //// d.[|propC|]; -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("propC"); diff --git a/tests/cases/fourslash/renameInheritedProperties7.ts b/tests/cases/fourslash/renameInheritedProperties7.ts index 94becfd2e5b..38d36a5416c 100644 --- a/tests/cases/fourslash/renameInheritedProperties7.ts +++ b/tests/cases/fourslash/renameInheritedProperties7.ts @@ -11,5 +11,4 @@ //// var c: C; //// c.[|prop1|]; -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("prop1"); diff --git a/tests/cases/fourslash/renameInheritedProperties8.ts b/tests/cases/fourslash/renameInheritedProperties8.ts index f27ded79dae..4762178aacf 100644 --- a/tests/cases/fourslash/renameInheritedProperties8.ts +++ b/tests/cases/fourslash/renameInheritedProperties8.ts @@ -11,4 +11,4 @@ //// var c: C; //// c.[|prop1|]; -verify.rangesAreRenameLocations(test.rangesByText().get("prop1")); +verify.rangesWithSameTextAreRenameLocations("prop1"); diff --git a/tests/cases/fourslash/renameJsPropertyAssignment.ts b/tests/cases/fourslash/renameJsPropertyAssignment.ts index a764bc18fd9..75b1a486255 100644 --- a/tests/cases/fourslash/renameJsPropertyAssignment.ts +++ b/tests/cases/fourslash/renameJsPropertyAssignment.ts @@ -7,5 +7,4 @@ ////[|bar.[|{| "declarationRangeIndex": 0 |}foo|] = "foo";|] ////console.log(bar.[|foo|]); -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("foo"); diff --git a/tests/cases/fourslash/renameJsPropertyAssignment2.ts b/tests/cases/fourslash/renameJsPropertyAssignment2.ts index dbd1749b3ed..0539fcf87d6 100644 --- a/tests/cases/fourslash/renameJsPropertyAssignment2.ts +++ b/tests/cases/fourslash/renameJsPropertyAssignment2.ts @@ -7,5 +7,4 @@ ////[|Minimatch.[|{| "declarationRangeIndex": 0 |}staticProperty|] = "string";|] ////console.log(Minimatch.[|staticProperty|]); -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("staticProperty"); diff --git a/tests/cases/fourslash/renameJsPropertyAssignment3.ts b/tests/cases/fourslash/renameJsPropertyAssignment3.ts index 462fbd06c8c..acd44682b41 100644 --- a/tests/cases/fourslash/renameJsPropertyAssignment3.ts +++ b/tests/cases/fourslash/renameJsPropertyAssignment3.ts @@ -7,5 +7,4 @@ ////[|C.[|{| "declarationRangeIndex": 0 |}staticProperty|] = "string";|] ////console.log(C.[|staticProperty|]); -const [rDef, ...ranges] = test.ranges(); -verify.rangesAreRenameLocations(ranges); +verify.rangesWithSameTextAreRenameLocations("staticProperty"); diff --git a/tests/cases/fourslash/renameJsPrototypeProperty01.ts b/tests/cases/fourslash/renameJsPrototypeProperty01.ts index b171ccdf005..519c161e727 100644 --- a/tests/cases/fourslash/renameJsPrototypeProperty01.ts +++ b/tests/cases/fourslash/renameJsPrototypeProperty01.ts @@ -8,5 +8,4 @@ ////var t = new bar(); ////[|t.[|{| "declarationRangeIndex": 2 |}x|] = 11;|] -const [r0Def, r0, r1Def, r1] = test.ranges(); -verify.rangesAreRenameLocations([r0, r1]); +verify.rangesWithSameTextAreRenameLocations("x"); diff --git a/tests/cases/fourslash/renameJsPrototypeProperty02.ts b/tests/cases/fourslash/renameJsPrototypeProperty02.ts index b171ccdf005..519c161e727 100644 --- a/tests/cases/fourslash/renameJsPrototypeProperty02.ts +++ b/tests/cases/fourslash/renameJsPrototypeProperty02.ts @@ -8,5 +8,4 @@ ////var t = new bar(); ////[|t.[|{| "declarationRangeIndex": 2 |}x|] = 11;|] -const [r0Def, r0, r1Def, r1] = test.ranges(); -verify.rangesAreRenameLocations([r0, r1]); +verify.rangesWithSameTextAreRenameLocations("x"); diff --git a/tests/cases/fourslash/renameJsThisProperty01.ts b/tests/cases/fourslash/renameJsThisProperty01.ts index 7cd55020e20..d08e11455bc 100644 --- a/tests/cases/fourslash/renameJsThisProperty01.ts +++ b/tests/cases/fourslash/renameJsThisProperty01.ts @@ -8,5 +8,4 @@ ////var t = new bar(); ////[|t.[|{| "declarationRangeIndex": 2 |}x|] = 11;|] -const [r0Def, r0, r1Def, r1] = test.ranges(); -verify.rangesAreRenameLocations([r0, r1]); +verify.rangesWithSameTextAreRenameLocations("x"); diff --git a/tests/cases/fourslash/renameJsThisProperty03.ts b/tests/cases/fourslash/renameJsThisProperty03.ts index da5fc01e57a..14150674e91 100644 --- a/tests/cases/fourslash/renameJsThisProperty03.ts +++ b/tests/cases/fourslash/renameJsThisProperty03.ts @@ -10,5 +10,4 @@ ////var t = new C(12); ////[|t.[|{| "declarationRangeIndex": 2 |}x|] = 11;|] -const [rDef, r0, r1Def, r1] = test.ranges(); -verify.rangesAreRenameLocations([r0, r1]); +verify.rangesWithSameTextAreRenameLocations("x"); diff --git a/tests/cases/fourslash/renameJsThisProperty05.ts b/tests/cases/fourslash/renameJsThisProperty05.ts index 95a514e0abc..1277df32288 100644 --- a/tests/cases/fourslash/renameJsThisProperty05.ts +++ b/tests/cases/fourslash/renameJsThisProperty05.ts @@ -11,5 +11,4 @@ ////var t = new C(12); ////[|t.[|{| "declarationRangeIndex": 2 |}z|] = 11;|] -const [r0Def, r0, r1Def, r1] = test.ranges(); -verify.rangesAreRenameLocations([r0, r1]); +verify.rangesWithSameTextAreRenameLocations("z"); diff --git a/tests/cases/fourslash/renameJsThisProperty06.ts b/tests/cases/fourslash/renameJsThisProperty06.ts index e7ae3256139..ab773cc2764 100644 --- a/tests/cases/fourslash/renameJsThisProperty06.ts +++ b/tests/cases/fourslash/renameJsThisProperty06.ts @@ -11,5 +11,4 @@ ////var t = new C(12); ////[|t.[|{| "declarationRangeIndex": 2 |}z|] = 11;|] -const [r0Def, r0, r1Def, r1] = test.ranges(); -verify.rangesAreRenameLocations([r0, r1]); +verify.rangesWithSameTextAreRenameLocations("z"); diff --git a/tests/cases/fourslash/renameLocationsForClassExpression01.ts b/tests/cases/fourslash/renameLocationsForClassExpression01.ts index 6379306608e..b6bdb7eccb0 100644 --- a/tests/cases/fourslash/renameLocationsForClassExpression01.ts +++ b/tests/cases/fourslash/renameLocationsForClassExpression01.ts @@ -20,5 +20,4 @@ ////} ////var z = class Foo {} -const [rDef, ...rest] = test.ranges(); -verify.rangesAreRenameLocations(rest); +verify.rangesWithSameTextAreRenameLocations("Foo"); diff --git a/tests/cases/fourslash/renameLocationsForFunctionExpression01.ts b/tests/cases/fourslash/renameLocationsForFunctionExpression01.ts index e32a080683a..f0ff6ee222d 100644 --- a/tests/cases/fourslash/renameLocationsForFunctionExpression01.ts +++ b/tests/cases/fourslash/renameLocationsForFunctionExpression01.ts @@ -4,5 +4,4 @@ //// [|f|]([|f|], g); ////}|] -const [rDef, ...rest] = test.ranges(); -verify.rangesAreRenameLocations(rest); +verify.rangesWithSameTextAreRenameLocations("f"); diff --git a/tests/cases/fourslash/renameLocationsForFunctionExpression02.ts b/tests/cases/fourslash/renameLocationsForFunctionExpression02.ts index ab835b5305c..0eb34d2baf9 100644 --- a/tests/cases/fourslash/renameLocationsForFunctionExpression02.ts +++ b/tests/cases/fourslash/renameLocationsForFunctionExpression02.ts @@ -10,5 +10,4 @@ //// let foo = () => [|f|]([|f|], g); ////}|] -const [rDef, ...rest] = test.ranges(); -verify.rangesAreRenameLocations(rest); +verify.rangesWithSameTextAreRenameLocations("f"); diff --git a/tests/cases/fourslash/renameObjectBindingElementPropertyName01.ts b/tests/cases/fourslash/renameObjectBindingElementPropertyName01.ts index 526838995c3..b9f733e3bf5 100644 --- a/tests/cases/fourslash/renameObjectBindingElementPropertyName01.ts +++ b/tests/cases/fourslash/renameObjectBindingElementPropertyName01.ts @@ -9,4 +9,4 @@ ////[|var { [|{| "declarationRangeIndex": 2 |}property1|]: prop1 } = foo;|] -verify.rangesAreRenameLocations(test.rangesByText().get("property1")); +verify.rangesWithSameTextAreRenameLocations("property1"); diff --git a/tests/cases/fourslash/renameParameterPropertyDeclaration1.ts b/tests/cases/fourslash/renameParameterPropertyDeclaration1.ts index 90939afbaa0..c3dfb37ca6f 100644 --- a/tests/cases/fourslash/renameParameterPropertyDeclaration1.ts +++ b/tests/cases/fourslash/renameParameterPropertyDeclaration1.ts @@ -7,5 +7,4 @@ //// } //// } -const [rDef, ...rest] = test.ranges(); -verify.rangesAreRenameLocations(rest); +verify.rangesWithSameTextAreRenameLocations("privateParam"); diff --git a/tests/cases/fourslash/renameParameterPropertyDeclaration2.ts b/tests/cases/fourslash/renameParameterPropertyDeclaration2.ts index a131106e4bf..a4e8acc3074 100644 --- a/tests/cases/fourslash/renameParameterPropertyDeclaration2.ts +++ b/tests/cases/fourslash/renameParameterPropertyDeclaration2.ts @@ -7,5 +7,4 @@ //// } //// } -const [rDef, ...rest] = test.ranges(); -verify.rangesAreRenameLocations(rest); +verify.rangesWithSameTextAreRenameLocations("publicParam"); diff --git a/tests/cases/fourslash/renameParameterPropertyDeclaration3.ts b/tests/cases/fourslash/renameParameterPropertyDeclaration3.ts index 73ab9b40c51..3d8b5510c98 100644 --- a/tests/cases/fourslash/renameParameterPropertyDeclaration3.ts +++ b/tests/cases/fourslash/renameParameterPropertyDeclaration3.ts @@ -7,5 +7,4 @@ //// } //// } -const [rDef, ...rest] = test.ranges(); -verify.rangesAreRenameLocations(rest); +verify.rangesWithSameTextAreRenameLocations("protectedParam"); diff --git a/tests/cases/fourslash/renameParameterPropertyDeclaration5.ts b/tests/cases/fourslash/renameParameterPropertyDeclaration5.ts index f92fd53b6f9..8cacfbad0fa 100644 --- a/tests/cases/fourslash/renameParameterPropertyDeclaration5.ts +++ b/tests/cases/fourslash/renameParameterPropertyDeclaration5.ts @@ -6,5 +6,4 @@ //// } //// } -const [rDef, ...rest] = test.ranges(); -verify.rangesAreRenameLocations(rest); +verify.rangesWithSameTextAreRenameLocations("protectedParam"); diff --git a/tests/cases/fourslash/renamePropertyAccessExpressionHeritageClause.ts b/tests/cases/fourslash/renamePropertyAccessExpressionHeritageClause.ts index ae6a1c70b90..32993d730e7 100644 --- a/tests/cases/fourslash/renamePropertyAccessExpressionHeritageClause.ts +++ b/tests/cases/fourslash/renamePropertyAccessExpressionHeritageClause.ts @@ -7,5 +7,4 @@ //// class C extends (foo()).[|B|] {} //// class C1 extends foo().[|B|] {} -const ranges = test.rangesByText(); -verify.rangesAreRenameLocations(ranges.get("B")); \ No newline at end of file +verify.rangesWithSameTextAreRenameLocations("B"); \ No newline at end of file diff --git a/tests/cases/fourslash/renameRest.ts b/tests/cases/fourslash/renameRest.ts index da1f590dd70..8540586857b 100644 --- a/tests/cases/fourslash/renameRest.ts +++ b/tests/cases/fourslash/renameRest.ts @@ -8,6 +8,4 @@ ////var { x, ...rest } = t; ////rest.[|parent|]; - -const rangesByText = test.rangesByText(); -verify.rangesAreRenameLocations(rangesByText.get("parent")); +verify.rangesWithSameTextAreRenameLocations("parent"); diff --git a/tests/cases/fourslash/renameStringPropertyNames.ts b/tests/cases/fourslash/renameStringPropertyNames.ts index 8d34ee458ea..609d45c62b3 100644 --- a/tests/cases/fourslash/renameStringPropertyNames.ts +++ b/tests/cases/fourslash/renameStringPropertyNames.ts @@ -12,5 +12,4 @@ ////o['[|prop|]']; ////o.[|prop|]; -const rangesByText = test.rangesByText(); -verify.rangesAreRenameLocations(rangesByText.get("prop")); +verify.rangesWithSameTextAreRenameLocations("prop"); diff --git a/tests/cases/fourslash/renameUMDModuleAlias1.ts b/tests/cases/fourslash/renameUMDModuleAlias1.ts index 510e117007b..36c67241a10 100644 --- a/tests/cases/fourslash/renameUMDModuleAlias1.ts +++ b/tests/cases/fourslash/renameUMDModuleAlias1.ts @@ -10,5 +10,4 @@ //// /// //// [|myLib|].doThing(); -const rangesByText = test.rangesByText(); -verify.rangesAreRenameLocations(rangesByText.get("myLib")); +verify.rangesWithSameTextAreRenameLocations("myLib"); diff --git a/tests/cases/fourslash/tsxRename1.ts b/tests/cases/fourslash/tsxRename1.ts index 25a4032032d..047bc391a38 100644 --- a/tests/cases/fourslash/tsxRename1.ts +++ b/tests/cases/fourslash/tsxRename1.ts @@ -12,5 +12,4 @@ //// } //// } //// var x = <[|div|] />; -const rangesByText = test.rangesByText(); -verify.rangesAreRenameLocations(rangesByText.get("div")); +verify.rangesWithSameTextAreRenameLocations("div"); diff --git a/tests/cases/fourslash/tsxRename2.ts b/tests/cases/fourslash/tsxRename2.ts index e79e7746d52..c6cb9d16ca8 100644 --- a/tests/cases/fourslash/tsxRename2.ts +++ b/tests/cases/fourslash/tsxRename2.ts @@ -13,5 +13,4 @@ //// } //// var x =
; -const rangesByText = test.rangesByText(); -verify.rangesAreRenameLocations(rangesByText.get("name")); +verify.rangesWithSameTextAreRenameLocations("name"); diff --git a/tests/cases/fourslash/tsxRename3.ts b/tests/cases/fourslash/tsxRename3.ts index 7970c314f45..c7c68abfa00 100644 --- a/tests/cases/fourslash/tsxRename3.ts +++ b/tests/cases/fourslash/tsxRename3.ts @@ -16,5 +16,4 @@ //// //// var x = ; -const rangesByText = test.rangesByText(); -verify.rangesAreRenameLocations(rangesByText.get("name")); +verify.rangesWithSameTextAreRenameLocations("name"); diff --git a/tests/cases/fourslash/tsxRename4.ts b/tests/cases/fourslash/tsxRename4.ts index cfd9b379fb7..0bc9fa10f0c 100644 --- a/tests/cases/fourslash/tsxRename4.ts +++ b/tests/cases/fourslash/tsxRename4.ts @@ -17,7 +17,4 @@ ////<[|div|]> verify.noErrors(); - -const rangesByText = test.rangesByText(); -verify.rangesAreRenameLocations(rangesByText.get("MyClass")); -verify.rangesAreRenameLocations(rangesByText.get("div")); \ No newline at end of file +verify.rangesWithSameTextAreRenameLocations("MyClass", "div"); \ No newline at end of file diff --git a/tests/cases/fourslash/tsxRename5.ts b/tests/cases/fourslash/tsxRename5.ts index d57da4b083a..953e950e6a6 100644 --- a/tests/cases/fourslash/tsxRename5.ts +++ b/tests/cases/fourslash/tsxRename5.ts @@ -16,5 +16,4 @@ //// [|var [|{| "declarationRangeIndex": 0 |}nn|]: string;|] //// var x = ; -const rangesByText = test.rangesByText(); -verify.rangesAreRenameLocations(rangesByText.get("nn")); +verify.rangesWithSameTextAreRenameLocations("nn"); diff --git a/tests/cases/fourslash/tsxRename6.ts b/tests/cases/fourslash/tsxRename6.ts index 3b0068d16b9..1cafd1332b0 100644 --- a/tests/cases/fourslash/tsxRename6.ts +++ b/tests/cases/fourslash/tsxRename6.ts @@ -22,6 +22,4 @@ //// let opt3 = <[|Opt|] wrong />; //// let opt4 = <[|Opt|] propx={100} propString="hi" />; -//verify.rangesAreRenameLocations(); -const rangesByText = test.rangesByText(); -verify.rangesAreRenameLocations(rangesByText.get("Opt")); +verify.rangesWithSameTextAreRenameLocations("Opt"); diff --git a/tests/cases/fourslash/tsxRename7.ts b/tests/cases/fourslash/tsxRename7.ts index 57b5da71cfc..13b16cf0ba5 100644 --- a/tests/cases/fourslash/tsxRename7.ts +++ b/tests/cases/fourslash/tsxRename7.ts @@ -21,5 +21,4 @@ //// let opt2 = ; //// let opt3 = ; -const rangesByText = test.rangesByText(); -verify.rangesAreRenameLocations(rangesByText.get("propx")); +verify.rangesWithSameTextAreRenameLocations("propx"); diff --git a/tests/cases/fourslash/tsxRename9.ts b/tests/cases/fourslash/tsxRename9.ts index 8de7a1c6d86..29a54d51cae 100644 --- a/tests/cases/fourslash/tsxRename9.ts +++ b/tests/cases/fourslash/tsxRename9.ts @@ -30,22 +30,10 @@ //// let opt = <[|MainButton|] [|[|{| "declarationRangeIndex": 20 |}goTo|]="goTo"|] />; //// let opt = <[|MainButton|] [|wrong|] />; -const [ - onClickDef_0, onClick_1, - goToDef_2, goTo_3, - mainButtonDef_4, mainButton_5, - mainButtonDef_6, mainButton_7, - mainButtonDef_8, mainButton_9, - mainButton_10, - mainButton_11, - mainButton_12, onClickDef_13, onClick_14, - mainButton_15, onClickDef_16, onClick_17, ignoreProp_18, - mainButton_19, goToDef_20, goTo_21, - mainButton_22, wrong_23 -] = test.ranges(); -const rangesByText = test.rangesByText(); -verify.rangesAreRenameLocations(rangesByText.get("onClick")); -verify.rangesAreRenameLocations(rangesByText.get("goTo")); -verify.rangesAreRenameLocations(rangesByText.get("MainButton")); -verify.rangesAreRenameLocations(rangesByText.get("ignore-prop")); -verify.rangesAreRenameLocations(rangesByText.get("wrong")); \ No newline at end of file +verify.rangesWithSameTextAreRenameLocations( + "onClick", + "goTo", + "MainButton", + "ignore-prop", + "wrong" +); \ No newline at end of file From 38da682de762bed1a48421a1dbc88a4f07a94ad5 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 5 Jun 2019 14:35:00 -0700 Subject: [PATCH 233/384] Unify contextual signature type parameter assignment (#31574) * Unify conditional signature type assignment * Moonomorphism --- src/compiler/checker.ts | 39 ++++++-- ...ckToBindingPatternForTypeInference.symbols | 1 + ...mpareAgainstUninstantiatedTypeParameter.js | 67 ++++++++++++++ ...AgainstUninstantiatedTypeParameter.symbols | 88 ++++++++++++++++++ ...reAgainstUninstantiatedTypeParameter.types | 92 +++++++++++++++++++ ...mpareAgainstUninstantiatedTypeParameter.ts | 33 +++++++ 6 files changed, 313 insertions(+), 7 deletions(-) create mode 100644 tests/baselines/reference/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.js create mode 100644 tests/baselines/reference/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.symbols create mode 100644 tests/baselines/reference/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.types create mode 100644 tests/cases/compiler/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3ed6768cb3d..817364ba832 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5231,7 +5231,7 @@ namespace ts { } } // Use contextual parameter type if one is available - const type = declaration.symbol.escapedName === InternalSymbolName.This ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration); + const type = declaration.symbol.escapedName === InternalSymbolName.This ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration, /*forCache*/ true); if (type) { return addOptionality(type, isOptional); } @@ -11522,6 +11522,7 @@ namespace ts { case SyntaxKind.FunctionExpression: case SyntaxKind.ArrowFunction: case SyntaxKind.MethodDeclaration: + case SyntaxKind.FunctionDeclaration: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); case SyntaxKind.ObjectLiteralExpression: return some((node).properties, isContextSensitive); @@ -11555,6 +11556,9 @@ namespace ts { } function isContextSensitiveFunctionLikeDeclaration(node: FunctionLikeDeclaration): boolean { + if (isFunctionDeclaration(node) && (!isInJSFile(node) || !getTypeForDeclarationFromJSDocComment(node))) { + return false; + } // Functions with type parameters are not context sensitive. if (node.typeParameters) { return false; @@ -18264,7 +18268,7 @@ namespace ts { } // Return contextual type of parameter or undefined if no contextual type is available - function getContextuallyTypedParameterType(parameter: ParameterDeclaration): Type | undefined { + function getContextuallyTypedParameterType(parameter: ParameterDeclaration, forCache: boolean): Type | undefined { const func = parameter.parent; if (!isContextSensitiveFunctionOrObjectLiteralMethod(func)) { return undefined; @@ -18285,8 +18289,21 @@ namespace ts { links.resolvedSignature = cached; return type; } - const contextualSignature = getContextualSignature(func); + let contextualSignature = getContextualSignature(func); if (contextualSignature) { + if (forCache) { + // Calling the below guarantees the types are primed and assigned in the same way + // as when the parameter is reached via `checkFunctionExpressionOrObjectLiteralMethod`. + // This should prevent any uninstantiated inference variables in the contextual signature + // from leaking, and should lock in cached parameter types via `assignContextualParameterTypes` + // which we will then immediately use the results of below. + contextuallyCheckFunctionExpressionOrObjectLiteralMethod(func); + const type = getTypeOfSymbol(getMergedSymbol(func.symbol)); + if (isTypeAny(type)) { + return type; + } + contextualSignature = getSignaturesOfType(type, SignatureKind.Call)[0]; + } const index = func.parameters.indexOf(parameter) - (getThisParameter(func) ? 1 : 0); return parameter.dotDotDotToken && lastOrUndefined(func.parameters) === parameter ? getRestTypeAtPosition(contextualSignature, index) : @@ -18301,7 +18318,7 @@ namespace ts { } switch (declaration.kind) { case SyntaxKind.Parameter: - return getContextuallyTypedParameterType(declaration); + return getContextuallyTypedParameterType(declaration, /*forCache*/ false); case SyntaxKind.BindingElement: return getContextualTypeForBindingElement(declaration); // By default, do nothing and return undefined - only parameters and binding elements have context implied by a parent @@ -23079,12 +23096,18 @@ namespace ts { checkGrammarForGenerator(node); } - const links = getNodeLinks(node); const type = getTypeOfSymbol(getMergedSymbol(node.symbol)); if (isTypeAny(type)) { return type; } + contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); + + return type; + } + + function contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node: FunctionExpression | ArrowFunction | MethodDeclaration, checkMode?: CheckMode) { + const links = getNodeLinks(node); // Check if function expression is contextually typed and assign parameter types if so. if (!(links.flags & NodeCheckFlags.ContextChecked)) { const contextualSignature = getContextualSignature(node); @@ -23094,6 +23117,10 @@ namespace ts { if (!(links.flags & NodeCheckFlags.ContextChecked)) { links.flags |= NodeCheckFlags.ContextChecked; if (contextualSignature) { + const type = getTypeOfSymbol(getMergedSymbol(node.symbol)); + if (isTypeAny(type)) { + return; + } const signature = getSignaturesOfType(type, SignatureKind.Call)[0]; if (isContextSensitive(node)) { const inferenceContext = getInferenceContext(node); @@ -23114,8 +23141,6 @@ namespace ts { checkSignatureDeclaration(node); } } - - return type; } function getReturnOrPromisedType(node: FunctionLikeDeclaration | MethodSignature, functionFlags: FunctionFlags) { diff --git a/tests/baselines/reference/fallbackToBindingPatternForTypeInference.symbols b/tests/baselines/reference/fallbackToBindingPatternForTypeInference.symbols index f57b234f39f..4f450e21c24 100644 --- a/tests/baselines/reference/fallbackToBindingPatternForTypeInference.symbols +++ b/tests/baselines/reference/fallbackToBindingPatternForTypeInference.symbols @@ -18,6 +18,7 @@ trans(([b,c]) => 'foo'); trans(({d: [e,f]}) => 'foo'); >trans : Symbol(trans, Decl(fallbackToBindingPatternForTypeInference.ts, 0, 0)) +>d : Symbol(d) >e : Symbol(e, Decl(fallbackToBindingPatternForTypeInference.ts, 3, 12)) >f : Symbol(f, Decl(fallbackToBindingPatternForTypeInference.ts, 3, 14)) diff --git a/tests/baselines/reference/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.js b/tests/baselines/reference/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.js new file mode 100644 index 00000000000..c3dd7d42112 --- /dev/null +++ b/tests/baselines/reference/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.js @@ -0,0 +1,67 @@ +//// [inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts] +class ClassA { + constructor(private entity?: TEntityClass, public settings?: SettingsInterface) { + + } +} +export interface ValueInterface { + func?: (row: TValueClass) => any; + value?: string; +} +export interface SettingsInterface { + values?: (row: TClass) => ValueInterface[], +} +class ConcreteClass { + theName = 'myClass'; +} + +var thisGetsTheFalseError = new ClassA(new ConcreteClass(), { + values: o => [ + { + value: o.theName, + func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' + } + ] +}); + +var thisIsOk = new ClassA(new ConcreteClass(), { + values: o => [ + { + value: o.theName, + func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' + } + ] +}); + +//// [inferenceDoesntCompareAgainstUninstantiatedTypeParameter.js] +"use strict"; +exports.__esModule = true; +var ClassA = /** @class */ (function () { + function ClassA(entity, settings) { + this.entity = entity; + this.settings = settings; + } + return ClassA; +}()); +var ConcreteClass = /** @class */ (function () { + function ConcreteClass() { + this.theName = 'myClass'; + } + return ConcreteClass; +}()); +var thisGetsTheFalseError = new ClassA(new ConcreteClass(), { + values: function (o) { return [ + { + value: o.theName, + func: function (x) { return 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj'; } + } + ]; } +}); +var thisIsOk = new ClassA(new ConcreteClass(), { + values: function (o) { return [ + { + value: o.theName, + func: function (x) { return 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj'; } + } + ]; } +}); diff --git a/tests/baselines/reference/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.symbols b/tests/baselines/reference/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.symbols new file mode 100644 index 00000000000..a47f3db5b55 --- /dev/null +++ b/tests/baselines/reference/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.symbols @@ -0,0 +1,88 @@ +=== tests/cases/compiler/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts === +class ClassA { +>ClassA : Symbol(ClassA, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 0, 0)) +>TEntityClass : Symbol(TEntityClass, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 0, 13)) + + constructor(private entity?: TEntityClass, public settings?: SettingsInterface) { +>entity : Symbol(ClassA.entity, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 1, 16)) +>TEntityClass : Symbol(TEntityClass, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 0, 13)) +>settings : Symbol(ClassA.settings, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 1, 46)) +>SettingsInterface : Symbol(SettingsInterface, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 8, 1)) +>TEntityClass : Symbol(TEntityClass, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 0, 13)) + + } +} +export interface ValueInterface { +>ValueInterface : Symbol(ValueInterface, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 4, 1)) +>TValueClass : Symbol(TValueClass, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 5, 32)) + + func?: (row: TValueClass) => any; +>func : Symbol(ValueInterface.func, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 5, 46)) +>row : Symbol(row, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 6, 12)) +>TValueClass : Symbol(TValueClass, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 5, 32)) + + value?: string; +>value : Symbol(ValueInterface.value, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 6, 37)) +} +export interface SettingsInterface { +>SettingsInterface : Symbol(SettingsInterface, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 8, 1)) +>TClass : Symbol(TClass, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 9, 35)) + + values?: (row: TClass) => ValueInterface[], +>values : Symbol(SettingsInterface.values, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 9, 44)) +>row : Symbol(row, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 10, 14)) +>TClass : Symbol(TClass, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 9, 35)) +>ValueInterface : Symbol(ValueInterface, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 4, 1)) +>TClass : Symbol(TClass, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 9, 35)) +} +class ConcreteClass { +>ConcreteClass : Symbol(ConcreteClass, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 11, 1)) + + theName = 'myClass'; +>theName : Symbol(ConcreteClass.theName, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 12, 21)) +} + +var thisGetsTheFalseError = new ClassA(new ConcreteClass(), { +>thisGetsTheFalseError : Symbol(thisGetsTheFalseError, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 16, 3)) +>ClassA : Symbol(ClassA, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 0, 0)) +>ConcreteClass : Symbol(ConcreteClass, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 11, 1)) + + values: o => [ +>values : Symbol(values, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 16, 61)) +>o : Symbol(o, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 17, 11)) + { + value: o.theName, +>value : Symbol(value, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 18, 9)) +>o.theName : Symbol(ConcreteClass.theName, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 12, 21)) +>o : Symbol(o, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 17, 11)) +>theName : Symbol(ConcreteClass.theName, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 12, 21)) + + func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' +>func : Symbol(func, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 19, 29)) +>x : Symbol(x, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 20, 17)) + } + ] +}); + +var thisIsOk = new ClassA(new ConcreteClass(), { +>thisIsOk : Symbol(thisIsOk, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 25, 3)) +>ClassA : Symbol(ClassA, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 0, 0)) +>ConcreteClass : Symbol(ConcreteClass, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 11, 1)) +>ConcreteClass : Symbol(ConcreteClass, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 11, 1)) + + values: o => [ +>values : Symbol(values, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 25, 63)) +>o : Symbol(o, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 26, 11)) + { + value: o.theName, +>value : Symbol(value, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 27, 9)) +>o.theName : Symbol(ConcreteClass.theName, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 12, 21)) +>o : Symbol(o, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 26, 11)) +>theName : Symbol(ConcreteClass.theName, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 12, 21)) + + func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' +>func : Symbol(func, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 28, 29)) +>x : Symbol(x, Decl(inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts, 29, 17)) + } + ] +}); diff --git a/tests/baselines/reference/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.types b/tests/baselines/reference/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.types new file mode 100644 index 00000000000..bda9aae9a4e --- /dev/null +++ b/tests/baselines/reference/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.types @@ -0,0 +1,92 @@ +=== tests/cases/compiler/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts === +class ClassA { +>ClassA : ClassA + + constructor(private entity?: TEntityClass, public settings?: SettingsInterface) { +>entity : TEntityClass +>settings : SettingsInterface + + } +} +export interface ValueInterface { + func?: (row: TValueClass) => any; +>func : (row: TValueClass) => any +>row : TValueClass + + value?: string; +>value : string +} +export interface SettingsInterface { + values?: (row: TClass) => ValueInterface[], +>values : (row: TClass) => ValueInterface[] +>row : TClass +} +class ConcreteClass { +>ConcreteClass : ConcreteClass + + theName = 'myClass'; +>theName : string +>'myClass' : "myClass" +} + +var thisGetsTheFalseError = new ClassA(new ConcreteClass(), { +>thisGetsTheFalseError : ClassA +>new ClassA(new ConcreteClass(), { values: o => [ { value: o.theName, func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' } ]}) : ClassA +>ClassA : typeof ClassA +>new ConcreteClass() : ConcreteClass +>ConcreteClass : typeof ConcreteClass +>{ values: o => [ { value: o.theName, func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' } ]} : { values: (o: ConcreteClass) => { value: string; func: (x: ConcreteClass) => string; }[]; } + + values: o => [ +>values : (o: ConcreteClass) => { value: string; func: (x: ConcreteClass) => string; }[] +>o => [ { value: o.theName, func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' } ] : (o: ConcreteClass) => { value: string; func: (x: ConcreteClass) => string; }[] +>o : ConcreteClass +>[ { value: o.theName, func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' } ] : { value: string; func: (x: ConcreteClass) => string; }[] + { +>{ value: o.theName, func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' } : { value: string; func: (x: ConcreteClass) => string; } + + value: o.theName, +>value : string +>o.theName : string +>o : ConcreteClass +>theName : string + + func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' +>func : (x: ConcreteClass) => string +>x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' : (x: ConcreteClass) => string +>x : ConcreteClass +>'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' : "asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj" + } + ] +}); + +var thisIsOk = new ClassA(new ConcreteClass(), { +>thisIsOk : ClassA +>new ClassA(new ConcreteClass(), { values: o => [ { value: o.theName, func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' } ]}) : ClassA +>ClassA : typeof ClassA +>new ConcreteClass() : ConcreteClass +>ConcreteClass : typeof ConcreteClass +>{ values: o => [ { value: o.theName, func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' } ]} : { values: (o: ConcreteClass) => { value: string; func: (x: ConcreteClass) => string; }[]; } + + values: o => [ +>values : (o: ConcreteClass) => { value: string; func: (x: ConcreteClass) => string; }[] +>o => [ { value: o.theName, func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' } ] : (o: ConcreteClass) => { value: string; func: (x: ConcreteClass) => string; }[] +>o : ConcreteClass +>[ { value: o.theName, func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' } ] : { value: string; func: (x: ConcreteClass) => string; }[] + { +>{ value: o.theName, func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' } : { value: string; func: (x: ConcreteClass) => string; } + + value: o.theName, +>value : string +>o.theName : string +>o : ConcreteClass +>theName : string + + func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' +>func : (x: ConcreteClass) => string +>x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' : (x: ConcreteClass) => string +>x : ConcreteClass +>'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' : "asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj" + } + ] +}); diff --git a/tests/cases/compiler/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts b/tests/cases/compiler/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts new file mode 100644 index 00000000000..98c0f25ee7b --- /dev/null +++ b/tests/cases/compiler/inferenceDoesntCompareAgainstUninstantiatedTypeParameter.ts @@ -0,0 +1,33 @@ +class ClassA { + constructor(private entity?: TEntityClass, public settings?: SettingsInterface) { + + } +} +export interface ValueInterface { + func?: (row: TValueClass) => any; + value?: string; +} +export interface SettingsInterface { + values?: (row: TClass) => ValueInterface[], +} +class ConcreteClass { + theName = 'myClass'; +} + +var thisGetsTheFalseError = new ClassA(new ConcreteClass(), { + values: o => [ + { + value: o.theName, + func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' + } + ] +}); + +var thisIsOk = new ClassA(new ConcreteClass(), { + values: o => [ + { + value: o.theName, + func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj' + } + ] +}); \ No newline at end of file From 6dc2ba793913ee372b8c7669493240365d00cfe3 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 5 Jun 2019 14:10:51 -0700 Subject: [PATCH 234/384] Take optional string of range text for singleReferenceGroup --- src/harness/fourslash.ts | 6 +++--- tests/cases/fourslash/findAllRefsOnDecorators.ts | 2 +- tests/cases/fourslash/findAllRefsOnDefinition.ts | 2 +- tests/cases/fourslash/findAllRefsOnDefinition2.ts | 2 +- .../findAllRefsOnPrivateParameterProperty1.ts | 2 +- ...dAllRefsPropertyContextuallyTypedByTypeParam01.ts | 2 +- tests/cases/fourslash/findAllRefsReExport_broken.ts | 2 +- tests/cases/fourslash/findAllRefsReExport_broken2.ts | 2 +- tests/cases/fourslash/findAllRefsTypedef.ts | 2 +- .../cases/fourslash/findAllRefsTypedef_importType.ts | 2 +- tests/cases/fourslash/findAllRefsTypeofImport.ts | 2 +- .../findAllRefsWithLeadingUnderscoreNames1.ts | 2 +- .../findAllRefsWithLeadingUnderscoreNames2.ts | 2 +- .../findAllRefsWithLeadingUnderscoreNames3.ts | 2 +- .../findAllRefsWithLeadingUnderscoreNames4.ts | 2 +- .../findAllRefsWithLeadingUnderscoreNames5.ts | 2 +- .../findAllRefsWithLeadingUnderscoreNames6.ts | 2 +- .../findAllRefsWithLeadingUnderscoreNames7.ts | 2 +- .../findAllRefsWithLeadingUnderscoreNames8.ts | 2 +- .../findAllRefsWithLeadingUnderscoreNames9.ts | 2 +- tests/cases/fourslash/findAllRefs_jsEnum.ts | 2 +- .../findReferencesAcrossMultipleProjects.ts | 2 +- tests/cases/fourslash/findReferencesAfterEdit.ts | 4 ++-- tests/cases/fourslash/findReferencesJSXTagName2.ts | 2 +- tests/cases/fourslash/fourslash.ts | 2 +- .../getOccurrencesIsDefinitionOfArrowFunction.ts | 2 +- .../fourslash/getOccurrencesIsDefinitionOfClass.ts | 2 +- .../getOccurrencesIsDefinitionOfComputedProperty.ts | 2 +- .../fourslash/getOccurrencesIsDefinitionOfEnum.ts | 2 +- .../getOccurrencesIsDefinitionOfFunction.ts | 2 +- .../getOccurrencesIsDefinitionOfInterface.ts | 2 +- ...etOccurrencesIsDefinitionOfInterfaceClassMerge.ts | 2 +- .../getOccurrencesIsDefinitionOfNamespace.ts | 2 +- ...etOccurrencesIsDefinitionOfNumberNamedProperty.ts | 2 +- .../getOccurrencesIsDefinitionOfParameter.ts | 2 +- ...etOccurrencesIsDefinitionOfStringNamedProperty.ts | 2 +- .../getOccurrencesIsDefinitionOfTypeAlias.ts | 2 +- .../getOccurrencesIsDefinitionOfVariable.ts | 2 +- .../fourslash/jsdocTypedefTagSemanticMeaning1.ts | 2 +- tests/cases/fourslash/referenceToClass.ts | 3 +-- tests/cases/fourslash/referencesBloomFilters.ts | 2 +- tests/cases/fourslash/referencesBloomFilters2.ts | 2 +- tests/cases/fourslash/referencesBloomFilters3.ts | 2 +- tests/cases/fourslash/referencesForAmbients2.ts | 2 +- tests/cases/fourslash/referencesForClassLocal.ts | 2 +- tests/cases/fourslash/referencesForClassParameter.ts | 2 +- ...cesForContextuallyTypedObjectLiteralProperties.ts | 2 +- ...referencesForContextuallyTypedUnionProperties2.ts | 2 +- tests/cases/fourslash/referencesForEnums.ts | 7 +++---- tests/cases/fourslash/referencesForExportedValues.ts | 2 +- .../fourslash/referencesForExternalModuleNames.ts | 2 +- .../fourslash/referencesForFunctionOverloads.ts | 2 +- .../fourslash/referencesForFunctionParameter.ts | 2 +- tests/cases/fourslash/referencesForGlobals.ts | 2 +- tests/cases/fourslash/referencesForGlobals2.ts | 2 +- tests/cases/fourslash/referencesForGlobals3.ts | 2 +- tests/cases/fourslash/referencesForGlobals4.ts | 2 +- tests/cases/fourslash/referencesForGlobals5.ts | 2 +- .../referencesForGlobalsInExternalModule.ts | 12 ++++-------- .../fourslash/referencesForIllegalAssignment.ts | 2 +- tests/cases/fourslash/referencesForIndexProperty.ts | 5 ++--- tests/cases/fourslash/referencesForIndexProperty3.ts | 2 +- .../fourslash/referencesForInheritedProperties3.ts | 5 ++--- .../fourslash/referencesForInheritedProperties4.ts | 6 ++---- tests/cases/fourslash/referencesForLabel6.ts | 5 ++--- .../fourslash/referencesForMergedDeclarations2.ts | 2 +- .../fourslash/referencesForMergedDeclarations4.ts | 2 +- .../fourslash/referencesForMergedDeclarations6.ts | 2 +- .../fourslash/referencesForMergedDeclarations8.ts | 2 +- .../referencesForNumericLiteralPropertyNames.ts | 2 +- .../referencesForObjectLiteralProperties.ts | 3 +-- .../referencesForPropertiesOfGenericType.ts | 3 +-- tests/cases/fourslash/referencesForStatic.ts | 3 +-- .../referencesForStringLiteralPropertyNames.ts | 2 +- .../referencesForStringLiteralPropertyNames2.ts | 2 +- .../referencesForStringLiteralPropertyNames3.ts | 3 +-- tests/cases/fourslash/renameJsExports01.ts | 5 ++--- tests/cases/fourslash/tsxFindAllReferences1.ts | 5 +---- tests/cases/fourslash/tsxFindAllReferences10.ts | 6 +----- tests/cases/fourslash/tsxFindAllReferences2.ts | 6 +----- tests/cases/fourslash/tsxFindAllReferences3.ts | 6 +----- tests/cases/fourslash/tsxFindAllReferences4.ts | 6 +----- tests/cases/fourslash/tsxFindAllReferences5.ts | 3 +-- tests/cases/fourslash/tsxFindAllReferences7.ts | 6 +----- tests/cases/fourslash/tsxFindAllReferences8.ts | 3 +-- tests/cases/fourslash/tsxFindAllReferences9.ts | 3 +-- .../tsxFindAllReferencesUnionElementType1.ts | 3 +-- .../tsxFindAllReferencesUnionElementType2.ts | 3 +-- 88 files changed, 101 insertions(+), 145 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index ace3df96daa..7842798dbef 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1001,8 +1001,8 @@ namespace FourSlash { assert.deepEqual | undefined>(refs, expected); } - public verifySingleReferenceGroup(definition: FourSlashInterface.ReferenceGroupDefinition, ranges?: Range[]) { - ranges = ranges || this.getRanges(); + public verifySingleReferenceGroup(definition: FourSlashInterface.ReferenceGroupDefinition, ranges?: Range[] | string) { + ranges = ts.isString(ranges) ? this.rangesByText().get(ranges)! : ranges || this.getRanges(); this.verifyReferenceGroups(ranges, [{ definition, ranges }]); } @@ -3971,7 +3971,7 @@ namespace FourSlashInterface { this.state.verifyGetReferencesForServerTest(expected); } - public singleReferenceGroup(definition: ReferenceGroupDefinition, ranges?: FourSlash.Range[]) { + public singleReferenceGroup(definition: ReferenceGroupDefinition, ranges?: FourSlash.Range[] | string) { this.state.verifySingleReferenceGroup(definition, ranges); } diff --git a/tests/cases/fourslash/findAllRefsOnDecorators.ts b/tests/cases/fourslash/findAllRefsOnDecorators.ts index aa8c0e0c9d2..0bb91f507ec 100644 --- a/tests/cases/fourslash/findAllRefsOnDecorators.ts +++ b/tests/cases/fourslash/findAllRefsOnDecorators.ts @@ -13,4 +13,4 @@ //// method() {} ////} -verify.singleReferenceGroup("function decorator(target: any): any", test.rangesByText().get("decorator")); +verify.singleReferenceGroup("function decorator(target: any): any", "decorator"); diff --git a/tests/cases/fourslash/findAllRefsOnDefinition.ts b/tests/cases/fourslash/findAllRefsOnDefinition.ts index da7640224e2..007b571fd03 100644 --- a/tests/cases/fourslash/findAllRefsOnDefinition.ts +++ b/tests/cases/fourslash/findAllRefsOnDefinition.ts @@ -23,4 +23,4 @@ ////second.[|start|](); ////second.stop(); -verify.singleReferenceGroup("(method) Test.start(): this", test.rangesByText().get("start")); +verify.singleReferenceGroup("(method) Test.start(): this", "start"); diff --git a/tests/cases/fourslash/findAllRefsOnDefinition2.ts b/tests/cases/fourslash/findAllRefsOnDefinition2.ts index b300213150a..1d58dd7c701 100644 --- a/tests/cases/fourslash/findAllRefsOnDefinition2.ts +++ b/tests/cases/fourslash/findAllRefsOnDefinition2.ts @@ -14,4 +14,4 @@ ////var start: Second.Test.[|start|]; ////var stop: Second.Test.stop; -verify.singleReferenceGroup("interface Test.start", test.rangesByText().get("start")); +verify.singleReferenceGroup("interface Test.start", "start"); diff --git a/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts b/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts index d438a87717d..f335f21a0b7 100644 --- a/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts +++ b/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts @@ -9,4 +9,4 @@ //// } ////} -verify.singleReferenceGroup("(property) ABCD.z: number", test.rangesByText().get("z")); +verify.singleReferenceGroup("(property) ABCD.z: number", "z"); diff --git a/tests/cases/fourslash/findAllRefsPropertyContextuallyTypedByTypeParam01.ts b/tests/cases/fourslash/findAllRefsPropertyContextuallyTypedByTypeParam01.ts index 8b8a82c169f..ec666c1d8a6 100644 --- a/tests/cases/fourslash/findAllRefsPropertyContextuallyTypedByTypeParam01.ts +++ b/tests/cases/fourslash/findAllRefsPropertyContextuallyTypedByTypeParam01.ts @@ -17,4 +17,4 @@ //// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}a|]: "ss"|] ////}; -verify.singleReferenceGroup("(property) IFoo.a: string", test.rangesByText().get("a")); +verify.singleReferenceGroup("(property) IFoo.a: string", "a"); diff --git a/tests/cases/fourslash/findAllRefsReExport_broken.ts b/tests/cases/fourslash/findAllRefsReExport_broken.ts index 3e57c60bdec..e8d35239795 100644 --- a/tests/cases/fourslash/findAllRefsReExport_broken.ts +++ b/tests/cases/fourslash/findAllRefsReExport_broken.ts @@ -3,4 +3,4 @@ // @Filename: /a.ts ////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] };|] -verify.singleReferenceGroup("export x", test.rangesByText().get("x")); +verify.singleReferenceGroup("export x", "x"); diff --git a/tests/cases/fourslash/findAllRefsReExport_broken2.ts b/tests/cases/fourslash/findAllRefsReExport_broken2.ts index bb8291403f8..5ae6afca6a9 100644 --- a/tests/cases/fourslash/findAllRefsReExport_broken2.ts +++ b/tests/cases/fourslash/findAllRefsReExport_broken2.ts @@ -3,4 +3,4 @@ // @Filename: /a.ts ////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] } from "nonsense";|] -verify.singleReferenceGroup("export x", test.rangesByText().get("x")); +verify.singleReferenceGroup("export x", "x"); diff --git a/tests/cases/fourslash/findAllRefsTypedef.ts b/tests/cases/fourslash/findAllRefsTypedef.ts index 3ca4e51cacd..19dd6611ba7 100644 --- a/tests/cases/fourslash/findAllRefsTypedef.ts +++ b/tests/cases/fourslash/findAllRefsTypedef.ts @@ -12,4 +12,4 @@ ////let x; ////x.[|p|]; -verify.singleReferenceGroup("(property) p: number", test.rangesByText().get("p")); +verify.singleReferenceGroup("(property) p: number", "p"); diff --git a/tests/cases/fourslash/findAllRefsTypedef_importType.ts b/tests/cases/fourslash/findAllRefsTypedef_importType.ts index aad77aeb712..ad2df19bd07 100644 --- a/tests/cases/fourslash/findAllRefsTypedef_importType.ts +++ b/tests/cases/fourslash/findAllRefsTypedef_importType.ts @@ -11,4 +11,4 @@ /////** @type {import('./a').[|Foo|]} */ ////const x = 0; -verify.singleReferenceGroup("type Foo = number", test.rangesByText().get("Foo")); +verify.singleReferenceGroup("type Foo = number", "Foo"); diff --git a/tests/cases/fourslash/findAllRefsTypeofImport.ts b/tests/cases/fourslash/findAllRefsTypeofImport.ts index 133d2275a31..4d381bedc17 100644 --- a/tests/cases/fourslash/findAllRefsTypeofImport.ts +++ b/tests/cases/fourslash/findAllRefsTypeofImport.ts @@ -5,4 +5,4 @@ ////declare const a: typeof import("./a"); ////a.[|x|]; -verify.singleReferenceGroup("const x: 0", test.rangesByText().get("x")); +verify.singleReferenceGroup("const x: 0", "x"); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts index 2ae0cc4ac71..7da05388de2 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts @@ -7,4 +7,4 @@ ////var x: Foo; ////x.[|_bar|]; -verify.singleReferenceGroup("(method) Foo._bar(): number", test.rangesByText().get("_bar")); +verify.singleReferenceGroup("(method) Foo._bar(): number", "_bar"); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts index 038e66449d4..9d64e11d64e 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts @@ -7,4 +7,4 @@ ////var x: Foo; ////x.[|__bar|]; -verify.singleReferenceGroup("(method) Foo.__bar(): number", test.rangesByText().get("__bar")); +verify.singleReferenceGroup("(method) Foo.__bar(): number", "__bar"); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts index 9c7815dea01..e93dfe75b9d 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts @@ -7,4 +7,4 @@ ////var x: Foo; ////x.[|___bar|]; -verify.singleReferenceGroup("(method) Foo.___bar(): number", test.rangesByText().get("___bar")); +verify.singleReferenceGroup("(method) Foo.___bar(): number", "___bar"); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts index 5c6566a8a0f..131cff144e4 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts @@ -7,4 +7,4 @@ ////var x: Foo; ////x.[|____bar|]; -verify.singleReferenceGroup("(method) Foo.____bar(): number", test.rangesByText().get("____bar")); +verify.singleReferenceGroup("(method) Foo.____bar(): number", "____bar"); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts index f3c807483cd..389772051e5 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts @@ -13,4 +13,4 @@ ////x.[|___bar|]; ////x.____bar; -verify.singleReferenceGroup("(property) Foo.___bar: any", test.rangesByText().get("___bar")); +verify.singleReferenceGroup("(property) Foo.___bar: any", "___bar"); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts index be8859c01a0..77fd15f1296 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts @@ -13,4 +13,4 @@ ////x.___bar; ////x.____bar; -verify.singleReferenceGroup("(property) Foo.__bar: any", test.rangesByText().get("__bar")); +verify.singleReferenceGroup("(property) Foo.__bar: any", "__bar"); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts index b6de0be25c9..2616d6f7f3c 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts @@ -4,4 +4,4 @@ //// [|__foo|](); ////}|] -verify.singleReferenceGroup("function __foo(): void", test.rangesByText().get("__foo")); +verify.singleReferenceGroup("function __foo(): void", "__foo"); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts index 945fa91e6d6..3785099aa2f 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts @@ -4,4 +4,4 @@ //// [|__foo|](); ////}|]) -verify.singleReferenceGroup("(local function) __foo(): void", test.rangesByText().get("__foo")); +verify.singleReferenceGroup("(local function) __foo(): void", "__foo"); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts index 2ff0420cc16..f4506809e76 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts @@ -4,4 +4,4 @@ //// [|___foo|](); ////}|]) -verify.singleReferenceGroup("(local function) ___foo(): void", test.rangesByText().get("___foo")); +verify.singleReferenceGroup("(local function) ___foo(): void", "___foo"); diff --git a/tests/cases/fourslash/findAllRefs_jsEnum.ts b/tests/cases/fourslash/findAllRefs_jsEnum.ts index 79c007c2947..c82c2507108 100644 --- a/tests/cases/fourslash/findAllRefs_jsEnum.ts +++ b/tests/cases/fourslash/findAllRefs_jsEnum.ts @@ -13,4 +13,4 @@ verify.singleReferenceGroup( `enum E const E: { A: string; -}`, test.rangesByText().get("E")); +}`, "E"); diff --git a/tests/cases/fourslash/findReferencesAcrossMultipleProjects.ts b/tests/cases/fourslash/findReferencesAcrossMultipleProjects.ts index b94b8629620..94b07d9305e 100644 --- a/tests/cases/fourslash/findReferencesAcrossMultipleProjects.ts +++ b/tests/cases/fourslash/findReferencesAcrossMultipleProjects.ts @@ -11,4 +11,4 @@ /////// ////[|{| "isWriteAccess": true |}x|]++; -verify.singleReferenceGroup("var x: number", test.rangesByText().get("x")); +verify.singleReferenceGroup("var x: number", "x"); diff --git a/tests/cases/fourslash/findReferencesAfterEdit.ts b/tests/cases/fourslash/findReferencesAfterEdit.ts index 9a8717eb1e3..9193f10f33d 100644 --- a/tests/cases/fourslash/findReferencesAfterEdit.ts +++ b/tests/cases/fourslash/findReferencesAfterEdit.ts @@ -12,9 +12,9 @@ //// x.[|foo|] ////} -verify.singleReferenceGroup("(property) A.foo: string", test.rangesByText().get("foo")); +verify.singleReferenceGroup("(property) A.foo: string", "foo"); goTo.marker(""); edit.insert("\n"); -verify.singleReferenceGroup("(property) A.foo: string", test.rangesByText().get("foo")); +verify.singleReferenceGroup("(property) A.foo: string", "foo"); diff --git a/tests/cases/fourslash/findReferencesJSXTagName2.ts b/tests/cases/fourslash/findReferencesJSXTagName2.ts index 46133d8e339..8036b943cc8 100644 --- a/tests/cases/fourslash/findReferencesJSXTagName2.ts +++ b/tests/cases/fourslash/findReferencesJSXTagName2.ts @@ -6,4 +6,4 @@ verify.singleReferenceGroup(`const obj: { Component: () => any; -}`, test.rangesByText().get("obj")); +}`, "obj"); diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 249d6d909c1..b431bd6306e 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -227,7 +227,7 @@ declare namespace FourSlashInterface { * This uses the 'findReferences' command instead of 'getReferencesAtPosition', so references are grouped by their definition. */ referenceGroups(starts: ArrayOrSingle | ArrayOrSingle, parts: ReadonlyArray): void; - singleReferenceGroup(definition: ReferencesDefinition, ranges?: Range[]): void; + singleReferenceGroup(definition: ReferencesDefinition, ranges?: Range[] | string): void; rangesAreOccurrences(isWriteAccess?: boolean, ranges?: Range[]): void; rangesWithSameTextAreRenameLocations(...texts: string[]): void; rangesAreRenameLocations(options?: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges?: Range[] }); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts index a50b2ca1149..094191f09ce 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts @@ -2,4 +2,4 @@ ////[|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}f|] = x => x + 1;|] ////[|f|](12); -verify.singleReferenceGroup("var f: (x: any) => any", test.rangesByText().get("f")); +verify.singleReferenceGroup("var f: (x: any) => any", "f"); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts index add271f14e4..7d4c3517767 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts @@ -7,4 +7,4 @@ ////}|] ////let c = new [|C|](); -verify.singleReferenceGroup("class C", test.rangesByText().get("C")); +verify.singleReferenceGroup("class C", "C"); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts index d67dfe74c95..23f3eca6cf6 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts @@ -3,4 +3,4 @@ ////let y = o.[|foo|]; ////let z = o['[|foo|]']; -verify.singleReferenceGroup('(property) ["foo"]: number', test.rangesByText().get("foo")); +verify.singleReferenceGroup('(property) ["foo"]: number', "foo"); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts index d1721c3b88b..0b76608e523 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts @@ -5,4 +5,4 @@ ////}|] ////let first = [|E|].First; -verify.singleReferenceGroup("enum E", test.rangesByText().get("E")); +verify.singleReferenceGroup("enum E", "E"); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts index 71746119230..e45dcf110d4 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts @@ -3,4 +3,4 @@ ////}|] ////[|func|](x) -verify.singleReferenceGroup("function func(x: number): void", test.rangesByText().get("func")); +verify.singleReferenceGroup("function func(x: number): void", "func"); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts index 57c96da1e8b..974cc7d4589 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts @@ -4,4 +4,4 @@ ////}|] ////let i: [|I|] = { p: 12 }; -verify.singleReferenceGroup("interface I", test.rangesByText().get("I")); +verify.singleReferenceGroup("interface I", "I"); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts index 2ec89979df4..df19e7473e9 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts @@ -13,4 +13,4 @@ ////let i: [|Numbers|] = new [|Numbers|](); ////let x = i.f(i.p + i.m); -verify.singleReferenceGroup("class Numbers\ninterface Numbers", test.rangesByText().get("Numbers")); +verify.singleReferenceGroup("class Numbers\ninterface Numbers", "Numbers"); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts index 0fc07b3bb6b..b0f5030f454 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts @@ -4,4 +4,4 @@ ////}|] ////let x = [|Numbers|].n + 1; -verify.singleReferenceGroup("namespace Numbers", test.rangesByText().get("Numbers")); +verify.singleReferenceGroup("namespace Numbers", "Numbers"); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts index 249d768bf11..4ace81eb773 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts @@ -2,4 +2,4 @@ ////let o = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}1|]: 12|] }; ////let y = o[[|1|]]; -verify.singleReferenceGroup("(property) 1: number", test.rangesByText().get("1")); +verify.singleReferenceGroup("(property) 1: number", "1"); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts index b18fc51f8eb..8ac460150bc 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts @@ -3,4 +3,4 @@ //// return [|x|] + 1 ////} -verify.singleReferenceGroup("(parameter) x: number", test.rangesByText().get("x")); +verify.singleReferenceGroup("(parameter) x: number", "x"); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts index 7ca03f00482..267cc1cdcbe 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts @@ -2,4 +2,4 @@ ////let o = { [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|]": 12|] }; ////let y = o.[|x|]; -verify.singleReferenceGroup('(property) "x": number', test.rangesByText().get("x")); +verify.singleReferenceGroup('(property) "x": number', "x"); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts index cf69914507b..122c6c8ea16 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts @@ -2,4 +2,4 @@ ////[|type [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Alias|]= number;|] ////let n: [|Alias|] = 12; -verify.singleReferenceGroup("type Alias = number", test.rangesByText().get("Alias")); +verify.singleReferenceGroup("type Alias = number", "Alias"); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts index b3a3ab4cc17..f3667912506 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts @@ -17,4 +17,4 @@ ////[|{| "isWriteAccess": true |}x|] += 1; ////[|{| "isWriteAccess": true |}x|] <<= 1; -verify.singleReferenceGroup("var x: number", test.rangesByText().get("x")); +verify.singleReferenceGroup("var x: number", "x"); diff --git a/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning1.ts b/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning1.ts index 60bef778045..d5da73d588e 100644 --- a/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning1.ts +++ b/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning1.ts @@ -9,4 +9,4 @@ /////** @type {[|T|]} */ ////const n = [|T|]; -verify.singleReferenceGroup("type T = number\nconst T: 1", test.rangesByText().get("T")); +verify.singleReferenceGroup("type T = number\nconst T: 1", "T"); diff --git a/tests/cases/fourslash/referenceToClass.ts b/tests/cases/fourslash/referenceToClass.ts index c1623313d84..7e0228cd8f5 100644 --- a/tests/cases/fourslash/referenceToClass.ts +++ b/tests/cases/fourslash/referenceToClass.ts @@ -20,5 +20,4 @@ // @Filename: referenceToClass_2.ts ////var k: [|foo|]; -const [rDef, ...ranges] = test.ranges(); -verify.singleReferenceGroup("class foo", ranges); +verify.singleReferenceGroup("class foo", "foo"); diff --git a/tests/cases/fourslash/referencesBloomFilters.ts b/tests/cases/fourslash/referencesBloomFilters.ts index 908339d6dce..374964a236f 100644 --- a/tests/cases/fourslash/referencesBloomFilters.ts +++ b/tests/cases/fourslash/referencesBloomFilters.ts @@ -14,4 +14,4 @@ // @Filename: redeclaration.ts ////container = { [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}searchProp|]" : 18|] }; -verify.singleReferenceGroup("(property) searchProp: number", test.rangesByText().get("searchProp")); +verify.singleReferenceGroup("(property) searchProp: number", "searchProp"); diff --git a/tests/cases/fourslash/referencesBloomFilters2.ts b/tests/cases/fourslash/referencesBloomFilters2.ts index 36890b2b87c..9dbb8b6605b 100644 --- a/tests/cases/fourslash/referencesBloomFilters2.ts +++ b/tests/cases/fourslash/referencesBloomFilters2.ts @@ -14,4 +14,4 @@ // @Filename: redeclaration.ts ////container = { [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}42|]" : 18|] }; -verify.singleReferenceGroup("(property) 42: number", test.rangesByText().get("42")); +verify.singleReferenceGroup("(property) 42: number", "42"); diff --git a/tests/cases/fourslash/referencesBloomFilters3.ts b/tests/cases/fourslash/referencesBloomFilters3.ts index 9d871047e86..b8888ca27ad 100644 --- a/tests/cases/fourslash/referencesBloomFilters3.ts +++ b/tests/cases/fourslash/referencesBloomFilters3.ts @@ -9,4 +9,4 @@ // @Filename: expression.ts ////(Test[[|42|]]); -verify.singleReferenceGroup('(enum member) Test["42"] = 1', test.rangesByText().get("42")); +verify.singleReferenceGroup('(enum member) Test["42"] = 1', "42"); diff --git a/tests/cases/fourslash/referencesForAmbients2.ts b/tests/cases/fourslash/referencesForAmbients2.ts index 3ec5b88a0a6..c0945e9a076 100644 --- a/tests/cases/fourslash/referencesForAmbients2.ts +++ b/tests/cases/fourslash/referencesForAmbients2.ts @@ -18,4 +18,4 @@ ////} verify.noErrors(); -verify.singleReferenceGroup("type T = number", test.rangesByText().get("T")); +verify.singleReferenceGroup("type T = number", "T"); diff --git a/tests/cases/fourslash/referencesForClassLocal.ts b/tests/cases/fourslash/referencesForClassLocal.ts index 6897f069245..5562666f091 100644 --- a/tests/cases/fourslash/referencesForClassLocal.ts +++ b/tests/cases/fourslash/referencesForClassLocal.ts @@ -20,4 +20,4 @@ //// } ////} -verify.singleReferenceGroup("(property) foo.n: number", test.rangesByText().get("n")); +verify.singleReferenceGroup("(property) foo.n: number", "n"); diff --git a/tests/cases/fourslash/referencesForClassParameter.ts b/tests/cases/fourslash/referencesForClassParameter.ts index 53cfba57c14..8fdf9b98154 100644 --- a/tests/cases/fourslash/referencesForClassParameter.ts +++ b/tests/cases/fourslash/referencesForClassParameter.ts @@ -19,4 +19,4 @@ ////var n = new foo(undefined); ////n.[|{| "isWriteAccess": true |}p|] = null; -verify.singleReferenceGroup("(property) foo.p: any", test.rangesByText().get("p")); +verify.singleReferenceGroup("(property) foo.p: any", "p"); diff --git a/tests/cases/fourslash/referencesForContextuallyTypedObjectLiteralProperties.ts b/tests/cases/fourslash/referencesForContextuallyTypedObjectLiteralProperties.ts index 9c510e4a097..5345d6e8aa3 100644 --- a/tests/cases/fourslash/referencesForContextuallyTypedObjectLiteralProperties.ts +++ b/tests/cases/fourslash/referencesForContextuallyTypedObjectLiteralProperties.ts @@ -25,4 +25,4 @@ ////// Untped -- should not be included ////var u = { xy: 0 }; -verify.singleReferenceGroup("(property) IFoo.xy: number", test.rangesByText().get("xy")); +verify.singleReferenceGroup("(property) IFoo.xy: number", "xy"); diff --git a/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties2.ts b/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties2.ts index 850561acf5c..0ad5f327995 100644 --- a/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties2.ts +++ b/tests/cases/fourslash/referencesForContextuallyTypedUnionProperties2.ts @@ -34,4 +34,4 @@ ////var u1 = { a: 0, b: 0, common: "" }; ////var u2 = { b: 0, common: 0 }; -verify.singleReferenceGroup("(property) B.b: number", test.rangesByText().get("b")); +verify.singleReferenceGroup("(property) B.b: number", "b"); diff --git a/tests/cases/fourslash/referencesForEnums.ts b/tests/cases/fourslash/referencesForEnums.ts index 2b948613704..464de3e40be 100644 --- a/tests/cases/fourslash/referencesForEnums.ts +++ b/tests/cases/fourslash/referencesForEnums.ts @@ -11,7 +11,6 @@ ////E.[|value2|]; ////E[[|111|]]; -const r = test.rangesByText(); -verify.singleReferenceGroup("(enum member) E.value1 = 1", r.get("value1")); -verify.singleReferenceGroup("(enum member) E[\"value2\"] = 1", r.get("value2")); -verify.singleReferenceGroup("(enum member) E[111] = 11", r.get("111")); +verify.singleReferenceGroup("(enum member) E.value1 = 1", "value1"); +verify.singleReferenceGroup("(enum member) E[\"value2\"] = 1", "value2"); +verify.singleReferenceGroup("(enum member) E[111] = 11", "111"); diff --git a/tests/cases/fourslash/referencesForExportedValues.ts b/tests/cases/fourslash/referencesForExportedValues.ts index 787440606fd..547de612c58 100644 --- a/tests/cases/fourslash/referencesForExportedValues.ts +++ b/tests/cases/fourslash/referencesForExportedValues.ts @@ -10,4 +10,4 @@ ////// external use ////M.[|variable|] -verify.singleReferenceGroup("var M.variable: number", test.rangesByText().get("variable")); +verify.singleReferenceGroup("var M.variable: number", "variable"); diff --git a/tests/cases/fourslash/referencesForExternalModuleNames.ts b/tests/cases/fourslash/referencesForExternalModuleNames.ts index 2929391228e..6fafec9f690 100644 --- a/tests/cases/fourslash/referencesForExternalModuleNames.ts +++ b/tests/cases/fourslash/referencesForExternalModuleNames.ts @@ -8,4 +8,4 @@ // @Filename: referencesForGlobals_2.ts ////import f = require("[|foo|]"); -verify.singleReferenceGroup('module "foo"', test.rangesByText().get("foo")); +verify.singleReferenceGroup('module "foo"', "foo"); diff --git a/tests/cases/fourslash/referencesForFunctionOverloads.ts b/tests/cases/fourslash/referencesForFunctionOverloads.ts index b086014a050..da9ad0e70f5 100644 --- a/tests/cases/fourslash/referencesForFunctionOverloads.ts +++ b/tests/cases/fourslash/referencesForFunctionOverloads.ts @@ -7,4 +7,4 @@ //// [|foo|]('', 43); ////}|] -verify.singleReferenceGroup("function foo(x: string): any", test.rangesByText().get("foo")); +verify.singleReferenceGroup("function foo(x: string): any", "foo"); diff --git a/tests/cases/fourslash/referencesForFunctionParameter.ts b/tests/cases/fourslash/referencesForFunctionParameter.ts index 267965e7044..d7fbc947fac 100644 --- a/tests/cases/fourslash/referencesForFunctionParameter.ts +++ b/tests/cases/fourslash/referencesForFunctionParameter.ts @@ -8,4 +8,4 @@ //// x = [|n|]; ////} -verify.singleReferenceGroup("(parameter) n: number", test.rangesByText().get("n")); +verify.singleReferenceGroup("(parameter) n: number", "n"); diff --git a/tests/cases/fourslash/referencesForGlobals.ts b/tests/cases/fourslash/referencesForGlobals.ts index 43cac1876be..540ab767317 100644 --- a/tests/cases/fourslash/referencesForGlobals.ts +++ b/tests/cases/fourslash/referencesForGlobals.ts @@ -25,4 +25,4 @@ // @Filename: referencesForGlobals_2.ts ////var m = [|global|]; -verify.singleReferenceGroup("var global: number", test.rangesByText().get("global")); +verify.singleReferenceGroup("var global: number", "global"); diff --git a/tests/cases/fourslash/referencesForGlobals2.ts b/tests/cases/fourslash/referencesForGlobals2.ts index d2b5c093f50..c5e56d01ed7 100644 --- a/tests/cases/fourslash/referencesForGlobals2.ts +++ b/tests/cases/fourslash/referencesForGlobals2.ts @@ -10,4 +10,4 @@ // @Filename: referencesForGlobals_2.ts ////var c = [|globalClass|](); -verify.singleReferenceGroup("class globalClass", test.rangesByText().get("globalClass")); +verify.singleReferenceGroup("class globalClass", "globalClass"); diff --git a/tests/cases/fourslash/referencesForGlobals3.ts b/tests/cases/fourslash/referencesForGlobals3.ts index 5ade69a8841..28c6277869d 100644 --- a/tests/cases/fourslash/referencesForGlobals3.ts +++ b/tests/cases/fourslash/referencesForGlobals3.ts @@ -10,4 +10,4 @@ // @Filename: referencesForGlobals_2.ts ////var i: [|globalInterface|]; -verify.singleReferenceGroup("interface globalInterface", test.rangesByText().get("globalInterface")); +verify.singleReferenceGroup("interface globalInterface", "globalInterface"); diff --git a/tests/cases/fourslash/referencesForGlobals4.ts b/tests/cases/fourslash/referencesForGlobals4.ts index cba70e1f441..5aee51ef4b5 100644 --- a/tests/cases/fourslash/referencesForGlobals4.ts +++ b/tests/cases/fourslash/referencesForGlobals4.ts @@ -10,4 +10,4 @@ // @Filename: referencesForGlobals_2.ts ////var m = [|globalModule|]; -verify.singleReferenceGroup("namespace globalModule", test.rangesByText().get("globalModule")); +verify.singleReferenceGroup("namespace globalModule", "globalModule"); diff --git a/tests/cases/fourslash/referencesForGlobals5.ts b/tests/cases/fourslash/referencesForGlobals5.ts index 34a46148d8a..e49d412d905 100644 --- a/tests/cases/fourslash/referencesForGlobals5.ts +++ b/tests/cases/fourslash/referencesForGlobals5.ts @@ -12,4 +12,4 @@ // @Filename: referencesForGlobals_2.ts ////var m = [|globalAlias|]; -verify.singleReferenceGroup("(alias) namespace globalAlias\nimport globalAlias = globalModule", test.rangesByText().get("globalAlias")); +verify.singleReferenceGroup("(alias) namespace globalAlias\nimport globalAlias = globalModule", "globalAlias"); diff --git a/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts b/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts index f4b9d07117c..2c1caf040c0 100644 --- a/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts +++ b/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts @@ -18,11 +18,7 @@ //// ////export = x; -const ranges = test.rangesByText(); -verify.singleReferenceGroup("var topLevelVar: number", ranges.get("topLevelVar")); - -const topLevelClass = ranges.get("topLevelClass"); -verify.singleReferenceGroup("class topLevelClass", topLevelClass); - -verify.singleReferenceGroup("interface topLevelInterface", ranges.get("topLevelInterface")); -verify.singleReferenceGroup("namespace topLevelModule", ranges.get("topLevelModule")); +verify.singleReferenceGroup("var topLevelVar: number", "topLevelVar"); +verify.singleReferenceGroup("class topLevelClass", "topLevelClass"); +verify.singleReferenceGroup("interface topLevelInterface", "topLevelInterface"); +verify.singleReferenceGroup("namespace topLevelModule", "topLevelModule"); diff --git a/tests/cases/fourslash/referencesForIllegalAssignment.ts b/tests/cases/fourslash/referencesForIllegalAssignment.ts index a0c0a610bc5..760f440bb02 100644 --- a/tests/cases/fourslash/referencesForIllegalAssignment.ts +++ b/tests/cases/fourslash/referencesForIllegalAssignment.ts @@ -11,4 +11,4 @@ verify.noReferences(); goTo.marker("2"); verify.noReferences(); -verify.singleReferenceGroup("var bar: () => void", test.rangesByText().get("bar")); +verify.singleReferenceGroup("var bar: () => void", "bar"); diff --git a/tests/cases/fourslash/referencesForIndexProperty.ts b/tests/cases/fourslash/referencesForIndexProperty.ts index 4d21e1d6aef..52560baeff9 100644 --- a/tests/cases/fourslash/referencesForIndexProperty.ts +++ b/tests/cases/fourslash/referencesForIndexProperty.ts @@ -11,6 +11,5 @@ ////f["[|property|]"]; ////f["[|method|]"]; -const ranges = test.rangesByText(); -verify.singleReferenceGroup("(property) Foo.property: number", ranges.get("property")); -verify.singleReferenceGroup("(method) Foo.method(): void", ranges.get("method")); +verify.singleReferenceGroup("(property) Foo.property: number", "property"); +verify.singleReferenceGroup("(method) Foo.method(): void", "method"); diff --git a/tests/cases/fourslash/referencesForIndexProperty3.ts b/tests/cases/fourslash/referencesForIndexProperty3.ts index 2d0d4fec089..fc1fe34749d 100644 --- a/tests/cases/fourslash/referencesForIndexProperty3.ts +++ b/tests/cases/fourslash/referencesForIndexProperty3.ts @@ -12,4 +12,4 @@ ////var x = {}; ////x["[|toMyString|]"](); -verify.singleReferenceGroup("(method) Object.toMyString(): any", test.rangesByText().get("toMyString")); +verify.singleReferenceGroup("(method) Object.toMyString(): any", "toMyString"); diff --git a/tests/cases/fourslash/referencesForInheritedProperties3.ts b/tests/cases/fourslash/referencesForInheritedProperties3.ts index 42de1905874..8dda63e69b4 100644 --- a/tests/cases/fourslash/referencesForInheritedProperties3.ts +++ b/tests/cases/fourslash/referencesForInheritedProperties3.ts @@ -9,6 +9,5 @@ //// v.[|propName|]; //// v.[|doStuff|](); -const ranges = test.rangesByText(); -verify.singleReferenceGroup("(method) interface1.doStuff(): void", ranges.get("doStuff")); -verify.singleReferenceGroup("(property) interface1.propName: string", ranges.get("propName")); +verify.singleReferenceGroup("(method) interface1.doStuff(): void", "doStuff"); +verify.singleReferenceGroup("(property) interface1.propName: string", "propName"); diff --git a/tests/cases/fourslash/referencesForInheritedProperties4.ts b/tests/cases/fourslash/referencesForInheritedProperties4.ts index 5c00529cd1b..e252cb522f1 100644 --- a/tests/cases/fourslash/referencesForInheritedProperties4.ts +++ b/tests/cases/fourslash/referencesForInheritedProperties4.ts @@ -9,7 +9,5 @@ //// c.[|doStuff|](); //// c.[|propName|]; -const ranges = test.rangesByText(); -const [r0, r1] = ranges.get("doStuff"); -verify.singleReferenceGroup("(method) class1.doStuff(): void", ranges.get("doStuff")); -verify.singleReferenceGroup("(property) class1.propName: string", ranges.get("propName")); +verify.singleReferenceGroup("(method) class1.doStuff(): void", "doStuff"); +verify.singleReferenceGroup("(property) class1.propName: string", "propName"); diff --git a/tests/cases/fourslash/referencesForLabel6.ts b/tests/cases/fourslash/referencesForLabel6.ts index 0255c07943c..a8f71480975 100644 --- a/tests/cases/fourslash/referencesForLabel6.ts +++ b/tests/cases/fourslash/referencesForLabel6.ts @@ -7,6 +7,5 @@ //// break labelc; ////} -const ranges = test.rangesByText(); -verify.singleReferenceGroup("labela", ranges.get("labela")); -verify.singleReferenceGroup("labelb", ranges.get("labelb")); +verify.singleReferenceGroup("labela", "labela"); +verify.singleReferenceGroup("labelb", "labelb"); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations2.ts b/tests/cases/fourslash/referencesForMergedDeclarations2.ts index 24ea93b30d5..5521bb96990 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations2.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations2.ts @@ -15,4 +15,4 @@ verify.singleReferenceGroup([ "(alias) function alias(): void", "(alias) namespace alias", "import alias = ATest" -].join("\n"), test.rangesByText().get("alias")); +].join("\n"), "alias"); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations4.ts b/tests/cases/fourslash/referencesForMergedDeclarations4.ts index f67f2aa62e4..880c714421e 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations4.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations4.ts @@ -22,4 +22,4 @@ ////[|testClass|].s; ////new [|testClass|](); -verify.singleReferenceGroup("class testClass\nnamespace testClass", test.rangesByText().get("testClass")); +verify.singleReferenceGroup("class testClass\nnamespace testClass", "testClass"); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations6.ts b/tests/cases/fourslash/referencesForMergedDeclarations6.ts index 91fc90f8e8f..4d6edf4df4c 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations6.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations6.ts @@ -10,4 +10,4 @@ ////// module ////import a1 = [|Foo|]; -verify.singleReferenceGroup("namespace Foo", test.rangesByText().get("Foo")); +verify.singleReferenceGroup("namespace Foo", "Foo"); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations8.ts b/tests/cases/fourslash/referencesForMergedDeclarations8.ts index 4485cd8d0de..81996361158 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations8.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations8.ts @@ -10,4 +10,4 @@ ////// module ////import a3 = Foo.[|Bar|].Baz; -verify.singleReferenceGroup("namespace Foo.Bar", test.rangesByText().get("Bar")); +verify.singleReferenceGroup("namespace Foo.Bar", "Bar"); diff --git a/tests/cases/fourslash/referencesForNumericLiteralPropertyNames.ts b/tests/cases/fourslash/referencesForNumericLiteralPropertyNames.ts index 1a9998be1e5..8f9ab78eb02 100644 --- a/tests/cases/fourslash/referencesForNumericLiteralPropertyNames.ts +++ b/tests/cases/fourslash/referencesForNumericLiteralPropertyNames.ts @@ -9,4 +9,4 @@ ////x = { [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}12|]": 0|] }; ////x = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}12|]: 0|] }; -verify.singleReferenceGroup("(property) Foo[12]: any", test.rangesByText().get("12")); +verify.singleReferenceGroup("(property) Foo[12]: any", "12"); diff --git a/tests/cases/fourslash/referencesForObjectLiteralProperties.ts b/tests/cases/fourslash/referencesForObjectLiteralProperties.ts index ed365a63706..60b1c808376 100644 --- a/tests/cases/fourslash/referencesForObjectLiteralProperties.ts +++ b/tests/cases/fourslash/referencesForObjectLiteralProperties.ts @@ -8,5 +8,4 @@ ////var y = x; ////y.[|add|]; -const [rDef, ...ranges] = test.ranges(); -verify.singleReferenceGroup("(property) add: number", ranges); +verify.singleReferenceGroup("(property) add: number", "add"); diff --git a/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts b/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts index 7fc42dce34e..e8ae86b2cef 100644 --- a/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts +++ b/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts @@ -10,5 +10,4 @@ ////var y: IFoo; ////y.[|doSomething|](12); -const [rDef, ...ranges] = test.ranges(); -verify.singleReferenceGroup("(method) IFoo.doSomething(v: T): T", ranges); +verify.singleReferenceGroup("(method) IFoo.doSomething(v: T): T", "doSomething"); diff --git a/tests/cases/fourslash/referencesForStatic.ts b/tests/cases/fourslash/referencesForStatic.ts index 7bc1ec13e9c..2e0a6182edb 100644 --- a/tests/cases/fourslash/referencesForStatic.ts +++ b/tests/cases/fourslash/referencesForStatic.ts @@ -30,5 +30,4 @@ // @Filename: referencesOnStatic_2.ts ////var q = foo.[|n|]; -const [rDef, ...ranges] = test.ranges(); -verify.singleReferenceGroup("(property) foo.n: string", ranges); +verify.singleReferenceGroup("(property) foo.n: string", "n"); diff --git a/tests/cases/fourslash/referencesForStringLiteralPropertyNames.ts b/tests/cases/fourslash/referencesForStringLiteralPropertyNames.ts index 036637ec75f..564f33bad48 100644 --- a/tests/cases/fourslash/referencesForStringLiteralPropertyNames.ts +++ b/tests/cases/fourslash/referencesForStringLiteralPropertyNames.ts @@ -10,4 +10,4 @@ ////x = { [|"[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}ss|]": 0|] }; ////x = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}ss|]: 0|] }; -verify.singleReferenceGroup('(property) Foo["ss"]: any', test.rangesByText().get("ss")); +verify.singleReferenceGroup('(property) Foo["ss"]: any', "ss"); diff --git a/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts b/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts index cc142bebb69..24e4e29ba8a 100644 --- a/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts +++ b/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts @@ -7,4 +7,4 @@ ////var x: Foo; ////x.[|blah|]; -verify.singleReferenceGroup('(method) Foo["blah"](): number', test.rangesByText().get("blah")); +verify.singleReferenceGroup('(method) Foo["blah"](): number', "blah"); diff --git a/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts b/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts index 050503a1e34..23519a0facf 100644 --- a/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts +++ b/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts @@ -8,5 +8,4 @@ ////var y: Foo2; ////y[[|42|]]; - -verify.singleReferenceGroup('(property) Foo2["42"]: number', test.rangesByText().get("42")); +verify.singleReferenceGroup('(property) Foo2["42"]: number', "42"); \ No newline at end of file diff --git a/tests/cases/fourslash/renameJsExports01.ts b/tests/cases/fourslash/renameJsExports01.ts index be5e4f6ea05..2a081525bbe 100644 --- a/tests/cases/fourslash/renameJsExports01.ts +++ b/tests/cases/fourslash/renameJsExports01.ts @@ -8,6 +8,5 @@ ////var mod = require('./a'); ////var t = mod./**/[|area|](10); -const [rDef, ...ranges] = test.ranges(); -verify.singleReferenceGroup("(property) area: (r: any) => number", ranges); -verify.rangesAreRenameLocations(ranges); +verify.singleReferenceGroup("(property) area: (r: any) => number", "area"); +verify.rangesWithSameTextAreRenameLocations("area"); diff --git a/tests/cases/fourslash/tsxFindAllReferences1.ts b/tests/cases/fourslash/tsxFindAllReferences1.ts index 1602bc7dae9..e943c4e69bf 100644 --- a/tests/cases/fourslash/tsxFindAllReferences1.ts +++ b/tests/cases/fourslash/tsxFindAllReferences1.ts @@ -13,11 +13,8 @@ //// } //// var x = <[|div|] />; -const rangesByText = test.rangesByText(); verify.singleReferenceGroup( `(property) JSX.IntrinsicElements.div: { name?: string; isOpen?: boolean; -}`, - rangesByText.get("div") -); +}`, "div"); diff --git a/tests/cases/fourslash/tsxFindAllReferences10.ts b/tests/cases/fourslash/tsxFindAllReferences10.ts index 29e57b97bd2..bbef12be7cc 100644 --- a/tests/cases/fourslash/tsxFindAllReferences10.ts +++ b/tests/cases/fourslash/tsxFindAllReferences10.ts @@ -30,8 +30,4 @@ //// let opt = ; //// let opt = ; -const rangesByText = test.rangesByText(); -verify.singleReferenceGroup( - "(method) ButtonProps.onClick(event?: any): void", - rangesByText.get("onClick") -); +verify.singleReferenceGroup("(method) ButtonProps.onClick(event?: any): void", "onClick"); \ No newline at end of file diff --git a/tests/cases/fourslash/tsxFindAllReferences2.ts b/tests/cases/fourslash/tsxFindAllReferences2.ts index f1b71e51811..4c6dc5a81bf 100644 --- a/tests/cases/fourslash/tsxFindAllReferences2.ts +++ b/tests/cases/fourslash/tsxFindAllReferences2.ts @@ -13,8 +13,4 @@ //// } //// var x =
; -const rangesByText = test.rangesByText(); -verify.singleReferenceGroup( - "(property) name?: string", - rangesByText.get("name") -); +verify.singleReferenceGroup("(property) name?: string", "name"); diff --git a/tests/cases/fourslash/tsxFindAllReferences3.ts b/tests/cases/fourslash/tsxFindAllReferences3.ts index c519d5da99b..299161bf1f0 100644 --- a/tests/cases/fourslash/tsxFindAllReferences3.ts +++ b/tests/cases/fourslash/tsxFindAllReferences3.ts @@ -16,8 +16,4 @@ //// //// var x = ; -const rangesByText = test.rangesByText(); -verify.singleReferenceGroup( - "(property) name?: string", - rangesByText.get("name") -); +verify.singleReferenceGroup("(property) name?: string", "name"); diff --git a/tests/cases/fourslash/tsxFindAllReferences4.ts b/tests/cases/fourslash/tsxFindAllReferences4.ts index 5d7ce7419bb..e761be8eb4d 100644 --- a/tests/cases/fourslash/tsxFindAllReferences4.ts +++ b/tests/cases/fourslash/tsxFindAllReferences4.ts @@ -16,8 +16,4 @@ //// //// var x = <[|MyClass|] name='hello'>; -const rangesByText = test.rangesByText(); -verify.singleReferenceGroup( - "class MyClass", - rangesByText.get("MyClass") -); +verify.singleReferenceGroup("class MyClass", "MyClass"); diff --git a/tests/cases/fourslash/tsxFindAllReferences5.ts b/tests/cases/fourslash/tsxFindAllReferences5.ts index 265b1a015f3..ee3e0e7e4bd 100644 --- a/tests/cases/fourslash/tsxFindAllReferences5.ts +++ b/tests/cases/fourslash/tsxFindAllReferences5.ts @@ -22,8 +22,7 @@ //// let opt3 = <[|Opt|] wrong />; //// let opt4 = <[|Opt|] propx={100} propString="hi" />; -const rangesByText = test.rangesByText(); verify.singleReferenceGroup( "function Opt(attributes: OptionPropBag): JSX.Element", - rangesByText.get("Opt") + "Opt" ); diff --git a/tests/cases/fourslash/tsxFindAllReferences7.ts b/tests/cases/fourslash/tsxFindAllReferences7.ts index 22c19e1cc29..c7e916cc8f1 100644 --- a/tests/cases/fourslash/tsxFindAllReferences7.ts +++ b/tests/cases/fourslash/tsxFindAllReferences7.ts @@ -21,8 +21,4 @@ //// let opt2 = ; //// let opt3 = ; -const rangesByText = test.rangesByText(); -verify.singleReferenceGroup( - "(property) OptionPropBag.propx: number", - rangesByText.get("propx") -); +verify.singleReferenceGroup("(property) OptionPropBag.propx: number", "propx"); diff --git a/tests/cases/fourslash/tsxFindAllReferences8.ts b/tests/cases/fourslash/tsxFindAllReferences8.ts index b509a9565a0..a5683cfb330 100644 --- a/tests/cases/fourslash/tsxFindAllReferences8.ts +++ b/tests/cases/fourslash/tsxFindAllReferences8.ts @@ -30,8 +30,7 @@ //// let opt = <[|MainButton|] goTo="goTo" />; //// let opt = <[|MainButton|] wrong />; -const rangesByText = test.rangesByText(); verify.singleReferenceGroup( "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", - rangesByText.get("MainButton") + "MainButton" ); diff --git a/tests/cases/fourslash/tsxFindAllReferences9.ts b/tests/cases/fourslash/tsxFindAllReferences9.ts index e10eb420926..ba55331d892 100644 --- a/tests/cases/fourslash/tsxFindAllReferences9.ts +++ b/tests/cases/fourslash/tsxFindAllReferences9.ts @@ -31,5 +31,4 @@ //// let opt = ; //// let opt = ; -const rangesByText = test.rangesByText(); -verify.singleReferenceGroup("(property) LinkProps.goTo: string", rangesByText.get("goTo")); +verify.singleReferenceGroup("(property) LinkProps.goTo: string", "goTo"); diff --git a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts index 9da352c64b1..dc85960bb6d 100644 --- a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts +++ b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts @@ -21,9 +21,8 @@ //// [|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}SFCComp|] = SFC1 || SFC2;|] //// <[|SFCComp|] x={ "hi" } /> -const [, r1, r2] = test.ranges(); verify.singleReferenceGroup(`var SFCComp: ((prop: { x: number; }) => JSX.Element) | ((prop: { x: boolean; -}) => JSX.Element)`, [r1, r2]); +}) => JSX.Element)`, "SFCComp"); diff --git a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts index 80291feb451..ffb33919fd4 100644 --- a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts +++ b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts @@ -20,5 +20,4 @@ //// [|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}RCComp|] = RC1 || RC2;|] //// <[|RCComp|] /> -const [, r1, r2 ] = test.ranges(); -verify.singleReferenceGroup("var RCComp: typeof RC1", [r1, r2]); +verify.singleReferenceGroup("var RCComp: typeof RC1", "RCComp"); From d1dc8373532049e94d42ce146e91229cd302e3d2 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 5 Jun 2019 14:43:33 -0700 Subject: [PATCH 235/384] Cache ranges by text --- src/harness/fourslash.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 7842798dbef..2061bbd69ba 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -42,6 +42,7 @@ namespace FourSlash { * is a range with `text in range` "selected". */ ranges: Range[]; + rangesByText?: ts.MultiMap; } export interface Marker { @@ -1002,7 +1003,7 @@ namespace FourSlash { } public verifySingleReferenceGroup(definition: FourSlashInterface.ReferenceGroupDefinition, ranges?: Range[] | string) { - ranges = ts.isString(ranges) ? this.rangesByText().get(ranges)! : ranges || this.getRanges(); + ranges = ts.isString(ranges) ? this.rangesByText().get(ranges)! : ranges || this.getRanges(); this.verifyReferenceGroups(ranges, [{ definition, ranges }]); } @@ -1853,6 +1854,7 @@ Actual: ${stringify(fullActual)}`); range.end = updatePosition(range.end, editStart, editEnd, newText); } } + this.testData.rangesByText = undefined; } private removeWhitespace(text: string): string { @@ -2035,7 +2037,9 @@ Actual: ${stringify(fullActual)}`); } public rangesByText(): ts.Map { + if (this.testData.rangesByText) return this.testData.rangesByText; const result = ts.createMultiMap(); + this.testData.rangesByText = result; for (const range of this.getRanges()) { const text = this.rangeText(range); result.add(text, range); From 2e99438edc937d6001a8047eb75ea82407207a23 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 5 Jun 2019 14:57:18 -0700 Subject: [PATCH 236/384] Handle numeric enums in mapped types + fix obscure crash --- src/compiler/checker.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3ed6768cb3d..01cb7c9fea2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6444,7 +6444,7 @@ namespace ts { for (const declaration of symbol.declarations) { if (declaration.kind === SyntaxKind.EnumDeclaration) { for (const member of (declaration).members) { - const memberType = getFreshTypeOfLiteralType(getLiteralType(getEnumMemberValue(member)!, enumCount, getSymbolOfNode(member))); // TODO: GH#18217 + const memberType = getFreshTypeOfLiteralType(getLiteralType(getEnumMemberValue(member) || 0, enumCount, getSymbolOfNode(member))); getSymbolLinks(getSymbolOfNode(member)).declaredType = memberType; memberTypeList.push(getRegularTypeOfLiteralType(memberType)); } @@ -7453,8 +7453,9 @@ namespace ts { else if (t.flags & (TypeFlags.Any | TypeFlags.String)) { stringIndexInfo = createIndexInfo(propType, !!(templateModifiers & MappedTypeModifiers.IncludeReadonly)); } - else if (t.flags & TypeFlags.Number) { - numberIndexInfo = createIndexInfo(propType, !!(templateModifiers & MappedTypeModifiers.IncludeReadonly)); + else if (t.flags & (TypeFlags.Number | TypeFlags.Enum)) { + numberIndexInfo = createIndexInfo(numberIndexInfo ? getUnionType([numberIndexInfo.type, propType]) : propType, + !!(templateModifiers & MappedTypeModifiers.IncludeReadonly)); } } } @@ -28440,9 +28441,9 @@ namespace ts { if (member.initializer) { return computeConstantValue(member); } - // In ambient enum declarations that specify no const modifier, enum member declarations that omit - // a value are considered computed members (as opposed to having auto-incremented values). - if (member.parent.flags & NodeFlags.Ambient && !isEnumConst(member.parent)) { + // In ambient non-const numeric enum declarations, enum members without initializers are + // considered computed members (as opposed to having auto-incremented values). + if (member.parent.flags & NodeFlags.Ambient && !isEnumConst(member.parent) && getEnumKind(getSymbolOfNode(member.parent)) === EnumKind.Numeric) { return undefined; } // If the member declaration specifies no value, the member is considered a constant enum member. From ec4ca6b6199b26fde721d0e8ef332d6d61a93913 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 5 Jun 2019 14:58:22 -0700 Subject: [PATCH 237/384] Slightly reorder experimental sync commands --- scripts/update-experimental-branches.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-experimental-branches.js b/scripts/update-experimental-branches.js index 8af4df95cb9..7e395ae995b 100644 --- a/scripts/update-experimental-branches.js +++ b/scripts/update-experimental-branches.js @@ -30,9 +30,9 @@ async function main() { runSequence([ ["git", ["clean", "-fdx"]], ["git", ["checkout", "."]], + ["git", ["fetch", "-fu", "origin", "master:master"]], ["git", ["checkout", "master"]], ["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork - ["git", ["fetch", "origin", "master:master"]], ]); const gh = new Octokit(); From 16030663ffe41310fcdb6cb7183ddc717fbddd10 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 5 Jun 2019 15:18:00 -0700 Subject: [PATCH 238/384] Dont clean - pipeline should already be clean and a clean will clean node_modules --- scripts/update-experimental-branches.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/update-experimental-branches.js b/scripts/update-experimental-branches.js index 7e395ae995b..49131a145c6 100644 --- a/scripts/update-experimental-branches.js +++ b/scripts/update-experimental-branches.js @@ -28,7 +28,6 @@ async function main() { // Forcibly cleanup workspace runSequence([ - ["git", ["clean", "-fdx"]], ["git", ["checkout", "."]], ["git", ["fetch", "-fu", "origin", "master:master"]], ["git", ["checkout", "master"]], From bddcf10eb8c8e9e8d6017ee5895db0eb154c098c Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 5 Jun 2019 15:25:33 -0700 Subject: [PATCH 239/384] Fix deprecation warnings in experiment sync script --- scripts/update-experimental-branches.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/update-experimental-branches.js b/scripts/update-experimental-branches.js index 49131a145c6..ddbf7a43827 100644 --- a/scripts/update-experimental-branches.js +++ b/scripts/update-experimental-branches.js @@ -34,23 +34,21 @@ async function main() { ["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork ]); - const gh = new Octokit(); - gh.authenticate({ - type: "token", - token: process.argv[2] + const gh = new Octokit({ + auth: process.argv[2] }); for (const numRaw of prnums) { const num = +numRaw; if (num) { // PR number rather than branch name - lookup info - const inputPR = await gh.pulls.get({ owner: "Microsoft", repo: "TypeScript", number: num }); + const inputPR = await gh.pulls.get({ owner: "Microsoft", repo: "TypeScript", pull_number: num }); // GH calculates the rebaseable-ness of a PR into its target, so we can just use that here if (!inputPR.data.rebaseable) { if (+triggeredPR === num) { await gh.issues.createComment({ owner: "Microsoft", repo: "TypeScript", - number: num, + issue_number: num, body: `This PR is configured as an experiment, and currently has merge conflicts with master - please rebase onto master and fix the conflicts.` }); throw new Error(`Merge conflict detected in PR ${num} with master`); From dcf2fa930d7172ea6e8a541d439dcebea7836c00 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 5 Jun 2019 15:28:52 -0700 Subject: [PATCH 240/384] merge -> rebase in experiment sync script text --- scripts/update-experimental-branches.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/update-experimental-branches.js b/scripts/update-experimental-branches.js index ddbf7a43827..4a496bbf783 100644 --- a/scripts/update-experimental-branches.js +++ b/scripts/update-experimental-branches.js @@ -49,9 +49,9 @@ async function main() { owner: "Microsoft", repo: "TypeScript", issue_number: num, - body: `This PR is configured as an experiment, and currently has merge conflicts with master - please rebase onto master and fix the conflicts.` + body: `This PR is configured as an experiment, and currently has rebase conflicts with master - please rebase onto master and fix the conflicts.` }); - throw new Error(`Merge conflict detected in PR ${num} with master`); + throw new Error(`Rebase conflict detected in PR ${num} with master`); } return; // A PR is currently in conflict, give up } From e1e160354733f621f5ef0df7e88367c43c553a0b Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 5 Jun 2019 15:01:34 -0700 Subject: [PATCH 241/384] More tests --- .../findAllRefsForComputedProperties.ts | 11 +++++------ .../findAllRefsForComputedProperties2.ts | 11 +++++------ .../fourslash/findAllRefsForDefaultExport.ts | 7 +++---- .../fourslash/findAllRefsForDefaultExport01.ts | 6 +++--- .../fourslash/findAllRefsForDefaultExport02.ts | 11 +++++------ .../fourslash/findAllRefsForDefaultExport03.ts | 12 ++++++------ .../fourslash/findAllRefsForDefaultExport08.ts | 6 +++--- .../findAllRefsForDefaultExport_reExport.ts | 10 +++++----- ...rt_reExport_allowSyntheticDefaultImports.ts | 10 +++++----- .../findAllRefsForFunctionExpression01.ts | 6 +++--- .../fourslash/findAllRefsForMappedType.ts | 8 ++++---- .../fourslash/findAllRefsForModuleGlobal.ts | 4 ++-- .../findAllRefsForObjectLiteralProperties.ts | 6 +++--- .../fourslash/findAllRefsForObjectSpread.ts | 8 ++++---- tests/cases/fourslash/findAllRefsForRest.ts | 4 ++-- .../fourslash/findAllRefsForUMDModuleAlias1.ts | 4 ++-- .../findAllRefsForVariableInExtendsClause01.ts | 4 ++-- .../findAllRefsForVariableInExtendsClause02.ts | 4 ++-- .../findAllRefsGlobalModuleAugmentation.ts | 4 ++-- .../fourslash/findAllRefsImportDefault.ts | 10 +++++----- .../cases/fourslash/findAllRefsImportEquals.ts | 4 ++-- .../findAllRefsImportEqualsJsonFile.ts | 6 +++--- .../cases/fourslash/findAllRefsImportNamed.ts | 6 +++--- .../findAllRefsImportStarOfExportEquals.ts | 15 +++++++-------- tests/cases/fourslash/findAllRefsImportType.ts | 4 ++-- .../fourslash/findAllRefsInClassExpression.ts | 6 +++--- .../fourslash/findAllRefsIndexedAccessTypes.ts | 9 ++++----- .../findAllRefsInheritedProperties1.ts | 6 +++--- .../findAllRefsInheritedProperties2.ts | 6 +++--- .../findAllRefsInheritedProperties3.ts | 14 +++++++------- .../findAllRefsInheritedProperties4.ts | 8 ++++---- .../findAllRefsInheritedProperties5.ts | 8 ++++---- .../fourslash/findAllRefsInsideTemplates1.ts | 4 ++-- .../fourslash/findAllRefsInsideTemplates2.ts | 4 ++-- .../fourslash/findAllRefsInsideWithBlock.ts | 4 ++-- .../fourslash/findAllRefsJsDocTypeDef_js.ts | 4 ++-- tests/cases/fourslash/findAllRefsMappedType.ts | 4 ++-- .../fourslash/findAllRefsModuleAugmentation.ts | 4 ++-- .../fourslash/findAllRefsModuleDotExports.ts | 5 +++-- .../fourslash/findAllRefsNoImportClause.ts | 4 ++-- ...llRefsObjectBindingElementPropertyName01.ts | 6 +++--- ...llRefsObjectBindingElementPropertyName02.ts | 6 +++--- ...llRefsObjectBindingElementPropertyName03.ts | 12 +++++++----- ...llRefsObjectBindingElementPropertyName04.ts | 9 ++++----- ...llRefsObjectBindingElementPropertyName06.ts | 18 ++++++++++-------- ...llRefsObjectBindingElementPropertyName07.ts | 4 ++-- ...llRefsObjectBindingElementPropertyName10.ts | 6 +++--- .../fourslash/findAllRefsOfConstructor.ts | 8 ++++---- .../fourslash/findAllRefsOfConstructor2.ts | 10 +++++----- .../findAllRefsOfConstructor_multipleFiles.ts | 12 ++++++------ .../findAllRefsOfConstructor_withModifier.ts | 4 ++-- 51 files changed, 182 insertions(+), 184 deletions(-) diff --git a/tests/cases/fourslash/findAllRefsForComputedProperties.ts b/tests/cases/fourslash/findAllRefsForComputedProperties.ts index 3c442b8b63a..d8a5ef9771f 100644 --- a/tests/cases/fourslash/findAllRefsForComputedProperties.ts +++ b/tests/cases/fourslash/findAllRefsForComputedProperties.ts @@ -1,20 +1,19 @@ /// ////interface I { -//// ["[|{| "isDefinition": true |}prop1|]"]: () => void; +//// [|["[|{| "isDefinition": true, "declarationRangeIndex": 0 |}prop1|]"]: () => void;|] ////} //// ////class C implements I { -//// ["[|{| "isDefinition": true |}prop1|]"]: any; +//// [|["[|{| "isDefinition": true, "declarationRangeIndex": 2 |}prop1|]"]: any;|] ////} //// ////var x: I = { -//// ["[|{| "isWriteAccess": true, "isDefinition": true |}prop1|]"]: function () { }, +//// [|["[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}prop1|]"]: function () { }|], ////} -const ranges = test.ranges(); -const [r0, r1, r2] = ranges; -verify.referenceGroups(ranges, [ +const [r0Def, r0, r1Def, r1, r2Def, r2] = test.ranges(); +verify.referenceGroups([r0, r1, r2], [ { definition: { text: '(property) I["prop1"]: () => void', range: r0 }, ranges: [r0, r2] }, { definition: { text: '(property) C["prop1"]: any', range: r1 }, ranges: [r1] }, ]); diff --git a/tests/cases/fourslash/findAllRefsForComputedProperties2.ts b/tests/cases/fourslash/findAllRefsForComputedProperties2.ts index 21f9d2c92ba..8b66fd635e4 100644 --- a/tests/cases/fourslash/findAllRefsForComputedProperties2.ts +++ b/tests/cases/fourslash/findAllRefsForComputedProperties2.ts @@ -1,20 +1,19 @@ /// ////interface I { -//// [[|{| "isDefinition": true |}42|]](): void; +//// [|[[|{| "isDefinition": true, "declarationRangeIndex": 0 |}42|]](): void;|] ////} //// ////class C implements I { -//// [[|{| "isDefinition": true |}42|]]: any; +//// [|[[|{| "isDefinition": true, "declarationRangeIndex": 2 |}42|]]: any;|] ////} //// ////var x: I = { -//// ["[|{| "isWriteAccess": true, "isDefinition": true |}42|]"]: function () { } +//// [|["[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}42|]"]: function () { }|] ////} -const ranges = test.ranges(); -const [r0, r1, r2] = ranges; -verify.referenceGroups(ranges, [ +const [r0Def, r0, r1Def, r1, r2Def, r2] = test.ranges(); +verify.referenceGroups([r0, r1, r2], [ { definition: { text: '(method) I[42](): void', range: r0 }, ranges: [r0, r2] }, { definition: { text: '(property) C[42]: any', range: r1 }, ranges: [r1] }, ]); diff --git a/tests/cases/fourslash/findAllRefsForDefaultExport.ts b/tests/cases/fourslash/findAllRefsForDefaultExport.ts index 71c566a6f42..6570fa2857d 100644 --- a/tests/cases/fourslash/findAllRefsForDefaultExport.ts +++ b/tests/cases/fourslash/findAllRefsForDefaultExport.ts @@ -1,17 +1,16 @@ /// // @Filename: a.ts -////export default function /*def*/[|{| "isWriteAccess": true, "isDefinition": true |}f|]() {} +////[|export default function /*def*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}f|]() {}|] // @Filename: b.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}g|] from "./a"; +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}g|] from "./a";|] ////[|/*ref*/g|](); // @Filename: c.ts ////import { f } from "./a"; -const ranges = test.ranges(); -const [r0, r1, r2] = ranges; +const [r0Def, r0, r1Def, r1, r2] = test.ranges(); verify.referenceGroups(r0, [ { definition: "function f(): void", ranges: [r0] }, { definition: "(alias) function g(): void\nimport g", ranges: [r1, r2] } diff --git a/tests/cases/fourslash/findAllRefsForDefaultExport01.ts b/tests/cases/fourslash/findAllRefsForDefaultExport01.ts index 419262bd10f..96b906ba9cb 100644 --- a/tests/cases/fourslash/findAllRefsForDefaultExport01.ts +++ b/tests/cases/fourslash/findAllRefsForDefaultExport01.ts @@ -1,10 +1,10 @@ /// -////export default class [|{| "isWriteAccess": true, "isDefinition": true |}DefaultExportedClass|] { -////} +////[|export default class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}DefaultExportedClass|] { +////}|] //// ////var x: [|DefaultExportedClass|]; //// ////var y = new [|DefaultExportedClass|]; -verify.singleReferenceGroup("class DefaultExportedClass"); +verify.singleReferenceGroup("class DefaultExportedClass", "DefaultExportedClass"); diff --git a/tests/cases/fourslash/findAllRefsForDefaultExport02.ts b/tests/cases/fourslash/findAllRefsForDefaultExport02.ts index c664b470938..1e00bb4f68d 100644 --- a/tests/cases/fourslash/findAllRefsForDefaultExport02.ts +++ b/tests/cases/fourslash/findAllRefsForDefaultExport02.ts @@ -1,19 +1,18 @@ /// -////export default function [|{| "isWriteAccess": true, "isDefinition": true |}DefaultExportedFunction|]() { +////[|export default function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}DefaultExportedFunction|]() { //// return [|DefaultExportedFunction|]; -////} +////}|] //// ////var x: typeof [|DefaultExportedFunction|]; //// ////var y = [|DefaultExportedFunction|](); //// -////namespace [|{| "isWriteAccess": true, "isDefinition": true |}DefaultExportedFunction|] { -////} +////[|namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}DefaultExportedFunction|] { +////}|] -const ranges = test.ranges(); -const [r0, r1, r2, r3, r4] = ranges; +const [r0Def, r0, r1, r2, r3, r4Def, r4] = test.ranges(); const fnRanges = [r0, r1, r2, r3]; verify.singleReferenceGroup("function DefaultExportedFunction(): () => typeof DefaultExportedFunction", fnRanges); diff --git a/tests/cases/fourslash/findAllRefsForDefaultExport03.ts b/tests/cases/fourslash/findAllRefsForDefaultExport03.ts index 75cbe556e36..1e8ddbc1507 100644 --- a/tests/cases/fourslash/findAllRefsForDefaultExport03.ts +++ b/tests/cases/fourslash/findAllRefsForDefaultExport03.ts @@ -1,17 +1,17 @@ /// -////function [|{| "isWriteAccess": true, "isDefinition": true |}f|]() { +////[|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}f|]() { //// return 100; -////} +////}|] //// -////export default [|f|]; +////[|export default [|{| "declarationRangeIndex": 2 |}f|];|] //// ////var x: typeof [|f|]; //// ////var y = [|f|](); //// -////namespace [|{| "isWriteAccess": true, "isDefinition": true |}f|] { +////[|namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}f|] { //// var local = 100; -////} +////}|] -verify.singleReferenceGroup("namespace f\nfunction f(): number"); +verify.singleReferenceGroup("namespace f\nfunction f(): number", "f"); diff --git a/tests/cases/fourslash/findAllRefsForDefaultExport08.ts b/tests/cases/fourslash/findAllRefsForDefaultExport08.ts index 5583ba34c95..d94a0ce5d3c 100644 --- a/tests/cases/fourslash/findAllRefsForDefaultExport08.ts +++ b/tests/cases/fourslash/findAllRefsForDefaultExport08.ts @@ -7,11 +7,11 @@ //// ////var y = new DefaultExportedClass; //// -////namespace [|{| "isWriteAccess": true, "isDefinition": true |}DefaultExportedClass|] { -////} +////[|namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}DefaultExportedClass|] { +////}|] verify.noErrors(); // The namespace and class do not merge, // so the namespace should be all alone. -verify.singleReferenceGroup("class DefaultExportedClass\nnamespace DefaultExportedClass"); +verify.singleReferenceGroup("class DefaultExportedClass\nnamespace DefaultExportedClass", "DefaultExportedClass"); diff --git a/tests/cases/fourslash/findAllRefsForDefaultExport_reExport.ts b/tests/cases/fourslash/findAllRefsForDefaultExport_reExport.ts index 2abd33b7d6e..d9dd9d06736 100644 --- a/tests/cases/fourslash/findAllRefsForDefaultExport_reExport.ts +++ b/tests/cases/fourslash/findAllRefsForDefaultExport_reExport.ts @@ -1,16 +1,16 @@ /// // @Filename: /export.ts -////const [|{| "isWriteAccess": true, "isDefinition": true |}foo|] = 1; -////export default [|foo|]; +////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|] = 1;|] +////[|export default [|{| "declarationRangeIndex": 2 |}foo|];|] // @Filename: /re-export.ts -////export { [|{| "isWriteAccess": true, "isDefinition": true |}default|] } from "./export"; +////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}default|] } from "./export";|] // @Filename: /re-export-dep.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}fooDefault|] from "./re-export"; +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}fooDefault|] from "./re-export";|] -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3] = test.ranges(); verify.referenceGroups([r0, r1], [ { definition: "const foo: 1", ranges: [r0, r1] }, { definition: "(alias) const foo: 1\nexport default", ranges: [r2], }, diff --git a/tests/cases/fourslash/findAllRefsForDefaultExport_reExport_allowSyntheticDefaultImports.ts b/tests/cases/fourslash/findAllRefsForDefaultExport_reExport_allowSyntheticDefaultImports.ts index 386eca5eae0..e49f7ca41bc 100644 --- a/tests/cases/fourslash/findAllRefsForDefaultExport_reExport_allowSyntheticDefaultImports.ts +++ b/tests/cases/fourslash/findAllRefsForDefaultExport_reExport_allowSyntheticDefaultImports.ts @@ -3,18 +3,18 @@ // @allowSyntheticDefaultImports: true // @Filename: /export.ts -////const [|{| "isWriteAccess": true, "isDefinition": true |}foo|] = 1; -////export = [|foo|]; +////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|] = 1;|] +////[|export = [|{| "declarationRangeIndex": 2 |}foo|];|] // @Filename: /re-export.ts -////export { [|{| "isWriteAccess": true, "isDefinition": true |}default|] } from "./export"; +////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}default|] } from "./export";|] // @Filename: /re-export-dep.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}fooDefault|] from "./re-export"; +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}fooDefault|] from "./re-export";|] verify.noErrors(); -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3] = test.ranges(); verify.referenceGroups([r0, r1], [ { definition: "const foo: 1", ranges: [r0, r1] }, { definition: "(alias) const foo: 1\nexport default", ranges: [r2], }, diff --git a/tests/cases/fourslash/findAllRefsForFunctionExpression01.ts b/tests/cases/fourslash/findAllRefsForFunctionExpression01.ts index ddb98711629..16caacc2aad 100644 --- a/tests/cases/fourslash/findAllRefsForFunctionExpression01.ts +++ b/tests/cases/fourslash/findAllRefsForFunctionExpression01.ts @@ -1,12 +1,12 @@ /// // @Filename: file1.ts -////var foo = function [|{| "isWriteAccess": true, "isDefinition": true |}foo|](a = [|foo|](), b = () => [|foo|]) { +////var foo = [|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|](a = [|foo|](), b = () => [|foo|]) { //// [|foo|]([|foo|], [|foo|]); -////} +////}|] // @Filename: file2.ts /////// ////foo(); -verify.singleReferenceGroup("(local function) foo(a?: void, b?: () => (a?: void, b?: ...) => void): void"); +verify.singleReferenceGroup("(local function) foo(a?: void, b?: () => (a?: void, b?: ...) => void): void", "foo"); diff --git a/tests/cases/fourslash/findAllRefsForMappedType.ts b/tests/cases/fourslash/findAllRefsForMappedType.ts index 8965fa046ea..8a64a730801 100644 --- a/tests/cases/fourslash/findAllRefsForMappedType.ts +++ b/tests/cases/fourslash/findAllRefsForMappedType.ts @@ -1,9 +1,9 @@ /// -////interface T { [|{| "isDefinition": true |}a|]: number }; +////interface T { [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}a|]: number|] }; ////type U = { [K in keyof T]: string }; ////type V = { [K in keyof U]: boolean }; -////const u: U = { [|{| "isWriteAccess": true, "isDefinition": true |}a|]: "" } -////const v: V = { [|{| "isWriteAccess": true, "isDefinition": true |}a|]: true } +////const u: U = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}a|]: ""|] } +////const v: V = { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}a|]: true|] } -verify.singleReferenceGroup("(property) T.a: number"); +verify.singleReferenceGroup("(property) T.a: number", "a"); diff --git a/tests/cases/fourslash/findAllRefsForModuleGlobal.ts b/tests/cases/fourslash/findAllRefsForModuleGlobal.ts index 817064c3f14..4c7aa3939c1 100644 --- a/tests/cases/fourslash/findAllRefsForModuleGlobal.ts +++ b/tests/cases/fourslash/findAllRefsForModuleGlobal.ts @@ -6,7 +6,7 @@ // @Filename: /b.ts /////// ////import { x } from "[|foo|]"; -////declare module "[|{| "isWriteAccess": true, "isDefinition": true |}foo|]" {} +////[|declare module "[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}foo|]" {}|] verify.noErrors(); -verify.singleReferenceGroup('module "/node_modules/foo/index"'); +verify.singleReferenceGroup('module "/node_modules/foo/index"', "foo"); diff --git a/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts b/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts index 2d9d9e267c5..5a6557d65d9 100644 --- a/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts +++ b/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts @@ -1,11 +1,11 @@ /// ////var x = { -//// [|{| "isWriteAccess": true, "isDefinition": true |}property|]: {} +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}property|]: {}|] ////}; //// ////x.[|property|]; //// -////let {[|property|]: pVar} = x; +////[|let {[|{| "declarationRangeIndex": 3 |}property|]: pVar} = x;|] -verify.singleReferenceGroup("(property) property: {}"); +verify.singleReferenceGroup("(property) property: {}", "property"); diff --git a/tests/cases/fourslash/findAllRefsForObjectSpread.ts b/tests/cases/fourslash/findAllRefsForObjectSpread.ts index 12c338ca529..5995d0d7cb0 100644 --- a/tests/cases/fourslash/findAllRefsForObjectSpread.ts +++ b/tests/cases/fourslash/findAllRefsForObjectSpread.ts @@ -1,14 +1,14 @@ /// -////interface A1 { readonly [|{| "isDefinition": true |}a|]: string }; -////interface A2 { [|{| "isDefinition": true |}a|]?: number }; +////interface A1 { [|readonly [|{| "isDefinition": true, "declarationRangeIndex": 0 |}a|]: string|] }; +////interface A2 { [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}a|]?: number|] }; ////let a1: A1; ////let a2: A2; ////let a12 = { ...a1, ...a2 }; ////a12.[|a|]; ////a1.[|a|]; -const ranges = test.ranges(); -const [r0, r1, r2, r3] = ranges; + +const [r0Def, r0, r1Def, r1, r2, r3] = test.ranges(); // members of spread types only refer to themselves and the resulting property verify.referenceGroups(r0, [{ definition: "(property) A1.a: string", ranges: [r0, r2, r3] }]); diff --git a/tests/cases/fourslash/findAllRefsForRest.ts b/tests/cases/fourslash/findAllRefsForRest.ts index 3dac71374f0..b39071c13c1 100644 --- a/tests/cases/fourslash/findAllRefsForRest.ts +++ b/tests/cases/fourslash/findAllRefsForRest.ts @@ -1,11 +1,11 @@ /// ////interface Gen { //// x: number -//// [|{| "isDefinition": true |}parent|]: Gen; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}parent|]: Gen;|] //// millenial: string; ////} ////let t: Gen; ////var { x, ...rest } = t; ////rest.[|parent|]; -verify.singleReferenceGroup("(property) Gen.parent: Gen"); +verify.singleReferenceGroup("(property) Gen.parent: Gen", "parent"); diff --git a/tests/cases/fourslash/findAllRefsForUMDModuleAlias1.ts b/tests/cases/fourslash/findAllRefsForUMDModuleAlias1.ts index 99ca347eac4..97188a5bac8 100644 --- a/tests/cases/fourslash/findAllRefsForUMDModuleAlias1.ts +++ b/tests/cases/fourslash/findAllRefsForUMDModuleAlias1.ts @@ -4,10 +4,10 @@ //// export function doThing(): string; //// export function doTheOtherThing(): void; -//// export as namespace [|{| "isWriteAccess": true, "isDefinition": true |}myLib|]; +//// [|export as namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}myLib|];|] // @Filename: 1.ts //// /// //// [|myLib|].doThing(); -verify.singleReferenceGroup("export namespace myLib"); +verify.singleReferenceGroup("export namespace myLib", "myLib"); diff --git a/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts b/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts index a61f925c97e..d72a1695cca 100644 --- a/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts +++ b/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts @@ -1,6 +1,6 @@ /// -////var [|{| "isWriteAccess": true, "isDefinition": true |}Base|] = class { }; +////[|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Base|] = class { };|] ////class C extends [|Base|] { } -verify.singleReferenceGroup("var Base: typeof Base"); +verify.singleReferenceGroup("var Base: typeof Base", "Base"); diff --git a/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts b/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts index 5685df0c4e1..c2fd4bd077b 100644 --- a/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts +++ b/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts @@ -1,9 +1,9 @@ /// -////interface [|{| "isWriteAccess": true, "isDefinition": true |}Base|] { } +////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Base|] { }|] ////namespace n { //// var Base = class { }; //// interface I extends [|Base|] { } ////} -verify.singleReferenceGroup("interface Base"); +verify.singleReferenceGroup("interface Base", "Base"); diff --git a/tests/cases/fourslash/findAllRefsGlobalModuleAugmentation.ts b/tests/cases/fourslash/findAllRefsGlobalModuleAugmentation.ts index c2f4982b653..82016acd9f0 100644 --- a/tests/cases/fourslash/findAllRefsGlobalModuleAugmentation.ts +++ b/tests/cases/fourslash/findAllRefsGlobalModuleAugmentation.ts @@ -3,11 +3,11 @@ // @Filename: /a.ts ////export {}; ////declare global { -//// function [|{| "isWriteAccess": true, "isDefinition": true |}f|](): void; +//// [|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}f|](): void;|] ////} // @Filename: /b.ts ////[|f|](); verify.noErrors(); -verify.singleReferenceGroup("function f(): void"); +verify.singleReferenceGroup("function f(): void", "f"); diff --git a/tests/cases/fourslash/findAllRefsImportDefault.ts b/tests/cases/fourslash/findAllRefsImportDefault.ts index 15b3bda8ddf..253bbd4ae3f 100644 --- a/tests/cases/fourslash/findAllRefsImportDefault.ts +++ b/tests/cases/fourslash/findAllRefsImportDefault.ts @@ -1,17 +1,17 @@ /// // @Filename: f.ts -////export { [|foo|] as [|{| "isWriteAccess": true, "isDefinition": true |}default|] }; -////function /*start*/[|{| "isWriteAccess": true, "isDefinition": true |}foo|](a: number, b: number) { +////[|export { [|{| "declarationRangeIndex": 0 |}foo|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}default|] };|] +////[|function /*start*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}foo|](a: number, b: number) { //// return a + b; -////} +////}|] // @Filename: b.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}bar|] from "./f"; +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}bar|] from "./f";|] ////[|bar|](1, 2); verify.noErrors(); -const [ foo0, foo1, foo2, bar0, bar1 ] = test.ranges(); +const [ foo0Def, foo0, foo1, foo2Def, foo2, bar0Def, bar0, bar1 ] = test.ranges(); const fooGroup = { definition: "function foo(a: number, b: number): number", ranges: [foo0, foo2] }; const exportDefaultGroup = { definition: "(alias) function foo(a: number, b: number): number\nexport default", ranges: [foo1] }; const barGroup = { definition: "(alias) function bar(a: number, b: number): number\nimport bar", ranges: [bar0, bar1]}; diff --git a/tests/cases/fourslash/findAllRefsImportEquals.ts b/tests/cases/fourslash/findAllRefsImportEquals.ts index c6884c78b8c..c085874d910 100644 --- a/tests/cases/fourslash/findAllRefsImportEquals.ts +++ b/tests/cases/fourslash/findAllRefsImportEquals.ts @@ -1,7 +1,7 @@ /// ////import j = N./**/ [|q|]; -////namespace N { export const [|{| "isWriteAccess": true, "isDefinition": true |}q|] = 0; } +////namespace N { [|export const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 1 |}q|] = 0;|] } goTo.marker(); -verify.referenceGroups("", [{ definition: "const N.q: 0", ranges: test.ranges() }]); +verify.referenceGroups("", [{ definition: "const N.q: 0", ranges: test.rangesByText().get("q") }]); diff --git a/tests/cases/fourslash/findAllRefsImportEqualsJsonFile.ts b/tests/cases/fourslash/findAllRefsImportEqualsJsonFile.ts index 3c3c0dbb2e4..7b6e0e5bbc0 100644 --- a/tests/cases/fourslash/findAllRefsImportEqualsJsonFile.ts +++ b/tests/cases/fourslash/findAllRefsImportEqualsJsonFile.ts @@ -5,11 +5,11 @@ // @resolveJsonModule: true // @Filename: /a.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}j|] = require("[|./j.json|]"); +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}j|] = require("[|./j.json|]");|] ////[|j|]; // @Filename: /b.js -////const [|{| "isWriteAccess": true, "isDefinition": true |}j|] = require("[|./j.json|]"); +////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}j|] = require("[|./j.json|]");|] ////[|j|]; // @Filename: /j.json @@ -17,7 +17,7 @@ verify.noErrors(); -const [r0, r1, r2, r3, r4, r5, r6] = test.ranges(); +const [r0Def, r0, r1, r2, r3Def, r3, r4, r5, r6] = test.ranges(); verify.singleReferenceGroup('import j = require("./j.json")', [r0, r2]); verify.referenceGroups([r1, r4], [{ definition: 'module "/j"', ranges: [r1, r4, r6] }]); verify.singleReferenceGroup('const j: {\n "x": number;\n}', [r3, r5]); diff --git a/tests/cases/fourslash/findAllRefsImportNamed.ts b/tests/cases/fourslash/findAllRefsImportNamed.ts index 5d18a8de164..50a88c2ed48 100644 --- a/tests/cases/fourslash/findAllRefsImportNamed.ts +++ b/tests/cases/fourslash/findAllRefsImportNamed.ts @@ -1,15 +1,15 @@ /// // @Filename: f.ts -////export { [|foo|] as [|{| "isWriteAccess": true, "isDefinition": true |}foo|] } -////function /*start*/[|{| "isWriteAccess": true, "isDefinition": true |}foo|](a: number, b: number) { } +////[|export { [|{| "declarationRangeIndex": 0 |}foo|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|] }|] +////[|function /*start*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}foo|](a: number, b: number) { }|] // @Filename: b.ts ////import x = require("./f"); ////x.[|foo|](1, 2); verify.noErrors(); -const [ foo0, foo1, foo2, foo3 ] = test.ranges(); +const [ foo0Def, foo0, foo1, foo2Def, foo2, foo3 ] = test.ranges(); const fooGroup = { definition: "function foo(a: number, b: number): void", ranges: [foo0, foo2] }; const exportFooGroup = { definition: "(alias) function foo(a: number, b: number): void\nexport foo", ranges: [foo1, foo3] }; verify.referenceGroups("start", [fooGroup, exportFooGroup]); diff --git a/tests/cases/fourslash/findAllRefsImportStarOfExportEquals.ts b/tests/cases/fourslash/findAllRefsImportStarOfExportEquals.ts index 7cab65bc388..56255873bc1 100644 --- a/tests/cases/fourslash/findAllRefsImportStarOfExportEquals.ts +++ b/tests/cases/fourslash/findAllRefsImportStarOfExportEquals.ts @@ -2,27 +2,26 @@ // @allowSyntheticDefaultimports: true // @Filename: /node_modules/a/index.d.ts -////declare function [|{| "isWriteAccess": true, "isDefinition": true |}a|](): void; -////declare namespace [|{| "isWriteAccess": true, "isDefinition": true |}a|] { +////[|declare function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}a|](): void;|] +////[|declare namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}a|] { //// export const x: number; -////} -////export = [|a|]; +////}|] +////[|export = [|{| "declarationRangeIndex": 4 |}a|];|] // Import with different name and we find local refs // @Filename: /b.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}b|] from "a"; +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}b|] from "a";|] ////[|b|](); ////[|b|].x; // Import with same name and we find all refs // @Filename: /c.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}a|] from "a"; +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 10 |}a|] from "a";|] ////[|a|](); ////[|a|].x; verify.noErrors(); -const ranges = test.ranges(); -const [a0, a1, a2, b0, b1, b2, c0, c1, c2] = ranges; +const [a0Def, a0, a1Def, a1, a2Def, a2, b0Def, b0, b1, b2, c0Def, c0, c1, c2] = test.ranges(); const aRanges = [a0, a1, a2]; const bRanges = [b0, b1, b2]; const cRanges = [c0, c1, c2]; diff --git a/tests/cases/fourslash/findAllRefsImportType.ts b/tests/cases/fourslash/findAllRefsImportType.ts index 9f1fa09436e..ad21110fa0f 100644 --- a/tests/cases/fourslash/findAllRefsImportType.ts +++ b/tests/cases/fourslash/findAllRefsImportType.ts @@ -4,9 +4,9 @@ // @Filename: /a.js ////module.exports = 0; -////export type [|{| "isWriteAccess": true, "isDefinition": true |}N|] = number; +////[|export type [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}N|] = number;|] // @Filename: /b.js ////type T = import("./a").[|N|]; -verify.singleReferenceGroup("type N = number"); +verify.singleReferenceGroup("type N = number", "N"); diff --git a/tests/cases/fourslash/findAllRefsInClassExpression.ts b/tests/cases/fourslash/findAllRefsInClassExpression.ts index 8adc64e8e6d..a6e6de3d1f1 100644 --- a/tests/cases/fourslash/findAllRefsInClassExpression.ts +++ b/tests/cases/fourslash/findAllRefsInClassExpression.ts @@ -1,11 +1,11 @@ /// -////interface I { [|{| "isDefinition": true |}boom|](): void; } +////interface I { [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}boom|](): void;|] } ////new class C implements I { -//// [|{| "isWriteAccess": true, "isDefinition": true |}boom|](){} +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}boom|](){}|] ////} -const [r0, r1] = test.ranges(); +const [r0Def, r0, r1Def, r1] = test.ranges(); verify.referenceGroups([r0, r1], [ { definition: "(method) I.boom(): void", ranges: [r0] }, { definition: "(method) C.boom(): void", ranges: [r1] } diff --git a/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts b/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts index 49dac247294..34a17d8306d 100644 --- a/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts +++ b/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts @@ -1,14 +1,13 @@ /// ////interface I { -//// [|{| "isDefinition": true |}0|]: number; -//// [|{| "isDefinition": true |}s|]: string; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}0|]: number;|] +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}s|]: string;|] ////} ////interface J { //// a: I[[|0|]], //// b: I["[|s|]"], ////} -const [n0, s0, n1, s1] = test.ranges(); -verify.singleReferenceGroup("(property) I[0]: number", [n0, n1]); -verify.singleReferenceGroup("(property) I.s: string", [s0, s1]); +verify.singleReferenceGroup("(property) I[0]: number", "0"); +verify.singleReferenceGroup("(property) I.s: string", "s"); diff --git a/tests/cases/fourslash/findAllRefsInheritedProperties1.ts b/tests/cases/fourslash/findAllRefsInheritedProperties1.ts index 9e58a37c589..42bf6bcb70a 100644 --- a/tests/cases/fourslash/findAllRefsInheritedProperties1.ts +++ b/tests/cases/fourslash/findAllRefsInheritedProperties1.ts @@ -1,14 +1,14 @@ /// //// class class1 extends class1 { -//// [|{| "isWriteAccess": true, "isDefinition": true |}doStuff|]() { } -//// [|{| "isDefinition": true |}propName|]: string; +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}doStuff|]() { }|] +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}propName|]: string;|] //// } //// //// var v: class1; //// v.[|doStuff|](); //// v.[|propName|]; -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2, r3] = test.ranges(); verify.singleReferenceGroup("(method) class1.doStuff(): void", [r0, r2]); verify.singleReferenceGroup("(property) class1.propName: string", [r1, r3]); diff --git a/tests/cases/fourslash/findAllRefsInheritedProperties2.ts b/tests/cases/fourslash/findAllRefsInheritedProperties2.ts index 2e776e48acd..3ba54ab0193 100644 --- a/tests/cases/fourslash/findAllRefsInheritedProperties2.ts +++ b/tests/cases/fourslash/findAllRefsInheritedProperties2.ts @@ -1,14 +1,14 @@ /// //// interface interface1 extends interface1 { -//// [|{| "isDefinition": true |}doStuff|](): void; // r0 -//// [|{| "isDefinition": true |}propName|]: string; // r1 +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}doStuff|](): void;|] // r0 +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}propName|]: string;|] // r1 //// } //// //// var v: interface1; //// v.[|doStuff|](); // r2 //// v.[|propName|]; // r3 -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2, r3] = test.ranges(); verify.singleReferenceGroup("(method) interface1.doStuff(): void", [r0, r2]); verify.singleReferenceGroup("(property) interface1.propName: string", [r1, r3]); diff --git a/tests/cases/fourslash/findAllRefsInheritedProperties3.ts b/tests/cases/fourslash/findAllRefsInheritedProperties3.ts index ea5b1ce7bf4..d7019164aeb 100644 --- a/tests/cases/fourslash/findAllRefsInheritedProperties3.ts +++ b/tests/cases/fourslash/findAllRefsInheritedProperties3.ts @@ -1,23 +1,23 @@ /// //// class class1 extends class1 { -//// [|{| "isWriteAccess": true, "isDefinition": true |}doStuff|]() { } // r0 -//// [|{| "isDefinition": true |}propName|]: string; // r1 +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}doStuff|]() { }|] // r0 +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}propName|]: string;|] // r1 //// } //// interface interface1 extends interface1 { -//// [|{| "isDefinition": true |}doStuff|](): void; // r2 -//// [|{| "isDefinition": true |}propName|]: string; // r3 +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 4 |}doStuff|](): void;|] // r2 +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 6 |}propName|]: string;|] // r3 //// } //// class class2 extends class1 implements interface1 { -//// [|{| "isWriteAccess": true, "isDefinition": true |}doStuff|]() { } // r4 -//// [|{| "isDefinition": true |}propName|]: string; // r5 +//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 8 |}doStuff|]() { }|] // r4 +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 10 |}propName|]: string;|] // r5 //// } //// //// var v: class2; //// v.[|doStuff|](); // r6 //// v.[|propName|]; // r7 -const [r0, r1, r2, r3, r4, r5, r6, r7] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4Def, r4, r5Def, r5, r6, r7] = test.ranges(); verify.referenceGroups(r0, [ { definition: "(method) class1.doStuff(): void", ranges: [r0] }, { definition: "(method) class2.doStuff(): void", ranges: [r4, r6] }, diff --git a/tests/cases/fourslash/findAllRefsInheritedProperties4.ts b/tests/cases/fourslash/findAllRefsInheritedProperties4.ts index 2528fef1939..fde757d28d3 100644 --- a/tests/cases/fourslash/findAllRefsInheritedProperties4.ts +++ b/tests/cases/fourslash/findAllRefsInheritedProperties4.ts @@ -1,19 +1,19 @@ /// //// interface C extends D { -//// [|{| "isDefinition": true |}prop0|]: string; // r0 -//// [|{| "isDefinition": true |}prop1|]: number; // r1 +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}prop0|]: string;|] // r0 +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}prop1|]: number;|] // r1 //// } //// //// interface D extends C { -//// [|{| "isDefinition": true |}prop0|]: string; // r2 +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 4 |}prop0|]: string;|] // r2 //// } //// //// var d: D; //// d.[|prop0|]; // r3 //// d.[|prop1|]; // r4 -const [r0, r1, r2, r3, r4] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3, r4] = test.ranges(); verify.referenceGroups([r0, r2, r3], [ { definition: "(property) C.prop0: string", ranges: [r0] }, { definition: "(property) D.prop0: string", ranges: [r2, r3] } diff --git a/tests/cases/fourslash/findAllRefsInheritedProperties5.ts b/tests/cases/fourslash/findAllRefsInheritedProperties5.ts index 343328405d5..e917871f465 100644 --- a/tests/cases/fourslash/findAllRefsInheritedProperties5.ts +++ b/tests/cases/fourslash/findAllRefsInheritedProperties5.ts @@ -1,19 +1,19 @@ /// //// class C extends D { -//// [|{| "isDefinition": true |}prop0|]: string; // r0 -//// [|{| "isDefinition": true |}prop1|]: number; // r1 +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}prop0|]: string;|] // r0 +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 2 |}prop1|]: number;|] // r1 //// } //// //// class D extends C { -//// [|{| "isDefinition": true |}prop0|]: string; // r2 +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 4 |}prop0|]: string;|] // r2 //// } //// //// var d: D; //// d.[|prop0|]; // r3 //// d.[|prop1|]; // r4 -const [r0, r1, r2, r3, r4] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3, r4] = test.ranges(); verify.singleReferenceGroup("(property) C.prop0: string", [r0]); verify.singleReferenceGroup("(property) C.prop1: number", [r1]); verify.singleReferenceGroup("(property) D.prop0: string", [r2, r3]); diff --git a/tests/cases/fourslash/findAllRefsInsideTemplates1.ts b/tests/cases/fourslash/findAllRefsInsideTemplates1.ts index 8d41961c6fd..44ad694d9bc 100644 --- a/tests/cases/fourslash/findAllRefsInsideTemplates1.ts +++ b/tests/cases/fourslash/findAllRefsInsideTemplates1.ts @@ -1,6 +1,6 @@ /// -////var [|{| "isWriteAccess": true, "isDefinition": true |}x|] = 10; +////[|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] = 10;|] ////var y = `${ [|x|] } ${ [|x|] }` -verify.singleReferenceGroup("var x: number"); +verify.singleReferenceGroup("var x: number", "x"); diff --git a/tests/cases/fourslash/findAllRefsInsideTemplates2.ts b/tests/cases/fourslash/findAllRefsInsideTemplates2.ts index 24a4a7c131b..09475e4cead 100644 --- a/tests/cases/fourslash/findAllRefsInsideTemplates2.ts +++ b/tests/cases/fourslash/findAllRefsInsideTemplates2.ts @@ -1,6 +1,6 @@ /// -////function [|{| "isWriteAccess": true, "isDefinition": true |}f|](...rest: any[]) { } +////[|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}f|](...rest: any[]) { }|] ////[|f|] `${ [|f|] } ${ [|f|] }` -verify.singleReferenceGroup("function f(...rest: any[]): void"); +verify.singleReferenceGroup("function f(...rest: any[]): void", "f"); diff --git a/tests/cases/fourslash/findAllRefsInsideWithBlock.ts b/tests/cases/fourslash/findAllRefsInsideWithBlock.ts index 52936248095..c31ab04376d 100644 --- a/tests/cases/fourslash/findAllRefsInsideWithBlock.ts +++ b/tests/cases/fourslash/findAllRefsInsideWithBlock.ts @@ -1,6 +1,6 @@ /// -////var [|{| "isWriteAccess": true, "isDefinition": true |}x|] = 0; +////[|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] = 0;|] //// ////with ({}) { //// var y = x; // Reference of x here should not be picked @@ -9,4 +9,4 @@ //// ////[|{| "isWriteAccess": true |}x|] = [|x|] + 1; -verify.singleReferenceGroup("var x: number"); +verify.singleReferenceGroup("var x: number", "x"); diff --git a/tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts b/tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts index a2d0cad3886..f03511adf51 100644 --- a/tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts +++ b/tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts @@ -5,7 +5,7 @@ // @allowJs: true // @Filename: /a.js -/////** @typedef {number} [|{| "isWriteAccess": true, "isDefinition": true |}T|] */ +/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}T|]|] */ //// /////** //// * @return {[|T|]} @@ -17,4 +17,4 @@ //// */ ////function f2(obj) { return 0; } -verify.singleReferenceGroup("type T = number"); +verify.singleReferenceGroup("type T = number", "T"); diff --git a/tests/cases/fourslash/findAllRefsMappedType.ts b/tests/cases/fourslash/findAllRefsMappedType.ts index 8c6c59150af..21090b0f32b 100644 --- a/tests/cases/fourslash/findAllRefsMappedType.ts +++ b/tests/cases/fourslash/findAllRefsMappedType.ts @@ -1,10 +1,10 @@ /// -////interface T { [|{| "isDefinition": true |}a|]: number; } +////interface T { [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}a|]: number;|] } ////type U = { readonly [K in keyof T]?: string }; ////declare const t: T; ////t.[|a|]; ////declare const u: U; ////u.[|a|]; -verify.singleReferenceGroup("(property) T.a: number"); +verify.singleReferenceGroup("(property) T.a: number", "a"); diff --git a/tests/cases/fourslash/findAllRefsModuleAugmentation.ts b/tests/cases/fourslash/findAllRefsModuleAugmentation.ts index c5adab35669..df8fb0ed615 100644 --- a/tests/cases/fourslash/findAllRefsModuleAugmentation.ts +++ b/tests/cases/fourslash/findAllRefsModuleAugmentation.ts @@ -1,7 +1,7 @@ /// // @Filename: /node_modules/foo/index.d.ts -////export type [|{| "isWriteAccess": true, "isDefinition": true |}T|] = number; +////[|export type [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}T|] = number;|] // @Filename: /a.ts ////import * as foo from "foo"; @@ -10,4 +10,4 @@ ////} verify.noErrors(); -verify.singleReferenceGroup("type T = number"); +verify.singleReferenceGroup("type T = number", "T"); diff --git a/tests/cases/fourslash/findAllRefsModuleDotExports.ts b/tests/cases/fourslash/findAllRefsModuleDotExports.ts index bc1bd705c2f..ca30b341b90 100644 --- a/tests/cases/fourslash/findAllRefsModuleDotExports.ts +++ b/tests/cases/fourslash/findAllRefsModuleDotExports.ts @@ -6,6 +6,7 @@ ////const b = require("[|./b|]"); // @Filename: /b.js -////[|module|].exports = 0; +////[|[|{| "declarationRangeIndex": 1 |}module|].exports = 0;|] -verify.singleReferenceGroup('module "/b"') +const [r0, rDef, r1] = test.ranges(); +verify.singleReferenceGroup('module "/b"', [r0, r1]); diff --git a/tests/cases/fourslash/findAllRefsNoImportClause.ts b/tests/cases/fourslash/findAllRefsNoImportClause.ts index b98f5d02d01..fc133afc4d8 100644 --- a/tests/cases/fourslash/findAllRefsNoImportClause.ts +++ b/tests/cases/fourslash/findAllRefsNoImportClause.ts @@ -3,9 +3,9 @@ // https://github.com/Microsoft/TypeScript/issues/15452 // @Filename: /a.ts -////export const [|{| "isWriteAccess": true, "isDefinition": true |}x|] = 0; +////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] = 0;|] // @Filename: /b.ts ////import "./a"; -verify.singleReferenceGroup("const x: 0"); +verify.singleReferenceGroup("const x: 0", "x"); diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts index 5a72ca1c1ec..404acea3ca4 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts @@ -1,11 +1,11 @@ /// ////interface I { -//// [|{| "isDefinition": true |}property1|]: number; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}property1|]: number;|] //// property2: string; ////} //// ////var foo: I; -////var { [|property1|]: prop1 } = foo; +////[|var { [|{| "declarationRangeIndex": 2 |}property1|]: prop1 } = foo;|] -verify.singleReferenceGroup("(property) I.property1: number"); +verify.singleReferenceGroup("(property) I.property1: number", "property1"); diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts index 76b6d046b8e..95bfdc51d82 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts @@ -1,11 +1,11 @@ /// ////interface I { -//// [|{| "isDefinition": true |}property1|]: number; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}property1|]: number;|] //// property2: string; ////} //// ////var foo: I; -////var { [|property1|]: {} } = foo; +////[|var { [|{| "declarationRangeIndex": 2 |}property1|]: {} } = foo;|] -verify.singleReferenceGroup("(property) I.property1: number"); +verify.singleReferenceGroup("(property) I.property1: number", "property1"); diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName03.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName03.ts index f82eca087bb..aa209d15b54 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName03.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName03.ts @@ -1,16 +1,18 @@ /// ////interface I { -//// [|{| "isDefinition": true |}property1|]: number; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}property1|]: number;|] //// property2: string; ////} //// ////var foo: I; -////var [{ [|property1|]: prop1 }, { [|{| "isWriteAccess": true, "isDefinition": true |}property1|], property2 } ] = [foo, foo]; +////[|var [{ [|{| "declarationRangeIndex": 2 |}property1|]: prop1 }, { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}property1|], property2 } ] = [foo, foo];|] -const ranges = test.ranges(); -const [r0, r1, r2] = ranges; -verify.referenceGroups([r0, r1], [{ definition: "(property) I.property1: number", ranges }]); +const [r0Def, r0, r1Def, r1, r2] = test.ranges(); +verify.referenceGroups([r0, r1], [{ + definition: "(property) I.property1: number", + ranges: [r0, r1, r2] +}]); verify.referenceGroups(r2, [ { definition: "(property) I.property1: number", ranges: [r0, r1] }, { definition: "var property1: number", ranges: [r2] } diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName04.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName04.ts index c3bebdb2623..b3fc306e47b 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName04.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName04.ts @@ -1,19 +1,18 @@ /// ////interface I { -//// [|{| "isDefinition": true |}property1|]: number; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}property1|]: number;|] //// property2: string; ////} //// -////function f({ [|property1|]: p1 }: I, -//// { [|{| "isWriteAccess": true, "isDefinition": true |}property1|] }: I, +////function f([|{ [|{| "declarationRangeIndex": 2 |}property1|]: p1 }: I|], +//// [|{ [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}property1|] }: I|], //// { property1: p2 }) { //// //// return [|property1|] + 1; ////} -const ranges = test.ranges(); -const [r0, r1, r2, r3] = ranges; +const [r0Def, r0, r1Def, r1, r2Def, r2, r3] = test.ranges(); verify.referenceGroups([r0, r1], [{ definition: "(property) I.property1: number", ranges: [r0, r1, r2] }]); verify.referenceGroups(r2, [ { definition: "(property) I.property1: number", ranges: [r0, r1] }, diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName06.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName06.ts index 62d1637f3b3..2cf78e46c96 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName06.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName06.ts @@ -1,24 +1,26 @@ /// ////interface I { -//// [|{| "isDefinition": true |}property1|]: number; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}property1|]: number;|] //// property2: string; ////} //// ////var elems: I[]; -////for (let { [|property1|]: p } of elems) { +////for ([|let { [|{| "declarationRangeIndex": 2 |}property1|]: p } of elems|]) { ////} -////for (let { [|{| "isWriteAccess": true, "isDefinition": true |}property1|] } of elems) { +////for ([|let { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}property1|] } of elems|]) { ////} -////for (var { [|property1|]: p1 } of elems) { +////for ([|var { [|{| "declarationRangeIndex": 6 |}property1|]: p1 } of elems|]) { ////} ////var p2; -////for ({ [|{| "isWriteAccess": true, "isDefinition": true |}property1|] : p2 } of elems) { +////for ([|{ [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 8 |}property1|] : p2 } of elems|]) { ////} -const ranges = test.ranges(); -const [r0, r1, r2, r3, r4] = ranges; -verify.referenceGroups([r0, r1, r3, r4], [{ definition: "(property) I.property1: number", ranges }]); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4Def, r4] = test.ranges(); +verify.referenceGroups([r0, r1, r3, r4], [{ + definition: "(property) I.property1: number", + ranges: [r0, r1, r2, r3, r4] +}]); verify.referenceGroups(r2, [ { definition: "(property) I.property1: number", ranges: [r0, r1, r3, r4] }, { definition: "let property1: number", ranges: [r2] } diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName07.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName07.ts index 18fa4e43273..318f26dc864 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName07.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName07.ts @@ -2,6 +2,6 @@ ////let p, b; //// -////p, [{ [|{| "isDefinition": true |}a|]: p, b }] = [{ [|{| "isWriteAccess": true, "isDefinition": true |}a|]: 10, b: true }]; +////p, [|[{ [|{| "isDefinition": true, "declarationRangeIndex": 0 |}a|]: p, b }] = [{ [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}a|]: 10|], b: true }]|]; -verify.singleReferenceGroup("(property) a: any"); +verify.singleReferenceGroup("(property) a: any", "a"); diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts index 7d31cfd4345..37c3a6ab0e1 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts @@ -1,11 +1,11 @@ /// ////interface Recursive { -//// [|{| "isDefinition": true |}next|]?: Recursive; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}next|]?: Recursive;|] //// value: any; ////} //// -////function f ({ [|next|]: { [|next|]: x} }: Recursive) { +////function f ([|{ [|{| "declarationRangeIndex": 2 |}next|]: { [|{| "declarationRangeIndex": 2 |}next|]: x} }: Recursive|]) { ////} -verify.singleReferenceGroup("(property) Recursive.next?: Recursive"); +verify.singleReferenceGroup("(property) Recursive.next?: Recursive", "next"); diff --git a/tests/cases/fourslash/findAllRefsOfConstructor.ts b/tests/cases/fourslash/findAllRefsOfConstructor.ts index 08846380749..26611ef9a03 100644 --- a/tests/cases/fourslash/findAllRefsOfConstructor.ts +++ b/tests/cases/fourslash/findAllRefsOfConstructor.ts @@ -2,13 +2,13 @@ ////class A { -//// [|constructor|](s: string) {} +//// [|[|{| "declarationRangeIndex": 0 |}constructor|](s: string) {}|] ////} ////class B extends A { } ////class C extends B { -//// [|constructor|]() { +//// [|[|{| "declarationRangeIndex": 2 |}constructor|]() { //// [|super|](""); -//// } +//// }|] ////} ////class D extends B { } ////class E implements A { } @@ -19,7 +19,7 @@ ////const e = new E(); verify.noErrors(); -const [aCtr, cCtr, cSuper, aNew, bNew, cNew, dNew] = test.ranges(); +const [aCtrDef, aCtr, cCtrDef, cCtr, cSuper, aNew, bNew, cNew, dNew] = test.ranges(); verify.referenceGroups(aCtr, [ { definition: "class A", ranges: [aCtr, aNew] }, { definition: "class B", ranges: [cSuper, bNew]}, diff --git a/tests/cases/fourslash/findAllRefsOfConstructor2.ts b/tests/cases/fourslash/findAllRefsOfConstructor2.ts index 17991cb555c..c51c7a1c098 100644 --- a/tests/cases/fourslash/findAllRefsOfConstructor2.ts +++ b/tests/cases/fourslash/findAllRefsOfConstructor2.ts @@ -2,15 +2,15 @@ ////class A { -//// [|constructor|](s: string) {} +//// [|[|{| "declarationRangeIndex": 0 |}constructor|](s: string) {}|] ////} ////class B extends A { -//// [|constructor|]() { [|super|](""); } +//// [|[|{| "declarationRangeIndex": 2 |}constructor|]() { [|super|](""); }|] ////} ////class C extends B { -//// [|constructor|]() { +//// [|[|{| "declarationRangeIndex": 5 |}constructor|]() { //// [|super|](); -//// } +//// }|] ////} ////class D extends B { } ////const a = new [|A|]("a"); @@ -19,7 +19,7 @@ ////const d = new [|D|](); verify.noErrors(); -const [aCtr, bCtr, bSuper, cCtr, cSuper, aNew, bNew, cNew, dNew] = test.ranges(); +const [aCtrDef, aCtr, bCtrDef, bCtr, bSuper, cCtrDef, cCtr, cSuper, aNew, bNew, cNew, dNew] = test.ranges(); verify.referenceGroups(aCtr, [{ definition: "class A", ranges: [aCtr, bSuper, aNew] }]); verify.referenceGroups(bCtr, [{ definition: "class B", ranges: [bCtr, cSuper, bNew]}, { definition: "class D", ranges: [dNew]}]); verify.referenceGroups(cCtr, [{ definition: "class C", ranges: [cCtr, cNew]}]); \ No newline at end of file diff --git a/tests/cases/fourslash/findAllRefsOfConstructor_multipleFiles.ts b/tests/cases/fourslash/findAllRefsOfConstructor_multipleFiles.ts index a20d9fc1f29..9e2681a2249 100644 --- a/tests/cases/fourslash/findAllRefsOfConstructor_multipleFiles.ts +++ b/tests/cases/fourslash/findAllRefsOfConstructor_multipleFiles.ts @@ -3,26 +3,26 @@ // @Filename: f.ts ////class A { -//// [|constructor|](s: string) {} +//// [|[|{| "declarationRangeIndex": 0 |}constructor|](s: string) {}|] ////} ////class B extends A { } -////export { [|{| "isWriteAccess": true, "isDefinition": true |}A|], [|{| "isWriteAccess": true, "isDefinition": true |}B|] }; +////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}A|], [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}B|] };|] // @Filename: a.ts -////import { [|A|] as A1 } from "./f"; +////[|import { [|{| "declarationRangeIndex": 5 |}A|] as A1 } from "./f";|] ////const a1 = new [|A1|]("a1"); ////export default class extends A1 { } -////export { [|B|] as [|{| "isWriteAccess": true, "isDefinition": true |}B1|] } from "./f"; +////[|export { [|{| "declarationRangeIndex": 8 |}B|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 8 |}B1|] } from "./f";|] // @Filename: b.ts -////import [|B|], { B1 } from "./a"; +////[|import [|{| "declarationRangeIndex": 11 |}B|], { B1 } from "./a";|] ////const d = new [|B|]("b"); ////const d1 = new [|B1|]("b1"); verify.noErrors(); -const [aCtr, aExport, bExport, aImport, a1New, bReExport, b1Export, bDefault, bNew, b1New ] = test.ranges(); +const [aCtrDef, aCtr, exportDef, aExport, bExport, aImportDef, aImport, a1New, reExportDef, bReExport, b1Export, bDefaultDef, bDefault, bNew, b1New ] = test.ranges(); verify.referenceGroups(aCtr, [ { definition: "class A", ranges: [aCtr, aExport] }, { definition: "class B", ranges: [bExport]}, diff --git a/tests/cases/fourslash/findAllRefsOfConstructor_withModifier.ts b/tests/cases/fourslash/findAllRefsOfConstructor_withModifier.ts index c425029490f..0bbc5024345 100644 --- a/tests/cases/fourslash/findAllRefsOfConstructor_withModifier.ts +++ b/tests/cases/fourslash/findAllRefsOfConstructor_withModifier.ts @@ -1,9 +1,9 @@ /// ////class X { -//// public [|constructor|]() {} +//// [|public [|{| "declarationRangeIndex": 0 |}constructor|]() {}|] ////} ////var x = new [|X|](); -const ranges = test.ranges(); +const [rDef, ...ranges] = test.ranges(); verify.referenceGroups(ranges[0], [{ definition: "class X", ranges }]); From 96a250502c2d11879d20741fe1864e18144ecd7e Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 5 Jun 2019 16:12:21 -0700 Subject: [PATCH 242/384] Deleting a branch that does not exist does not work (we should never download the ref anyway) --- scripts/update-experimental-branches.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/update-experimental-branches.js b/scripts/update-experimental-branches.js index 4a496bbf783..07b089433ea 100644 --- a/scripts/update-experimental-branches.js +++ b/scripts/update-experimental-branches.js @@ -71,7 +71,6 @@ async function main() { // Return to `master` and make a new `experimental` branch runSequence([ ["git", ["checkout", "master"]], - ["git", ["branch", "-D", "experimental"]], ["git", ["checkout", "-b", "experimental"]], ]); From e6fde9e8094ca8553fcbb24ca34ca77f12349c3e Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 5 Jun 2019 16:24:02 -0700 Subject: [PATCH 243/384] Taking typos out one line at a time --- scripts/update-experimental-branches.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-experimental-branches.js b/scripts/update-experimental-branches.js index 07b089433ea..b734c8a6fd8 100644 --- a/scripts/update-experimental-branches.js +++ b/scripts/update-experimental-branches.js @@ -84,7 +84,7 @@ async function main() { const mergeTree = runSequence([ ["git", ["merge-tree", mergeBase.trim(), branch, "experimental"]] ]); - if (mergeTree.indexOf(`===${"="}===`)) { // 7 equals is the center of the merge conflict marker + if (mergeTree.indexOf(`===${"="}===`) >= 0) { // 7 equals is the center of the merge conflict marker throw new Error(`Merge conflict detected involving PR ${branch} with other experiment`); } // Merge (always producing a merge commit) From 1163a93ed6af2e31cc8c2908f114a8396689212c Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 5 Jun 2019 16:26:04 -0700 Subject: [PATCH 244/384] Handle default keyword of default export --- src/services/findAllReferences.ts | 7 ++++++- tests/cases/fourslash/findAllRefsForDefaultExport04.ts | 8 ++++---- .../fourslash/findAllRefsForDefaultExportAnonymous.ts | 6 +++--- .../fourslash/findAllRefsForDefaultExport_anonymous.ts | 6 +++--- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 14e47b2c4d1..62191137f25 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -79,7 +79,12 @@ namespace ts.FindAllReferences { // Property name of the import export specifier or binding pattern, use parent ((isImportOrExportSpecifier(node.parent) || isBindingElement(node.parent)) && node.parent.propertyName === node) || - isExportAssignment(node.parent) && node.parent.expression === node) { + isExportAssignment(node.parent) && ( + node.parent.expression === node || + (!node.parent.isExportEquals && node.kind === SyntaxKind.DefaultKeyword) + ) || + // Is default export + (node.kind === SyntaxKind.DefaultKeyword && hasModifier(node.parent, ModifierFlags.ExportDefault))) { return getDeclarationForDeclarationSpan(node.parent); } diff --git a/tests/cases/fourslash/findAllRefsForDefaultExport04.ts b/tests/cases/fourslash/findAllRefsForDefaultExport04.ts index 279f2bd1e81..aa10ab1d59d 100644 --- a/tests/cases/fourslash/findAllRefsForDefaultExport04.ts +++ b/tests/cases/fourslash/findAllRefsForDefaultExport04.ts @@ -1,14 +1,14 @@ /// // @Filename: /a.ts -////const [|{| "isWriteAccess": true, "isDefinition": true |}a|] = 0; -////export [|{| "isWriteAccess": true, "isDefinition": true |}default|] [|a|]; +////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}a|] = 0;|] +////[|export [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}default|] [|{| "declarationRangeIndex": 2 |}a|];|] // @Filename: /b.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}a|] from "./a"; +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}a|] from "./a";|] ////[|a|]; -const [r0, r1, r2, r3, r4] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2, r3Def, r3, r4] = test.ranges(); verify.referenceGroups([r0, r2], [ { definition: "const a: 0", ranges: [r0, r2] }, { definition: "(alias) const a: 0\nimport a", ranges: [r3, r4] } diff --git a/tests/cases/fourslash/findAllRefsForDefaultExportAnonymous.ts b/tests/cases/fourslash/findAllRefsForDefaultExportAnonymous.ts index 3beb5b59424..1820624374d 100644 --- a/tests/cases/fourslash/findAllRefsForDefaultExportAnonymous.ts +++ b/tests/cases/fourslash/findAllRefsForDefaultExportAnonymous.ts @@ -1,12 +1,12 @@ /// // @Filename: /a.ts -////export [|{| "isWriteAccess": true, "isDefinition": true |}default|] function() {} +////[|export [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}default|] function() {}|] // @Filename: /b.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}f|] from "./a"; +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}f|] from "./a";|] -const [r0, r1] = test.ranges(); +const [r0Def, r0, r1Def, r1] = test.ranges(); verify.referenceGroups(r0, [ { definition: "function default(): void", ranges: [r0] }, { definition: "import f", ranges: [r1] }, diff --git a/tests/cases/fourslash/findAllRefsForDefaultExport_anonymous.ts b/tests/cases/fourslash/findAllRefsForDefaultExport_anonymous.ts index 058bc419986..778203c1bcd 100644 --- a/tests/cases/fourslash/findAllRefsForDefaultExport_anonymous.ts +++ b/tests/cases/fourslash/findAllRefsForDefaultExport_anonymous.ts @@ -1,12 +1,12 @@ /// // @Filename: /a.ts -////export [|{| "isDefinition": true, "isWriteAccess": true |}default|] 1; +////[|export [|{| "isDefinition": true, "isWriteAccess": true, "declarationRangeIndex": 0 |}default|] 1;|] // @Filename: /b.ts -////import [|{| "isDefinition": true, "isWriteAccess": true |}a|] from "./a"; +////[|import [|{| "isDefinition": true, "isWriteAccess": true, "declarationRangeIndex": 2 |}a|] from "./a";|] -const [r0, r1] = test.ranges(); +const [r0Def, r0, r1Def, r1] = test.ranges(); verify.referenceGroups(r0, [ { definition: "(property) default: 1", ranges: [r0] }, { definition: "import a", ranges: [r1] }, From 5ad46b180b0ec0b1b51df234acf0d5ededf457c3 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 5 Jun 2019 16:53:42 -0700 Subject: [PATCH 245/384] Fix minor issue --- src/compiler/checker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 01cb7c9fea2..f2a34ae9a1a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6444,7 +6444,8 @@ namespace ts { for (const declaration of symbol.declarations) { if (declaration.kind === SyntaxKind.EnumDeclaration) { for (const member of (declaration).members) { - const memberType = getFreshTypeOfLiteralType(getLiteralType(getEnumMemberValue(member) || 0, enumCount, getSymbolOfNode(member))); + const value = getEnumMemberValue(member); + const memberType = getFreshTypeOfLiteralType(getLiteralType(value !== undefined ? value : 0, enumCount, getSymbolOfNode(member))); getSymbolLinks(getSymbolOfNode(member)).declaredType = memberType; memberTypeList.push(getRegularTypeOfLiteralType(memberType)); } From f8aaccdd1d64dca3e3d99a02643264b9f17a05e7 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 5 Jun 2019 16:55:08 -0700 Subject: [PATCH 246/384] Add tests --- tests/cases/compiler/numericEnumMappedType.ts | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/cases/compiler/numericEnumMappedType.ts diff --git a/tests/cases/compiler/numericEnumMappedType.ts b/tests/cases/compiler/numericEnumMappedType.ts new file mode 100644 index 00000000000..be29167bb3d --- /dev/null +++ b/tests/cases/compiler/numericEnumMappedType.ts @@ -0,0 +1,38 @@ +// @strict: true + +// Repro from #31771 + +enum E1 { ONE, TWO, THREE } +declare enum E2 { ONE, TWO, THREE } + +type Bins1 = { [k in E1]?: string; } +type Bins2 = { [k in E2]?: string; } + +const b1: Bins1 = {}; +const b2: Bins2 = {}; + +const e1: E1 = E1.ONE; +const e2: E2 = E2.ONE; + +b1[1] = "a"; +b1[e1] = "b"; + +b2[1] = "a"; +b2[e2] = "b"; + +// Multiple numeric enum types accrue to the same numeric index signature in a mapped type + +declare function val(): number; + +enum N1 { A = val(), B = val() } +enum N2 { C = val(), D = val() } + +type T1 = { [K in N1 | N2]: K }; + +// Enum types with string valued members are always literal enum types and therefore +// ONE and TWO below are not computed members but rather just numerically valued members +// with auto-incremented values. + +declare enum E { ONE, TWO, THREE = 'x' } +const e: E = E.ONE; +const x: E.ONE = e; From fb8216bca024b7a37b7643472942901936886aa2 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 5 Jun 2019 16:55:16 -0700 Subject: [PATCH 247/384] Accept new baselines --- .../reference/numericEnumMappedType.js | 68 ++++++++++ .../reference/numericEnumMappedType.symbols | 111 +++++++++++++++++ .../reference/numericEnumMappedType.types | 117 ++++++++++++++++++ 3 files changed, 296 insertions(+) create mode 100644 tests/baselines/reference/numericEnumMappedType.js create mode 100644 tests/baselines/reference/numericEnumMappedType.symbols create mode 100644 tests/baselines/reference/numericEnumMappedType.types diff --git a/tests/baselines/reference/numericEnumMappedType.js b/tests/baselines/reference/numericEnumMappedType.js new file mode 100644 index 00000000000..555ec9712db --- /dev/null +++ b/tests/baselines/reference/numericEnumMappedType.js @@ -0,0 +1,68 @@ +//// [numericEnumMappedType.ts] +// Repro from #31771 + +enum E1 { ONE, TWO, THREE } +declare enum E2 { ONE, TWO, THREE } + +type Bins1 = { [k in E1]?: string; } +type Bins2 = { [k in E2]?: string; } + +const b1: Bins1 = {}; +const b2: Bins2 = {}; + +const e1: E1 = E1.ONE; +const e2: E2 = E2.ONE; + +b1[1] = "a"; +b1[e1] = "b"; + +b2[1] = "a"; +b2[e2] = "b"; + +// Multiple numeric enum types accrue to the same numeric index signature in a mapped type + +declare function val(): number; + +enum N1 { A = val(), B = val() } +enum N2 { C = val(), D = val() } + +type T1 = { [K in N1 | N2]: K }; + +// Enum types with string valued members are always literal enum types and therefore +// ONE and TWO below are not computed members but rather just numerically valued members +// with auto-incremented values. + +declare enum E { ONE, TWO, THREE = 'x' } +const e: E = E.ONE; +const x: E.ONE = e; + + +//// [numericEnumMappedType.js] +"use strict"; +// Repro from #31771 +var E1; +(function (E1) { + E1[E1["ONE"] = 0] = "ONE"; + E1[E1["TWO"] = 1] = "TWO"; + E1[E1["THREE"] = 2] = "THREE"; +})(E1 || (E1 = {})); +var b1 = {}; +var b2 = {}; +var e1 = E1.ONE; +var e2 = E2.ONE; +b1[1] = "a"; +b1[e1] = "b"; +b2[1] = "a"; +b2[e2] = "b"; +var N1; +(function (N1) { + N1[N1["A"] = val()] = "A"; + N1[N1["B"] = val()] = "B"; +})(N1 || (N1 = {})); +var N2; +(function (N2) { + N2[N2["C"] = val()] = "C"; + N2[N2["D"] = val()] = "D"; +})(N2 || (N2 = {})); +var e = E.ONE; +var x = e; diff --git a/tests/baselines/reference/numericEnumMappedType.symbols b/tests/baselines/reference/numericEnumMappedType.symbols new file mode 100644 index 00000000000..08979b3bed1 --- /dev/null +++ b/tests/baselines/reference/numericEnumMappedType.symbols @@ -0,0 +1,111 @@ +=== tests/cases/compiler/numericEnumMappedType.ts === +// Repro from #31771 + +enum E1 { ONE, TWO, THREE } +>E1 : Symbol(E1, Decl(numericEnumMappedType.ts, 0, 0)) +>ONE : Symbol(E1.ONE, Decl(numericEnumMappedType.ts, 2, 9)) +>TWO : Symbol(E1.TWO, Decl(numericEnumMappedType.ts, 2, 14)) +>THREE : Symbol(E1.THREE, Decl(numericEnumMappedType.ts, 2, 19)) + +declare enum E2 { ONE, TWO, THREE } +>E2 : Symbol(E2, Decl(numericEnumMappedType.ts, 2, 27)) +>ONE : Symbol(E2.ONE, Decl(numericEnumMappedType.ts, 3, 17)) +>TWO : Symbol(E2.TWO, Decl(numericEnumMappedType.ts, 3, 22)) +>THREE : Symbol(E2.THREE, Decl(numericEnumMappedType.ts, 3, 27)) + +type Bins1 = { [k in E1]?: string; } +>Bins1 : Symbol(Bins1, Decl(numericEnumMappedType.ts, 3, 35)) +>k : Symbol(k, Decl(numericEnumMappedType.ts, 5, 16)) +>E1 : Symbol(E1, Decl(numericEnumMappedType.ts, 0, 0)) + +type Bins2 = { [k in E2]?: string; } +>Bins2 : Symbol(Bins2, Decl(numericEnumMappedType.ts, 5, 36)) +>k : Symbol(k, Decl(numericEnumMappedType.ts, 6, 16)) +>E2 : Symbol(E2, Decl(numericEnumMappedType.ts, 2, 27)) + +const b1: Bins1 = {}; +>b1 : Symbol(b1, Decl(numericEnumMappedType.ts, 8, 5)) +>Bins1 : Symbol(Bins1, Decl(numericEnumMappedType.ts, 3, 35)) + +const b2: Bins2 = {}; +>b2 : Symbol(b2, Decl(numericEnumMappedType.ts, 9, 5)) +>Bins2 : Symbol(Bins2, Decl(numericEnumMappedType.ts, 5, 36)) + +const e1: E1 = E1.ONE; +>e1 : Symbol(e1, Decl(numericEnumMappedType.ts, 11, 5)) +>E1 : Symbol(E1, Decl(numericEnumMappedType.ts, 0, 0)) +>E1.ONE : Symbol(E1.ONE, Decl(numericEnumMappedType.ts, 2, 9)) +>E1 : Symbol(E1, Decl(numericEnumMappedType.ts, 0, 0)) +>ONE : Symbol(E1.ONE, Decl(numericEnumMappedType.ts, 2, 9)) + +const e2: E2 = E2.ONE; +>e2 : Symbol(e2, Decl(numericEnumMappedType.ts, 12, 5)) +>E2 : Symbol(E2, Decl(numericEnumMappedType.ts, 2, 27)) +>E2.ONE : Symbol(E2.ONE, Decl(numericEnumMappedType.ts, 3, 17)) +>E2 : Symbol(E2, Decl(numericEnumMappedType.ts, 2, 27)) +>ONE : Symbol(E2.ONE, Decl(numericEnumMappedType.ts, 3, 17)) + +b1[1] = "a"; +>b1 : Symbol(b1, Decl(numericEnumMappedType.ts, 8, 5)) +>1 : Symbol(1) + +b1[e1] = "b"; +>b1 : Symbol(b1, Decl(numericEnumMappedType.ts, 8, 5)) +>e1 : Symbol(e1, Decl(numericEnumMappedType.ts, 11, 5)) + +b2[1] = "a"; +>b2 : Symbol(b2, Decl(numericEnumMappedType.ts, 9, 5)) + +b2[e2] = "b"; +>b2 : Symbol(b2, Decl(numericEnumMappedType.ts, 9, 5)) +>e2 : Symbol(e2, Decl(numericEnumMappedType.ts, 12, 5)) + +// Multiple numeric enum types accrue to the same numeric index signature in a mapped type + +declare function val(): number; +>val : Symbol(val, Decl(numericEnumMappedType.ts, 18, 13)) + +enum N1 { A = val(), B = val() } +>N1 : Symbol(N1, Decl(numericEnumMappedType.ts, 22, 31)) +>A : Symbol(N1.A, Decl(numericEnumMappedType.ts, 24, 9)) +>val : Symbol(val, Decl(numericEnumMappedType.ts, 18, 13)) +>B : Symbol(N1.B, Decl(numericEnumMappedType.ts, 24, 20)) +>val : Symbol(val, Decl(numericEnumMappedType.ts, 18, 13)) + +enum N2 { C = val(), D = val() } +>N2 : Symbol(N2, Decl(numericEnumMappedType.ts, 24, 32)) +>C : Symbol(N2.C, Decl(numericEnumMappedType.ts, 25, 9)) +>val : Symbol(val, Decl(numericEnumMappedType.ts, 18, 13)) +>D : Symbol(N2.D, Decl(numericEnumMappedType.ts, 25, 20)) +>val : Symbol(val, Decl(numericEnumMappedType.ts, 18, 13)) + +type T1 = { [K in N1 | N2]: K }; +>T1 : Symbol(T1, Decl(numericEnumMappedType.ts, 25, 32)) +>K : Symbol(K, Decl(numericEnumMappedType.ts, 27, 13)) +>N1 : Symbol(N1, Decl(numericEnumMappedType.ts, 22, 31)) +>N2 : Symbol(N2, Decl(numericEnumMappedType.ts, 24, 32)) +>K : Symbol(K, Decl(numericEnumMappedType.ts, 27, 13)) + +// Enum types with string valued members are always literal enum types and therefore +// ONE and TWO below are not computed members but rather just numerically valued members +// with auto-incremented values. + +declare enum E { ONE, TWO, THREE = 'x' } +>E : Symbol(E, Decl(numericEnumMappedType.ts, 27, 32)) +>ONE : Symbol(E.ONE, Decl(numericEnumMappedType.ts, 33, 16)) +>TWO : Symbol(E.TWO, Decl(numericEnumMappedType.ts, 33, 21)) +>THREE : Symbol(E.THREE, Decl(numericEnumMappedType.ts, 33, 26)) + +const e: E = E.ONE; +>e : Symbol(e, Decl(numericEnumMappedType.ts, 34, 5)) +>E : Symbol(E, Decl(numericEnumMappedType.ts, 27, 32)) +>E.ONE : Symbol(E.ONE, Decl(numericEnumMappedType.ts, 33, 16)) +>E : Symbol(E, Decl(numericEnumMappedType.ts, 27, 32)) +>ONE : Symbol(E.ONE, Decl(numericEnumMappedType.ts, 33, 16)) + +const x: E.ONE = e; +>x : Symbol(x, Decl(numericEnumMappedType.ts, 35, 5)) +>E : Symbol(E, Decl(numericEnumMappedType.ts, 27, 32)) +>ONE : Symbol(E.ONE, Decl(numericEnumMappedType.ts, 33, 16)) +>e : Symbol(e, Decl(numericEnumMappedType.ts, 34, 5)) + diff --git a/tests/baselines/reference/numericEnumMappedType.types b/tests/baselines/reference/numericEnumMappedType.types new file mode 100644 index 00000000000..bffec2ed8ca --- /dev/null +++ b/tests/baselines/reference/numericEnumMappedType.types @@ -0,0 +1,117 @@ +=== tests/cases/compiler/numericEnumMappedType.ts === +// Repro from #31771 + +enum E1 { ONE, TWO, THREE } +>E1 : E1 +>ONE : E1.ONE +>TWO : E1.TWO +>THREE : E1.THREE + +declare enum E2 { ONE, TWO, THREE } +>E2 : E2 +>ONE : E2 +>TWO : E2 +>THREE : E2 + +type Bins1 = { [k in E1]?: string; } +>Bins1 : Bins1 + +type Bins2 = { [k in E2]?: string; } +>Bins2 : Bins2 + +const b1: Bins1 = {}; +>b1 : Bins1 +>{} : {} + +const b2: Bins2 = {}; +>b2 : Bins2 +>{} : {} + +const e1: E1 = E1.ONE; +>e1 : E1 +>E1.ONE : E1.ONE +>E1 : typeof E1 +>ONE : E1.ONE + +const e2: E2 = E2.ONE; +>e2 : E2 +>E2.ONE : E2 +>E2 : typeof E2 +>ONE : E2 + +b1[1] = "a"; +>b1[1] = "a" : "a" +>b1[1] : string | undefined +>b1 : Bins1 +>1 : 1 +>"a" : "a" + +b1[e1] = "b"; +>b1[e1] = "b" : "b" +>b1[e1] : string | undefined +>b1 : Bins1 +>e1 : E1.ONE +>"b" : "b" + +b2[1] = "a"; +>b2[1] = "a" : "a" +>b2[1] : string | undefined +>b2 : Bins2 +>1 : 1 +>"a" : "a" + +b2[e2] = "b"; +>b2[e2] = "b" : "b" +>b2[e2] : string | undefined +>b2 : Bins2 +>e2 : E2 +>"b" : "b" + +// Multiple numeric enum types accrue to the same numeric index signature in a mapped type + +declare function val(): number; +>val : () => number + +enum N1 { A = val(), B = val() } +>N1 : N1 +>A : N1 +>val() : number +>val : () => number +>B : N1 +>val() : number +>val : () => number + +enum N2 { C = val(), D = val() } +>N2 : N2 +>C : N2 +>val() : number +>val : () => number +>D : N2 +>val() : number +>val : () => number + +type T1 = { [K in N1 | N2]: K }; +>T1 : T1 + +// Enum types with string valued members are always literal enum types and therefore +// ONE and TWO below are not computed members but rather just numerically valued members +// with auto-incremented values. + +declare enum E { ONE, TWO, THREE = 'x' } +>E : E +>ONE : E.ONE +>TWO : E.TWO +>THREE : E.THREE +>'x' : "x" + +const e: E = E.ONE; +>e : E +>E.ONE : E.ONE +>E : typeof E +>ONE : E.ONE + +const x: E.ONE = e; +>x : E.ONE +>E : any +>e : E.ONE + From 3139cf2f857483bc9b5b74d9c101379e27d2fa9f Mon Sep 17 00:00:00 2001 From: Joey Watts Date: Thu, 6 Jun 2019 01:24:25 -0400 Subject: [PATCH 248/384] Move class property transformation into new transformer. (#30467) Signed-off-by: Joseph Watts --- src/compiler/binder.ts | 21 +- src/compiler/transformer.ts | 1 + src/compiler/transformers/classFields.ts | 491 +++++++++++++++++ src/compiler/transformers/ts.ts | 493 ++++++------------ src/compiler/transformers/utilities.ts | 80 +++ src/compiler/tsconfig.json | 1 + src/compiler/types.ts | 1 + ...tPrivateSymbolCausesVarDeclarationEmit2.js | 4 +- .../decoratorsOnComputedProperties.js | 169 +++--- .../reference/systemModuleTargetES6.js | 2 +- ...arationEmitUniqueSymbolPartialStatement.js | 2 +- 11 files changed, 819 insertions(+), 446 deletions(-) create mode 100644 src/compiler/transformers/classFields.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 4540a4409d6..660b19a5872 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -3229,8 +3229,7 @@ namespace ts { // A ClassDeclaration is ES6 syntax. transformFlags = subtreeFlags | TransformFlags.AssertES2015; - // A class with a parameter property assignment, property initializer, computed property name, or decorator is - // TypeScript syntax. + // A class with a parameter property assignment or decorator is TypeScript syntax. // An exported declaration may be TypeScript syntax, but is handled by the visitor // for a namespace declaration. if ((subtreeFlags & TransformFlags.ContainsTypeScriptClassSyntax) @@ -3247,8 +3246,7 @@ namespace ts { // A ClassExpression is ES6 syntax. let transformFlags = subtreeFlags | TransformFlags.AssertES2015; - // A class with a parameter property assignment, property initializer, or decorator is - // TypeScript syntax. + // A class with a parameter property assignment or decorator is TypeScript syntax. if (subtreeFlags & TransformFlags.ContainsTypeScriptClassSyntax || node.typeParameters) { transformFlags |= TransformFlags.AssertTypeScript; @@ -3338,7 +3336,6 @@ namespace ts { || hasModifier(node, ModifierFlags.TypeScriptModifier) || node.typeParameters || node.type - || (node.name && isComputedPropertyName(node.name)) // While computed method names aren't typescript, the TS transform must visit them to emit property declarations correctly || !node.body) { transformFlags |= TransformFlags.AssertTypeScript; } @@ -3369,7 +3366,6 @@ namespace ts { if (node.decorators || hasModifier(node, ModifierFlags.TypeScriptModifier) || node.type - || (node.name && isComputedPropertyName(node.name)) // While computed accessor names aren't typescript, the TS transform must visit them to emit property declarations correctly || !node.body) { transformFlags |= TransformFlags.AssertTypeScript; } @@ -3384,12 +3380,15 @@ namespace ts { } function computePropertyDeclaration(node: PropertyDeclaration, subtreeFlags: TransformFlags) { - // A PropertyDeclaration is TypeScript syntax. - let transformFlags = subtreeFlags | TransformFlags.AssertTypeScript; + let transformFlags = subtreeFlags | TransformFlags.ContainsClassFields; - // If the PropertyDeclaration has an initializer or a computed name, we need to inform its ancestor - // so that it handle the transformation. - if (node.initializer || isComputedPropertyName(node.name)) { + // Decorators, TypeScript-specific modifiers, and type annotations are TypeScript syntax. + if (some(node.decorators) || hasModifier(node, ModifierFlags.TypeScriptModifier) || node.type) { + transformFlags |= TransformFlags.AssertTypeScript; + } + + // Hoisted variables related to class properties should live within the TypeScript class wrapper. + if (isComputedPropertyName(node.name) || (hasStaticModifier(node) && node.initializer)) { transformFlags |= TransformFlags.ContainsTypeScriptClassSyntax; } diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 1c1df9bb0c2..d520571e6df 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -44,6 +44,7 @@ namespace ts { addRange(transformers, customTransformers && map(customTransformers.before, wrapScriptTransformerFactory)); transformers.push(transformTypeScript); + transformers.push(transformClassFields); if (jsx === JsxEmit.React) { transformers.push(transformJsx); diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts new file mode 100644 index 00000000000..575e1d13346 --- /dev/null +++ b/src/compiler/transformers/classFields.ts @@ -0,0 +1,491 @@ +/*@internal*/ +namespace ts { + const enum ClassPropertySubstitutionFlags { + /** + * Enables substitutions for class expressions with static fields + * which have initializers that reference the class name. + */ + ClassAliases = 1 << 0, + } + /** + * Transforms ECMAScript Class Syntax. + * TypeScript parameter property syntax is transformed in the TypeScript transformer. + * For now, this transforms public field declarations using TypeScript class semantics + * (where the declarations get elided and initializers are transformed as assignments in the constructor). + * Eventually, this transform will change to the ECMAScript semantics (with Object.defineProperty). + */ + export function transformClassFields(context: TransformationContext) { + const { + hoistVariableDeclaration, + endLexicalEnvironment, + resumeLexicalEnvironment + } = context; + const resolver = context.getEmitResolver(); + + const previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + + let enabledSubstitutions: ClassPropertySubstitutionFlags; + + let classAliases: Identifier[]; + + /** + * Tracks what computed name expressions originating from elided names must be inlined + * at the next execution site, in document order + */ + let pendingExpressions: Expression[] | undefined; + + /** + * Tracks what computed name expression statements and static property initializers must be + * emitted at the next execution site, in document order (for decorated classes). + */ + let pendingStatements: Statement[] | undefined; + + return chainBundle(transformSourceFile); + + function transformSourceFile(node: SourceFile) { + if (node.isDeclarationFile) { + return node; + } + const visited = visitEachChild(node, visitor, context); + addEmitHelpers(visited, context.readEmitHelpers()); + return visited; + } + + function visitor(node: Node): VisitResult { + if (!(node.transformFlags & TransformFlags.ContainsClassFields)) return node; + + switch (node.kind) { + case SyntaxKind.ClassExpression: + return visitClassExpression(node as ClassExpression); + case SyntaxKind.ClassDeclaration: + return visitClassDeclaration(node as ClassDeclaration); + case SyntaxKind.VariableStatement: + return visitVariableStatement(node as VariableStatement); + } + return visitEachChild(node, visitor, context); + } + + /** + * Visits the members of a class that has fields. + * + * @param node The node to visit. + */ + function classElementVisitor(node: Node): VisitResult { + switch (node.kind) { + case SyntaxKind.Constructor: + // Constructors for classes using class fields are transformed in + // `visitClassDeclaration` or `visitClassExpression`. + return undefined; + + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.MethodDeclaration: + // Visit the name of the member (if it's a computed property name). + return visitEachChild(node, classElementVisitor, context); + + case SyntaxKind.PropertyDeclaration: + return visitPropertyDeclaration(node as PropertyDeclaration); + + case SyntaxKind.ComputedPropertyName: + return visitComputedPropertyName(node as ComputedPropertyName); + + default: + return node; + } + } + + function visitVariableStatement(node: VariableStatement) { + const savedPendingStatements = pendingStatements; + pendingStatements = []; + + const visitedNode = visitEachChild(node, visitor, context); + const statement = some(pendingStatements) ? + [visitedNode, ...pendingStatements] : + visitedNode; + + pendingStatements = savedPendingStatements; + return statement; + } + + function visitComputedPropertyName(name: ComputedPropertyName) { + let node = visitEachChild(name, visitor, context); + if (some(pendingExpressions)) { + const expressions = pendingExpressions; + expressions.push(name.expression); + pendingExpressions = []; + node = updateComputedPropertyName( + node, + inlineExpressions(expressions) + ); + } + return node; + } + + function visitPropertyDeclaration(node: PropertyDeclaration) { + Debug.assert(!some(node.decorators)); + // Create a temporary variable to store a computed property name (if necessary). + // If it's not inlineable, then we emit an expression after the class which assigns + // the property name to the temporary variable. + const expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer); + if (expr && !isSimpleInlineableExpression(expr)) { + (pendingExpressions || (pendingExpressions = [])).push(expr); + } + return undefined; + } + + function visitClassDeclaration(node: ClassDeclaration) { + if (!forEach(node.members, isPropertyDeclaration)) { + return visitEachChild(node, visitor, context); + } + const savedPendingExpressions = pendingExpressions; + pendingExpressions = undefined; + + const extendsClauseElement = getEffectiveBaseTypeNode(node); + const isDerivedClass = !!(extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== SyntaxKind.NullKeyword); + + const statements: Statement[] = [ + updateClassDeclaration( + node, + node.decorators, + node.modifiers, + node.name, + node.typeParameters, + node.heritageClauses, + transformClassMembers(node, isDerivedClass) + ) + ]; + + // Write any pending expressions from elided or moved computed property names + if (some(pendingExpressions)) { + statements.push(createExpressionStatement(inlineExpressions(pendingExpressions!))); + } + pendingExpressions = savedPendingExpressions; + + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + const staticProperties = getInitializedProperties(node, /*isStatic*/ true); + if (some(staticProperties)) { + addInitializedPropertyStatements(statements, staticProperties, getInternalName(node)); + } + + return statements; + } + + function visitClassExpression(node: ClassExpression): Expression { + if (!forEach(node.members, isPropertyDeclaration)) { + return visitEachChild(node, visitor, context); + } + const savedPendingExpressions = pendingExpressions; + pendingExpressions = undefined; + + // If this class expression is a transformation of a decorated class declaration, + // then we want to output the pendingExpressions as statements, not as inlined + // expressions with the class statement. + // + // In this case, we use pendingStatements to produce the same output as the + // class declaration transformation. The VariableStatement visitor will insert + // these statements after the class expression variable statement. + const isDecoratedClassDeclaration = isClassDeclaration(getOriginalNode(node)); + + const staticProperties = getInitializedProperties(node, /*isStatic*/ true); + const extendsClauseElement = getEffectiveBaseTypeNode(node); + const isDerivedClass = !!(extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== SyntaxKind.NullKeyword); + + const classExpression = updateClassExpression( + node, + node.modifiers, + node.name, + node.typeParameters, + visitNodes(node.heritageClauses, visitor, isHeritageClause), + transformClassMembers(node, isDerivedClass) + ); + + if (some(staticProperties) || some(pendingExpressions)) { + if (isDecoratedClassDeclaration) { + Debug.assertDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); + + // Write any pending expressions from elided or moved computed property names + if (pendingStatements && pendingExpressions && some(pendingExpressions)) { + pendingStatements.push(createExpressionStatement(inlineExpressions(pendingExpressions))); + } + pendingExpressions = savedPendingExpressions; + + if (pendingStatements && some(staticProperties)) { + addInitializedPropertyStatements(pendingStatements, staticProperties, getInternalName(node)); + } + return classExpression; + } + else { + const expressions: Expression[] = []; + const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & NodeCheckFlags.ClassWithConstructorReference; + const temp = createTempVariable(hoistVariableDeclaration, !!isClassWithConstructorReference); + if (isClassWithConstructorReference) { + // record an alias as the class name is not in scope for statics. + enableSubstitutionForClassAliases(); + const alias = getSynthesizedClone(temp); + alias.autoGenerateFlags &= ~GeneratedIdentifierFlags.ReservedInNestedScopes; + classAliases[getOriginalNodeId(node)] = alias; + } + + // To preserve the behavior of the old emitter, we explicitly indent + // the body of a class with static initializers. + setEmitFlags(classExpression, EmitFlags.Indented | getEmitFlags(classExpression)); + expressions.push(startOnNewLine(createAssignment(temp, classExpression))); + // Add any pending expressions leftover from elided or relocated computed property names + addRange(expressions, map(pendingExpressions, startOnNewLine)); + addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp)); + expressions.push(startOnNewLine(temp)); + + pendingExpressions = savedPendingExpressions; + return inlineExpressions(expressions); + } + } + + pendingExpressions = savedPendingExpressions; + return classExpression; + } + + function transformClassMembers(node: ClassDeclaration | ClassExpression, isDerivedClass: boolean) { + const members: ClassElement[] = []; + const constructor = transformConstructor(node, isDerivedClass); + if (constructor) { + members.push(constructor); + } + addRange(members, visitNodes(node.members, classElementVisitor, isClassElement)); + return setTextRange(createNodeArray(members), /*location*/ node.members); + } + + function transformConstructor(node: ClassDeclaration | ClassExpression, isDerivedClass: boolean) { + const constructor = visitNode(getFirstConstructorWithBody(node), visitor, isConstructorDeclaration); + const containsPropertyInitializer = forEach(node.members, isInitializedProperty); + if (!containsPropertyInitializer) { + return constructor; + } + const parameters = visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); + const body = transformConstructorBody(node, constructor, isDerivedClass); + if (!body) { + return undefined; + } + return startOnNewLine( + setOriginalNode( + setTextRange( + createConstructor( + /*decorators*/ undefined, + /*modifiers*/ undefined, + parameters, + body + ), + constructor || node + ), + constructor + ) + ); + } + + function transformConstructorBody(node: ClassDeclaration | ClassExpression, constructor: ConstructorDeclaration | undefined, isDerivedClass: boolean) { + const properties = getInitializedProperties(node, /*isStatic*/ false); + + // Only generate synthetic constructor when there are property initializers to move. + if (!constructor && !some(properties)) { + return visitFunctionBody(/*node*/ undefined, visitor, context); + } + + resumeLexicalEnvironment(); + + let indexOfFirstStatement = 0; + let statements: Statement[] = []; + + if (!constructor && isDerivedClass) { + // Add a synthetic `super` call: + // + // super(...arguments); + // + statements.push( + createExpressionStatement( + createCall( + createSuper(), + /*typeArguments*/ undefined, + [createSpread(createIdentifier("arguments"))] + ) + ) + ); + } + + if (constructor) { + indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements, visitor); + } + + // Add the property initializers. Transforms this: + // + // public x = 1; + // + // Into this: + // + // constructor() { + // this.x = 1; + // } + // + addInitializedPropertyStatements(statements, properties, createThis()); + + // Add existing statements, skipping the initial super call. + if (constructor) { + addRange(statements, visitNodes(constructor.body!.statements, visitor, isStatement, indexOfFirstStatement)); + } + + statements = mergeLexicalEnvironment(statements, endLexicalEnvironment()); + + return setTextRange( + createBlock( + setTextRange( + createNodeArray(statements), + /*location*/ constructor ? constructor.body!.statements : node.members + ), + /*multiLine*/ true + ), + /*location*/ constructor ? constructor.body : undefined + ); + } + + /** + * Generates assignment statements for property initializers. + * + * @param properties An array of property declarations to transform. + * @param receiver The receiver on which each property should be assigned. + */ + function addInitializedPropertyStatements(statements: Statement[], properties: ReadonlyArray, receiver: LeftHandSideExpression) { + for (const property of properties) { + const statement = createExpressionStatement(transformInitializedProperty(property, receiver)); + setSourceMapRange(statement, moveRangePastModifiers(property)); + setCommentRange(statement, property); + setOriginalNode(statement, property); + statements.push(statement); + } + } + + /** + * Generates assignment expressions for property initializers. + * + * @param properties An array of property declarations to transform. + * @param receiver The receiver on which each property should be assigned. + */ + function generateInitializedPropertyExpressions(properties: ReadonlyArray, receiver: LeftHandSideExpression) { + const expressions: Expression[] = []; + for (const property of properties) { + const expression = transformInitializedProperty(property, receiver); + startOnNewLine(expression); + setSourceMapRange(expression, moveRangePastModifiers(property)); + setCommentRange(expression, property); + setOriginalNode(expression, property); + expressions.push(expression); + } + + return expressions; + } + + /** + * Transforms a property initializer into an assignment statement. + * + * @param property The property declaration. + * @param receiver The object receiving the property assignment. + */ + function transformInitializedProperty(property: PropertyDeclaration, receiver: LeftHandSideExpression) { + // We generate a name here in order to reuse the value cached by the relocated computed name expression (which uses the same generated name) + const propertyName = isComputedPropertyName(property.name) && !isSimpleInlineableExpression(property.name.expression) + ? updateComputedPropertyName(property.name, getGeneratedNameForNode(property.name)) + : property.name; + const initializer = visitNode(property.initializer!, visitor, isExpression); + const memberAccess = createMemberAccessForPropertyName(receiver, propertyName, /*location*/ propertyName); + + return createAssignment(memberAccess, initializer); + } + + function enableSubstitutionForClassAliases() { + if ((enabledSubstitutions & ClassPropertySubstitutionFlags.ClassAliases) === 0) { + enabledSubstitutions |= ClassPropertySubstitutionFlags.ClassAliases; + + // We need to enable substitutions for identifiers. This allows us to + // substitute class names inside of a class declaration. + context.enableSubstitution(SyntaxKind.Identifier); + + // Keep track of class aliases. + classAliases = []; + } + } + + /** + * 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) { + return substituteExpression(node as Expression); + } + return node; + } + + function substituteExpression(node: Expression) { + switch (node.kind) { + case SyntaxKind.Identifier: + return substituteExpressionIdentifier(node as Identifier); + } + return node; + } + + function substituteExpressionIdentifier(node: Identifier): Expression { + return trySubstituteClassAlias(node) || node; + } + + function trySubstituteClassAlias(node: Identifier): Expression | undefined { + if (enabledSubstitutions & ClassPropertySubstitutionFlags.ClassAliases) { + if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.ConstructorReferenceInClass) { + // Due to the emit for class decorators, any reference to the class from inside of the class body + // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind + // behavior of class names in ES6. + // Also, when emitting statics for class expressions, we must substitute a class alias for + // constructor references in static property initializers. + const declaration = resolver.getReferencedValueDeclaration(node); + if (declaration) { + const classAlias = classAliases[declaration.id!]; // TODO: GH#18217 + if (classAlias) { + const clone = getSynthesizedClone(classAlias); + setSourceMapRange(clone, node); + setCommentRange(clone, node); + return clone; + } + } + } + } + + return undefined; + } + + + /** + * If the name is a computed property, this function transforms it, then either returns an expression which caches the + * value of the result or the expression itself if the value is either unused or safe to inline into multiple locations + * @param shouldHoist Does the expression need to be reused? (ie, for an initializer or a decorator) + */ + function getPropertyNameExpressionIfNeeded(name: PropertyName, shouldHoist: boolean): Expression | undefined { + if (isComputedPropertyName(name)) { + const expression = visitNode(name.expression, visitor, isExpression); + const innerExpression = skipPartiallyEmittedExpressions(expression); + const inlinable = isSimpleInlineableExpression(innerExpression); + const alreadyTransformed = isAssignmentExpression(innerExpression) && isGeneratedIdentifier(innerExpression.left); + if (!alreadyTransformed && !inlinable && shouldHoist) { + const generatedName = getGeneratedNameForNode(name); + hoistVariableDeclaration(generatedName); + return createAssignment(generatedName, expression); + } + return (inlinable || isIdentifier(innerExpression)) ? undefined : expression; + } + } + } + +} diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index a70fb820e79..adfe16c73f6 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -64,6 +64,7 @@ namespace ts { let currentLexicalScope: SourceFile | Block | ModuleBlock | CaseBlock; let currentNameScope: ClassDeclaration | undefined; let currentScopeFirstDeclarationsOfName: UnderscoreEscapedMap | undefined; + let currentClassHasParameterProperties: boolean | undefined; /** * Keeps track of whether expression substitution has been enabled for specific edge cases. @@ -83,12 +84,6 @@ namespace ts { */ let applicableSubstitutions: TypeScriptSubstitutionFlags; - /** - * Tracks what computed name expressions originating from elided names must be inlined - * at the next execution site, in document order - */ - let pendingExpressions: Expression[] | undefined; - return transformSourceFileOrBundle; function transformSourceFileOrBundle(node: SourceFile | Bundle) { @@ -136,6 +131,7 @@ namespace ts { const savedCurrentScope = currentLexicalScope; const savedCurrentNameScope = currentNameScope; const savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName; + const savedCurrentClassHasParameterProperties = currentClassHasParameterProperties; // Handle state changes before visiting a node. onBeforeVisitNode(node); @@ -149,6 +145,7 @@ namespace ts { currentLexicalScope = savedCurrentScope; currentNameScope = savedCurrentNameScope; + currentClassHasParameterProperties = savedCurrentClassHasParameterProperties; return visited; } @@ -321,6 +318,9 @@ namespace ts { return undefined; case SyntaxKind.PropertyDeclaration: + // Property declarations are not TypeScript syntax, but they must be visited + // for the decorator transformation. + return visitPropertyDeclaration(node as PropertyDeclaration); case SyntaxKind.IndexSignature: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: @@ -437,7 +437,6 @@ namespace ts { // - decorators // - optional `implements` heritage clause // - parameter property assignments in the constructor - // - property declarations // - index signatures // - method overload signatures return visitClassDeclaration(node); @@ -449,7 +448,6 @@ namespace ts { // - decorators // - optional `implements` heritage clause // - parameter property assignments in the constructor - // - property declarations // - index signatures // - method overload signatures return visitClassExpression(node); @@ -611,10 +609,6 @@ namespace ts { if (!isClassLikeDeclarationWithTypeScriptSyntax(node) && !(currentNamespace && hasModifier(node, ModifierFlags.Export))) { return visitEachChild(node, visitor, context); } - - const savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - const staticProperties = getInitializedProperties(node, /*isStatic*/ true); const facts = getClassFacts(node, staticProperties); @@ -624,25 +618,11 @@ namespace ts { const name = node.name || (facts & ClassFacts.NeedsName ? getGeneratedNameForNode(node) : undefined); const classStatement = facts & ClassFacts.HasConstructorDecorators - ? createClassDeclarationHeadWithDecorators(node, name, facts) + ? createClassDeclarationHeadWithDecorators(node, name) : createClassDeclarationHeadWithoutDecorators(node, name, facts); let statements: Statement[] = [classStatement]; - // Write any pending expressions from elided or moved computed property names - if (some(pendingExpressions)) { - statements.push(createExpressionStatement(inlineExpressions(pendingExpressions!))); - } - pendingExpressions = savedPendingExpressions; - - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - if (facts & ClassFacts.HasStaticInitializedProperties) { - addInitializedPropertyStatements(statements, staticProperties, facts & ClassFacts.UseImmediatelyInvokedFunctionExpression ? getInternalName(node) : getLocalName(node)); - } // Write any decorators of the node. addClassElementDecorationStatements(statements, node, /*isStatic*/ false); @@ -745,7 +725,7 @@ namespace ts { name, /*typeParameters*/ undefined, visitNodes(node.heritageClauses, visitor, isHeritageClause), - transformClassMembers(node, (facts & ClassFacts.IsDerivedClass) !== 0) + transformClassMembers(node) ); // To better align with the old emitter, we should not emit a trailing source map @@ -765,7 +745,7 @@ namespace ts { * Transforms a decorated class declaration and appends the resulting statements. If * the class requires an alias to avoid issues with double-binding, the alias is returned. */ - function createClassDeclarationHeadWithDecorators(node: ClassDeclaration, name: Identifier | undefined, facts: ClassFacts) { + function createClassDeclarationHeadWithDecorators(node: ClassDeclaration, name: Identifier | undefined) { // When we emit an ES6 class that has a class decorator, we must tailor the // emit to certain specific cases. // @@ -860,7 +840,7 @@ namespace ts { // ${members} // } const heritageClauses = visitNodes(node.heritageClauses, visitor, isHeritageClause); - const members = transformClassMembers(node, (facts & ClassFacts.IsDerivedClass) !== 0); + const members = transformClassMembers(node); const classExpression = createClassExpression(/*modifiers*/ undefined, name, /*typeParameters*/ undefined, heritageClauses, members); setOriginalNode(classExpression, node); setTextRange(classExpression, location); @@ -888,49 +868,19 @@ namespace ts { return visitEachChild(node, visitor, context); } - const savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - - const staticProperties = getInitializedProperties(node, /*isStatic*/ true); - const heritageClauses = visitNodes(node.heritageClauses, visitor, isHeritageClause); - const members = transformClassMembers(node, some(heritageClauses, c => c.token === SyntaxKind.ExtendsKeyword)); + const members = transformClassMembers(node); const classExpression = createClassExpression( /*modifiers*/ undefined, node.name, /*typeParameters*/ undefined, - heritageClauses, + node.heritageClauses, members ); setOriginalNode(classExpression, node); setTextRange(classExpression, node); - if (some(staticProperties) || some(pendingExpressions)) { - const expressions: Expression[] = []; - const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & NodeCheckFlags.ClassWithConstructorReference; - const temp = createTempVariable(hoistVariableDeclaration, !!isClassWithConstructorReference); - if (isClassWithConstructorReference) { - // record an alias as the class name is not in scope for statics. - enableSubstitutionForClassAliases(); - const alias = getSynthesizedClone(temp); - alias.autoGenerateFlags &= ~GeneratedIdentifierFlags.ReservedInNestedScopes; - classAliases[getOriginalNodeId(node)] = alias; - } - - // To preserve the behavior of the old emitter, we explicitly indent - // the body of a class with static initializers. - setEmitFlags(classExpression, EmitFlags.Indented | getEmitFlags(classExpression)); - expressions.push(startOnNewLine(createAssignment(temp, classExpression))); - // Add any pending expressions leftover from elided or relocated computed property names - addRange(expressions, map(pendingExpressions, startOnNewLine)); - pendingExpressions = savedPendingExpressions; - addRange(expressions, generateInitializedPropertyExpressions(staticProperties, temp)); - expressions.push(startOnNewLine(temp)); - return inlineExpressions(expressions); - } - - pendingExpressions = savedPendingExpressions; return classExpression; } @@ -938,61 +888,81 @@ namespace ts { * Transforms the members of a class. * * @param node The current class. - * @param isDerivedClass A value indicating whether the class has an extends clause that does not extend 'null'. */ - function transformClassMembers(node: ClassDeclaration | ClassExpression, isDerivedClass: boolean) { + function transformClassMembers(node: ClassDeclaration | ClassExpression) { const members: ClassElement[] = []; - const constructor = transformConstructor(node, isDerivedClass); - if (constructor) { - members.push(constructor); - } - - addRange(members, visitNodes(node.members, classElementVisitor, isClassElement)); - return setTextRange(createNodeArray(members), /*location*/ node.members); - } - - /** - * Transforms (or creates) a constructor for a class. - * - * @param node The current class. - * @param isDerivedClass A value indicating whether the class has an extends clause that does not extend 'null'. - */ - function transformConstructor(node: ClassDeclaration | ClassExpression, isDerivedClass: boolean) { - // Check if we have property assignment inside class declaration. - // If there is a property assignment, we need to emit constructor whether users define it or not - // If there is no property assignment, we can omit constructor if users do not define it + const existingMembers = visitNodes(node.members, classElementVisitor, isClassElement); const constructor = getFirstConstructorWithBody(node); - const hasInstancePropertyWithInitializer = forEach(node.members, isInstanceInitializedProperty); - const hasParameterPropertyAssignments = constructor && - constructor.transformFlags & TransformFlags.ContainsTypeScriptClassSyntax && - forEach(constructor.parameters, isParameterWithPropertyAssignment); + const parametersWithPropertyAssignments = + constructor && hasTypeScriptClassSyntax(constructor) + ? filter(constructor.parameters, isParameterPropertyDeclaration) + : undefined; + if (some(parametersWithPropertyAssignments) && constructor) { + currentClassHasParameterProperties = true; - // If the class does not contain nodes that require a synthesized constructor, - // accept the current constructor if it exists. - if (!hasInstancePropertyWithInitializer && !hasParameterPropertyAssignments) { - return visitEachChild(constructor, visitor, context); - } - - const parameters = transformConstructorParameters(constructor); - const body = transformConstructorBody(node, constructor, isDerivedClass); - - // constructor(${parameters}) { - // ${body} - // } - return startOnNewLine( - setOriginalNode( - setTextRange( - createConstructor( + // Create property declarations for constructor parameter properties. + addRange( + members, + parametersWithPropertyAssignments.map(param => + createProperty( /*decorators*/ undefined, /*modifiers*/ undefined, - parameters, - body + param.name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined + ) + ) + ); + + const parameters = transformConstructorParameters(constructor); + const body = transformConstructorBody(node.members, constructor, parametersWithPropertyAssignments); + members.push(startOnNewLine( + setOriginalNode( + setTextRange( + createConstructor( + /*decorators*/ undefined, + /*modifiers*/ undefined, + parameters, + body + ), + constructor ), - constructor || node - ), - constructor - ) - ); + constructor + ) + )); + addRange( + members, + visitNodes( + existingMembers, + member => { + if (isPropertyDeclaration(member) && !hasStaticModifier(member) && !!member.initializer) { + const updated = updateProperty( + member, + member.decorators, + member.modifiers, + member.name, + member.questionToken, + member.type, + /*initializer*/ undefined + ); + setCommentRange(updated, node); + setSourceMapRange(updated, node); + return updated; + } + return member; + }, + isClassElement + ) + ); + } + else { + if (constructor) { + members.push(visitEachChild(constructor, visitor, context)); + } + addRange(members, existingMembers); + } + return setTextRange(createNodeArray(members), /*location*/ node.members); } /** @@ -1001,7 +971,7 @@ namespace ts { * * @param constructor The constructor declaration. */ - function transformConstructorParameters(constructor: ConstructorDeclaration | undefined) { + function transformConstructorParameters(constructor: ConstructorDeclaration) { // The ES2015 spec specifies in 14.5.14. Runtime Semantics: ClassDefinitionEvaluation: // If constructor is empty, then // If ClassHeritag_eopt is present and protoParent is not null, then @@ -1022,70 +992,54 @@ namespace ts { } /** - * Transforms (or creates) a constructor body for a class with parameter property - * assignments or instance property initializers. + * Transforms (or creates) a constructor body for a class with parameter property assignments. * * @param node The current class. * @param constructor The current class constructor. - * @param isDerivedClass A value indicating whether the class has an extends clause that does not extend 'null'. */ - function transformConstructorBody(node: ClassExpression | ClassDeclaration, constructor: ConstructorDeclaration | undefined, isDerivedClass: boolean) { + function transformConstructorBody(members: NodeArray, constructor: ConstructorDeclaration, propertyAssignments: ReadonlyArray) { let statements: Statement[] = []; let indexOfFirstStatement = 0; resumeLexicalEnvironment(); - if (constructor) { - indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements); + indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements, visitor); - // Add parameters with property assignments. Transforms this: - // - // constructor (public x, public y) { - // } - // - // Into this: - // - // constructor (x, y) { - // this.x = x; - // this.y = y; - // } - // - const propertyAssignments = getParametersWithPropertyAssignments(constructor); - addRange(statements, map(propertyAssignments, transformParameterWithPropertyAssignment)); - } - else if (isDerivedClass) { - // Add a synthetic `super` call: - // - // super(...arguments); - // - statements.push( - createExpressionStatement( - createCall( - createSuper(), - /*typeArguments*/ undefined, - [createSpread(createIdentifier("arguments"))] - ) - ) - ); - } - - // Add the property initializers. Transforms this: + // Add parameters with property assignments. Transforms this: // - // public x = 1; + // constructor (public x, public y) { + // } // // Into this: // - // constructor() { - // this.x = 1; + // constructor (x, y) { + // this.x = x; + // this.y = y; // } // - const properties = getInitializedProperties(node, /*isStatic*/ false); - addInitializedPropertyStatements(statements, properties, createThis()); + addRange(statements, map(propertyAssignments, transformParameterWithPropertyAssignment)); - if (constructor) { - // The class already had a constructor, so we should add the existing statements, skipping the initial super call. - addRange(statements, visitNodes(constructor.body!.statements, visitor, isStatement, indexOfFirstStatement)); - } + // Get property initializers. + const classBodyProperties = members.filter(member => isPropertyDeclaration(member) && !hasStaticModifier(member) && !!member.initializer) as PropertyDeclaration[]; + addRange(statements, classBodyProperties.map( + prop => { + const name = prop.name; + const lhs = (!isComputedPropertyName(name) || isSimpleInlineableExpression(name.expression)) ? + createMemberAccessForPropertyName(createThis(), name, prop) : + createElementAccess(createThis(), getGeneratedNameForNode(name)); + const initializerNode = createExpressionStatement( + createAssignment(lhs, prop.initializer!) + ); + setOriginalNode(initializerNode, prop); + setTextRange(initializerNode, prop); + setCommentRange(initializerNode, prop); + setSourceMapRange(initializerNode, prop); + return initializerNode; + } + )); + + // Add the existing statements, skipping the initial super call. + addRange(statements, visitNodes(constructor.body!.statements, visitor, isStatement, indexOfFirstStatement)); // End the lexical environment. statements = mergeLexicalEnvironment(statements, endLexicalEnvironment()); @@ -1093,7 +1047,7 @@ namespace ts { createBlock( setTextRange( createNodeArray(statements), - /*location*/ constructor ? constructor.body!.statements : node.members + /*location*/ constructor ? constructor.body!.statements : members ), /*multiLine*/ true ), @@ -1101,61 +1055,16 @@ namespace ts { ); } - /** - * Adds super call and preceding prologue directives into the list of statements. - * - * @param ctor The constructor node. - * @returns index of the statement that follows super call - */ - function addPrologueDirectivesAndInitialSuperCall(ctor: ConstructorDeclaration, result: Statement[]): number { - if (ctor.body) { - const statements = ctor.body.statements; - // add prologue directives to the list (if any) - const index = addPrologue(result, statements, /*ensureUseStrict*/ false, visitor); - if (index === statements.length) { - // list contains nothing but prologue directives (or empty) - exit - return index; - } - - const statement = statements[index]; - if (statement.kind === SyntaxKind.ExpressionStatement && isSuperCall((statement).expression)) { - result.push(visitNode(statement, visitor, isStatement)); - return index + 1; - } - - return index; - } - - return 0; - } - - /** - * Gets all parameters of a constructor that should be transformed into property assignments. - * - * @param node The constructor node. - */ - function getParametersWithPropertyAssignments(node: ConstructorDeclaration): ReadonlyArray { - return filter(node.parameters, isParameterWithPropertyAssignment); - } - - /** - * Determines whether a parameter should be transformed into a property assignment. - * - * @param parameter The parameter node. - */ - function isParameterWithPropertyAssignment(parameter: ParameterDeclaration) { - return hasModifier(parameter, ModifierFlags.ParameterPropertyModifier) - && isIdentifier(parameter.name); - } - /** * Transforms a parameter into a property assignment statement. * * @param node The parameter declaration. */ - function transformParameterWithPropertyAssignment(node: ParameterDeclaration) { - Debug.assert(isIdentifier(node.name)); - const name = node.name as Identifier; + function transformParameterWithPropertyAssignment(node: ParameterPropertyDeclaration) { + const name = node.name; + if (!isIdentifier(name)) { + return undefined; + } const propertyName = getMutableClone(name); setEmitFlags(propertyName, EmitFlags.NoComments | EmitFlags.NoSourceMap); @@ -1184,99 +1093,6 @@ namespace ts { ); } - /** - * Gets all property declarations with initializers on either the static or instance side of a class. - * - * @param node The class node. - * @param isStatic A value indicating whether to get properties from the static or instance side of the class. - */ - function getInitializedProperties(node: ClassExpression | ClassDeclaration, isStatic: boolean): ReadonlyArray { - return filter(node.members, isStatic ? isStaticInitializedProperty : isInstanceInitializedProperty); - } - - /** - * Gets a value indicating whether a class element is a static property declaration with an initializer. - * - * @param member The class element node. - */ - function isStaticInitializedProperty(member: ClassElement): member is PropertyDeclaration { - return isInitializedProperty(member, /*isStatic*/ true); - } - - /** - * Gets a value indicating whether a class element is an instance property declaration with an initializer. - * - * @param member The class element node. - */ - function isInstanceInitializedProperty(member: ClassElement): member is PropertyDeclaration { - return isInitializedProperty(member, /*isStatic*/ false); - } - - /** - * Gets a value indicating whether a class element is either a static or an instance property declaration with an initializer. - * - * @param member The class element node. - * @param isStatic A value indicating whether the member should be a static or instance member. - */ - function isInitializedProperty(member: ClassElement, isStatic: boolean) { - return member.kind === SyntaxKind.PropertyDeclaration - && isStatic === hasModifier(member, ModifierFlags.Static) - && (member).initializer !== undefined; - } - - /** - * Generates assignment statements for property initializers. - * - * @param properties An array of property declarations to transform. - * @param receiver The receiver on which each property should be assigned. - */ - function addInitializedPropertyStatements(statements: Statement[], properties: ReadonlyArray, receiver: LeftHandSideExpression) { - for (const property of properties) { - const statement = createExpressionStatement(transformInitializedProperty(property, receiver)); - setSourceMapRange(statement, moveRangePastModifiers(property)); - setCommentRange(statement, property); - setOriginalNode(statement, property); - statements.push(statement); - } - } - - /** - * Generates assignment expressions for property initializers. - * - * @param properties An array of property declarations to transform. - * @param receiver The receiver on which each property should be assigned. - */ - function generateInitializedPropertyExpressions(properties: ReadonlyArray, receiver: LeftHandSideExpression) { - const expressions: Expression[] = []; - for (const property of properties) { - const expression = transformInitializedProperty(property, receiver); - startOnNewLine(expression); - setSourceMapRange(expression, moveRangePastModifiers(property)); - setCommentRange(expression, property); - setOriginalNode(expression, property); - expressions.push(expression); - } - - return expressions; - } - - /** - * Transforms a property initializer into an assignment statement. - * - * @param property The property declaration. - * @param receiver The object receiving the property assignment. - */ - function transformInitializedProperty(property: PropertyDeclaration, receiver: LeftHandSideExpression) { - // We generate a name here in order to reuse the value cached by the relocated computed name expression (which uses the same generated name) - const propertyName = isComputedPropertyName(property.name) && !isSimpleInlineableExpression(property.name.expression) - ? updateComputedPropertyName(property.name, getGeneratedNameForNode(property.name)) - : property.name; - const initializer = visitNode(property.initializer!, visitor, isExpression); - const memberAccess = createMemberAccessForPropertyName(receiver, propertyName, /*location*/ propertyName); - - return createAssignment(memberAccess, initializer); - } - /** * Gets either the static or instance members of a class that are decorated, or have * parameters that are decorated. @@ -2144,16 +1960,6 @@ namespace ts { : createIdentifier("BigInt"); } - /** - * A simple inlinable expression is an expression which can be copied into multiple locations - * without risk of repeating any sideeffects and whose value could not possibly change between - * any such locations - */ - function isSimpleInlineableExpression(expression: Expression) { - return !isIdentifier(expression) && isSimpleCopiableExpression(expression) || - isWellKnownSymbolSyntactically(expression); - } - /** * Gets an expression that represents a property name. For a computed property, a * name is generated for the node. @@ -2175,26 +1981,6 @@ namespace ts { } } - /** - * If the name is a computed property, this function transforms it, then either returns an expression which caches the - * value of the result or the expression itself if the value is either unused or safe to inline into multiple locations - * @param shouldHoist Does the expression need to be reused? (ie, for an initializer or a decorator) - * @param omitSimple Should expressions with no observable side-effects be elided? (ie, the expression is not hoisted for a decorator or initializer and is a literal) - */ - function getPropertyNameExpressionIfNeeded(name: PropertyName, shouldHoist: boolean, omitSimple: boolean): Expression | undefined { - if (isComputedPropertyName(name)) { - const expression = visitNode(name.expression, visitor, isExpression); - const innerExpression = skipPartiallyEmittedExpressions(expression); - const inlinable = isSimpleInlineableExpression(innerExpression); - if (!inlinable && shouldHoist) { - const generatedName = getGeneratedNameForNode(name); - hoistVariableDeclaration(generatedName); - return createAssignment(generatedName, expression); - } - return (omitSimple && (inlinable || isIdentifier(innerExpression))) ? undefined : expression; - } - } - /** * Visits the property name of a class element, for use when emitting property * initializers. For a computed property on a node with decorators, a temporary @@ -2204,18 +1990,20 @@ namespace ts { */ function visitPropertyNameOfClassElement(member: ClassElement): PropertyName { const name = member.name!; - let expr = getPropertyNameExpressionIfNeeded(name, some(member.decorators), /*omitSimple*/ false); - if (expr) { // expr only exists if `name` is a computed property name - // Inline any pending expressions from previous elided or relocated computed property name expressions in order to preserve execution order - if (some(pendingExpressions)) { - expr = inlineExpressions([...pendingExpressions, expr]); - pendingExpressions.length = 0; + // Computed property names need to be transformed into a hoisted variable when they are used more than once. + // The names are used more than once when: + // - the property is non-static and its initializer is moved to the constructor (when there are parameter property assignments). + // - the property has a decorator. + if (isComputedPropertyName(name) && ((!hasStaticModifier(member) && currentClassHasParameterProperties) || some(member.decorators))) { + const expression = visitNode(name.expression, visitor, isExpression); + const innerExpression = skipPartiallyEmittedExpressions(expression); + if (!isSimpleInlineableExpression(innerExpression)) { + const generatedName = getGeneratedNameForNode(name); + hoistVariableDeclaration(generatedName); + return updateComputedPropertyName(name, createAssignment(generatedName, expression)); } - return updateComputedPropertyName(name as ComputedPropertyName, expr); - } - else { - return name; } + return visitNode(name, visitor, isPropertyName); } /** @@ -2261,12 +2049,23 @@ namespace ts { return !nodeIsMissing(node.body); } - function visitPropertyDeclaration(node: PropertyDeclaration): undefined { - const expr = getPropertyNameExpressionIfNeeded(node.name, some(node.decorators) || !!node.initializer, /*omitSimple*/ true); - if (expr && !isSimpleInlineableExpression(expr)) { - (pendingExpressions || (pendingExpressions = [])).push(expr); + function visitPropertyDeclaration(node: PropertyDeclaration) { + const updated = updateProperty( + node, + /*decorators*/ undefined, + visitNodes(node.modifiers, visitor, isModifier), + visitPropertyNameOfClassElement(node), + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + visitNode(node.initializer, visitor) + ); + if (updated !== node) { + // While we emit the source map for the node after skipping decorators and modifiers, + // we need to emit the comments for the original range. + setCommentRange(updated, node); + setSourceMapRange(updated, moveRangePastDecorators(node)); } - return undefined; + return updated; } function visitConstructor(node: ConstructorDeclaration) { diff --git a/src/compiler/transformers/utilities.ts b/src/compiler/transformers/utilities.ts index 09239d7765f..f5f8a298a49 100644 --- a/src/compiler/transformers/utilities.ts +++ b/src/compiler/transformers/utilities.ts @@ -240,6 +240,47 @@ namespace ts { isIdentifier(expression); } + /** + * A simple inlinable expression is an expression which can be copied into multiple locations + * without risk of repeating any sideeffects and whose value could not possibly change between + * any such locations + */ + export function isSimpleInlineableExpression(expression: Expression) { + return !isIdentifier(expression) && isSimpleCopiableExpression(expression) || + isWellKnownSymbolSyntactically(expression); + } + + /** + * Adds super call and preceding prologue directives into the list of statements. + * + * @param ctor The constructor node. + * @param result The list of statements. + * @param visitor The visitor to apply to each node added to the result array. + * @returns index of the statement that follows super call + */ + export function addPrologueDirectivesAndInitialSuperCall(ctor: ConstructorDeclaration, result: Statement[], visitor: Visitor): number { + if (ctor.body) { + const statements = ctor.body.statements; + // add prologue directives to the list (if any) + const index = addPrologue(result, statements, /*ensureUseStrict*/ false, visitor); + if (index === statements.length) { + // list contains nothing but prologue directives (or empty) - exit + return index; + } + + const statement = statements[index]; + if (statement.kind === SyntaxKind.ExpressionStatement && isSuperCall((statement).expression)) { + result.push(visitNode(statement, visitor, isStatement)); + return index + 1; + } + + return index; + } + + return 0; + } + + /** * @param input Template string input strings * @param args Names which need to be made file-level unique @@ -255,4 +296,43 @@ namespace ts { return result; }; } + + /** + * Gets all property declarations with initializers on either the static or instance side of a class. + * + * @param node The class node. + * @param isStatic A value indicating whether to get properties from the static or instance side of the class. + */ + export function getInitializedProperties(node: ClassExpression | ClassDeclaration, isStatic: boolean): ReadonlyArray { + return filter(node.members, isStatic ? isStaticInitializedProperty : isInstanceInitializedProperty); + } + + /** + * Gets a value indicating whether a class element is a static property declaration with an initializer. + * + * @param member The class element node. + */ + export function isStaticInitializedProperty(member: ClassElement): member is PropertyDeclaration & { initializer: Expression; } { + return isInitializedProperty(member) && hasStaticModifier(member); + } + + /** + * Gets a value indicating whether a class element is an instance property declaration with an initializer. + * + * @param member The class element node. + */ + export function isInstanceInitializedProperty(member: ClassElement): member is PropertyDeclaration & { initializer: Expression; } { + return isInitializedProperty(member) && !hasStaticModifier(member); + } + + /** + * Gets a value indicating whether a class element is either a static or an instance property declaration with an initializer. + * + * @param member The class element node. + * @param isStatic A value indicating whether the member should be a static or instance member. + */ + export function isInitializedProperty(member: ClassElement): member is PropertyDeclaration & { initializer: Expression; } { + return member.kind === SyntaxKind.PropertyDeclaration + && (member).initializer !== undefined; + } } \ No newline at end of file diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json index fdc0ff2969f..f5e16b0d127 100644 --- a/src/compiler/tsconfig.json +++ b/src/compiler/tsconfig.json @@ -30,6 +30,7 @@ "transformers/utilities.ts", "transformers/destructuring.ts", "transformers/ts.ts", + "transformers/classFields.ts", "transformers/es2017.ts", "transformers/es2018.ts", "transformers/es2019.ts", diff --git a/src/compiler/types.ts b/src/compiler/types.ts index a7ee1c5745f..31fb4984507 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5197,6 +5197,7 @@ namespace ts { ContainsYield = 1 << 17, ContainsHoistedDeclarationOrCompletion = 1 << 18, ContainsDynamicImport = 1 << 19, + ContainsClassFields = 1 << 20, // Please leave this as 1 << 29. // It is the maximum bit we can set before we outgrow the size of a v8 small integer (SMI) on an x86 system. diff --git a/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js b/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js index ab986aba1e8..970590c136b 100644 --- a/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js +++ b/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js @@ -34,8 +34,8 @@ var C = /** @class */ (function () { } return C; }()); -_a = a_1.x; exports.C = C; +_a = a_1.x; //// [c.js] "use strict"; var __extends = (this && this.__extends) || (function () { @@ -64,8 +64,8 @@ var D = /** @class */ (function (_super) { } return D; }(b_1.C)); -_a = a_1.x; exports.D = D; +_a = a_1.x; //// [a.d.ts] diff --git a/tests/baselines/reference/decoratorsOnComputedProperties.js b/tests/baselines/reference/decoratorsOnComputedProperties.js index 2af6b460c05..3f0444b310a 100644 --- a/tests/baselines/reference/decoratorsOnComputedProperties.js +++ b/tests/baselines/reference/decoratorsOnComputedProperties.js @@ -196,7 +196,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, 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; }; -var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21; +var _a, _b, _c, _d; +var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21; function x(o, k) { } let i = 0; function foo() { return ++i + ""; } @@ -209,11 +210,11 @@ class A { this[Symbol.iterator] = null; this["property4"] = 2; this[Symbol.match] = null; - this[_b] = null; - this[_d] = null; + this[_f] = null; + this[_h] = null; } } -foo(), _a = foo(), _b = foo(), _c = fieldNameB, _d = fieldNameC; +foo(), _e = foo(), _f = foo(), _g = fieldNameB, _h = fieldNameC; __decorate([ x ], A.prototype, "property", void 0); @@ -228,42 +229,42 @@ __decorate([ ], A.prototype, Symbol.iterator, void 0); __decorate([ x -], A.prototype, _a, void 0); +], A.prototype, _e, void 0); __decorate([ x -], A.prototype, _b, void 0); +], A.prototype, _f, void 0); __decorate([ x -], A.prototype, _c, void 0); +], A.prototype, _g, void 0); __decorate([ x -], A.prototype, _d, void 0); -void (_j = class B { +], A.prototype, _h, void 0); +void (_a = class B { constructor() { this["property2"] = 2; this[Symbol.iterator] = null; this["property4"] = 2; this[Symbol.match] = null; - this[_f] = null; - this[_h] = null; + this[_k] = null; + this[_m] = null; } }, foo(), - _e = foo(), - _f = foo(), - _g = fieldNameB, - _h = fieldNameC, - _j); + _j = foo(), + _k = foo(), + _l = fieldNameB, + _m = fieldNameC, + _a); class C { constructor() { this["property2"] = 2; this[Symbol.iterator] = null; this["property4"] = 2; this[Symbol.match] = null; - this[_l] = null; - this[_o] = null; + this[_p] = null; + this[_r] = null; } - [(foo(), _k = foo(), _l = foo(), _m = fieldNameB, _o = fieldNameC, "some" + "method")]() { } + [(foo(), _o = foo(), _p = foo(), _q = fieldNameB, _r = fieldNameC, "some" + "method")]() { } } __decorate([ x @@ -277,28 +278,28 @@ __decorate([ __decorate([ x ], C.prototype, Symbol.iterator, void 0); -__decorate([ - x -], C.prototype, _k, void 0); -__decorate([ - x -], C.prototype, _l, void 0); -__decorate([ - x -], C.prototype, _m, void 0); __decorate([ x ], C.prototype, _o, void 0); +__decorate([ + x +], C.prototype, _p, void 0); +__decorate([ + x +], C.prototype, _q, void 0); +__decorate([ + x +], C.prototype, _r, void 0); void class D { constructor() { this["property2"] = 2; this[Symbol.iterator] = null; this["property4"] = 2; this[Symbol.match] = null; - this[_q] = null; - this[_s] = null; + this[_t] = null; + this[_v] = null; } - [(foo(), _p = foo(), _q = foo(), _r = fieldNameB, _s = fieldNameC, "some" + "method")]() { } + [(foo(), _s = foo(), _t = foo(), _u = fieldNameB, _v = fieldNameC, "some" + "method")]() { } }; class E { constructor() { @@ -306,12 +307,12 @@ class E { this[Symbol.iterator] = null; this["property4"] = 2; this[Symbol.match] = null; - this[_u] = null; - this[_w] = null; + this[_x] = null; + this[_z] = null; } - [(foo(), _t = foo(), _u = foo(), "some" + "method")]() { } + [(foo(), _w = foo(), _x = foo(), "some" + "method")]() { } } -_v = fieldNameB, _w = fieldNameC; +_y = fieldNameB, _z = fieldNameC; __decorate([ x ], E.prototype, "property", void 0); @@ -324,45 +325,45 @@ __decorate([ __decorate([ x ], E.prototype, Symbol.iterator, void 0); -__decorate([ - x -], E.prototype, _t, void 0); -__decorate([ - x -], E.prototype, _u, void 0); -__decorate([ - x -], E.prototype, _v, void 0); __decorate([ x ], E.prototype, _w, void 0); -void (_1 = class F { +__decorate([ + x +], E.prototype, _x, void 0); +__decorate([ + x +], E.prototype, _y, void 0); +__decorate([ + x +], E.prototype, _z, void 0); +void (_b = class F { constructor() { this["property2"] = 2; this[Symbol.iterator] = null; this["property4"] = 2; this[Symbol.match] = null; - this[_y] = null; - this[_0] = null; + this[_1] = null; + this[_3] = null; } - [(foo(), _x = foo(), _y = foo(), "some" + "method")]() { } + [(foo(), _0 = foo(), _1 = foo(), "some" + "method")]() { } }, - _z = fieldNameB, - _0 = fieldNameC, - _1); + _2 = fieldNameB, + _3 = fieldNameC, + _b); class G { constructor() { this["property2"] = 2; this[Symbol.iterator] = null; this["property4"] = 2; this[Symbol.match] = null; - this[_3] = null; this[_5] = null; + this[_7] = null; } - [(foo(), _2 = foo(), _3 = foo(), "some" + "method")]() { } - [(_4 = fieldNameB, "some" + "method2")]() { } + [(foo(), _4 = foo(), _5 = foo(), "some" + "method")]() { } + [(_6 = fieldNameB, "some" + "method2")]() { } } -_5 = fieldNameC; +_7 = fieldNameC; __decorate([ x ], G.prototype, "property", void 0); @@ -375,45 +376,45 @@ __decorate([ __decorate([ x ], G.prototype, Symbol.iterator, void 0); -__decorate([ - x -], G.prototype, _2, void 0); -__decorate([ - x -], G.prototype, _3, void 0); __decorate([ x ], G.prototype, _4, void 0); __decorate([ x ], G.prototype, _5, void 0); -void (_10 = class H { +__decorate([ + x +], G.prototype, _6, void 0); +__decorate([ + x +], G.prototype, _7, void 0); +void (_c = class H { constructor() { this["property2"] = 2; this[Symbol.iterator] = null; this["property4"] = 2; this[Symbol.match] = null; - this[_7] = null; this[_9] = null; + this[_11] = null; } - [(foo(), _6 = foo(), _7 = foo(), "some" + "method")]() { } - [(_8 = fieldNameB, "some" + "method2")]() { } + [(foo(), _8 = foo(), _9 = foo(), "some" + "method")]() { } + [(_10 = fieldNameB, "some" + "method2")]() { } }, - _9 = fieldNameC, - _10); + _11 = fieldNameC, + _c); class I { constructor() { this["property2"] = 2; this[Symbol.iterator] = null; this["property4"] = 2; this[Symbol.match] = null; - this[_12] = null; - this[_15] = null; + this[_13] = null; + this[_16] = null; } - [(foo(), _11 = foo(), _12 = foo(), _13 = "some" + "method")]() { } - [(_14 = fieldNameB, "some" + "method2")]() { } + [(foo(), _12 = foo(), _13 = foo(), _14 = "some" + "method")]() { } + [(_15 = fieldNameB, "some" + "method2")]() { } } -_15 = fieldNameC; +_16 = fieldNameC; __decorate([ x ], I.prototype, "property", void 0); @@ -426,32 +427,32 @@ __decorate([ __decorate([ x ], I.prototype, Symbol.iterator, void 0); -__decorate([ - x -], I.prototype, _11, void 0); __decorate([ x ], I.prototype, _12, void 0); __decorate([ x -], I.prototype, _13, null); +], I.prototype, _13, void 0); __decorate([ x -], I.prototype, _14, void 0); +], I.prototype, _14, null); __decorate([ x ], I.prototype, _15, void 0); -void (_21 = class J { +__decorate([ + x +], I.prototype, _16, void 0); +void (_d = class J { constructor() { this["property2"] = 2; this[Symbol.iterator] = null; this["property4"] = 2; this[Symbol.match] = null; - this[_17] = null; - this[_20] = null; + this[_18] = null; + this[_21] = null; } - [(foo(), _16 = foo(), _17 = foo(), _18 = "some" + "method")]() { } - [(_19 = fieldNameB, "some" + "method2")]() { } + [(foo(), _17 = foo(), _18 = foo(), _19 = "some" + "method")]() { } + [(_20 = fieldNameB, "some" + "method2")]() { } }, - _20 = fieldNameC, - _21); + _21 = fieldNameC, + _d); diff --git a/tests/baselines/reference/systemModuleTargetES6.js b/tests/baselines/reference/systemModuleTargetES6.js index 943e57ff742..0df2835683e 100644 --- a/tests/baselines/reference/systemModuleTargetES6.js +++ b/tests/baselines/reference/systemModuleTargetES6.js @@ -35,8 +35,8 @@ System.register([], function (exports_1, context_1) { MyClass2 = class MyClass2 { static getInstance() { return MyClass2.value; } }; - MyClass2.value = 42; exports_1("MyClass2", MyClass2); + MyClass2.value = 42; } }; }); diff --git a/tests/baselines/reference/variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.js b/tests/baselines/reference/variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.js index 21871ff2304..872008368c6 100644 --- a/tests/baselines/reference/variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.js +++ b/tests/baselines/reference/variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.js @@ -16,8 +16,8 @@ var Foo = /** @class */ (function () { } return Foo; }()); -_a = key; exports.Foo = Foo; +_a = key; //// [variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.d.ts] From 64de998356c16cec75eaaab52e8778d868b159b3 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 6 Jun 2019 09:00:57 -0700 Subject: [PATCH 249/384] More tests --- tests/cases/fourslash/findAllRefsEnumAsNamespace.ts | 4 ++-- tests/cases/fourslash/findAllRefsExportAsNamespace.ts | 7 +++---- .../cases/fourslash/findAllRefsExportConstEqualToClass.ts | 8 ++++---- .../fourslash/findAllRefsExportDefaultClassConstructor.ts | 4 ++-- tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts | 4 ++-- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts b/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts index a065f355d10..e98da5f8d9f 100644 --- a/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts +++ b/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts @@ -1,6 +1,6 @@ /// -////enum [|{| "isWriteAccess": true, "isDefinition": true |}E|] { A } +////[|enum [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}E|] { A }|] ////let e: [|E|].A; -verify.singleReferenceGroup("enum E"); +verify.singleReferenceGroup("enum E", "E"); diff --git a/tests/cases/fourslash/findAllRefsExportAsNamespace.ts b/tests/cases/fourslash/findAllRefsExportAsNamespace.ts index f6149f17d90..e97d3411ce4 100644 --- a/tests/cases/fourslash/findAllRefsExportAsNamespace.ts +++ b/tests/cases/fourslash/findAllRefsExportAsNamespace.ts @@ -3,19 +3,18 @@ // `export as namespace` results in global search. // @Filename: /node_modules/a/index.d.ts -////export function [|{| "isWriteAccess": true, "isDefinition": true |}f|](): void; +////[|export function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}f|](): void;|] ////export as namespace A; // @Filename: /b.ts -////import { [|{| "isWriteAccess": true, "isDefinition": true |}f|] } from "a"; +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}f|] } from "a";|] // @Filename: /c.ts ////A.[|f|](); verify.noErrors(); -const ranges = test.ranges(); -const [r0, r1, r2] = ranges; +const [r0Def, r0, r1Def, r1, r2] = test.ranges(); const globals = { definition: "function f(): void", ranges: [r0, r2] }; const imports = { definition: "(alias) function f(): void\nimport f", ranges: [r1] }; diff --git a/tests/cases/fourslash/findAllRefsExportConstEqualToClass.ts b/tests/cases/fourslash/findAllRefsExportConstEqualToClass.ts index 6be7ea0bdba..98ab1b3a456 100644 --- a/tests/cases/fourslash/findAllRefsExportConstEqualToClass.ts +++ b/tests/cases/fourslash/findAllRefsExportConstEqualToClass.ts @@ -1,13 +1,13 @@ /// // @Filename: /a.ts -////class [|{| "isWriteAccess": true, "isDefinition": true |}C|] {} -////export const [|{| "isWriteAccess": true, "isDefinition": true |}D|] = [|C|]; +////[|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}C|] {}|] +////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}D|] = [|C|];|] // @Filename: /b.ts -////import { [|{| "isWriteAccess": true, "isDefinition": true |}D|] } from "./a"; +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}D|] } from "./a";|] -const [C0, D0, C1, D1] = test.ranges(); +const [C0Def, C0, D0Def, D0, C1, D1Def, D1] = test.ranges(); verify.singleReferenceGroup("class C", [C0, C1]); diff --git a/tests/cases/fourslash/findAllRefsExportDefaultClassConstructor.ts b/tests/cases/fourslash/findAllRefsExportDefaultClassConstructor.ts index 0f269bd5f5b..e8754ff15be 100644 --- a/tests/cases/fourslash/findAllRefsExportDefaultClassConstructor.ts +++ b/tests/cases/fourslash/findAllRefsExportDefaultClassConstructor.ts @@ -1,5 +1,5 @@ ////export default class { -//// [|constructor|]() {} +//// [|[|{| "declarationRangeIndex": 0 |}constructor|]() {}|] ////} -verify.singleReferenceGroup("class default"); +verify.singleReferenceGroup("class default", "constructor"); diff --git a/tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts b/tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts index 7f9c258bbe2..a99116726f8 100644 --- a/tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts +++ b/tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts @@ -1,8 +1,8 @@ /// ////{ -//// export const [|{| "isWriteAccess": true, "isDefinition": true |}x|] = 0; +//// [|export const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] = 0;|] //// [|x|]; ////} -verify.singleReferenceGroup("const x: 0"); +verify.singleReferenceGroup("const x: 0", "x"); From e4a2dd510fa2c5b144d328d00cd264addf239b45 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 6 Jun 2019 09:09:39 -0700 Subject: [PATCH 250/384] Handle export keyword of export assignment --- src/services/findAllReferences.ts | 9 +++------ tests/cases/fourslash/findAllRefsExportEquals.ts | 8 ++++---- .../fourslash/findAllRefs_importType_exportEquals.ts | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 62191137f25..ae31ab544f3 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -74,15 +74,12 @@ namespace ts.FindAllReferences { undefined; } - if (isConstructorDeclaration(node.parent) || - node.parent.name === node || // node is name of declaration, use parent + if (node.parent.name === node || // node is name of declaration, use parent + isConstructorDeclaration(node.parent) || + isExportAssignment(node.parent) || // Property name of the import export specifier or binding pattern, use parent ((isImportOrExportSpecifier(node.parent) || isBindingElement(node.parent)) && node.parent.propertyName === node) || - isExportAssignment(node.parent) && ( - node.parent.expression === node || - (!node.parent.isExportEquals && node.kind === SyntaxKind.DefaultKeyword) - ) || // Is default export (node.kind === SyntaxKind.DefaultKeyword && hasModifier(node.parent, ModifierFlags.ExportDefault))) { return getDeclarationForDeclarationSpan(node.parent); diff --git a/tests/cases/fourslash/findAllRefsExportEquals.ts b/tests/cases/fourslash/findAllRefsExportEquals.ts index 3580c8fe4ee..fd17a82633c 100644 --- a/tests/cases/fourslash/findAllRefsExportEquals.ts +++ b/tests/cases/fourslash/findAllRefsExportEquals.ts @@ -1,13 +1,13 @@ /// // @Filename: /a.ts -////type [|{| "isWriteAccess": true, "isDefinition": true |}T|] = number; -////[|export|] = [|T|]; +////[|type [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}T|] = number;|] +////[|[|{| "declarationRangeIndex": 2 |}export|] = [|{| "declarationRangeIndex": 2 |}T|];|] // @Filename: /b.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}T|] = require("[|./a|]"); +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}T|] = require("[|./a|]");|] -const [r0, r1, r2, r3, r4] = test.ranges(); +const [r0Def, r0, r12Def, r1, r2, r3Def, r3, r4] = test.ranges(); const mod = { definition: 'module "/a"', ranges: [r4, r1] }; const a = { definition: "type T = number", ranges: [r0, r2] }; const b = { definition: '(alias) type T = number\nimport T = require("./a")', ranges: [r3] }; diff --git a/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts b/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts index 0d60c153ce9..4597c3a8bc9 100644 --- a/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts +++ b/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts @@ -5,7 +5,7 @@ ////[|namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}T|] { //// export type U = string; ////}|] -////[|[|export|] = [|{| "declarationRangeIndex": 4 |}T|];|] +////[|[|{| "declarationRangeIndex": 4 |}export|] = [|{| "declarationRangeIndex": 4 |}T|];|] // @Filename: /b.ts ////const x: import("[|./[|a|]|]") = 0; From 7e07669885437103c06ff6832736c88120eccc67 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 6 Jun 2019 09:41:44 -0700 Subject: [PATCH 251/384] Generate declaration file from tests --- tests/cases/compiler/numericEnumMappedType.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/cases/compiler/numericEnumMappedType.ts b/tests/cases/compiler/numericEnumMappedType.ts index be29167bb3d..7c03991e6a2 100644 --- a/tests/cases/compiler/numericEnumMappedType.ts +++ b/tests/cases/compiler/numericEnumMappedType.ts @@ -1,4 +1,5 @@ // @strict: true +// @declaration: true // Repro from #31771 From 50a6002d8ceabf752d68ff67e0b73f3e8ff3b97c Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 6 Jun 2019 09:41:52 -0700 Subject: [PATCH 252/384] Accept new baselines --- .../reference/numericEnumMappedType.js | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/baselines/reference/numericEnumMappedType.js b/tests/baselines/reference/numericEnumMappedType.js index 555ec9712db..78a13e443ff 100644 --- a/tests/baselines/reference/numericEnumMappedType.js +++ b/tests/baselines/reference/numericEnumMappedType.js @@ -66,3 +66,45 @@ var N2; })(N2 || (N2 = {})); var e = E.ONE; var x = e; + + +//// [numericEnumMappedType.d.ts] +declare enum E1 { + ONE = 0, + TWO = 1, + THREE = 2 +} +declare enum E2 { + ONE, + TWO, + THREE +} +declare type Bins1 = { + [k in E1]?: string; +}; +declare type Bins2 = { + [k in E2]?: string; +}; +declare const b1: Bins1; +declare const b2: Bins2; +declare const e1: E1; +declare const e2: E2; +declare function val(): number; +declare enum N1 { + A, + B +} +declare enum N2 { + C, + D +} +declare type T1 = { + [K in N1 | N2]: K; +}; +declare enum E { + ONE = 0, + TWO = 1, + THREE = "x" +} +declare const e: E; +declare const x: E.ONE; From 018026ad52fcc86e2ddd8241a2db80d29b9f0805 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 6 Jun 2019 09:49:31 -0700 Subject: [PATCH 253/384] More tests --- .../cases/fourslash/ambientShorthandFindAllRefs.ts | 7 +++---- .../cancellationWhenfindingAllRefsOnDefinition.ts | 6 +++--- tests/cases/fourslash/doubleUnderscoreRenames.ts | 8 ++++---- tests/cases/fourslash/duplicatePackageServices.ts | 14 +++++++------- .../fourslash/esModuleInteropFindAllReferences.ts | 4 ++-- .../fourslash/esModuleInteropFindAllReferences2.ts | 4 ++-- ...lReferPropertyAccessExpressionHeritageClause.ts | 4 ++-- .../fourslash/findAllReferencesDynamicImport2.ts | 6 +++--- .../fourslash/findAllReferencesDynamicImport3.ts | 6 +++--- .../fourslash/findAllReferencesJSDocFunctionNew.ts | 4 ++-- .../fourslash/findAllReferencesOfConstructor.ts | 9 ++++----- .../findAllReferencesOfConstructor_badOverload.ts | 6 +++--- .../fourslash/findAllReferencesOfJsonModule.ts | 4 ++-- .../findAllReferencesUmdModuleAsGlobalConst.ts | 7 ++++--- tests/cases/fourslash/findAllRefsBadImport.ts | 4 ++-- .../cases/fourslash/findAllRefsClassExpression0.ts | 8 ++++---- .../cases/fourslash/findAllRefsClassExpression1.ts | 6 +++--- .../cases/fourslash/findAllRefsClassExpression2.ts | 6 +++--- .../findAllRefsClassWithStaticThisAccess.ts | 6 +++--- .../fourslash/findAllRefsConstructorFunctions.ts | 6 +++--- tests/cases/fourslash/findAllRefsDeclareClass.ts | 6 +++--- tests/cases/fourslash/findAllRefsDefaultImport.ts | 6 +++--- .../findAllRefsDefaultImportThroughNamespace.ts | 6 +++--- tests/cases/fourslash/findAllRefsDefinition.ts | 4 ++-- .../fourslash/findAllRefsDestructureGeneric.ts | 6 +++--- .../fourslash/findAllRefsDestructureGetter.ts | 8 ++++---- .../fourslash/findAllRefsDestructureGetter2.ts | 8 ++++---- .../fourslash/shims-pp/getReferencesAtPosition.ts | 6 +++--- tests/cases/fourslash/shims-pp/getRenameInfo.ts | 6 +++--- .../fourslash/shims/getReferencesAtPosition.ts | 6 +++--- tests/cases/fourslash/shims/getRenameInfo.ts | 6 +++--- 31 files changed, 96 insertions(+), 97 deletions(-) diff --git a/tests/cases/fourslash/ambientShorthandFindAllRefs.ts b/tests/cases/fourslash/ambientShorthandFindAllRefs.ts index 14918f4a449..822a70ccaf6 100644 --- a/tests/cases/fourslash/ambientShorthandFindAllRefs.ts +++ b/tests/cases/fourslash/ambientShorthandFindAllRefs.ts @@ -4,13 +4,12 @@ ////declare module "jquery"; // @Filename: user.ts -////import {[|{| "isWriteAccess": true, "isDefinition": true |}x|]} from "jquery"; +////[|import {[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|]} from "jquery";|] // @Filename: user2.ts -////import {[|{| "isWriteAccess": true, "isDefinition": true |}x|]} from "jquery"; +////[|import {[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}x|]} from "jquery";|] -const ranges = test.ranges(); -const [r0, r1] = ranges; +const [r0Def, r0, r1Def, r1] = test.ranges(); // TODO: Want these to be in the same group, but that would require creating a symbol for `x`. verify.singleReferenceGroup("(alias) module \"jquery\"\nimport x", [r0]); verify.singleReferenceGroup("(alias) module \"jquery\"\nimport x", [r1]); \ No newline at end of file diff --git a/tests/cases/fourslash/cancellationWhenfindingAllRefsOnDefinition.ts b/tests/cases/fourslash/cancellationWhenfindingAllRefsOnDefinition.ts index 9334ab28b48..a6ff91fbbd5 100644 --- a/tests/cases/fourslash/cancellationWhenfindingAllRefsOnDefinition.ts +++ b/tests/cases/fourslash/cancellationWhenfindingAllRefsOnDefinition.ts @@ -7,9 +7,9 @@ //// //// } //// -//// public /**/[|{| "isWriteAccess": true, "isDefinition": true |}start|](){ +//// [|public /**/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}start|](){ //// return this; -//// } +//// }|] //// //// public stop(){ //// return this; @@ -33,5 +33,5 @@ cancellation.resetCancelled(); checkRefs(); function checkRefs() { - verify.singleReferenceGroup("(method) Test.start(): this"); + verify.singleReferenceGroup("(method) Test.start(): this", "start"); } diff --git a/tests/cases/fourslash/doubleUnderscoreRenames.ts b/tests/cases/fourslash/doubleUnderscoreRenames.ts index 5709be97b6f..6b50d65f124 100644 --- a/tests/cases/fourslash/doubleUnderscoreRenames.ts +++ b/tests/cases/fourslash/doubleUnderscoreRenames.ts @@ -1,12 +1,12 @@ /// // @Filename: fileA.ts -//// export function [|__foo|]() { -//// } +//// [|export function [|{| "declarationRangeIndex": 0 |}__foo|]() { +//// }|] //// // @Filename: fileB.ts -//// import { [|__foo|] as bar } from "./fileA"; +//// [|import { [|{| "declarationRangeIndex": 2 |}__foo|] as bar } from "./fileA";|] //// //// bar(); -verify.rangesAreRenameLocations(); +verify.rangesWithSameTextAreRenameLocations("__foo"); diff --git a/tests/cases/fourslash/duplicatePackageServices.ts b/tests/cases/fourslash/duplicatePackageServices.ts index 2ececda4e06..e5653f9da6d 100644 --- a/tests/cases/fourslash/duplicatePackageServices.ts +++ b/tests/cases/fourslash/duplicatePackageServices.ts @@ -2,25 +2,25 @@ // @noImplicitReferences: true // @Filename: /node_modules/a/index.d.ts -////import [|{| "name": "useAX", "isWriteAccess": true, "isDefinition": true |}X|] from "x"; +////[|import [|{| "name": "useAX", "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}X|] from "x";|] ////export function a(x: [|X|]): void; // @Filename: /node_modules/a/node_modules/x/index.d.ts -////export default class /*defAX*/[|{| "isWriteAccess": true, "isDefinition": true |}X|] { +////[|export default class /*defAX*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}X|] { //// private x: number; -////} +////}|] // @Filename: /node_modules/a/node_modules/x/package.json ////{ "name": "x", "version": "1.2.3" } // @Filename: /node_modules/b/index.d.ts -////import [|{| "name": "useBX", "isWriteAccess": true, "isDefinition": true |}X|] from "x"; +////[|import [|{| "name": "useBX", "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}X|] from "x";|] ////export const b: [|X|]; // @Filename: /node_modules/b/node_modules/x/index.d.ts -////export default class /*defBX*/[|{| "isWriteAccess": true, "isDefinition": true |}X|] { +////[|export default class /*defBX*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 8 |}X|] { //// private x: number; -////} +////}|] // @Filename: /node_modules/b/node_modules/x/package.json ////{ "name": "x", "version": "1.2.3" } @@ -35,7 +35,7 @@ verify.numberOfErrorsInCurrentFile(0); verify.goToDefinition("useAX", "defAX"); verify.goToDefinition("useBX", "defAX"); -const [r0, r1, r2, r3, r4, r5] = test.ranges(); +const [r0Def, r0, r1, r2Def, r2, r3Def, r3, r4, r5Def, r5] = test.ranges(); const aImport = { definition: "(alias) class X\nimport X", ranges: [r0, r1] }; const def = { definition: "class X", ranges: [r2] }; const bImport = { definition: "(alias) class X\nimport X", ranges: [r3, r4] }; diff --git a/tests/cases/fourslash/esModuleInteropFindAllReferences.ts b/tests/cases/fourslash/esModuleInteropFindAllReferences.ts index 4e493e58c24..e1ca3e4c9b1 100644 --- a/tests/cases/fourslash/esModuleInteropFindAllReferences.ts +++ b/tests/cases/fourslash/esModuleInteropFindAllReferences.ts @@ -4,11 +4,11 @@ // @Filename: /abc.d.ts ////declare module "a" { -//// export const [|{| "isWriteAccess": true, "isDefinition": true |}x|]: number; +//// [|export const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|]: number;|] ////} // @Filename: /b.ts ////import a from "a"; ////a.[|x|]; -verify.singleReferenceGroup("const x: number"); +verify.singleReferenceGroup("const x: number", "x"); diff --git a/tests/cases/fourslash/esModuleInteropFindAllReferences2.ts b/tests/cases/fourslash/esModuleInteropFindAllReferences2.ts index e55129a357c..02dbddd6b4e 100644 --- a/tests/cases/fourslash/esModuleInteropFindAllReferences2.ts +++ b/tests/cases/fourslash/esModuleInteropFindAllReferences2.ts @@ -6,10 +6,10 @@ // @Filename: /a.d.ts ////export as namespace abc; -////export const [|{| "isWriteAccess": true, "isDefinition": true |}x|]: number; +////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|]: number;|] // @Filename: /b.ts ////import a from "./a"; ////a.[|x|]; -verify.singleReferenceGroup('const x: number'); +verify.singleReferenceGroup('const x: number', "x"); diff --git a/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts b/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts index 61dfb1c33bc..9e9f552b528 100644 --- a/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts +++ b/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts @@ -2,9 +2,9 @@ //// class B {} //// function foo() { -//// return {[|{| "isWriteAccess": true, "isDefinition": true |}B|]: B}; +//// return {[|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}B|]: B|]}; //// } //// class C extends (foo()).[|B|] {} //// class C1 extends foo().[|B|] {} -verify.singleReferenceGroup("(property) B: typeof B"); +verify.singleReferenceGroup("(property) B: typeof B", "B"); diff --git a/tests/cases/fourslash/findAllReferencesDynamicImport2.ts b/tests/cases/fourslash/findAllReferencesDynamicImport2.ts index 6644a55ec1b..5e90911875b 100644 --- a/tests/cases/fourslash/findAllReferencesDynamicImport2.ts +++ b/tests/cases/fourslash/findAllReferencesDynamicImport2.ts @@ -1,12 +1,12 @@ /// // @Filename: foo.ts -//// export function [|{| "isWriteAccess": true, "isDefinition": true |}bar|]() { return "bar"; } +//// [|export function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}bar|]() { return "bar"; }|] //// var x = import("./foo"); //// x.then(foo => { //// foo.[|bar|](); //// }) -verify.singleReferenceGroup("function bar(): string"); -verify.rangesAreRenameLocations(); +verify.singleReferenceGroup("function bar(): string", "bar"); +verify.rangesWithSameTextAreRenameLocations("bar"); diff --git a/tests/cases/fourslash/findAllReferencesDynamicImport3.ts b/tests/cases/fourslash/findAllReferencesDynamicImport3.ts index 371369ac39c..1035ff40389 100644 --- a/tests/cases/fourslash/findAllReferencesDynamicImport3.ts +++ b/tests/cases/fourslash/findAllReferencesDynamicImport3.ts @@ -1,10 +1,10 @@ /// // @Filename: foo.ts -////export function [|{| "isWriteAccess": true, "isDefinition": true |}bar|]() { return "bar"; } -////import('./foo').then(({ [|{| "isWriteAccess": true, "isDefinition": true |}bar|] }) => undefined); +////[|export function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}bar|]() { return "bar"; }|] +////import('./foo').then(([|{ [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}bar|] }|]) => undefined); -const [r0, r1] = test.ranges(); +const [r0Def, r0, r1Def, r1] = test.ranges(); verify.referenceGroups(r0, [{ definition: "function bar(): string", ranges: [r0, r1] }]); verify.referenceGroups(r1, [ { definition: "function bar(): string", ranges: [r0] }, diff --git a/tests/cases/fourslash/findAllReferencesJSDocFunctionNew.ts b/tests/cases/fourslash/findAllReferencesJSDocFunctionNew.ts index b094714cefb..50066b9b136 100644 --- a/tests/cases/fourslash/findAllReferencesJSDocFunctionNew.ts +++ b/tests/cases/fourslash/findAllReferencesJSDocFunctionNew.ts @@ -1,8 +1,8 @@ /// // @allowJs: true // @Filename: Foo.js -/////** @type {function ([|{|"isWriteAccess": true, "isDefinition": true|}new|]: string, string): string} */ +/////** @type {function ([|[|{|"isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0|}new|]: string|], string): string} */ ////var f; -const [a0] = test.ranges(); +const [a0Def, a0] = test.ranges(); verify.singleReferenceGroup("(parameter) new: string", [a0]); diff --git a/tests/cases/fourslash/findAllReferencesOfConstructor.ts b/tests/cases/fourslash/findAllReferencesOfConstructor.ts index 3dffdeaffb9..ecaada06b1d 100644 --- a/tests/cases/fourslash/findAllReferencesOfConstructor.ts +++ b/tests/cases/fourslash/findAllReferencesOfConstructor.ts @@ -2,9 +2,9 @@ // @Filename: a.ts ////export class C { -//// [|constructor|](n: number); -//// [|constructor|](); -//// [|constructor|](n?: number){} +//// [|[|{| "declarationRangeIndex": 0 |}constructor|](n: number);|] +//// [|[|{| "declarationRangeIndex": 2 |}constructor|]();|] +//// [|[|{| "declarationRangeIndex": 4 |}constructor|](n?: number){}|] //// static f() { //// this.f(); //// new [|this|](); @@ -40,8 +40,7 @@ ////new a.[|C|](); ////class d extends a.C { constructor() { [|super|](); } -const ranges = test.ranges(); -const [a0, a1, a2, a3, a4, b0, c0, d0, d1] = ranges; +const [a0Def, a0, a1Def, a1, a2Def, a2, a3, a4, b0, c0, d0, d1] = test.ranges(); verify.referenceGroups([a0, a2], defs("class C")); verify.referenceGroups(a1, defs("class C")); diff --git a/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts b/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts index 2c4857145e1..ef4dc289359 100644 --- a/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts +++ b/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts @@ -1,8 +1,8 @@ /// ////class C { -//// [|constructor|](n: number); -//// [|constructor|](){} +//// [|[|{| "declarationRangeIndex": 0 |}constructor|](n: number);|] +//// [|[|{| "declarationRangeIndex": 2 |}constructor|](){}|] ////} -verify.singleReferenceGroup("class C"); +verify.singleReferenceGroup("class C", "constructor"); diff --git a/tests/cases/fourslash/findAllReferencesOfJsonModule.ts b/tests/cases/fourslash/findAllReferencesOfJsonModule.ts index 36f700b09e6..fd944097299 100644 --- a/tests/cases/fourslash/findAllReferencesOfJsonModule.ts +++ b/tests/cases/fourslash/findAllReferencesOfJsonModule.ts @@ -5,10 +5,10 @@ // @esModuleInterop: true // @Filename: /foo.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}settings|] from "./settings.json"; +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}settings|] from "./settings.json";|] ////[|settings|]; // @Filename: /settings.json //// {} -verify.singleReferenceGroup("import settings"); +verify.singleReferenceGroup("import settings", "settings"); diff --git a/tests/cases/fourslash/findAllReferencesUmdModuleAsGlobalConst.ts b/tests/cases/fourslash/findAllReferencesUmdModuleAsGlobalConst.ts index 464dcef1548..4876b1e0229 100644 --- a/tests/cases/fourslash/findAllReferencesUmdModuleAsGlobalConst.ts +++ b/tests/cases/fourslash/findAllReferencesUmdModuleAsGlobalConst.ts @@ -9,12 +9,12 @@ // @Filename: /node_modules/@types/three/index.d.ts ////export * from "./three-core"; -////export as namespace [|{| "isWriteAccess": true, "isDefinition": true |}THREE|]; +////[|export as namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}THREE|];|] // @Filename: /typings/global.d.ts ////import * as _THREE from '[|three|]'; ////declare global { -//// const [|{| "isWriteAccess": true, "isDefinition": true |}THREE|]: typeof _THREE; +//// [|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}THREE|]: typeof _THREE;|] ////} // @Filename: /src/index.ts @@ -38,7 +38,8 @@ //// "files": ["/src/index.ts", "typings/global.d.ts"] ////} +const [r0Def, r0, r1, r2Def, ...rest] = test.ranges(); // GH#29533 // TODO:: this should be var THREE: typeof import instead of module name as var but thats existing issue and repros with quickInfo too. verify.singleReferenceGroup(`module "/node_modules/@types/three/index" -var "/node_modules/@types/three/index": typeof import("/node_modules/@types/three/index")`); \ No newline at end of file +var "/node_modules/@types/three/index": typeof import("/node_modules/@types/three/index")`, [r0, r1, ...rest]); \ No newline at end of file diff --git a/tests/cases/fourslash/findAllRefsBadImport.ts b/tests/cases/fourslash/findAllRefsBadImport.ts index a54454ea365..cde75d2df9a 100644 --- a/tests/cases/fourslash/findAllRefsBadImport.ts +++ b/tests/cases/fourslash/findAllRefsBadImport.ts @@ -1,7 +1,7 @@ /// -////import { [|ab|] as [|{| "isWriteAccess": true, "isDefinition": true |}cd|] } from "doesNotExist"; +////[|import { [|{| "declarationRangeIndex": 0 |}ab|] as [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}cd|] } from "doesNotExist";|] -const [r0, r1] = test.ranges(); +const [r0Def, r0, r1] = test.ranges(); verify.referenceGroups(r0, undefined); verify.singleReferenceGroup("import cd", [r1]); diff --git a/tests/cases/fourslash/findAllRefsClassExpression0.ts b/tests/cases/fourslash/findAllRefsClassExpression0.ts index e8d4aa671a3..9ccff25ab96 100644 --- a/tests/cases/fourslash/findAllRefsClassExpression0.ts +++ b/tests/cases/fourslash/findAllRefsClassExpression0.ts @@ -1,15 +1,15 @@ /// // @Filename: /a.ts -////export = class [|{| "isWriteAccess": true, "isDefinition": true |}A|] { +////export = [|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}A|] { //// m() { [|A|]; } -////}; +////}|]; // @Filename: /b.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}A|] = require("./a"); +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}A|] = require("./a");|] ////[|A|]; -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1, r2Def, r2, r3] = test.ranges(); const defs = { definition: "(local class) A", ranges: [r0, r1] }; const imports = { definition: '(alias) (local class) A\nimport A = require("./a")', ranges: [r2, r3] }; verify.referenceGroups([r0, r1], [defs, imports]); diff --git a/tests/cases/fourslash/findAllRefsClassExpression1.ts b/tests/cases/fourslash/findAllRefsClassExpression1.ts index 64aad512a5e..96bba426a25 100644 --- a/tests/cases/fourslash/findAllRefsClassExpression1.ts +++ b/tests/cases/fourslash/findAllRefsClassExpression1.ts @@ -3,13 +3,13 @@ // @allowJs: true // @Filename: /a.js -////module.exports = class [|{| "isWriteAccess": true, "isDefinition": true |}A|] {}; +////module.exports = [|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}A|] {}|]; // @Filename: /b.js -////import [|{| "isWriteAccess": true, "isDefinition": true |}A|] = require("./a"); +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}A|] = require("./a");|] ////[|A|]; -const [r0, r1, r2] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2] = test.ranges(); const defs = { definition: "(local class) A", ranges: [r0] }; const imports = { definition: '(alias) (local class) A\nimport A = require("./a")', ranges: [r1, r2] }; verify.referenceGroups([r0], [defs, imports]); diff --git a/tests/cases/fourslash/findAllRefsClassExpression2.ts b/tests/cases/fourslash/findAllRefsClassExpression2.ts index 1214e3f7c88..9432e9e7181 100644 --- a/tests/cases/fourslash/findAllRefsClassExpression2.ts +++ b/tests/cases/fourslash/findAllRefsClassExpression2.ts @@ -3,13 +3,13 @@ // @allowJs: true // @Filename: /a.js -////exports.[|{| "isWriteAccess": true, "isDefinition": true |}A|] = class {}; +////[|exports.[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}A|] = class {};|] // @Filename: /b.js -////import { [|{| "isWriteAccess": true, "isDefinition": true |}A|] } from "./a"; +////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}A|] } from "./a";|] ////[|A|]; -const [r0, r1, r2] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2] = test.ranges(); const defs = { definition: "class A\n(property) A: typeof A", ranges: [r0] }; const imports = { definition: "(alias) class A\n(alias) (property) A: typeof A\nimport A", ranges: [r1, r2] }; verify.referenceGroups([r0], [defs, imports]); diff --git a/tests/cases/fourslash/findAllRefsClassWithStaticThisAccess.ts b/tests/cases/fourslash/findAllRefsClassWithStaticThisAccess.ts index f2c432abc76..419f61836d3 100644 --- a/tests/cases/fourslash/findAllRefsClassWithStaticThisAccess.ts +++ b/tests/cases/fourslash/findAllRefsClassWithStaticThisAccess.ts @@ -1,6 +1,6 @@ /// -////class [|{| "isWriteAccess": true, "isDefinition": true |}C|] { +////[|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}C|] { //// static s() { //// [|this|]; //// } @@ -10,9 +10,9 @@ //// function inner() { this; } //// class Inner { x = this; } //// } -////} +////}|] -const [r0, r1, r2] = test.ranges(); +const [r0Def, r0, r1, r2] = test.ranges(); verify.referenceGroups(r0, [{ definition: "class C", ranges: [r0, r1, r2] }]); verify.singleReferenceGroup("this: typeof C", [r1, r2]); diff --git a/tests/cases/fourslash/findAllRefsConstructorFunctions.ts b/tests/cases/fourslash/findAllRefsConstructorFunctions.ts index 77fa674f65b..8f95f94da2b 100644 --- a/tests/cases/fourslash/findAllRefsConstructorFunctions.ts +++ b/tests/cases/fourslash/findAllRefsConstructorFunctions.ts @@ -4,11 +4,11 @@ // @Filename: /a.js ////function f() { -//// this.[|{| "isWriteAccess": true, "isDefinition": true |}x|] = 0; +//// [|this.[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] = 0;|] ////} ////f.prototype.setX = function() { -//// this.[|{| "isWriteAccess": true, "isDefinition": true |}x|] = 1; +//// [|this.[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}x|] = 1;|] ////} ////f.prototype.useX = function() { this.[|x|]; } -verify.singleReferenceGroup("(property) f.x: number"); +verify.singleReferenceGroup("(property) f.x: number", "x"); diff --git a/tests/cases/fourslash/findAllRefsDeclareClass.ts b/tests/cases/fourslash/findAllRefsDeclareClass.ts index 9ef813634a5..4632f48c527 100644 --- a/tests/cases/fourslash/findAllRefsDeclareClass.ts +++ b/tests/cases/fourslash/findAllRefsDeclareClass.ts @@ -1,7 +1,7 @@ /// -////declare class [|{| "isWriteAccess": true, "isDefinition": true |}C|] { +////[|declare class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}C|] { //// static m(): void; -////} +////}|] -verify.singleReferenceGroup("class C"); +verify.singleReferenceGroup("class C", "C"); diff --git a/tests/cases/fourslash/findAllRefsDefaultImport.ts b/tests/cases/fourslash/findAllRefsDefaultImport.ts index b981f50bd16..23b7c8af76a 100644 --- a/tests/cases/fourslash/findAllRefsDefaultImport.ts +++ b/tests/cases/fourslash/findAllRefsDefaultImport.ts @@ -1,12 +1,12 @@ /// // @Filename: /a.ts -////export default function [|{| "isWriteAccess": true, "isDefinition": true |}a|]() {} +////[|export default function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}a|]() {}|] // @Filename: /b.ts -////import [|{| "isWriteAccess": true, "isDefinition": true |}a|], * as ns from "./a"; +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}a|], * as ns from "./a";|] -const [r0, r1] = test.ranges(); +const [r0Def, r0, r1Def, r1] = test.ranges(); const a: FourSlashInterface.ReferenceGroup = { definition: "function a(): void", ranges: [r0] }; const b: FourSlashInterface.ReferenceGroup = { definition: "(alias) function a(): void\nimport a", ranges: [r1] }; verify.referenceGroups(r0, [a, b]); diff --git a/tests/cases/fourslash/findAllRefsDefaultImportThroughNamespace.ts b/tests/cases/fourslash/findAllRefsDefaultImportThroughNamespace.ts index 722403f45cf..ca99174463b 100644 --- a/tests/cases/fourslash/findAllRefsDefaultImportThroughNamespace.ts +++ b/tests/cases/fourslash/findAllRefsDefaultImportThroughNamespace.ts @@ -1,7 +1,7 @@ /// // @Filename: /a.ts -////export [|{| "isWriteAccess": true, "isDefinition": true |}default|] function [|{| "isWriteAccess": true, "isDefinition": true |}f|]() {} +////[|export [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}default|] function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}f|]() {}|] // @Filename: /b.ts ////export import a = require("./a"); @@ -10,10 +10,10 @@ ////import { a } from "./b"; ////a.[|default|](); //// -////declare const x: { [|{| "isWriteAccess": true, "isDefinition": true |}default|]: number }; +////declare const x: { [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}default|]: number|] }; ////x.[|default|]; -const [r0, r1, r2, r3, r4] = test.ranges(); +const [r0Def, r0, r1, r2, r3Def, r3, r4] = test.ranges(); verify.referenceGroups([r0], [{ definition: "function f(): void", ranges: [r0, r2] }]); verify.singleReferenceGroup("function f(): void", [r1, r2]); diff --git a/tests/cases/fourslash/findAllRefsDefinition.ts b/tests/cases/fourslash/findAllRefsDefinition.ts index 7b7016e7049..4d9d50a618a 100644 --- a/tests/cases/fourslash/findAllRefsDefinition.ts +++ b/tests/cases/fourslash/findAllRefsDefinition.ts @@ -1,9 +1,9 @@ /// -////const [|{| "isWriteAccess": true, "isDefinition": true |}x|] = 0; +////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|] = 0;|] ////[|x|]; -const ranges = test.ranges(); +const ranges = test.rangesByText().get("x"); verify.referenceGroups(ranges, [ { definition: { text: "const x: 0", range: ranges[0] }, diff --git a/tests/cases/fourslash/findAllRefsDestructureGeneric.ts b/tests/cases/fourslash/findAllRefsDestructureGeneric.ts index 3d7a84cb35a..d6e96155ec7 100644 --- a/tests/cases/fourslash/findAllRefsDestructureGeneric.ts +++ b/tests/cases/fourslash/findAllRefsDestructureGeneric.ts @@ -1,12 +1,12 @@ /// ////interface I { -//// [|{| "isDefinition": true |}x|]: boolean; +//// [|[|{| "isDefinition": true, "declarationRangeIndex": 0 |}x|]: boolean;|] ////} ////declare const i: I; -////const { [|{| "isWriteAccess": true, "isDefinition": true |}x|] } = i; +////[|const { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}x|] } = i;|] -const [r0, r1] = test.ranges(); +const [r0Def, r0, r1Def, r1] = test.ranges(); verify.referenceGroups(r0, [{ definition: "(property) I.x: boolean", ranges: [r0, r1] }]); verify.referenceGroups(r1, [ diff --git a/tests/cases/fourslash/findAllRefsDestructureGetter.ts b/tests/cases/fourslash/findAllRefsDestructureGetter.ts index 763d3cfb0e5..ed4a74d5d2b 100644 --- a/tests/cases/fourslash/findAllRefsDestructureGetter.ts +++ b/tests/cases/fourslash/findAllRefsDestructureGetter.ts @@ -1,14 +1,14 @@ /// ////class Test { -//// get [|{| "isDefinition": true, "isWriteAccess": true |}x|]() { return 0; } +//// [|get [|{| "isDefinition": true, "isWriteAccess": true, "declarationRangeIndex": 0 |}x|]() { return 0; }|] //// -//// set [|{| "isDefinition": true, "isWriteAccess": true |}y|](a: number) {} +//// [|set [|{| "isDefinition": true, "isWriteAccess": true, "declarationRangeIndex": 2 |}y|](a: number) {}|] ////} -////const { [|{| "isDefinition": true, "isWriteAccess": true |}x|], [|{| "isDefinition": true, "isWriteAccess": true |}y|] } = new Test(); +////[|const { [|{| "isDefinition": true, "isWriteAccess": true, "declarationRangeIndex": 4 |}x|], [|{| "isDefinition": true, "isWriteAccess": true, "declarationRangeIndex": 4 |}y|] } = new Test();|] ////[|x|]; [|y|]; -const [x0, y0, x1, y1, x2, y2] = test.ranges(); +const [x0Def, x0, y0Def, y0, xy1Def, x1, y1, x2, y2] = test.ranges(); verify.referenceGroups(x0, [{ definition: "(property) Test.x: number", ranges: [x0, x1] }]); verify.referenceGroups(x1, [ { definition: "(property) Test.x: number", ranges: [x0] }, diff --git a/tests/cases/fourslash/findAllRefsDestructureGetter2.ts b/tests/cases/fourslash/findAllRefsDestructureGetter2.ts index d26983a1091..8d6300e976f 100644 --- a/tests/cases/fourslash/findAllRefsDestructureGetter2.ts +++ b/tests/cases/fourslash/findAllRefsDestructureGetter2.ts @@ -4,13 +4,13 @@ // @Filename: /a.ts ////class C { -//// get [|{| "isWriteAccess": true, "isDefinition": true |}g|](): number { return 0; } +//// [|get [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}g|](): number { return 0; }|] //// -//// set [|{| "isWriteAccess": true, "isDefinition": true |}s|](value: number) {} +//// [|set [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}s|](value: number) {}|] ////} -////const { [|{| "isWriteAccess": true, "isDefinition": true |}g|], [|{| "isWriteAccess": true, "isDefinition": true |}s|] } = new C(); +////[|const { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}g|], [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}s|] } = new C();|] -const [g0, s0, g1, s1] = test.ranges(); +const [g0Def, g0, s0Def, s0, gs1Def, g1, s1] = test.ranges(); verify.quickInfoAt(g0, "(property) C.g: number"); verify.referenceGroups(g0, [{ definition: "(property) C.g: number", ranges: [g0, g1] }]); verify.referenceGroups(g1, [ diff --git a/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts b/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts index 7189738435f..fabe77c53ac 100644 --- a/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts +++ b/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts @@ -7,9 +7,9 @@ //// //// } //// -//// public [|{| "isWriteAccess": true, "isDefinition": true |}start|](){ +//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}start|](){ //// return this; -//// } +//// }|] //// //// public stop(){ //// return this; @@ -23,4 +23,4 @@ ////second.[|start|](); ////second.stop(); -verify.singleReferenceGroup("(method) Test.start(): this"); +verify.singleReferenceGroup("(method) Test.start(): this", "start"); diff --git a/tests/cases/fourslash/shims-pp/getRenameInfo.ts b/tests/cases/fourslash/shims-pp/getRenameInfo.ts index aa04d69962a..2595a523f16 100644 --- a/tests/cases/fourslash/shims-pp/getRenameInfo.ts +++ b/tests/cases/fourslash/shims-pp/getRenameInfo.ts @@ -2,9 +2,9 @@ /////// -////function [|Bar|]() { +////[|function [|{| "declarationRangeIndex": 0 |}Bar|]() { //// // This is a reference to Bar in a comment. //// "this is a reference to Bar in a string" -////} +////}|] -verify.rangesAreRenameLocations(); +verify.rangesWithSameTextAreRenameLocations("Bar"); diff --git a/tests/cases/fourslash/shims/getReferencesAtPosition.ts b/tests/cases/fourslash/shims/getReferencesAtPosition.ts index 7189738435f..fabe77c53ac 100644 --- a/tests/cases/fourslash/shims/getReferencesAtPosition.ts +++ b/tests/cases/fourslash/shims/getReferencesAtPosition.ts @@ -7,9 +7,9 @@ //// //// } //// -//// public [|{| "isWriteAccess": true, "isDefinition": true |}start|](){ +//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}start|](){ //// return this; -//// } +//// }|] //// //// public stop(){ //// return this; @@ -23,4 +23,4 @@ ////second.[|start|](); ////second.stop(); -verify.singleReferenceGroup("(method) Test.start(): this"); +verify.singleReferenceGroup("(method) Test.start(): this", "start"); diff --git a/tests/cases/fourslash/shims/getRenameInfo.ts b/tests/cases/fourslash/shims/getRenameInfo.ts index aa04d69962a..2595a523f16 100644 --- a/tests/cases/fourslash/shims/getRenameInfo.ts +++ b/tests/cases/fourslash/shims/getRenameInfo.ts @@ -2,9 +2,9 @@ /////// -////function [|Bar|]() { +////[|function [|{| "declarationRangeIndex": 0 |}Bar|]() { //// // This is a reference to Bar in a comment. //// "this is a reference to Bar in a string" -////} +////}|] -verify.rangesAreRenameLocations(); +verify.rangesWithSameTextAreRenameLocations("Bar"); From 2fdf7b5d3b319a105b85203026a7b677a8e69ee7 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Thu, 6 Jun 2019 10:13:07 -0700 Subject: [PATCH 254/384] Update user baselines (#31793) --- .../baselines/reference/user/chrome-devtools-frontend.log | 8 ++++++++ tests/baselines/reference/user/prettier.log | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/tests/baselines/reference/user/chrome-devtools-frontend.log b/tests/baselines/reference/user/chrome-devtools-frontend.log index 6b6b46ab180..7c51aef5159 100644 --- a/tests/baselines/reference/user/chrome-devtools-frontend.log +++ b/tests/baselines/reference/user/chrome-devtools-frontend.log @@ -3012,7 +3012,15 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(65285,7): error TS2339: Property 'description' does not exist on type 'Error'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(65310,1): error TS2323: Cannot redeclare exported variable '__esModule'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(65379,1): error TS2323: Cannot redeclare exported variable '__esModule'. +node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(65443,1): error TS2322: Type '{ line: number; column: number; }' is not assignable to type '{}'. + Property 'line' does not exist on type '{}'. +node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(65464,1): error TS2322: Type '{ line: number; column: number; }' is not assignable to type '{}'. + Property 'line' does not exist on type '{}'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(65468,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'entry' must be of type '{ multiLine: boolean; slice: any[]; range: number[]; loc: { start: { line: number; column: number; }; end: {}; }; }', but here has type '{ multiLine: boolean; slice: any[]; range: any[]; loc: { start: { line: number; column: number; }; end: {}; }; }'. +node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(65507,1): error TS2322: Type '{ line: number; column: number; }' is not assignable to type '{}'. + Property 'line' does not exist on type '{}'. +node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(65529,1): error TS2322: Type '{ line: number; column: number; }' is not assignable to type '{}'. + Property 'line' does not exist on type '{}'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(65533,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'entry' must be of type '{ multiLine: boolean; slice: number[]; range: any[]; loc: { start: { line: number; column: number; }; end: {}; }; }', but here has type '{ multiLine: boolean; slice: any[]; range: any[]; loc: { start: { line: number; column: number; }; end: {}; }; }'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(65576,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'comment' must be of type '{ multiLine: boolean; slice: any[]; range: number[]; loc: { start: { line: number; column: number; }; end: {}; }; }[]', but here has type '{ multiLine: boolean; slice: number[]; range: any[]; loc: { start: { line: number; column: number; }; end: {}; }; }[]'. node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(66529,1): error TS2323: Cannot redeclare exported variable '__esModule'. diff --git a/tests/baselines/reference/user/prettier.log b/tests/baselines/reference/user/prettier.log index 6ee6e91cb6b..2082b66ee59 100644 --- a/tests/baselines/reference/user/prettier.log +++ b/tests/baselines/reference/user/prettier.log @@ -160,6 +160,13 @@ src/language-js/printer-estree.js(1892,20): error TS2345: Argument of type '{ ty src/language-js/printer-estree.js(1894,18): error TS2345: Argument of type '"while ("' is not assignable to parameter of type '{ type: string; id: any; contents: any; break: boolean; expandedStates: any; }'. src/language-js/printer-estree.js(1903,9): error TS2345: Argument of type '")"' is not assignable to parameter of type '{ type: string; id: any; contents: any; break: boolean; expandedStates: any; }'. src/language-js/printer-estree.js(2426,28): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'. +src/language-js/printer-estree.js(2446,13): error TS2345: Argument of type '{ hasLineBreak: boolean; cells: never[]; }[]' is not assignable to parameter of type '{ cells: any; } | ConcatArray<{ cells: any; }>'. + Type '{ hasLineBreak: boolean; cells: never[]; }[]' is not assignable to type 'ConcatArray<{ cells: any; }>'. + Types of property 'slice' are incompatible. + Type '(start?: number | undefined, end?: number | undefined) => { hasLineBreak: boolean; cells: never[]; }[]' is not assignable to type '(start?: number | undefined, end?: number | undefined) => { cells: any; }[]'. + Type '{ hasLineBreak: boolean; cells: never[]; }[]' is not assignable to type '{ cells: any; }[]'. + Type '{ hasLineBreak: boolean; cells: never[]; }' is not assignable to type '{ cells: any; }'. + Property 'hasLineBreak' does not exist on type '{ cells: any; }'. src/language-js/printer-estree.js(3513,11): error TS2345: Argument of type 'never[] | { type: string; parts: any; }' is not assignable to parameter of type 'ConcatArray'. Type '{ type: string; parts: any; }' is not assignable to type 'ConcatArray'. src/language-js/printer-estree.js(4031,23): error TS2532: Object is possibly 'undefined'. From ca44ee8f975b32d275a7f6470f2232fc68cbc8a5 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 6 Jun 2019 10:28:42 -0700 Subject: [PATCH 255/384] Update fourslash tests to have semicolons --- .../extract-method-in-anonymous-function-declaration.ts | 2 +- .../fourslash/extract-method_jsxIntrinsicTagSymbol.ts | 2 +- tests/cases/fourslash/refactorExtractType11.ts | 4 ++-- tests/cases/fourslash/refactorExtractType14.ts | 4 ++-- tests/cases/fourslash/refactorExtractType15.ts | 4 ++-- tests/cases/fourslash/refactorExtractType17.ts | 4 ++-- tests/cases/fourslash/refactorExtractType18.ts | 4 ++-- tests/cases/fourslash/refactorExtractType19.ts | 4 ++-- tests/cases/fourslash/refactorExtractType20.ts | 4 ++-- tests/cases/fourslash/refactorExtractType21.ts | 4 ++-- tests/cases/fourslash/refactorExtractType22.ts | 4 ++-- tests/cases/fourslash/refactorExtractType23.ts | 4 ++-- tests/cases/fourslash/refactorExtractType24.ts | 4 ++-- tests/cases/fourslash/refactorExtractType25.ts | 4 ++-- tests/cases/fourslash/refactorExtractType26.ts | 4 ++-- tests/cases/fourslash/refactorExtractType27.ts | 4 ++-- tests/cases/fourslash/refactorExtractType28.ts | 4 ++-- tests/cases/fourslash/refactorExtractType29.ts | 4 ++-- tests/cases/fourslash/refactorExtractType30.ts | 4 ++-- tests/cases/fourslash/refactorExtractType34.ts | 4 ++-- tests/cases/fourslash/refactorExtractType35.ts | 4 ++-- tests/cases/fourslash/refactorExtractType36.ts | 4 ++-- tests/cases/fourslash/refactorExtractType37.ts | 4 ++-- tests/cases/fourslash/refactorExtractType39.ts | 4 ++-- tests/cases/fourslash/refactorExtractType42.ts | 8 ++++---- tests/cases/fourslash/refactorExtractType44.ts | 4 ++-- tests/cases/fourslash/refactorExtractType45.ts | 4 ++-- tests/cases/fourslash/refactorExtractType46.ts | 8 ++++---- tests/cases/fourslash/refactorExtractType49.ts | 8 ++++---- tests/cases/fourslash/refactorExtractType7.ts | 4 ++-- tests/cases/fourslash/refactorExtractType8.ts | 4 ++-- tests/cases/fourslash/refactorExtractType9.ts | 4 ++-- 32 files changed, 68 insertions(+), 68 deletions(-) diff --git a/tests/cases/fourslash/extract-method-in-anonymous-function-declaration.ts b/tests/cases/fourslash/extract-method-in-anonymous-function-declaration.ts index 6566d129874..197ad698088 100644 --- a/tests/cases/fourslash/extract-method-in-anonymous-function-declaration.ts +++ b/tests/cases/fourslash/extract-method-in-anonymous-function-declaration.ts @@ -1,7 +1,7 @@ /// ////export default function() { -//// /*start*/0/*end*/ +//// /*start*/0/*end*/; ////} goTo.select('start', 'end') diff --git a/tests/cases/fourslash/extract-method_jsxIntrinsicTagSymbol.ts b/tests/cases/fourslash/extract-method_jsxIntrinsicTagSymbol.ts index 072fd670ddd..74a6b2fc212 100644 --- a/tests/cases/fourslash/extract-method_jsxIntrinsicTagSymbol.ts +++ b/tests/cases/fourslash/extract-method_jsxIntrinsicTagSymbol.ts @@ -11,5 +11,5 @@ edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "constant_scope_0", actionDescription: "Extract to constant in enclosing scope", - newContent: "const /*RENAME*/newLocal =
;", + newContent: "const /*RENAME*/newLocal =
", }); diff --git a/tests/cases/fourslash/refactorExtractType11.ts b/tests/cases/fourslash/refactorExtractType11.ts index feb5e68c440..7f465bef111 100644 --- a/tests/cases/fourslash/refactorExtractType11.ts +++ b/tests/cases/fourslash/refactorExtractType11.ts @@ -1,7 +1,7 @@ /// //// function foo(a: number, b?: number, ...c: number[]): boolean { -//// return false as /*a*/boolean/*b*/ +//// return false as /*a*/boolean/*b*/; //// } goTo.select("a", "b"); @@ -12,6 +12,6 @@ edit.applyRefactor({ newContent: `function foo(a: number, b?: number, ...c: number[]): boolean { type /*RENAME*/NewType = boolean; - return false as NewType + return false as NewType; }`, }); diff --git a/tests/cases/fourslash/refactorExtractType14.ts b/tests/cases/fourslash/refactorExtractType14.ts index 4d5667bb540..29655086921 100644 --- a/tests/cases/fourslash/refactorExtractType14.ts +++ b/tests/cases/fourslash/refactorExtractType14.ts @@ -1,6 +1,6 @@ /// -//// type A = string | number | T +//// type A = string | number | T; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = boolean; -type A = string | number | T`, +type A = string | number | T;`, }); diff --git a/tests/cases/fourslash/refactorExtractType15.ts b/tests/cases/fourslash/refactorExtractType15.ts index a716f42509a..84a26de6be4 100644 --- a/tests/cases/fourslash/refactorExtractType15.ts +++ b/tests/cases/fourslash/refactorExtractType15.ts @@ -1,6 +1,6 @@ /// -//// type A = /*a*/string/*b*/ | number | T +//// type A = /*a*/string/*b*/ | number | T; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = string; -type A = NewType | number | T`, +type A = NewType | number | T;`, }); diff --git a/tests/cases/fourslash/refactorExtractType17.ts b/tests/cases/fourslash/refactorExtractType17.ts index ae62b402fe3..605fccb25d6 100644 --- a/tests/cases/fourslash/refactorExtractType17.ts +++ b/tests/cases/fourslash/refactorExtractType17.ts @@ -1,6 +1,6 @@ /// -//// type A = string | number | /*a*/T/*b*/ +//// type A = string | number | /*a*/T/*b*/; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = T; -type A = string | number | NewType`, +type A = string | number | NewType;`, }); diff --git a/tests/cases/fourslash/refactorExtractType18.ts b/tests/cases/fourslash/refactorExtractType18.ts index 1ebe8a2b354..310be9b0e28 100644 --- a/tests/cases/fourslash/refactorExtractType18.ts +++ b/tests/cases/fourslash/refactorExtractType18.ts @@ -1,6 +1,6 @@ /// -//// type A = /*a*/Partial/*b*/ & D | C +//// type A = /*a*/Partial/*b*/ & D | C; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,6 +9,6 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = Partial; -type A = NewType & D | C`, +type A = NewType & D | C;`, }); diff --git a/tests/cases/fourslash/refactorExtractType19.ts b/tests/cases/fourslash/refactorExtractType19.ts index 4a982f6899d..4ecd563c7ea 100644 --- a/tests/cases/fourslash/refactorExtractType19.ts +++ b/tests/cases/fourslash/refactorExtractType19.ts @@ -1,6 +1,6 @@ /// -//// type A = /*a*/Partial/*b*/ & D | C +//// type A = /*a*/Partial/*b*/ & D | C; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,6 +9,6 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = Partial; -type A = NewType & D | C`, +type A = NewType & D | C;`, }); diff --git a/tests/cases/fourslash/refactorExtractType20.ts b/tests/cases/fourslash/refactorExtractType20.ts index b31f208704f..2994418355b 100644 --- a/tests/cases/fourslash/refactorExtractType20.ts +++ b/tests/cases/fourslash/refactorExtractType20.ts @@ -1,6 +1,6 @@ /// -//// type A = () => (v: /*a*/T/*b*/) => (v: T) => (v: T) => U +//// type A = () => (v: /*a*/T/*b*/) => (v: T) => (v: T) => U; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = T; -type A = () => (v: NewType) => (v: T) => (v: T) => U`, +type A = () => (v: NewType) => (v: T) => (v: T) => U;`, }); diff --git a/tests/cases/fourslash/refactorExtractType21.ts b/tests/cases/fourslash/refactorExtractType21.ts index e97485c8269..157e38af75e 100644 --- a/tests/cases/fourslash/refactorExtractType21.ts +++ b/tests/cases/fourslash/refactorExtractType21.ts @@ -1,6 +1,6 @@ /// -//// type A = () => (v: T) => (v: /*a*/T/*b*/) => (v: T) => U +//// type A = () => (v: T) => (v: /*a*/T/*b*/) => (v: T) => U; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = T; -type A = () => (v: T) => (v: NewType) => (v: T) => U`, +type A = () => (v: T) => (v: NewType) => (v: T) => U;`, }); diff --git a/tests/cases/fourslash/refactorExtractType22.ts b/tests/cases/fourslash/refactorExtractType22.ts index f7282df4ef7..16344397db6 100644 --- a/tests/cases/fourslash/refactorExtractType22.ts +++ b/tests/cases/fourslash/refactorExtractType22.ts @@ -1,6 +1,6 @@ /// -//// type A = () => (v: T) => (v: T) => (v: /*a*/T/*b*/) => U +//// type A = () => (v: T) => (v: T) => (v: /*a*/T/*b*/) => U; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = T; -type A = () => (v: T) => (v: T) => (v: NewType) => U`, +type A = () => (v: T) => (v: T) => (v: NewType) => U;`, }); diff --git a/tests/cases/fourslash/refactorExtractType23.ts b/tests/cases/fourslash/refactorExtractType23.ts index 9e219dd3383..ea8082a3b2a 100644 --- a/tests/cases/fourslash/refactorExtractType23.ts +++ b/tests/cases/fourslash/refactorExtractType23.ts @@ -1,6 +1,6 @@ /// -//// type A = () => (v: T) => (v: T) => (v: T) => /*a*/U/*b*/ +//// type A = () => (v: T) => (v: T) => (v: T) => /*a*/U/*b*/; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = U; -type A = () => (v: T) => (v: T) => (v: T) => NewType`, +type A = () => (v: T) => (v: T) => (v: T) => NewType;`, }); diff --git a/tests/cases/fourslash/refactorExtractType24.ts b/tests/cases/fourslash/refactorExtractType24.ts index 54b36acb252..98f3edecc67 100644 --- a/tests/cases/fourslash/refactorExtractType24.ts +++ b/tests/cases/fourslash/refactorExtractType24.ts @@ -1,6 +1,6 @@ /// -//// type A = () => (v: T) => (v: T) => /*a*/(v: T) => U/*b*/ +//// type A = () => (v: T) => (v: T) => /*a*/(v: T) => U/*b*/; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = (v: T) => U; -type A = () => (v: T) => (v: T) => NewType`, +type A = () => (v: T) => (v: T) => NewType;`, }); diff --git a/tests/cases/fourslash/refactorExtractType25.ts b/tests/cases/fourslash/refactorExtractType25.ts index b09d04912c1..9ad43742111 100644 --- a/tests/cases/fourslash/refactorExtractType25.ts +++ b/tests/cases/fourslash/refactorExtractType25.ts @@ -1,6 +1,6 @@ /// -//// type A = () => (v: T) => /*a*/(v: T) => (v: T) => U/*b*/ +//// type A = () => (v: T) => /*a*/(v: T) => (v: T) => U/*b*/; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = (v: T) => (v: T) => U; -type A = () => (v: T) => NewType`, +type A = () => (v: T) => NewType;`, }); diff --git a/tests/cases/fourslash/refactorExtractType26.ts b/tests/cases/fourslash/refactorExtractType26.ts index 662ce7eb8dc..2dffef7e9ac 100644 --- a/tests/cases/fourslash/refactorExtractType26.ts +++ b/tests/cases/fourslash/refactorExtractType26.ts @@ -1,6 +1,6 @@ /// -//// type A = () => /*a*/(v: T) => (v: T) => (v: T) => U/*b*/ +//// type A = () => /*a*/(v: T) => (v: T) => (v: T) => U/*b*/; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = (v: T) => (v: T) => (v: T) => U; -type A = () => NewType`, +type A = () => NewType;`, }); diff --git a/tests/cases/fourslash/refactorExtractType27.ts b/tests/cases/fourslash/refactorExtractType27.ts index 5163fd2d480..e9c8d05601c 100644 --- a/tests/cases/fourslash/refactorExtractType27.ts +++ b/tests/cases/fourslash/refactorExtractType27.ts @@ -1,6 +1,6 @@ /// -//// type A = /*a*/() => (v: T) => (v: T) => (v: T) => U/*b*/ +//// type A = /*a*/() => (v: T) => (v: T) => (v: T) => U/*b*/; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = () => (v: T) => (v: T) => (v: T) => U; -type A = NewType`, +type A = NewType;`, }); diff --git a/tests/cases/fourslash/refactorExtractType28.ts b/tests/cases/fourslash/refactorExtractType28.ts index 81d1356ca21..4e53e463a90 100644 --- a/tests/cases/fourslash/refactorExtractType28.ts +++ b/tests/cases/fourslash/refactorExtractType28.ts @@ -1,6 +1,6 @@ /// -//// type Item = /*a*/T/*b*/ extends (infer P)[] ? P : never +//// type Item = /*a*/T/*b*/ extends (infer P)[] ? P : never; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = T; -type Item = NewType extends (infer P)[] ? P : never`, +type Item = NewType extends (infer P)[] ? P : never;`, }); diff --git a/tests/cases/fourslash/refactorExtractType29.ts b/tests/cases/fourslash/refactorExtractType29.ts index a1fb2ac405c..29fd2ec7e61 100644 --- a/tests/cases/fourslash/refactorExtractType29.ts +++ b/tests/cases/fourslash/refactorExtractType29.ts @@ -1,6 +1,6 @@ /// -//// type Item = T extends (infer P)[] ? /*a*/P/*b*/ : never +//// type Item = T extends (infer P)[] ? /*a*/P/*b*/ : never; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType

= P; -type Item = T extends (infer P)[] ? NewType

: never`, +type Item = T extends (infer P)[] ? NewType

: never;`, }); diff --git a/tests/cases/fourslash/refactorExtractType30.ts b/tests/cases/fourslash/refactorExtractType30.ts index a0684cabb53..a3943d32128 100644 --- a/tests/cases/fourslash/refactorExtractType30.ts +++ b/tests/cases/fourslash/refactorExtractType30.ts @@ -1,6 +1,6 @@ /// -//// type Item = T extends (infer P)[] ? P : /*a*/never/*b*/ +//// type Item = T extends (infer P)[] ? P : /*a*/never/*b*/; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = never; -type Item = T extends (infer P)[] ? P : NewType`, +type Item = T extends (infer P)[] ? P : NewType;`, }); diff --git a/tests/cases/fourslash/refactorExtractType34.ts b/tests/cases/fourslash/refactorExtractType34.ts index 114d08a09a6..45b4c116549 100644 --- a/tests/cases/fourslash/refactorExtractType34.ts +++ b/tests/cases/fourslash/refactorExtractType34.ts @@ -1,6 +1,6 @@ /// -//// type Item = /*a*/T extends (infer P)[] ? P : never/*b*/ +//// type Item = /*a*/T extends (infer P)[] ? P : never/*b*/; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = T extends (infer P)[] ? P : never; -type Item = NewType`, +type Item = NewType;`, }); diff --git a/tests/cases/fourslash/refactorExtractType35.ts b/tests/cases/fourslash/refactorExtractType35.ts index 8ace9f929b8..979918e13e8 100644 --- a/tests/cases/fourslash/refactorExtractType35.ts +++ b/tests/cases/fourslash/refactorExtractType35.ts @@ -1,6 +1,6 @@ /// -//// type Union = /*a*/U | T/*b*/ +//// type Union = /*a*/U | T/*b*/; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = U | T; -type Union = NewType`, +type Union = NewType;`, }); diff --git a/tests/cases/fourslash/refactorExtractType36.ts b/tests/cases/fourslash/refactorExtractType36.ts index 5086bf130ce..e36983e7440 100644 --- a/tests/cases/fourslash/refactorExtractType36.ts +++ b/tests/cases/fourslash/refactorExtractType36.ts @@ -1,6 +1,6 @@ /// -//// type A = (v: /*a*/string | number/*b*/) => v is string +//// type A = (v: /*a*/string | number/*b*/) => v is string; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,6 +9,6 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = string | number; -type A = (v: NewType) => v is string`, +type A = (v: NewType) => v is string;`, }); diff --git a/tests/cases/fourslash/refactorExtractType37.ts b/tests/cases/fourslash/refactorExtractType37.ts index b24e219b3e4..d3c9514e4d2 100644 --- a/tests/cases/fourslash/refactorExtractType37.ts +++ b/tests/cases/fourslash/refactorExtractType37.ts @@ -1,6 +1,6 @@ /// -//// type A = (v: string | number) => v is /*a*/string/*b*/ +//// type A = (v: string | number) => v is /*a*/string/*b*/; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = string; -type A = (v: string | number) => v is NewType`, +type A = (v: string | number) => v is NewType;`, }); diff --git a/tests/cases/fourslash/refactorExtractType39.ts b/tests/cases/fourslash/refactorExtractType39.ts index 1f55dcee39a..d5a96889304 100644 --- a/tests/cases/fourslash/refactorExtractType39.ts +++ b/tests/cases/fourslash/refactorExtractType39.ts @@ -1,6 +1,6 @@ /// -//// type A = /*a*/(v: string | number) => v is string/*b*/ +//// type A = /*a*/(v: string | number) => v is string/*b*/; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = (v: string | number) => v is string; -type A = NewType`, +type A = NewType;`, }); diff --git a/tests/cases/fourslash/refactorExtractType42.ts b/tests/cases/fourslash/refactorExtractType42.ts index 29692ab06e6..67b6dc51875 100644 --- a/tests/cases/fourslash/refactorExtractType42.ts +++ b/tests/cases/fourslash/refactorExtractType42.ts @@ -1,15 +1,15 @@ /// -//// const a = 1 -//// type A = (v: string | number) => /*a*/typeof a/*b*/ +//// const a = 1; +//// type A = (v: string | number) => /*a*/typeof a/*b*/; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", - newContent: `const a = 1 + newContent: `const a = 1; type /*RENAME*/NewType = typeof a; -type A = (v: string | number) => NewType`, +type A = (v: string | number) => NewType;`, }); diff --git a/tests/cases/fourslash/refactorExtractType44.ts b/tests/cases/fourslash/refactorExtractType44.ts index 22e1a9172dc..e570c9d60e9 100644 --- a/tests/cases/fourslash/refactorExtractType44.ts +++ b/tests/cases/fourslash/refactorExtractType44.ts @@ -1,6 +1,6 @@ /// -//// type A = /*a*/B.C.D/*b*/ +//// type A = /*a*/B.C.D/*b*/; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = B.C.D; -type A = NewType`, +type A = NewType;`, }); diff --git a/tests/cases/fourslash/refactorExtractType45.ts b/tests/cases/fourslash/refactorExtractType45.ts index 60d9d77bc29..bfc3288e587 100644 --- a/tests/cases/fourslash/refactorExtractType45.ts +++ b/tests/cases/fourslash/refactorExtractType45.ts @@ -1,6 +1,6 @@ /// -//// type A = /*a*/B.C.D/*b*/ +//// type A = /*a*/B.C.D/*b*/; goTo.select("a", "b"); edit.applyRefactor({ @@ -9,5 +9,5 @@ edit.applyRefactor({ actionDescription: "Extract to type alias", newContent: `type /*RENAME*/NewType = B.C.D; -type A = NewType`, +type A = NewType;`, }); diff --git a/tests/cases/fourslash/refactorExtractType46.ts b/tests/cases/fourslash/refactorExtractType46.ts index ddcfa4878c9..0f244f0ec02 100644 --- a/tests/cases/fourslash/refactorExtractType46.ts +++ b/tests/cases/fourslash/refactorExtractType46.ts @@ -1,15 +1,15 @@ /// -//// namespace A { export const b = 1 } -//// function a(b: string): /*a*/typeof A.b/*b*/ { return 1 } +//// namespace A { export const b = 1; } +//// function a(b: string): /*a*/typeof A.b/*b*/ { return 1; } goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", - newContent: `namespace A { export const b = 1 } + newContent: `namespace A { export const b = 1; } type /*RENAME*/NewType = typeof A.b; -function a(b: string): NewType { return 1 }`, +function a(b: string): NewType { return 1; }`, }); diff --git a/tests/cases/fourslash/refactorExtractType49.ts b/tests/cases/fourslash/refactorExtractType49.ts index 7d965ee3d09..96429a91881 100644 --- a/tests/cases/fourslash/refactorExtractType49.ts +++ b/tests/cases/fourslash/refactorExtractType49.ts @@ -1,15 +1,15 @@ /// -//// type A = T -//// type B = /*a*/A/*b*/ +//// type A = T; +//// type B = /*a*/A/*b*/; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", - newContent: `type A = T + newContent: `type A = T; type /*RENAME*/NewType = A; -type B = NewType`, +type B = NewType;`, }); diff --git a/tests/cases/fourslash/refactorExtractType7.ts b/tests/cases/fourslash/refactorExtractType7.ts index a5b1f4c7dd0..d1a40f83579 100644 --- a/tests/cases/fourslash/refactorExtractType7.ts +++ b/tests/cases/fourslash/refactorExtractType7.ts @@ -1,7 +1,7 @@ /// //// function foo(a: /*a*/number/*b*/, b?: number, ...c: number[]): boolean { -//// return false as boolean +//// return false as boolean; //// } goTo.select("a", "b"); @@ -12,6 +12,6 @@ edit.applyRefactor({ newContent: `type /*RENAME*/NewType = number; function foo(a: NewType, b?: number, ...c: number[]): boolean { - return false as boolean + return false as boolean; }`, }); diff --git a/tests/cases/fourslash/refactorExtractType8.ts b/tests/cases/fourslash/refactorExtractType8.ts index 61121c67374..c13e68e10f5 100644 --- a/tests/cases/fourslash/refactorExtractType8.ts +++ b/tests/cases/fourslash/refactorExtractType8.ts @@ -1,7 +1,7 @@ /// //// function foo(a: number, b?: /*a*/number/*b*/, ...c: number[]): boolean { -//// return false as boolean +//// return false as boolean; //// } goTo.select("a", "b"); @@ -12,6 +12,6 @@ edit.applyRefactor({ newContent: `type /*RENAME*/NewType = number; function foo(a: number, b?: NewType, ...c: number[]): boolean { - return false as boolean + return false as boolean; }`, }); diff --git a/tests/cases/fourslash/refactorExtractType9.ts b/tests/cases/fourslash/refactorExtractType9.ts index 921f2a005a5..49a5f737ee9 100644 --- a/tests/cases/fourslash/refactorExtractType9.ts +++ b/tests/cases/fourslash/refactorExtractType9.ts @@ -1,7 +1,7 @@ /// //// function foo(a: number, b?: number, ...c: /*a*/number[]/*b*/): boolean { -//// return false as boolean +//// return false as boolean; //// } goTo.select("a", "b"); @@ -12,6 +12,6 @@ edit.applyRefactor({ newContent: `type /*RENAME*/NewType = number[]; function foo(a: number, b?: number, ...c: NewType): boolean { - return false as boolean + return false as boolean; }`, }); From edad317395354f164593051186d19520db21135c Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 6 Jun 2019 10:23:13 -0700 Subject: [PATCH 256/384] Fourslash server tests --- src/harness/client.ts | 8 ++++++-- tests/cases/fourslash/server/jsdocCallbackTagRename01.ts | 6 +++--- tests/cases/fourslash/server/jsdocTypedefTagRename01.ts | 5 +++-- tests/cases/fourslash/server/jsdocTypedefTagRename02.ts | 5 +++-- tests/cases/fourslash/server/jsdocTypedefTagRename03.ts | 6 +++--- tests/cases/fourslash/server/rename01.ts | 6 +++--- tests/cases/fourslash/server/renameInConfiguredProject.ts | 5 +++-- 7 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/harness/client.ts b/src/harness/client.ts index d223f9f5fe3..ecfbbddecd0 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -395,8 +395,12 @@ namespace ts.server { const locations: RenameLocation[] = []; for (const entry of body.locs) { const fileName = entry.file; - for (const { start, end, ...prefixSuffixText } of entry.locs) { - locations.push({ textSpan: this.decodeSpan({ start, end }, fileName), fileName, ...prefixSuffixText }); + for (const { start, end, declarationStart, declarationEnd, ...prefixSuffixText } of entry.locs) { + const renameLocation: RenameLocation = { textSpan: this.decodeSpan({ start, end }, fileName), fileName, ...prefixSuffixText }; + if (declarationStart !== undefined) { + renameLocation.declarationSpan = this.decodeSpan({ start: declarationStart, end: declarationEnd! }, fileName); + } + locations.push(renameLocation); } } diff --git a/tests/cases/fourslash/server/jsdocCallbackTagRename01.ts b/tests/cases/fourslash/server/jsdocCallbackTagRename01.ts index bb7dd32cfc2..557d0d49298 100644 --- a/tests/cases/fourslash/server/jsdocCallbackTagRename01.ts +++ b/tests/cases/fourslash/server/jsdocCallbackTagRename01.ts @@ -4,12 +4,12 @@ // @Filename: jsDocCallback.js //// //// /** -//// * @callback [|FooCallback|] +//// * [|@callback [|{| "declarationRangeIndex": 0 |}FooCallback|] //// * @param {string} eventName - Rename should work -//// */ +//// |]*/ //// //// /** @type {/*1*/[|FooCallback|]} */ //// var t; -const ranges = test.ranges(); +const [rDef, ...ranges] = test.ranges(); verify.renameLocations(ranges[0], { findInStrings: false, findInComments: true, ranges }); diff --git a/tests/cases/fourslash/server/jsdocTypedefTagRename01.ts b/tests/cases/fourslash/server/jsdocTypedefTagRename01.ts index 38a35b58cbf..8bfd04bda81 100644 --- a/tests/cases/fourslash/server/jsdocTypedefTagRename01.ts +++ b/tests/cases/fourslash/server/jsdocTypedefTagRename01.ts @@ -4,11 +4,12 @@ // @Filename: jsDocTypedef_form1.js //// //// /** @typedef {(string | number)} */ -//// var [|NumberLike|]; +//// [|var [|{| "declarationRangeIndex": 0 |}NumberLike|];|] //// //// [|NumberLike|] = 10; //// //// /** @type {[|NumberLike|]} */ //// var numberLike; -verify.rangesAreRenameLocations({ findInComments: true }); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations({ findInComments: true, ranges }); diff --git a/tests/cases/fourslash/server/jsdocTypedefTagRename02.ts b/tests/cases/fourslash/server/jsdocTypedefTagRename02.ts index 38da754247f..dca1a21da9a 100644 --- a/tests/cases/fourslash/server/jsdocTypedefTagRename02.ts +++ b/tests/cases/fourslash/server/jsdocTypedefTagRename02.ts @@ -3,9 +3,10 @@ // @allowNonTsExtensions: true // @Filename: jsDocTypedef_form2.js //// -//// /** @typedef {(string | number)} [|NumberLike|] */ +//// /** [|@typedef {(string | number)} [|{| "declarationRangeIndex": 0 |}NumberLike|]|] */ //// //// /** @type {[|NumberLike|]} */ //// var numberLike; -verify.rangesAreRenameLocations({ findInComments: true }); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations({ findInComments: true, ranges }); diff --git a/tests/cases/fourslash/server/jsdocTypedefTagRename03.ts b/tests/cases/fourslash/server/jsdocTypedefTagRename03.ts index 7b61682e594..0540e9963e5 100644 --- a/tests/cases/fourslash/server/jsdocTypedefTagRename03.ts +++ b/tests/cases/fourslash/server/jsdocTypedefTagRename03.ts @@ -4,14 +4,14 @@ // @Filename: jsDocTypedef_form3.js //// //// /** -//// * @typedef /*1*/[|Person|] +//// * [|@typedef /*1*/[|{| "declarationRangeIndex": 0 |}Person|] //// * @type {Object} //// * @property {number} age //// * @property {string} name -//// */ +//// |]*/ //// //// /** @type {/*2*/[|Person|]} */ //// var person; goTo.file('jsDocTypedef_form3.js') -verify.rangesAreRenameLocations({ findInComments: true }); +verify.rangesAreRenameLocations({ findInComments: true, ranges: test.rangesByText().get("Person") }); diff --git a/tests/cases/fourslash/server/rename01.ts b/tests/cases/fourslash/server/rename01.ts index 74385c30da3..871a70c763a 100644 --- a/tests/cases/fourslash/server/rename01.ts +++ b/tests/cases/fourslash/server/rename01.ts @@ -2,10 +2,10 @@ /////// -////function [|Bar|]() { +////[|function [|{| "declarationRangeIndex": 0 |}Bar|]() { //// // This is a reference to [|Bar|] in a comment. //// "this is a reference to [|Bar|] in a string" -////} +////}|] -const ranges = test.ranges(); +const [rDef, ...ranges] = test.ranges(); verify.renameLocations(ranges[0], { findInStrings: true, findInComments: true, ranges }); diff --git a/tests/cases/fourslash/server/renameInConfiguredProject.ts b/tests/cases/fourslash/server/renameInConfiguredProject.ts index a235f783f4c..da576bcb30f 100644 --- a/tests/cases/fourslash/server/renameInConfiguredProject.ts +++ b/tests/cases/fourslash/server/renameInConfiguredProject.ts @@ -1,7 +1,7 @@ /// // @Filename: referencesForGlobals_1.ts -////var [|globalName|] = 0; +////[|var [|{| "declarationRangeIndex": 0 |}globalName|] = 0;|] // @Filename: referencesForGlobals_2.ts ////var y = [|globalName|]; @@ -9,4 +9,5 @@ // @Filename: tsconfig.json ////{ "files": ["referencesForGlobals_1.ts", "referencesForGlobals_2.ts"] } -verify.rangesAreRenameLocations({ findInStrings: true, findInComments: true }); +const [rDef, ...ranges] = test.ranges(); +verify.rangesAreRenameLocations({ findInStrings: true, findInComments: true, ranges }); From 7815778fb053e453e17f83442fc45261937b3bb0 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 6 Jun 2019 10:48:26 -0700 Subject: [PATCH 257/384] =?UTF-8?q?Update=20fourslash=20tests=20that=20sho?= =?UTF-8?q?uldn=E2=80=99t=20insert=20semicolons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../completionsImport_default_anonymous.ts | 28 +++++++++---------- ...ompletionsImport_exportEquals_anonymous.ts | 2 +- .../extract-method_jsxIntrinsicTagSymbol.ts | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/cases/fourslash/completionsImport_default_anonymous.ts b/tests/cases/fourslash/completionsImport_default_anonymous.ts index a1eb5da6490..80ad6494dc6 100644 --- a/tests/cases/fourslash/completionsImport_default_anonymous.ts +++ b/tests/cases/fourslash/completionsImport_default_anonymous.ts @@ -14,25 +14,25 @@ goTo.marker("0"); const preferences: FourSlashInterface.UserPreferences = { includeCompletionsForModuleExports: true }; verify.completions( - { + { marker: "0", exact: [ - completion.globalThisEntry, - completion.undefinedVarEntry, - ...completion.statementKeywordsWithTypes - ], - preferences + completion.globalThisEntry, + completion.undefinedVarEntry, + ...completion.statementKeywordsWithTypes + ], + preferences }, { marker: "1", includes: { - name: "fooBar", - source: "/src/foo-bar", - sourceDisplay: "./foo-bar", - text: "(property) default: 0", - kind: "property", - hasAction: true, - sortText: completion.SortText.AutoImportSuggestions + name: "fooBar", + source: "/src/foo-bar", + sourceDisplay: "./foo-bar", + text: "(property) default: 0", + kind: "property", + hasAction: true, + sortText: completion.SortText.AutoImportSuggestions }, preferences, }, @@ -41,7 +41,7 @@ verify.applyCodeActionFromCompletion("1", { name: "fooBar", source: "/src/foo-bar", description: `Import default 'fooBar' from module "./foo-bar"`, - newFileContent: `import fooBar from "./foo-bar"; + newFileContent: `import fooBar from "./foo-bar" def fooB`, diff --git a/tests/cases/fourslash/completionsImport_exportEquals_anonymous.ts b/tests/cases/fourslash/completionsImport_exportEquals_anonymous.ts index b28de47c69d..e8d675cba8b 100644 --- a/tests/cases/fourslash/completionsImport_exportEquals_anonymous.ts +++ b/tests/cases/fourslash/completionsImport_exportEquals_anonymous.ts @@ -38,7 +38,7 @@ verify.applyCodeActionFromCompletion("0", { name: "fooBar", source: "/src/foo-bar", description: `Import 'fooBar' from module "./foo-bar"`, - newFileContent: `import fooBar = require("./foo-bar"); + newFileContent: `import fooBar = require("./foo-bar") exp fooB`, diff --git a/tests/cases/fourslash/extract-method_jsxIntrinsicTagSymbol.ts b/tests/cases/fourslash/extract-method_jsxIntrinsicTagSymbol.ts index 74a6b2fc212..072fd670ddd 100644 --- a/tests/cases/fourslash/extract-method_jsxIntrinsicTagSymbol.ts +++ b/tests/cases/fourslash/extract-method_jsxIntrinsicTagSymbol.ts @@ -11,5 +11,5 @@ edit.applyRefactor({ refactorName: "Extract Symbol", actionName: "constant_scope_0", actionDescription: "Extract to constant in enclosing scope", - newContent: "const /*RENAME*/newLocal =

", + newContent: "const /*RENAME*/newLocal =
;", }); From b37875ff7aac7c85e1a3a4859c6589ef8d50e4cf Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 6 Jun 2019 10:49:09 -0700 Subject: [PATCH 258/384] Detect semicolons in file before writing quick fixes --- src/services/textChanges.ts | 234 ++++++++++++++++++++---------------- src/services/utilities.ts | 47 ++++++++ 2 files changed, 177 insertions(+), 104 deletions(-) diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index 81441627635..c55a08808a9 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -834,9 +834,10 @@ namespace ts.textChanges { /** Note: output node may be mutated input node. */ export function getNonformattedText(node: Node, sourceFile: SourceFile | undefined, newLineCharacter: string): { text: string, node: Node } { - const writer = new Writer(newLineCharacter); + const omitTrailingSemicolon = !!sourceFile && !probablyUsesSemicolons(sourceFile); + const writer = createWriter(newLineCharacter, omitTrailingSemicolon); const newLine = newLineCharacter === "\n" ? NewLineKind.LineFeed : NewLineKind.CarriageReturnLineFeed; - createPrinter({ newLine, neverAsciiEscape: true }, writer).writeNode(EmitHint.Unspecified, node, sourceFile, writer); + createPrinter({ newLine, neverAsciiEscape: true, omitTrailingSemicolon }, writer).writeNode(EmitHint.Unspecified, node, sourceFile, writer); return { text: writer.getText(), node: assignPositionsToNode(node) }; } } @@ -874,143 +875,168 @@ namespace ts.textChanges { return nodeArray; } - class Writer implements EmitTextWriter, PrintHandlers { - private lastNonTriviaPosition = 0; - private readonly writer: EmitTextWriter; + interface TextChangesWriter extends EmitTextWriter, PrintHandlers {} - public readonly onEmitNode: PrintHandlers["onEmitNode"]; - public readonly onBeforeEmitNodeArray: PrintHandlers["onBeforeEmitNodeArray"]; - public readonly onAfterEmitNodeArray: PrintHandlers["onAfterEmitNodeArray"]; - public readonly onBeforeEmitToken: PrintHandlers["onBeforeEmitToken"]; - public readonly onAfterEmitToken: PrintHandlers["onAfterEmitToken"]; + function createWriter(newLine: string, omitTrailingSemicolon?: boolean): TextChangesWriter { + let lastNonTriviaPosition = 0; - constructor(newLine: string) { - this.writer = createTextWriter(newLine); - this.onEmitNode = (hint, node, printCallback) => { - if (node) { - setPos(node, this.lastNonTriviaPosition); - } - printCallback(hint, node); - if (node) { - setEnd(node, this.lastNonTriviaPosition); - } - }; - this.onBeforeEmitNodeArray = nodes => { - if (nodes) { - setPos(nodes, this.lastNonTriviaPosition); - } - }; - this.onAfterEmitNodeArray = nodes => { - if (nodes) { - setEnd(nodes, this.lastNonTriviaPosition); - } - }; - this.onBeforeEmitToken = node => { - if (node) { - setPos(node, this.lastNonTriviaPosition); - } - }; - this.onAfterEmitToken = node => { - if (node) { - setEnd(node, this.lastNonTriviaPosition); - } - }; - } - private setLastNonTriviaPosition(s: string, force: boolean) { + const writer = omitTrailingSemicolon ? getTrailingSemicolonOmittingWriter(createTextWriter(newLine)) : createTextWriter(newLine); + const onEmitNode: PrintHandlers["onEmitNode"] = (hint, node, printCallback) => { + if (node) { + setPos(node, lastNonTriviaPosition); + } + printCallback(hint, node); + if (node) { + setEnd(node, lastNonTriviaPosition); + } + }; + const onBeforeEmitNodeArray: PrintHandlers["onBeforeEmitNodeArray"] = nodes => { + if (nodes) { + setPos(nodes, lastNonTriviaPosition); + } + }; + const onAfterEmitNodeArray: PrintHandlers["onAfterEmitNodeArray"] = nodes => { + if (nodes) { + setEnd(nodes, lastNonTriviaPosition); + } + }; + const onBeforeEmitToken: PrintHandlers["onBeforeEmitToken"] = node => { + if (node) { + setPos(node, lastNonTriviaPosition); + } + }; + const onAfterEmitToken: PrintHandlers["onAfterEmitToken"] = node => { + if (node) { + setEnd(node, lastNonTriviaPosition); + } + }; + + function setLastNonTriviaPosition(s: string, force: boolean) { if (force || !isTrivia(s)) { - this.lastNonTriviaPosition = this.writer.getTextPos(); + lastNonTriviaPosition = writer.getTextPos(); let i = 0; while (isWhiteSpaceLike(s.charCodeAt(s.length - i - 1))) { i++; } // trim trailing whitespaces - this.lastNonTriviaPosition -= i; + lastNonTriviaPosition -= i; } } - write(s: string): void { - this.writer.write(s); - this.setLastNonTriviaPosition(s, /*force*/ false); + function write(s: string): void { + writer.write(s); + setLastNonTriviaPosition(s, /*force*/ false); } - writeComment(s: string): void { - this.writer.writeComment(s); + function writeComment(s: string): void { + writer.writeComment(s); } - writeKeyword(s: string): void { - this.writer.writeKeyword(s); - this.setLastNonTriviaPosition(s, /*force*/ false); + function writeKeyword(s: string): void { + writer.writeKeyword(s); + setLastNonTriviaPosition(s, /*force*/ false); } - writeOperator(s: string): void { - this.writer.writeOperator(s); - this.setLastNonTriviaPosition(s, /*force*/ false); + function writeOperator(s: string): void { + writer.writeOperator(s); + setLastNonTriviaPosition(s, /*force*/ false); } - writePunctuation(s: string): void { - this.writer.writePunctuation(s); - this.setLastNonTriviaPosition(s, /*force*/ false); + function writePunctuation(s: string): void { + writer.writePunctuation(s); + setLastNonTriviaPosition(s, /*force*/ false); } - writeTrailingSemicolon(s: string): void { - this.writer.writeTrailingSemicolon(s); - this.setLastNonTriviaPosition(s, /*force*/ false); + function writeTrailingSemicolon(s: string): void { + writer.writeTrailingSemicolon(s); + setLastNonTriviaPosition(s, /*force*/ false); } - writeParameter(s: string): void { - this.writer.writeParameter(s); - this.setLastNonTriviaPosition(s, /*force*/ false); + function writeParameter(s: string): void { + writer.writeParameter(s); + setLastNonTriviaPosition(s, /*force*/ false); } - writeProperty(s: string): void { - this.writer.writeProperty(s); - this.setLastNonTriviaPosition(s, /*force*/ false); + function writeProperty(s: string): void { + writer.writeProperty(s); + setLastNonTriviaPosition(s, /*force*/ false); } - writeSpace(s: string): void { - this.writer.writeSpace(s); - this.setLastNonTriviaPosition(s, /*force*/ false); + function writeSpace(s: string): void { + writer.writeSpace(s); + setLastNonTriviaPosition(s, /*force*/ false); } - writeStringLiteral(s: string): void { - this.writer.writeStringLiteral(s); - this.setLastNonTriviaPosition(s, /*force*/ false); + function writeStringLiteral(s: string): void { + writer.writeStringLiteral(s); + setLastNonTriviaPosition(s, /*force*/ false); } - writeSymbol(s: string, sym: Symbol): void { - this.writer.writeSymbol(s, sym); - this.setLastNonTriviaPosition(s, /*force*/ false); + function writeSymbol(s: string, sym: Symbol): void { + writer.writeSymbol(s, sym); + setLastNonTriviaPosition(s, /*force*/ false); } - writeLine(): void { - this.writer.writeLine(); + function writeLine(): void { + writer.writeLine(); } - increaseIndent(): void { - this.writer.increaseIndent(); + function increaseIndent(): void { + writer.increaseIndent(); } - decreaseIndent(): void { - this.writer.decreaseIndent(); + function decreaseIndent(): void { + writer.decreaseIndent(); } - getText(): string { - return this.writer.getText(); + function getText(): string { + return writer.getText(); } - rawWrite(s: string): void { - this.writer.rawWrite(s); - this.setLastNonTriviaPosition(s, /*force*/ false); + function rawWrite(s: string): void { + writer.rawWrite(s); + setLastNonTriviaPosition(s, /*force*/ false); } - writeLiteral(s: string): void { - this.writer.writeLiteral(s); - this.setLastNonTriviaPosition(s, /*force*/ true); + function writeLiteral(s: string): void { + writer.writeLiteral(s); + setLastNonTriviaPosition(s, /*force*/ true); } - getTextPos(): number { - return this.writer.getTextPos(); + function getTextPos(): number { + return writer.getTextPos(); } - getLine(): number { - return this.writer.getLine(); + function getLine(): number { + return writer.getLine(); } - getColumn(): number { - return this.writer.getColumn(); + function getColumn(): number { + return writer.getColumn(); } - getIndent(): number { - return this.writer.getIndent(); + function getIndent(): number { + return writer.getIndent(); } - isAtStartOfLine(): boolean { - return this.writer.isAtStartOfLine(); + function isAtStartOfLine(): boolean { + return writer.isAtStartOfLine(); } - clear(): void { - this.writer.clear(); - this.lastNonTriviaPosition = 0; + function clear(): void { + writer.clear(); + lastNonTriviaPosition = 0; } + + return { + onEmitNode, + onBeforeEmitNodeArray, + onAfterEmitNodeArray, + onBeforeEmitToken, + onAfterEmitToken, + write, + writeComment, + writeKeyword, + writeOperator, + writePunctuation, + writeTrailingSemicolon, + writeParameter, + writeProperty, + writeSpace, + writeStringLiteral, + writeSymbol, + writeLine, + increaseIndent, + decreaseIndent, + getText, + rawWrite, + writeLiteral, + getTextPos, + getLine, + getColumn, + getIndent, + isAtStartOfLine, + clear + }; } function getInsertionPositionAtSourceFileTop(sourceFile: SourceFile): number { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 5506b45d380..4c6549b002c 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1991,4 +1991,51 @@ namespace ts { }); return typeIsAccessible ? res : undefined; } + + export function syntaxUsuallyHasTrailingSemicolon(kind: SyntaxKind) { + return kind === SyntaxKind.VariableStatement + || kind === SyntaxKind.ExpressionStatement + || kind === SyntaxKind.DoStatement + || kind === SyntaxKind.ContinueStatement + || kind === SyntaxKind.BreakStatement + || kind === SyntaxKind.ReturnStatement + || kind === SyntaxKind.ThrowStatement + || kind === SyntaxKind.DebuggerStatement + || kind === SyntaxKind.PropertyDeclaration + || kind === SyntaxKind.TypeAliasDeclaration + || kind === SyntaxKind.ImportDeclaration + || kind === SyntaxKind.ImportEqualsDeclaration + || kind === SyntaxKind.ExportDeclaration; + } + + export function probablyUsesSemicolons(sourceFile: SourceFile): boolean { + let withSemicolon = 0; + let withoutSemicolon = 0; + const nStatementsToObserve = 5; + forEachChild(sourceFile, function visit(node): boolean | undefined { + if (syntaxUsuallyHasTrailingSemicolon(node.kind)) { + const lastToken = node.getLastToken(sourceFile); + if (lastToken && lastToken.kind === SyntaxKind.SemicolonToken) { + withSemicolon++; + } + else { + withoutSemicolon++; + } + } + if (withSemicolon + withoutSemicolon >= nStatementsToObserve) { + return true; + } + + return forEachChild(node, visit); + }); + + // One statement missing a semicolon isn’t sufficient evidence to say the user + // doesn’t want semicolons, because they may not even be done writing that statement. + if (withSemicolon === 0 && withoutSemicolon <= 1) { + return true; + } + + // If even 2/5 places have a semicolon, the user probably wants semicolons + return withSemicolon / withoutSemicolon > 1 / nStatementsToObserve; + } } From 6282c9fb5e2097c86f44ee67da872423df1c1d5c Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 6 Jun 2019 10:55:56 -0700 Subject: [PATCH 259/384] Add test for semicolon detection in auto-import --- .../completionsImport_noSemicolons.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/cases/fourslash/completionsImport_noSemicolons.ts diff --git a/tests/cases/fourslash/completionsImport_noSemicolons.ts b/tests/cases/fourslash/completionsImport_noSemicolons.ts new file mode 100644 index 00000000000..f1e183b8b3c --- /dev/null +++ b/tests/cases/fourslash/completionsImport_noSemicolons.ts @@ -0,0 +1,20 @@ +/// + +// @Filename: /a.ts +////export function foo() {} + +// @Filename: /b.ts +////const x = 0 +////const y = 1 +////const z = fo/**/ + +verify.applyCodeActionFromCompletion("", { + name: "foo", + source: "/a", + description: `Import 'foo' from module "./a"`, + newFileContent: `import { foo } from "./a" + +const x = 0 +const y = 1 +const z = fo`, +}); From 768c9ed8d7f2faa7c1fcf979e497f17f8442f811 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 6 Jun 2019 10:57:09 -0700 Subject: [PATCH 260/384] Handle jsx Opening, Closing and Self closing tags --- src/services/findAllReferences.ts | 10 ++++++++-- src/services/services.ts | 10 ++++++++-- tests/cases/fourslash/findReferencesJSXTagName.ts | 6 +++--- tests/cases/fourslash/findReferencesJSXTagName3.ts | 12 ++++++------ tests/cases/fourslash/tsxFindAllReferences1.ts | 2 +- tests/cases/fourslash/tsxFindAllReferences4.ts | 2 +- tests/cases/fourslash/tsxFindAllReferences5.ts | 10 +++++----- tests/cases/fourslash/tsxFindAllReferences8.ts | 12 ++++++------ .../tsxFindAllReferencesUnionElementType1.ts | 2 +- .../tsxFindAllReferencesUnionElementType2.ts | 2 +- tests/cases/fourslash/tsxRename1.ts | 2 +- tests/cases/fourslash/tsxRename4.ts | 6 +++--- tests/cases/fourslash/tsxRename6.ts | 10 +++++----- tests/cases/fourslash/tsxRename9.ts | 12 ++++++------ 14 files changed, 55 insertions(+), 43 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index ae31ab544f3..a2eb4f3ec29 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -48,11 +48,17 @@ namespace ts.FindAllReferences { return getDeclarationForDeclarationSpan(node); } - // TODO(shkamat):: - // JSXOpeningElement or JSXElement for tagName ? if (!node.parent) return undefined; if (!isDeclaration(node.parent) && !isExportAssignment(node.parent)) { + // Jsx Tags + if (isJsxOpeningElement(node.parent) || isJsxClosingElement(node.parent)) { + return node.parent.parent; + } + else if (isJsxSelfClosingElement(node.parent)) { + return node.parent; + } + // Special property assignment in javascript if (isInJSFile(node)) { const binaryExpression = isBinaryExpression(node.parent) ? diff --git a/src/services/services.ts b/src/services/services.ts index cae6ce7ac47..032dee4a40c 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1577,8 +1577,14 @@ namespace ts { const node = getTouchingPropertyName(sourceFile, position); if (isIdentifier(node) && (isJsxOpeningElement(node.parent) || isJsxClosingElement(node.parent)) && isIntrinsicJsxName(node.escapedText)) { const { openingElement, closingElement } = node.parent.parent; - return [openingElement, closingElement].map((node): RenameLocation => - ({ fileName: sourceFile.fileName, textSpan: createTextSpanFromNode(node.tagName, sourceFile) })); + return [openingElement, closingElement].map(node => { + const result: RenameLocation = { + fileName: sourceFile.fileName, + textSpan: createTextSpanFromNode(node.tagName, sourceFile) + }; + FindAllReferences.setDeclarationSpan(result, sourceFile, node.parent); + return result; + }); } else { return getReferencesWorker(node, position, { findInStrings, findInComments, providePrefixAndSuffixTextForRename, isForRename: true }, diff --git a/tests/cases/fourslash/findReferencesJSXTagName.ts b/tests/cases/fourslash/findReferencesJSXTagName.ts index ec011671c9e..cd6675c7c3f 100644 --- a/tests/cases/fourslash/findReferencesJSXTagName.ts +++ b/tests/cases/fourslash/findReferencesJSXTagName.ts @@ -4,14 +4,14 @@ ////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}SubmissionComp|] } from "./RedditSubmission"|] ////function displaySubreddit(subreddit: string) { //// let components = submissions -//// .map((value, index) => <[|SubmissionComp|] key={ index } elementPosition= { index } {...value.data} />); +//// .map((value, index) => [|<[|{| "declarationRangeIndex": 2 |}SubmissionComp|] key={ index } elementPosition= { index } {...value.data} />|]); ////} // @Filename: RedditSubmission.ts -////export const [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}SubmissionComp|] = (submission: SubmissionProps) => +////export const [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}SubmissionComp|] = (submission: SubmissionProps) => ////
; -const [r0Def, r0, r1, r2Def, r2] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2] = test.ranges(); const imports = { definition: "(alias) const SubmissionComp: (submission: any) => any\nimport SubmissionComp", ranges: [r0, r1] }; const def = { definition: "const SubmissionComp: (submission: any) => any", ranges: [r2] }; verify.referenceGroups([r0, r1], [imports, def]); diff --git a/tests/cases/fourslash/findReferencesJSXTagName3.ts b/tests/cases/fourslash/findReferencesJSXTagName3.ts index afd90562777..b4e87388f99 100644 --- a/tests/cases/fourslash/findReferencesJSXTagName3.ts +++ b/tests/cases/fourslash/findReferencesJSXTagName3.ts @@ -11,16 +11,16 @@ ////} //// ////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}Comp|] = () => -//// <[|div|]> +//// [|<[|{| "declarationRangeIndex": 4 |}div|]> //// Some content -//// <[|div|]>More content -//// ;|] +//// [|<[|{| "declarationRangeIndex": 6 |}div|]>More content|] +//// |];|] //// -////const x = <[|Comp|]> +////const x = [|<[|{| "declarationRangeIndex": 10 |}Comp|]> //// Content -////; +////|]; -const [d0Def, d0, c0Def, c0, d1, d2, d3, d4, c1, c2] = test.ranges(); +const [d0Def, d0, c0Def, c0, d1Def, d1, d2Def, d2, d3, d4, c1Def, c1, c2] = test.ranges(); const allD = [d0, d1, d2, d3, d4]; const allC = [c0, c1, c2]; diff --git a/tests/cases/fourslash/tsxFindAllReferences1.ts b/tests/cases/fourslash/tsxFindAllReferences1.ts index e943c4e69bf..f5d0a2e7488 100644 --- a/tests/cases/fourslash/tsxFindAllReferences1.ts +++ b/tests/cases/fourslash/tsxFindAllReferences1.ts @@ -11,7 +11,7 @@ //// span: { n: string; }; //// } //// } -//// var x = <[|div|] />; +//// var x = [|<[|{| "declarationRangeIndex": 2 |}div|] />|]; verify.singleReferenceGroup( `(property) JSX.IntrinsicElements.div: { diff --git a/tests/cases/fourslash/tsxFindAllReferences4.ts b/tests/cases/fourslash/tsxFindAllReferences4.ts index e761be8eb4d..38433bb7f21 100644 --- a/tests/cases/fourslash/tsxFindAllReferences4.ts +++ b/tests/cases/fourslash/tsxFindAllReferences4.ts @@ -14,6 +14,6 @@ //// }|] //// //// -//// var x = <[|MyClass|] name='hello'>; +//// var x = [|<[|{| "declarationRangeIndex" : 2 |}MyClass|] name='hello'>|]; verify.singleReferenceGroup("class MyClass", "MyClass"); diff --git a/tests/cases/fourslash/tsxFindAllReferences5.ts b/tests/cases/fourslash/tsxFindAllReferences5.ts index ee3e0e7e4bd..804943ec85d 100644 --- a/tests/cases/fourslash/tsxFindAllReferences5.ts +++ b/tests/cases/fourslash/tsxFindAllReferences5.ts @@ -16,11 +16,11 @@ //// optional?: boolean //// } //// [|declare function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Opt|](attributes: OptionPropBag): JSX.Element;|] -//// let opt = <[|Opt|] />; -//// let opt1 = <[|Opt|] propx={100} propString />; -//// let opt2 = <[|Opt|] propx={100} optional/>; -//// let opt3 = <[|Opt|] wrong />; -//// let opt4 = <[|Opt|] propx={100} propString="hi" />; +//// let opt = [|<[|{| "declarationRangeIndex": 2 |}Opt|] />|]; +//// let opt1 = [|<[|{| "declarationRangeIndex": 4 |}Opt|] propx={100} propString />|]; +//// let opt2 = [|<[|{| "declarationRangeIndex": 6 |}Opt|] propx={100} optional/>|]; +//// let opt3 = [|<[|{| "declarationRangeIndex": 8 |}Opt|] wrong />|]; +//// let opt4 = [|<[|{| "declarationRangeIndex": 10 |}Opt|] propx={100} propString="hi" />|]; verify.singleReferenceGroup( "function Opt(attributes: OptionPropBag): JSX.Element", diff --git a/tests/cases/fourslash/tsxFindAllReferences8.ts b/tests/cases/fourslash/tsxFindAllReferences8.ts index a5683cfb330..6dcd94e726b 100644 --- a/tests/cases/fourslash/tsxFindAllReferences8.ts +++ b/tests/cases/fourslash/tsxFindAllReferences8.ts @@ -23,12 +23,12 @@ //// [|declare function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}MainButton|](buttonProps: ButtonProps): JSX.Element;|] //// [|declare function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}MainButton|](linkProps: LinkProps): JSX.Element;|] //// [|declare function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}MainButton|](props: ButtonProps | LinkProps): JSX.Element;|] -//// let opt = <[|MainButton|] />; -//// let opt = <[|MainButton|] children="chidlren" />; -//// let opt = <[|MainButton|] onClick={()=>{}} />; -//// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; -//// let opt = <[|MainButton|] goTo="goTo" />; -//// let opt = <[|MainButton|] wrong />; +//// let opt = [|<[|{| "declarationRangeIndex": 6 |}MainButton|] />|]; +//// let opt = [|<[|{| "declarationRangeIndex": 8 |}MainButton|] children="chidlren" />|]; +//// let opt = [|<[|{| "declarationRangeIndex": 10 |}MainButton|] onClick={()=>{}} />|]; +//// let opt = [|<[|{| "declarationRangeIndex": 12 |}MainButton|] onClick={()=>{}} ignore-prop />|]; +//// let opt = [|<[|{| "declarationRangeIndex": 14 |}MainButton|] goTo="goTo" />|]; +//// let opt = [|<[|{| "declarationRangeIndex": 16 |}MainButton|] wrong />|]; verify.singleReferenceGroup( "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", diff --git a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts index dc85960bb6d..60b95f1b43e 100644 --- a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts +++ b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts @@ -19,7 +19,7 @@ //// } //// [|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}SFCComp|] = SFC1 || SFC2;|] -//// <[|SFCComp|] x={ "hi" } /> +//// [|<[|{| "declarationRangeIndex": 2 |}SFCComp|] x={ "hi" } />|] verify.singleReferenceGroup(`var SFCComp: ((prop: { x: number; diff --git a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts index ffb33919fd4..cb4151aa3c5 100644 --- a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts +++ b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts @@ -18,6 +18,6 @@ //// } //// [|var [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}RCComp|] = RC1 || RC2;|] -//// <[|RCComp|] /> +//// [|<[|{| "declarationRangeIndex": 2 |}RCComp|] />|] verify.singleReferenceGroup("var RCComp: typeof RC1", "RCComp"); diff --git a/tests/cases/fourslash/tsxRename1.ts b/tests/cases/fourslash/tsxRename1.ts index 047bc391a38..e16c390f4e5 100644 --- a/tests/cases/fourslash/tsxRename1.ts +++ b/tests/cases/fourslash/tsxRename1.ts @@ -11,5 +11,5 @@ //// span: { n: string; }; //// } //// } -//// var x = <[|div|] />; +//// var x = [|<[|{| "declarationRangeIndex": 2 |}div|] />|]; verify.rangesWithSameTextAreRenameLocations("div"); diff --git a/tests/cases/fourslash/tsxRename4.ts b/tests/cases/fourslash/tsxRename4.ts index 0bc9fa10f0c..f9c33972ecd 100644 --- a/tests/cases/fourslash/tsxRename4.ts +++ b/tests/cases/fourslash/tsxRename4.ts @@ -11,10 +11,10 @@ ////} ////[|class [|{| "declarationRangeIndex": 0 |}MyClass|] {}|] //// -////<[|MyClass|]>; -////<[|MyClass|]/>; +////[|<[|{| "declarationRangeIndex": 2 |}MyClass|]>|]; +////[|<[|{| "declarationRangeIndex": 5 |}MyClass|]/>|]; //// -////<[|div|]> +////[|<[|{| "declarationRangeIndex": 7 |}div|]> |] verify.noErrors(); verify.rangesWithSameTextAreRenameLocations("MyClass", "div"); \ No newline at end of file diff --git a/tests/cases/fourslash/tsxRename6.ts b/tests/cases/fourslash/tsxRename6.ts index 1cafd1332b0..320f3e6ac6b 100644 --- a/tests/cases/fourslash/tsxRename6.ts +++ b/tests/cases/fourslash/tsxRename6.ts @@ -16,10 +16,10 @@ //// optional?: boolean //// } //// [|declare function [|{| "declarationRangeIndex": 0 |}Opt|](attributes: OptionPropBag): JSX.Element;|] -//// let opt = <[|Opt|] />; -//// let opt1 = <[|Opt|] propx={100} propString />; -//// let opt2 = <[|Opt|] propx={100} optional/>; -//// let opt3 = <[|Opt|] wrong />; -//// let opt4 = <[|Opt|] propx={100} propString="hi" />; +//// let opt = [|<[|{| "declarationRangeIndex": 2 |}Opt|] />|]; +//// let opt1 = [|<[|{| "declarationRangeIndex": 4 |}Opt|] propx={100} propString />|]; +//// let opt2 = [|<[|{| "declarationRangeIndex": 6 |}Opt|] propx={100} optional/>|]; +//// let opt3 = [|<[|{| "declarationRangeIndex": 8 |}Opt|] wrong />|]; +//// let opt4 = [|<[|{| "declarationRangeIndex": 10 |}Opt|] propx={100} propString="hi" />|]; verify.rangesWithSameTextAreRenameLocations("Opt"); diff --git a/tests/cases/fourslash/tsxRename9.ts b/tests/cases/fourslash/tsxRename9.ts index 29a54d51cae..0aa8ef8345f 100644 --- a/tests/cases/fourslash/tsxRename9.ts +++ b/tests/cases/fourslash/tsxRename9.ts @@ -23,12 +23,12 @@ //// [|declare function [|{| "declarationRangeIndex": 4 |}MainButton|](buttonProps: ButtonProps): JSX.Element;|] //// [|declare function [|{| "declarationRangeIndex": 6 |}MainButton|](linkProps: LinkProps): JSX.Element;|] //// [|declare function [|{| "declarationRangeIndex": 8 |}MainButton|](props: ButtonProps | LinkProps): JSX.Element;|] -//// let opt = <[|MainButton|] />; -//// let opt = <[|MainButton|] children="chidlren" />; -//// let opt = <[|MainButton|] [|[|{| "declarationRangeIndex": 13 |}onClick|]={()=>{}}|] />; -//// let opt = <[|MainButton|] [|[|{| "declarationRangeIndex": 16 |}onClick|]={()=>{}}|] [|ignore-prop|] />; -//// let opt = <[|MainButton|] [|[|{| "declarationRangeIndex": 20 |}goTo|]="goTo"|] />; -//// let opt = <[|MainButton|] [|wrong|] />; +//// let opt = [|<[|{| "declarationRangeIndex": 10 |}MainButton|] />|]; +//// let opt = [|<[|{| "declarationRangeIndex": 12 |}MainButton|] children="chidlren" />|]; +//// let opt = [|<[|{| "declarationRangeIndex": 14 |}MainButton|] [|[|{| "declarationRangeIndex": 16 |}onClick|]={()=>{}}|] />|]; +//// let opt = [|<[|{| "declarationRangeIndex": 18 |}MainButton|] [|[|{| "declarationRangeIndex": 20 |}onClick|]={()=>{}}|] [|ignore-prop|] />|]; +//// let opt = [|<[|{| "declarationRangeIndex": 23 |}MainButton|] [|[|{| "declarationRangeIndex": 25 |}goTo|]="goTo"|] />|]; +//// let opt = [|<[|{| "declarationRangeIndex": 27 |}MainButton|] [|wrong|] />|]; verify.rangesWithSameTextAreRenameLocations( "onClick", From a120c5901563a553d6bcf6fca54038c2dd52ad41 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 6 Jun 2019 11:59:18 -0700 Subject: [PATCH 261/384] Handle Lable --- src/services/findAllReferences.ts | 4 +++- tests/cases/fourslash/referencesForLabel.ts | 12 ++++++------ tests/cases/fourslash/referencesForLabel3.ts | 6 +++--- tests/cases/fourslash/referencesForLabel4.ts | 8 ++++---- tests/cases/fourslash/referencesForLabel5.ts | 16 ++++++++-------- tests/cases/fourslash/referencesForLabel6.ts | 6 +++--- 6 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index a2eb4f3ec29..a23c5575ce7 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -55,7 +55,9 @@ namespace ts.FindAllReferences { if (isJsxOpeningElement(node.parent) || isJsxClosingElement(node.parent)) { return node.parent.parent; } - else if (isJsxSelfClosingElement(node.parent)) { + else if (isJsxSelfClosingElement(node.parent) || + isLabeledStatement(node.parent) || + isBreakOrContinueStatement(node.parent)) { return node.parent; } diff --git a/tests/cases/fourslash/referencesForLabel.ts b/tests/cases/fourslash/referencesForLabel.ts index 1abcafda0f2..bc77f5b0031 100644 --- a/tests/cases/fourslash/referencesForLabel.ts +++ b/tests/cases/fourslash/referencesForLabel.ts @@ -2,14 +2,14 @@ // Valid References for a label -////[|label|]: while (true) { -//// if (false) break [|label|]; -//// if (true) continue [|label|]; -////} +////[|[|{| "declarationRangeIndex": 0 |}label|]: while (true) { +//// if (false) [|break [|{| "declarationRangeIndex": 2 |}label|];|] +//// if (true) [|continue [|{| "declarationRangeIndex": 4 |}label|];|] +////}|] //// -////[|label|]: while (false) { } +////[|[|{| "declarationRangeIndex": 6 |}label|]: while (false) { }|] ////var label = "label"; -const [r0, r1, r2, r3] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3] = test.ranges(); verify.singleReferenceGroup("label", [r0, r1, r2]); verify.singleReferenceGroup("label", [r3]); diff --git a/tests/cases/fourslash/referencesForLabel3.ts b/tests/cases/fourslash/referencesForLabel3.ts index 13622eb90c3..be700ed6df0 100644 --- a/tests/cases/fourslash/referencesForLabel3.ts +++ b/tests/cases/fourslash/referencesForLabel3.ts @@ -2,8 +2,8 @@ // References to unused label -////[|label|]: while (true) { +////[|[|{| "declarationRangeIndex": 0 |}label|]: while (true) { //// var label = "label"; -////} +////}|] -verify.singleReferenceGroup("label"); +verify.singleReferenceGroup("label", "label"); diff --git a/tests/cases/fourslash/referencesForLabel4.ts b/tests/cases/fourslash/referencesForLabel4.ts index 2ff159bc755..353e663b0d9 100644 --- a/tests/cases/fourslash/referencesForLabel4.ts +++ b/tests/cases/fourslash/referencesForLabel4.ts @@ -2,10 +2,10 @@ // References to a label outside function bounderies -////[|label|]: function foo(label) { +////[|[|{| "declarationRangeIndex": 0 |}label|]: function foo(label) { //// while (true) { -//// break [|label|]; +//// [|break [|{| "declarationRangeIndex": 2 |}label|];|] //// } -////} +////}|] -verify.singleReferenceGroup("label"); +verify.singleReferenceGroup("label", "label"); diff --git a/tests/cases/fourslash/referencesForLabel5.ts b/tests/cases/fourslash/referencesForLabel5.ts index bc986e3350d..91223507624 100644 --- a/tests/cases/fourslash/referencesForLabel5.ts +++ b/tests/cases/fourslash/referencesForLabel5.ts @@ -2,16 +2,16 @@ // References to shadowed label -////[|label|]: while (true) { -//// if (false) break [|label|]; +////[|[|{| "declarationRangeIndex": 0 |}label|]: while (true) { +//// if (false) [|break [|{| "declarationRangeIndex": 2 |}label|];|] //// function blah() { -////[|label|]: while (true) { -//// if (false) break [|label|]; -//// } +////[|[|{| "declarationRangeIndex": 4 |}label|]: while (true) { +//// if (false) [|break [|{| "declarationRangeIndex": 6 |}label|];|] +//// }|] //// } -//// if (false) break [|label|]; -//// } +//// if (false) [|break [|{| "declarationRangeIndex": 8 |}label|];|] +//// }|] -const [outer1, outer2, inner1, inner2, outer3] = test.ranges(); +const [ourter1Def, outer1, outer2Def, outer2, inner1Def, inner1, inner2Def, inner2, outer3Def, outer3] = test.ranges(); verify.singleReferenceGroup("label", [outer1, outer2, outer3]); verify.singleReferenceGroup("label", [inner1, inner2]); diff --git a/tests/cases/fourslash/referencesForLabel6.ts b/tests/cases/fourslash/referencesForLabel6.ts index a8f71480975..2597d8a7291 100644 --- a/tests/cases/fourslash/referencesForLabel6.ts +++ b/tests/cases/fourslash/referencesForLabel6.ts @@ -2,10 +2,10 @@ // References to labels with close names -////[|labela|]: while (true) { -////[|labelb|]: while (false) { break [|labelb|]; } +////[|[|{| "declarationRangeIndex": 0 |}labela|]: while (true) { +////[|[|{| "declarationRangeIndex": 2 |}labelb|]: while (false) { [|break [|{| "declarationRangeIndex": 4 |}labelb|];|] }|] //// break labelc; -////} +////}|] verify.singleReferenceGroup("labela", "labela"); verify.singleReferenceGroup("labelb", "labelb"); From 13557299e90a1644e87ffe4b06ac91a1aa042150 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 6 Jun 2019 12:45:56 -0700 Subject: [PATCH 262/384] Consistent widening in property and element access expressions --- src/compiler/checker.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 817364ba832..df77afd8926 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -20217,19 +20217,25 @@ namespace ts { return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right); } + function isMethodAccessForCall(node: Node) { + while (node.parent.kind === SyntaxKind.ParenthesizedExpression) { + node = node.parent; + } + return isCallOrNewExpression(node.parent) && node.parent.expression === node; + } + function checkPropertyAccessExpressionOrQualifiedName(node: PropertyAccessExpression | QualifiedName, left: Expression | QualifiedName, right: Identifier) { let propType: Type; const leftType = checkNonNullExpression(left); const parentSymbol = getNodeLinks(left).resolvedSymbol; - // We widen array literals to get type any[] instead of undefined[] in non-strict mode - const apparentType = getApparentType(isEmptyArrayLiteralType(leftType) ? getWidenedType(leftType) : leftType); + const assignmentKind = getAssignmentTargetKind(node); + const apparentType = getApparentType(assignmentKind !== AssignmentKind.None || isMethodAccessForCall(node) ? getWidenedType(leftType) : leftType); if (isTypeAny(apparentType) || apparentType === silentNeverType) { if (isIdentifier(left) && parentSymbol) { markAliasReferenced(parentSymbol, node); } return apparentType; } - const assignmentKind = getAssignmentTargetKind(node); const prop = getPropertyOfType(apparentType, right.escapedText); if (isIdentifier(left) && parentSymbol && !(prop && isConstEnumOrConstEnumOnlyModule(prop))) { markAliasReferenced(parentSymbol, node); @@ -20623,7 +20629,8 @@ namespace ts { } function checkIndexedAccess(node: ElementAccessExpression): Type { - const objectType = checkNonNullExpression(node.expression); + const exprType = checkNonNullExpression(node.expression); + const objectType = getAssignmentTargetKind(node) !== AssignmentKind.None || isMethodAccessForCall(node.parent) ? getWidenedType(exprType) : exprType; const indexExpression = node.argumentExpression; if (!indexExpression) { From ddc742c40ced60071a9e057a64f714dfa6106a94 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 6 Jun 2019 13:33:18 -0700 Subject: [PATCH 263/384] Minor fix --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index df77afd8926..a59c5b89ecf 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -20630,7 +20630,7 @@ namespace ts { function checkIndexedAccess(node: ElementAccessExpression): Type { const exprType = checkNonNullExpression(node.expression); - const objectType = getAssignmentTargetKind(node) !== AssignmentKind.None || isMethodAccessForCall(node.parent) ? getWidenedType(exprType) : exprType; + const objectType = getAssignmentTargetKind(node) !== AssignmentKind.None || isMethodAccessForCall(node) ? getWidenedType(exprType) : exprType; const indexExpression = node.argumentExpression; if (!indexExpression) { From 9d2a2c96344011a9f3db5ee85dc2cbb61c059b83 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 6 Jun 2019 13:33:36 -0700 Subject: [PATCH 264/384] Add tests --- .../propertyAccess/propertyAccessWidening.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/cases/conformance/expressions/propertyAccess/propertyAccessWidening.ts diff --git a/tests/cases/conformance/expressions/propertyAccess/propertyAccessWidening.ts b/tests/cases/conformance/expressions/propertyAccess/propertyAccessWidening.ts new file mode 100644 index 00000000000..ddcad3f57c9 --- /dev/null +++ b/tests/cases/conformance/expressions/propertyAccess/propertyAccessWidening.ts @@ -0,0 +1,22 @@ +// @strict: true + +// Repro from #31762 + +function g1(headerNames: any) { + let t = [{ hasLineBreak: false, cells: [] }]; + const table = [{cells: headerNames }].concat(t); +} + +function g2(headerNames: any) { + let t = [{ hasLineBreak: false, cells: [] }]; + const table = [{cells: headerNames }]["concat"](t); +} + +// Object in property or element access is widened when target of assignment + +function foo(options?: { a: string, b: number }) { + let x1 = (options || {}).a; // Object type not widened + let x2 = (options || {})["a"]; // Object type not widened + (options || {}).a = 1; // Object type widened, error + (options || {})["a"] = 1; // Object type widened, error +} From 1aed26aab72800b02319e81e7325bb96566152c6 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 6 Jun 2019 13:34:00 -0700 Subject: [PATCH 265/384] Accept new baselines --- .../propertyAccessWidening.errors.txt | 34 ++++++ .../reference/propertyAccessWidening.js | 41 +++++++ .../reference/propertyAccessWidening.symbols | 65 ++++++++++++ .../reference/propertyAccessWidening.types | 100 ++++++++++++++++++ 4 files changed, 240 insertions(+) create mode 100644 tests/baselines/reference/propertyAccessWidening.errors.txt create mode 100644 tests/baselines/reference/propertyAccessWidening.js create mode 100644 tests/baselines/reference/propertyAccessWidening.symbols create mode 100644 tests/baselines/reference/propertyAccessWidening.types diff --git a/tests/baselines/reference/propertyAccessWidening.errors.txt b/tests/baselines/reference/propertyAccessWidening.errors.txt new file mode 100644 index 00000000000..5dc4762a540 --- /dev/null +++ b/tests/baselines/reference/propertyAccessWidening.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/expressions/propertyAccess/propertyAccessWidening.ts(18,21): error TS2339: Property 'a' does not exist on type '{ a: string; b: number; } | {}'. + Property 'a' does not exist on type '{}'. +tests/cases/conformance/expressions/propertyAccess/propertyAccessWidening.ts(19,5): error TS7053: Element implicitly has an 'any' type because expression of type '"a"' can't be used to index type '{}'. + Property 'a' does not exist on type '{}'. + + +==== tests/cases/conformance/expressions/propertyAccess/propertyAccessWidening.ts (2 errors) ==== + // Repro from #31762 + + function g1(headerNames: any) { + let t = [{ hasLineBreak: false, cells: [] }]; + const table = [{cells: headerNames }].concat(t); + } + + function g2(headerNames: any) { + let t = [{ hasLineBreak: false, cells: [] }]; + const table = [{cells: headerNames }]["concat"](t); + } + + // Object in property or element access is widened when target of assignment + + function foo(options?: { a: string, b: number }) { + let x1 = (options || {}).a; // Object type not widened + let x2 = (options || {})["a"]; // Object type not widened + (options || {}).a = 1; // Object type widened, error + ~ +!!! error TS2339: Property 'a' does not exist on type '{ a: string; b: number; } | {}'. +!!! error TS2339: Property 'a' does not exist on type '{}'. + (options || {})["a"] = 1; // Object type widened, error + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"a"' can't be used to index type '{}'. +!!! error TS7053: Property 'a' does not exist on type '{}'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/propertyAccessWidening.js b/tests/baselines/reference/propertyAccessWidening.js new file mode 100644 index 00000000000..e48b0ec3a6c --- /dev/null +++ b/tests/baselines/reference/propertyAccessWidening.js @@ -0,0 +1,41 @@ +//// [propertyAccessWidening.ts] +// Repro from #31762 + +function g1(headerNames: any) { + let t = [{ hasLineBreak: false, cells: [] }]; + const table = [{cells: headerNames }].concat(t); +} + +function g2(headerNames: any) { + let t = [{ hasLineBreak: false, cells: [] }]; + const table = [{cells: headerNames }]["concat"](t); +} + +// Object in property or element access is widened when target of assignment + +function foo(options?: { a: string, b: number }) { + let x1 = (options || {}).a; // Object type not widened + let x2 = (options || {})["a"]; // Object type not widened + (options || {}).a = 1; // Object type widened, error + (options || {})["a"] = 1; // Object type widened, error +} + + +//// [propertyAccessWidening.js] +"use strict"; +// Repro from #31762 +function g1(headerNames) { + var t = [{ hasLineBreak: false, cells: [] }]; + var table = [{ cells: headerNames }].concat(t); +} +function g2(headerNames) { + var t = [{ hasLineBreak: false, cells: [] }]; + var table = [{ cells: headerNames }]["concat"](t); +} +// Object in property or element access is widened when target of assignment +function foo(options) { + var x1 = (options || {}).a; // Object type not widened + var x2 = (options || {})["a"]; // Object type not widened + (options || {}).a = 1; // Object type widened, error + (options || {})["a"] = 1; // Object type widened, error +} diff --git a/tests/baselines/reference/propertyAccessWidening.symbols b/tests/baselines/reference/propertyAccessWidening.symbols new file mode 100644 index 00000000000..4e901d23dad --- /dev/null +++ b/tests/baselines/reference/propertyAccessWidening.symbols @@ -0,0 +1,65 @@ +=== tests/cases/conformance/expressions/propertyAccess/propertyAccessWidening.ts === +// Repro from #31762 + +function g1(headerNames: any) { +>g1 : Symbol(g1, Decl(propertyAccessWidening.ts, 0, 0)) +>headerNames : Symbol(headerNames, Decl(propertyAccessWidening.ts, 2, 12)) + + let t = [{ hasLineBreak: false, cells: [] }]; +>t : Symbol(t, Decl(propertyAccessWidening.ts, 3, 7)) +>hasLineBreak : Symbol(hasLineBreak, Decl(propertyAccessWidening.ts, 3, 14)) +>cells : Symbol(cells, Decl(propertyAccessWidening.ts, 3, 35)) + + const table = [{cells: headerNames }].concat(t); +>table : Symbol(table, Decl(propertyAccessWidening.ts, 4, 9)) +>[{cells: headerNames }].concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>cells : Symbol(cells, Decl(propertyAccessWidening.ts, 4, 20)) +>headerNames : Symbol(headerNames, Decl(propertyAccessWidening.ts, 2, 12)) +>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>t : Symbol(t, Decl(propertyAccessWidening.ts, 3, 7)) +} + +function g2(headerNames: any) { +>g2 : Symbol(g2, Decl(propertyAccessWidening.ts, 5, 1)) +>headerNames : Symbol(headerNames, Decl(propertyAccessWidening.ts, 7, 12)) + + let t = [{ hasLineBreak: false, cells: [] }]; +>t : Symbol(t, Decl(propertyAccessWidening.ts, 8, 7)) +>hasLineBreak : Symbol(hasLineBreak, Decl(propertyAccessWidening.ts, 8, 14)) +>cells : Symbol(cells, Decl(propertyAccessWidening.ts, 8, 35)) + + const table = [{cells: headerNames }]["concat"](t); +>table : Symbol(table, Decl(propertyAccessWidening.ts, 9, 9)) +>cells : Symbol(cells, Decl(propertyAccessWidening.ts, 9, 20)) +>headerNames : Symbol(headerNames, Decl(propertyAccessWidening.ts, 7, 12)) +>"concat" : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>t : Symbol(t, Decl(propertyAccessWidening.ts, 8, 7)) +} + +// Object in property or element access is widened when target of assignment + +function foo(options?: { a: string, b: number }) { +>foo : Symbol(foo, Decl(propertyAccessWidening.ts, 10, 1)) +>options : Symbol(options, Decl(propertyAccessWidening.ts, 14, 13)) +>a : Symbol(a, Decl(propertyAccessWidening.ts, 14, 24)) +>b : Symbol(b, Decl(propertyAccessWidening.ts, 14, 35)) + + let x1 = (options || {}).a; // Object type not widened +>x1 : Symbol(x1, Decl(propertyAccessWidening.ts, 15, 7)) +>(options || {}).a : Symbol(a, Decl(propertyAccessWidening.ts, 14, 24)) +>options : Symbol(options, Decl(propertyAccessWidening.ts, 14, 13)) +>a : Symbol(a, Decl(propertyAccessWidening.ts, 14, 24)) + + let x2 = (options || {})["a"]; // Object type not widened +>x2 : Symbol(x2, Decl(propertyAccessWidening.ts, 16, 7)) +>options : Symbol(options, Decl(propertyAccessWidening.ts, 14, 13)) +>"a" : Symbol(a, Decl(propertyAccessWidening.ts, 14, 24)) + + (options || {}).a = 1; // Object type widened, error +>options : Symbol(options, Decl(propertyAccessWidening.ts, 14, 13)) + + (options || {})["a"] = 1; // Object type widened, error +>options : Symbol(options, Decl(propertyAccessWidening.ts, 14, 13)) +>"a" : Symbol(a, Decl(propertyAccessWidening.ts, 14, 24)) +} + diff --git a/tests/baselines/reference/propertyAccessWidening.types b/tests/baselines/reference/propertyAccessWidening.types new file mode 100644 index 00000000000..244b43be69f --- /dev/null +++ b/tests/baselines/reference/propertyAccessWidening.types @@ -0,0 +1,100 @@ +=== tests/cases/conformance/expressions/propertyAccess/propertyAccessWidening.ts === +// Repro from #31762 + +function g1(headerNames: any) { +>g1 : (headerNames: any) => void +>headerNames : any + + let t = [{ hasLineBreak: false, cells: [] }]; +>t : { hasLineBreak: boolean; cells: never[]; }[] +>[{ hasLineBreak: false, cells: [] }] : { hasLineBreak: boolean; cells: never[]; }[] +>{ hasLineBreak: false, cells: [] } : { hasLineBreak: boolean; cells: never[]; } +>hasLineBreak : boolean +>false : false +>cells : never[] +>[] : never[] + + const table = [{cells: headerNames }].concat(t); +>table : { cells: any; }[] +>[{cells: headerNames }].concat(t) : { cells: any; }[] +>[{cells: headerNames }].concat : { (...items: ConcatArray<{ cells: any; }>[]): { cells: any; }[]; (...items: ({ cells: any; } | ConcatArray<{ cells: any; }>)[]): { cells: any; }[]; } +>[{cells: headerNames }] : { cells: any; }[] +>{cells: headerNames } : { cells: any; } +>cells : any +>headerNames : any +>concat : { (...items: ConcatArray<{ cells: any; }>[]): { cells: any; }[]; (...items: ({ cells: any; } | ConcatArray<{ cells: any; }>)[]): { cells: any; }[]; } +>t : { hasLineBreak: boolean; cells: never[]; }[] +} + +function g2(headerNames: any) { +>g2 : (headerNames: any) => void +>headerNames : any + + let t = [{ hasLineBreak: false, cells: [] }]; +>t : { hasLineBreak: boolean; cells: never[]; }[] +>[{ hasLineBreak: false, cells: [] }] : { hasLineBreak: boolean; cells: never[]; }[] +>{ hasLineBreak: false, cells: [] } : { hasLineBreak: boolean; cells: never[]; } +>hasLineBreak : boolean +>false : false +>cells : never[] +>[] : never[] + + const table = [{cells: headerNames }]["concat"](t); +>table : { cells: any; }[] +>[{cells: headerNames }]["concat"](t) : { cells: any; }[] +>[{cells: headerNames }]["concat"] : { (...items: ConcatArray<{ cells: any; }>[]): { cells: any; }[]; (...items: ({ cells: any; } | ConcatArray<{ cells: any; }>)[]): { cells: any; }[]; } +>[{cells: headerNames }] : { cells: any; }[] +>{cells: headerNames } : { cells: any; } +>cells : any +>headerNames : any +>"concat" : "concat" +>t : { hasLineBreak: boolean; cells: never[]; }[] +} + +// Object in property or element access is widened when target of assignment + +function foo(options?: { a: string, b: number }) { +>foo : (options?: { a: string; b: number; } | undefined) => void +>options : { a: string; b: number; } | undefined +>a : string +>b : number + + let x1 = (options || {}).a; // Object type not widened +>x1 : string | undefined +>(options || {}).a : string | undefined +>(options || {}) : { a: string; b: number; } | {} +>options || {} : { a: string; b: number; } | {} +>options : { a: string; b: number; } | undefined +>{} : {} +>a : string | undefined + + let x2 = (options || {})["a"]; // Object type not widened +>x2 : string | undefined +>(options || {})["a"] : string | undefined +>(options || {}) : { a: string; b: number; } | {} +>options || {} : { a: string; b: number; } | {} +>options : { a: string; b: number; } | undefined +>{} : {} +>"a" : "a" + + (options || {}).a = 1; // Object type widened, error +>(options || {}).a = 1 : 1 +>(options || {}).a : any +>(options || {}) : { a: string; b: number; } | {} +>options || {} : { a: string; b: number; } | {} +>options : { a: string; b: number; } | undefined +>{} : {} +>a : any +>1 : 1 + + (options || {})["a"] = 1; // Object type widened, error +>(options || {})["a"] = 1 : 1 +>(options || {})["a"] : any +>(options || {}) : { a: string; b: number; } | {} +>options || {} : { a: string; b: number; } | {} +>options : { a: string; b: number; } | undefined +>{} : {} +>"a" : "a" +>1 : 1 +} + From a67b375d0efb3ecc0abaabc2f8a2f168a680e99e Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 6 Jun 2019 12:51:26 -0700 Subject: [PATCH 266/384] Handle module specifiers --- src/services/findAllReferences.ts | 33 +++++++++++++------ src/testRunner/unittests/tsserver/rename.ts | 9 +++-- .../findAllReferencesDynamicImport1.ts | 6 ++-- ...findAllReferencesUmdModuleAsGlobalConst.ts | 6 ++-- .../fourslash/findAllRefsExportEquals.ts | 2 +- tests/cases/fourslash/findAllRefsForModule.ts | 10 +++--- .../fourslash/findAllRefsForModuleGlobal.ts | 4 +-- .../findAllRefsImportEqualsJsonFile.ts | 4 +-- .../fourslash/findAllRefsModuleDotExports.ts | 6 ++-- .../findAllRefs_importType_exportEquals.ts | 6 ++-- .../fourslash/findAllRefs_importType_js.ts | 6 ++-- .../findAllRefs_importType_typeofImport.ts | 6 ++-- .../cases/fourslash/referencesForAmbients.ts | 6 ++-- .../referencesForExternalModuleNames.ts | 2 +- tests/cases/fourslash/untypedModuleImport.ts | 2 +- 15 files changed, 62 insertions(+), 46 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index a23c5575ce7..b8971d74a41 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -51,16 +51,6 @@ namespace ts.FindAllReferences { if (!node.parent) return undefined; if (!isDeclaration(node.parent) && !isExportAssignment(node.parent)) { - // Jsx Tags - if (isJsxOpeningElement(node.parent) || isJsxClosingElement(node.parent)) { - return node.parent.parent; - } - else if (isJsxSelfClosingElement(node.parent) || - isLabeledStatement(node.parent) || - isBreakOrContinueStatement(node.parent)) { - return node.parent; - } - // Special property assignment in javascript if (isInJSFile(node)) { const binaryExpression = isBinaryExpression(node.parent) ? @@ -75,6 +65,29 @@ namespace ts.FindAllReferences { } } + // Jsx Tags + if (isJsxOpeningElement(node.parent) || isJsxClosingElement(node.parent)) { + return node.parent.parent; + } + else if (isJsxSelfClosingElement(node.parent) || + isLabeledStatement(node.parent) || + isBreakOrContinueStatement(node.parent)) { + return node.parent; + } + else if (isStringLiteralLike(node)) { + const validImport = tryGetImportFromModuleSpecifier(node); + if (validImport) { + const declOrStatement = findAncestor(validImport, node => + isDeclaration(node) || + isStatement(node) || + isJSDocTag(node) + )! as NamedDeclaration | Statement | JSDocTag; + return isDeclaration(declOrStatement) ? + getDeclarationForDeclarationSpan(declOrStatement) : + declOrStatement; + } + } + // Handle computed property name const propertyName = findAncestor(node, isComputedPropertyName); return propertyName ? diff --git a/src/testRunner/unittests/tsserver/rename.ts b/src/testRunner/unittests/tsserver/rename.ts index 67464499a5b..6f5633875fa 100644 --- a/src/testRunner/unittests/tsserver/rename.ts +++ b/src/testRunner/unittests/tsserver/rename.ts @@ -19,7 +19,8 @@ namespace ts.projectSystem { locs: [ protocolRenameSpanFromSubstring({ fileText: bTs.content, - text: "./a" + text: "./a", + declarationText: bTs.content }) ] }], @@ -43,7 +44,8 @@ namespace ts.projectSystem { locs: [ protocolRenameSpanFromSubstring({ fileText: bTs.content, - text: "./a" + text: "./a", + declarationText: bTs.content }) ] }], @@ -68,7 +70,8 @@ namespace ts.projectSystem { locs: [ protocolRenameSpanFromSubstring({ fileText: bTs.content, - text: "./a" + text: "./a", + declarationText: bTs.content }) ] }], diff --git a/tests/cases/fourslash/findAllReferencesDynamicImport1.ts b/tests/cases/fourslash/findAllReferencesDynamicImport1.ts index c2b6f359ba6..070621ef94b 100644 --- a/tests/cases/fourslash/findAllReferencesDynamicImport1.ts +++ b/tests/cases/fourslash/findAllReferencesDynamicImport1.ts @@ -3,7 +3,7 @@ // @Filename: foo.ts //// export function foo() { return "foo"; } -//// import("[|./foo|]") -//// var x = import("[|./foo|]") +//// [|import("[|{| "declarationRangeIndex": 0 |}./foo|]")|] +//// [|var x = import("[|{| "declarationRangeIndex": 2 |}./foo|]")|] -verify.singleReferenceGroup('module "/tests/cases/fourslash/foo"'); +verify.singleReferenceGroup('module "/tests/cases/fourslash/foo"', "./foo"); diff --git a/tests/cases/fourslash/findAllReferencesUmdModuleAsGlobalConst.ts b/tests/cases/fourslash/findAllReferencesUmdModuleAsGlobalConst.ts index 4876b1e0229..23435fa5cad 100644 --- a/tests/cases/fourslash/findAllReferencesUmdModuleAsGlobalConst.ts +++ b/tests/cases/fourslash/findAllReferencesUmdModuleAsGlobalConst.ts @@ -12,9 +12,9 @@ ////[|export as namespace [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}THREE|];|] // @Filename: /typings/global.d.ts -////import * as _THREE from '[|three|]'; +////[|import * as _THREE from '[|{| "declarationRangeIndex": 2 |}three|]';|] ////declare global { -//// [|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}THREE|]: typeof _THREE;|] +//// [|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}THREE|]: typeof _THREE;|] ////} // @Filename: /src/index.ts @@ -38,7 +38,7 @@ //// "files": ["/src/index.ts", "typings/global.d.ts"] ////} -const [r0Def, r0, r1, r2Def, ...rest] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, ...rest] = test.ranges(); // GH#29533 // TODO:: this should be var THREE: typeof import instead of module name as var but thats existing issue and repros with quickInfo too. verify.singleReferenceGroup(`module "/node_modules/@types/three/index" diff --git a/tests/cases/fourslash/findAllRefsExportEquals.ts b/tests/cases/fourslash/findAllRefsExportEquals.ts index fd17a82633c..d7d80564e5b 100644 --- a/tests/cases/fourslash/findAllRefsExportEquals.ts +++ b/tests/cases/fourslash/findAllRefsExportEquals.ts @@ -5,7 +5,7 @@ ////[|[|{| "declarationRangeIndex": 2 |}export|] = [|{| "declarationRangeIndex": 2 |}T|];|] // @Filename: /b.ts -////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}T|] = require("[|./a|]");|] +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}T|] = require("[|{| "declarationRangeIndex": 5 |}./a|]");|] const [r0Def, r0, r12Def, r1, r2, r3Def, r3, r4] = test.ranges(); const mod = { definition: 'module "/a"', ranges: [r4, r1] }; diff --git a/tests/cases/fourslash/findAllRefsForModule.ts b/tests/cases/fourslash/findAllRefsForModule.ts index a9a44d6ffaa..0449c6a4408 100644 --- a/tests/cases/fourslash/findAllRefsForModule.ts +++ b/tests/cases/fourslash/findAllRefsForModule.ts @@ -6,16 +6,16 @@ ////export const x = 0; // @Filename: /b.ts -////import { x } from "[|./a|]"; +////[|import { x } from "[|{| "declarationRangeIndex": 0 |}./a|]";|] // @Filename: /c/sub.js -////const a = require("[|../a|]"); +////[|const a = require("[|{| "declarationRangeIndex": 2 |}../a|]");|] // @Filename: /d.ts //// /// -const ranges = test.ranges(); -const [r0, r1, r2] = ranges; +const [r0Def, r0, r1Def, r1, r2] = test.ranges(); +const ranges = [r0, r1, r2]; verify.referenceGroups(ranges, [{ definition: 'module "/a"', ranges: [r0, r1, r2] }]); // Testing that it works with documentHighlights too -verify.rangesAreDocumentHighlights(); +verify.rangesAreDocumentHighlights(ranges); diff --git a/tests/cases/fourslash/findAllRefsForModuleGlobal.ts b/tests/cases/fourslash/findAllRefsForModuleGlobal.ts index 4c7aa3939c1..bdb0d62a5cb 100644 --- a/tests/cases/fourslash/findAllRefsForModuleGlobal.ts +++ b/tests/cases/fourslash/findAllRefsForModuleGlobal.ts @@ -5,8 +5,8 @@ // @Filename: /b.ts /////// -////import { x } from "[|foo|]"; -////[|declare module "[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}foo|]" {}|] +////[|import { x } from "[|{| "declarationRangeIndex": 1 |}foo|]";|] +////[|declare module "[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}foo|]" {}|] verify.noErrors(); verify.singleReferenceGroup('module "/node_modules/foo/index"', "foo"); diff --git a/tests/cases/fourslash/findAllRefsImportEqualsJsonFile.ts b/tests/cases/fourslash/findAllRefsImportEqualsJsonFile.ts index 7b6e0e5bbc0..97147e4a1f6 100644 --- a/tests/cases/fourslash/findAllRefsImportEqualsJsonFile.ts +++ b/tests/cases/fourslash/findAllRefsImportEqualsJsonFile.ts @@ -5,11 +5,11 @@ // @resolveJsonModule: true // @Filename: /a.ts -////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}j|] = require("[|./j.json|]");|] +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}j|] = require("[|{| "declarationRangeIndex": 0 |}./j.json|]");|] ////[|j|]; // @Filename: /b.js -////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}j|] = require("[|./j.json|]");|] +////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}j|] = require("[|{| "declarationRangeIndex": 4 |}./j.json|]");|] ////[|j|]; // @Filename: /j.json diff --git a/tests/cases/fourslash/findAllRefsModuleDotExports.ts b/tests/cases/fourslash/findAllRefsModuleDotExports.ts index ca30b341b90..165944ba356 100644 --- a/tests/cases/fourslash/findAllRefsModuleDotExports.ts +++ b/tests/cases/fourslash/findAllRefsModuleDotExports.ts @@ -3,10 +3,10 @@ // @allowJs: true // @Filename: /a.js -////const b = require("[|./b|]"); +////[|const b = require("[|{| "declarationRangeIndex": 0 |}./b|]");|] // @Filename: /b.js -////[|[|{| "declarationRangeIndex": 1 |}module|].exports = 0;|] +////[|[|{| "declarationRangeIndex": 2 |}module|].exports = 0;|] -const [r0, rDef, r1] = test.ranges(); +const [r0Def, r0, rDef, r1] = test.ranges(); verify.singleReferenceGroup('module "/b"', [r0, r1]); diff --git a/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts b/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts index 4597c3a8bc9..e2c86d60c9c 100644 --- a/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts +++ b/tests/cases/fourslash/findAllRefs_importType_exportEquals.ts @@ -8,12 +8,12 @@ ////[|[|{| "declarationRangeIndex": 4 |}export|] = [|{| "declarationRangeIndex": 4 |}T|];|] // @Filename: /b.ts -////const x: import("[|./[|a|]|]") = 0; -////const y: import("[|./[|a|]|]").U = ""; +////[|const x: import("[|{| "declarationRangeIndex": 7 |}./[|a|]|]") = 0;|] +////[|const y: import("[|{| "declarationRangeIndex": 10 |}./[|a|]|]").U = "";|] verify.noErrors(); -const [r0Def, r0, r1Def, r1, r2Def, rExport, r2, r3, r3b, r4, r4b] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, rExport, r2, r3Def, r3, r3b, r4Def, r4, r4b] = test.ranges(); verify.referenceGroups(r0, [{ definition: "type T = number\nnamespace T", ranges: [r0, r2, r3] }]); verify.referenceGroups(r1, [{ definition: "namespace T", ranges: [r1, r2] }]); const t: FourSlashInterface.ReferenceGroup = { definition: "type T = number\nnamespace T", ranges: [r0, r1, r2, r3] }; diff --git a/tests/cases/fourslash/findAllRefs_importType_js.ts b/tests/cases/fourslash/findAllRefs_importType_js.ts index 79f99da90a4..51d99aaae7a 100644 --- a/tests/cases/fourslash/findAllRefs_importType_js.ts +++ b/tests/cases/fourslash/findAllRefs_importType_js.ts @@ -8,16 +8,16 @@ ////[|module.exports.[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}D|] = [|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}D|] {}|];|] // @Filename: /b.js -/////** @type {import("[|./a|]")} */ +/////** [|@type {import("[|{| "declarationRangeIndex": 8 |}./a|]")}|] */ ////const x = 0; -/////** @type {import("[|./a|]").[|D|]} */ +/////** [|@type {import("[|{| "declarationRangeIndex": 10 |}./a|]").[|D|]}|] */ ////const y = 0; verify.noErrors(); // TODO: GH#24025 -const [rModuleDef, rModule, r0Def, r0, r1Def, r1, r2Def, r2, r3, r4, r5] = test.ranges(); +const [rModuleDef, rModule, r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4Def, r4, r5] = test.ranges(); verify.referenceGroups(rModule, [{ definition: 'module "/a"', ranges: [r3, r4, rModule] }]); verify.referenceGroups(r0, [ { definition: "(local class) C", ranges: [r0] }, diff --git a/tests/cases/fourslash/findAllRefs_importType_typeofImport.ts b/tests/cases/fourslash/findAllRefs_importType_typeofImport.ts index beab9c7cfc4..082b34b6792 100644 --- a/tests/cases/fourslash/findAllRefs_importType_typeofImport.ts +++ b/tests/cases/fourslash/findAllRefs_importType_typeofImport.ts @@ -4,7 +4,7 @@ ////export const x = 0; // @Filename: /b.ts -////const x: typeof import("[|./a|]") = { x: 0 }; -////const y: typeof import("[|./a|]") = { x: 0 }; +////[|const x: typeof import("[|{| "declarationRangeIndex": 0 |}./a|]") = { x: 0 };|] +////[|const y: typeof import("[|{| "declarationRangeIndex": 2 |}./a|]") = { x: 0 };|] -verify.singleReferenceGroup('module "/a"'); +verify.singleReferenceGroup('module "/a"', "./a"); diff --git a/tests/cases/fourslash/referencesForAmbients.ts b/tests/cases/fourslash/referencesForAmbients.ts index 77ff23cab98..4631a659b00 100644 --- a/tests/cases/fourslash/referencesForAmbients.ts +++ b/tests/cases/fourslash/referencesForAmbients.ts @@ -5,16 +5,16 @@ ////}|] //// ////[|declare module "[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}bar|]" { -//// [|export import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}foo|] = require("[|foo|]");|] +//// [|export import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}foo|] = require("[|{| "declarationRangeIndex": 6 |}foo|]");|] //// var f2: typeof [|foo|].[|f|]; ////}|] //// ////declare module "baz" { -//// import bar = require("[|bar|]"); +//// [|import bar = require("[|{| "declarationRangeIndex": 11 |}bar|]");|] //// var f2: typeof bar.[|foo|]; ////} -const [moduleFoo0Def, moduleFoo0, f0Def, f0, moduleBar0Def, moduleBar0, foo0Def, foo0, moduleFoo1, foo1, f1, moduleBar1, foo2] = test.ranges(); +const [moduleFoo0Def, moduleFoo0, f0Def, f0, moduleBar0Def, moduleBar0, foo0Def, foo0, moduleFoo1, foo1, f1, moduleBar1Def, moduleBar1, foo2] = test.ranges(); verify.singleReferenceGroup('module "foo"', [moduleFoo0, moduleFoo1]); verify.singleReferenceGroup('module "bar"', [moduleBar0, moduleBar1]); verify.singleReferenceGroup('(alias) module "foo"\nimport foo = require("foo")', [foo0, foo1, foo2]); diff --git a/tests/cases/fourslash/referencesForExternalModuleNames.ts b/tests/cases/fourslash/referencesForExternalModuleNames.ts index 6fafec9f690..66fa11d45c3 100644 --- a/tests/cases/fourslash/referencesForExternalModuleNames.ts +++ b/tests/cases/fourslash/referencesForExternalModuleNames.ts @@ -6,6 +6,6 @@ ////}|] // @Filename: referencesForGlobals_2.ts -////import f = require("[|foo|]"); +////[|import f = require("[|{| "declarationRangeIndex": 2 |}foo|]");|] verify.singleReferenceGroup('module "foo"', "foo"); diff --git a/tests/cases/fourslash/untypedModuleImport.ts b/tests/cases/fourslash/untypedModuleImport.ts index 783e020e3fc..72452fac0ae 100644 --- a/tests/cases/fourslash/untypedModuleImport.ts +++ b/tests/cases/fourslash/untypedModuleImport.ts @@ -4,7 +4,7 @@ ////{} // @Filename: a.ts -////[|import /*foo*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|] from /*fooModule*/"[|{| "isInString": true |}foo|]";|] +////[|import /*foo*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}foo|] from /*fooModule*/"[|{| "isInString": true, "declarationRangeIndex": 0 |}foo|]";|] ////[|foo|](); goTo.file("a.ts"); From bdf8d5c8cb17622b0a6910d7a9639b08671c6683 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 6 Jun 2019 15:13:16 -0700 Subject: [PATCH 267/384] Update DOM and baselines --- src/lib/dom.generated.d.ts | 3822 +++++++++-------- src/lib/dom.iterable.generated.d.ts | 124 +- src/lib/webworker.generated.d.ts | 714 +-- .../globalThisBlockscopedProperties.types | 2 +- tests/baselines/reference/importMeta.symbols | 2 +- tests/baselines/reference/importMeta.types | 2 +- .../baselines/reference/importMetaES5.symbols | 2 +- tests/baselines/reference/importMetaES5.types | 2 +- .../intersectionsOfLargeUnions2.errors.txt | 2 +- .../mappedTypeRecursiveInference.errors.txt | 8 +- .../multiExtendsSplitInterfaces1.symbols | 4 +- 11 files changed, 2519 insertions(+), 2165 deletions(-) diff --git a/src/lib/dom.generated.d.ts b/src/lib/dom.generated.d.ts index 18f38b53560..e527838fc76 100644 --- a/src/lib/dom.generated.d.ts +++ b/src/lib/dom.generated.d.ts @@ -250,6 +250,15 @@ interface ConvolverOptions extends AudioNodeOptions { disableNormalization?: boolean; } +interface CredentialCreationOptions { + signal?: AbortSignal; +} + +interface CredentialRequestOptions { + mediation?: CredentialMediationRequirement; + signal?: AbortSignal; +} + interface CustomEventInit extends EventInit { detail?: T; } @@ -432,7 +441,6 @@ interface EventModifierInit extends UIEventInit { modifierFnLock?: boolean; modifierHyper?: boolean; modifierNumLock?: boolean; - modifierOS?: boolean; modifierScrollLock?: boolean; modifierSuper?: boolean; modifierSymbol?: boolean; @@ -546,6 +554,12 @@ interface ImageEncodeOptions { type?: string; } +interface InputEventInit extends UIEventInit { + data?: string | null; + inputType?: string; + isComposing?: boolean; +} + interface IntersectionObserverEntryInit { boundingClientRect: DOMRectInit; intersectionRatio: number; @@ -589,6 +603,7 @@ interface KeyAlgorithm { interface KeyboardEventInit extends EventModifierInit { code?: string; + isComposing?: boolean; key?: string; location?: number; repeat?: boolean; @@ -780,12 +795,33 @@ interface MultiCacheQueryOptions extends CacheQueryOptions { } interface MutationObserverInit { + /** + * Set to a list of attribute local names (without namespace) if not all attribute mutations need to be observed and attributes is true or omitted. + */ attributeFilter?: string[]; + /** + * Set to true if attributes is true or omitted and target's attribute value before the mutation needs to be recorded. + */ attributeOldValue?: boolean; + /** + * Set to true if mutations to target's attributes are to be observed. Can be omitted if attributeOldValue or attributeFilter is specified. + */ attributes?: boolean; + /** + * Set to true if mutations to target's data are to be observed. Can be omitted if characterDataOldValue is specified. + */ characterData?: boolean; + /** + * Set to true if characterData is set to true or omitted and target's data before the mutation needs to be recorded. + */ characterDataOldValue?: boolean; + /** + * Set to true if mutations to target's children are to be observed. + */ childList?: boolean; + /** + * Set to true if mutations to not just target, but also target's descendants are to be observed. + */ subtree?: boolean; } @@ -1390,18 +1426,57 @@ interface RegistrationOptions { } interface RequestInit { + /** + * A BodyInit object or null to set request's body. + */ body?: BodyInit | null; + /** + * A string indicating how the request will interact with the browser's cache to set request's cache. + */ cache?: RequestCache; + /** + * A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials. + */ credentials?: RequestCredentials; + /** + * A Headers object, an object literal, or an array of two-item arrays to set request's headers. + */ headers?: HeadersInit; + /** + * A cryptographic hash of the resource to be fetched by request. Sets request's integrity. + */ integrity?: string; + /** + * A boolean to set request's keepalive. + */ keepalive?: boolean; + /** + * A string to set request's method. + */ method?: string; + /** + * A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode. + */ mode?: RequestMode; + /** + * A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. + */ redirect?: RequestRedirect; + /** + * A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer. + */ referrer?: string; + /** + * A referrer policy to set request's referrerPolicy. + */ referrerPolicy?: ReferrerPolicy; + /** + * An AbortSignal to set request's signal. + */ signal?: AbortSignal | null; + /** + * Can only be null. Used to disassociate request from any Window. + */ window?: any; } @@ -1654,14 +1729,15 @@ interface WebAuthnExtensions { } interface WebGLContextAttributes { - alpha?: GLboolean; - antialias?: GLboolean; - depth?: GLboolean; + alpha?: boolean; + antialias?: boolean; + depth?: boolean; + desynchronized?: boolean; failIfMajorPerformanceCaveat?: boolean; powerPreference?: WebGLPowerPreference; - premultipliedAlpha?: GLboolean; - preserveDrawingBuffer?: GLboolean; - stencil?: GLboolean; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; + stencil?: boolean; } interface WebGLContextEventInit extends EventInit { @@ -1706,8 +1782,7 @@ interface AbortController { */ readonly signal: AbortSignal; /** - * Invoking this method will set this object's AbortSignal's aborted flag and - * signal to any observers that the associated activity is to be aborted. + * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. */ abort(): void; } @@ -1724,8 +1799,7 @@ interface AbortSignalEventMap { /** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ interface AbortSignal extends EventTarget { /** - * Returns true if this AbortSignal's AbortController has signaled to abort, and false - * otherwise. + * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */ readonly aborted: boolean; onabort: ((this: AbortSignal, ev: Event) => any) | null; @@ -1741,10 +1815,25 @@ declare var AbortSignal: { }; interface AbstractRange { + /** + * Returns true if range is collapsed, and false otherwise. + */ readonly collapsed: boolean; + /** + * Returns range's end node. + */ readonly endContainer: Node; + /** + * Returns range's end offset. + */ readonly endOffset: number; + /** + * Returns range's start node. + */ readonly startContainer: Node; + /** + * Returns range's start offset. + */ readonly startOffset: number; } @@ -1854,6 +1943,11 @@ declare var AnimationEvent: { new(type: string, animationEventInitDict?: AnimationEventInit): AnimationEvent; }; +interface AnimationFrameProvider { + cancelAnimationFrame(handle: number): void; + requestAnimationFrame(callback: FrameRequestCallback): number; +} + interface AnimationPlaybackEvent extends Event { readonly currentTime: number | null; readonly timelineTime: number | null; @@ -2343,7 +2437,7 @@ declare var BroadcastChannel: { new(name: string): BroadcastChannel; }; -/** An interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. */ +/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ interface ByteLengthQueuingStrategy extends QueuingStrategy { highWaterMark: number; size(chunk: ArrayBufferView): number; @@ -2522,9 +2616,9 @@ declare var CSSRuleList: { /** An object that is a CSS declaration block, and exposes style information and various style-related methods and properties. */ interface CSSStyleDeclaration { - alignContent: string | null; - alignItems: string | null; - alignSelf: string | null; + alignContent: string; + alignItems: string; + alignSelf: string; alignmentBaseline: string | null; animation: string; animationDelay: string; @@ -2594,7 +2688,7 @@ interface CSSStyleDeclaration { clipPath: string | null; clipRule: string | null; color: string | null; - colorInterpolationFilters: string | null; + colorInterpolationFilters: string; columnCount: string; columnFill: string; columnGap: string; @@ -2611,7 +2705,7 @@ interface CSSStyleDeclaration { cssFloat: string | null; cssText: string; cursor: string; - direction: string | null; + direction: string; display: string | null; dominantBaseline: string | null; emptyCells: string | null; @@ -2619,7 +2713,7 @@ interface CSSStyleDeclaration { fill: string | null; fillOpacity: string | null; fillRule: string | null; - filter: string | null; + filter: string; flex: string | null; flexBasis: string | null; flexDirection: string | null; @@ -2627,20 +2721,27 @@ interface CSSStyleDeclaration { flexGrow: string | null; flexShrink: string | null; flexWrap: string | null; - floodColor: string | null; - floodOpacity: string | null; - font: string | null; - fontFamily: string | null; - fontFeatureSettings: string | null; - fontSize: string | null; - fontSizeAdjust: string | null; - fontStretch: string | null; - fontStyle: string | null; - fontVariant: string | null; - fontWeight: string | null; - gap: string | null; + floodColor: string; + floodOpacity: string; + font: string; + fontFamily: string; + fontFeatureSettings: string; + fontKerning: string; + fontSize: string; + fontSizeAdjust: string; + fontStretch: string; + fontStyle: string; + fontSynthesis: string; + fontVariant: string; + fontVariantCaps: string; + fontVariantEastAsian: string; + fontVariantLigatures: string; + fontVariantNumeric: string; + fontVariantPosition: string; + fontWeight: string; + gap: string; glyphOrientationHorizontal: string | null; - glyphOrientationVertical: string | null; + glyphOrientationVertical: string; grid: string | null; gridArea: string | null; gridAutoColumns: string | null; @@ -2648,24 +2749,25 @@ interface CSSStyleDeclaration { gridAutoRows: string | null; gridColumn: string | null; gridColumnEnd: string | null; - gridColumnGap: string | null; + gridColumnGap: string; gridColumnStart: string | null; - gridGap: string | null; + gridGap: string; gridRow: string | null; gridRowEnd: string | null; - gridRowGap: string | null; + gridRowGap: string; gridRowStart: string | null; gridTemplate: string | null; gridTemplateAreas: string | null; gridTemplateColumns: string | null; gridTemplateRows: string | null; height: string | null; + hyphens: string; imageOrientation: string; imageRendering: string; imeMode: string | null; - justifyContent: string | null; - justifyItems: string | null; - justifySelf: string | null; + justifyContent: string; + justifyItems: string; + justifySelf: string; kerning: string | null; layoutGrid: string | null; layoutGridChar: string | null; @@ -2674,9 +2776,9 @@ interface CSSStyleDeclaration { layoutGridType: string | null; left: string | null; readonly length: number; - letterSpacing: string | null; - lightingColor: string | null; - lineBreak: string | null; + letterSpacing: string; + lightingColor: string; + lineBreak: string; lineHeight: string | null; listStyle: string | null; listStyleImage: string | null; @@ -2755,6 +2857,8 @@ interface CSSStyleDeclaration { outlineStyle: string; outlineWidth: string; overflow: string | null; + overflowAnchor: string; + overflowWrap: string; overflowX: string | null; overflowY: string | null; padding: string | null; @@ -2769,13 +2873,16 @@ interface CSSStyleDeclaration { penAction: string | null; perspective: string | null; perspectiveOrigin: string | null; + placeContent: string; + placeItems: string; + placeSelf: string; pointerEvents: string | null; position: string | null; quotes: string | null; - resize: string | null; + resize: string; right: string | null; rotate: string | null; - rowGap: string | null; + rowGap: string; rubyAlign: string | null; rubyOverhang: string | null; rubyPosition: string | null; @@ -2791,24 +2898,34 @@ interface CSSStyleDeclaration { strokeMiterlimit: string | null; strokeOpacity: string | null; strokeWidth: string | null; + tabSize: string; tableLayout: string | null; - textAlign: string | null; - textAlignLast: string | null; + textAlign: string; + textAlignLast: string; textAnchor: string | null; - textCombineUpright: string | null; - textDecoration: string | null; - textIndent: string | null; - textJustify: string | null; + textCombineUpright: string; + textDecoration: string; + textDecorationColor: string; + textDecorationLine: string; + textDecorationStyle: string; + textEmphasis: string; + textEmphasisColor: string; + textEmphasisPosition: string; + textEmphasisStyle: string; + textIndent: string; + textJustify: string; textKashida: string | null; textKashidaSpace: string | null; + textOrientation: string; textOverflow: string; - textShadow: string | null; - textTransform: string | null; - textUnderlinePosition: string | null; + textShadow: string; + textTransform: string; + textUnderlinePosition: string; top: string | null; touchAction: string; - transform: string | null; - transformOrigin: string | null; + transform: string; + transformBox: string; + transformOrigin: string; transformStyle: string | null; transition: string; transitionDelay: string; @@ -2816,8 +2933,8 @@ interface CSSStyleDeclaration { transitionProperty: string; transitionTimingFunction: string; translate: string | null; - unicodeBidi: string | null; - userSelect: string | null; + unicodeBidi: string; + userSelect: string; verticalAlign: string | null; visibility: string | null; /** @deprecated */ @@ -2973,14 +3090,14 @@ interface CSSStyleDeclaration { webkitUserModify: string | null; webkitUserSelect: string | null; webkitWritingMode: string | null; - whiteSpace: string | null; + whiteSpace: string; widows: string | null; width: string | null; willChange: string; - wordBreak: string | null; - wordSpacing: string | null; - wordWrap: string | null; - writingMode: string | null; + wordBreak: string; + wordSpacing: string; + wordWrap: string; + writingMode: string; zIndex: string | null; zoom: string | null; getPropertyPriority(propertyName: string): string; @@ -3124,11 +3241,9 @@ interface CanvasFilters { /** An opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient(). */ interface CanvasGradient { /** - * Adds a color stop with the given color to the gradient at the given offset. 0.0 is the offset - * at one end of the gradient, 1.0 is the offset at the other end. - * Throws an "IndexSizeError" DOMException if the offset - * is out of range. Throws a "SyntaxError" DOMException if - * the color cannot be parsed. + * Adds a color stop with the given color to the gradient at the given offset. 0.0 is the offset at one end of the gradient, 1.0 is the offset at the other end. + * + * Throws an "IndexSizeError" DOMException if the offset is out of range. Throws a "SyntaxError" DOMException if the color cannot be parsed. */ addColorStop(offset: number, color: string): void; } @@ -3176,8 +3291,7 @@ interface CanvasPathDrawingStyles { /** An opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method. */ interface CanvasPattern { /** - * Sets the transformation matrix that will be used when rendering the pattern during a fill or - * stroke painting operation. + * Sets the transformation matrix that will be used when rendering the pattern during a fill or stroke painting operation. */ setTransform(transform?: DOMMatrix2DInit): void; } @@ -3294,14 +3408,14 @@ declare var CharacterData: { interface ChildNode extends Node { /** * Inserts nodes just after node, while replacing strings in nodes with equivalent Text nodes. - * Throws a "HierarchyRequestError" DOMException if the constraints of - * the node tree are violated. + * + * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. */ after(...nodes: (Node | string)[]): void; /** * Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes. - * Throws a "HierarchyRequestError" DOMException if the constraints of - * the node tree are violated. + * + * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. */ before(...nodes: (Node | string)[]): void; /** @@ -3310,8 +3424,8 @@ interface ChildNode extends Node { remove(): void; /** * Replaces node with nodes, while replacing strings in nodes with equivalent Text nodes. - * Throws a "HierarchyRequestError" DOMException if the constraints of - * the node tree are violated. + * + * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. */ replaceWith(...nodes: (Node | string)[]): void; } @@ -3387,13 +3501,11 @@ declare var Comment: { /** The DOM CompositionEvent represents events that occur due to the user indirectly entering text. */ interface CompositionEvent extends UIEvent { readonly data: string; - readonly locale: string; - initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; } declare var CompositionEvent: { prototype: CompositionEvent; - new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent; + new(type: string, eventInitDict?: CompositionEventInit): CompositionEvent; }; interface ConcatParams extends Algorithm { @@ -3474,7 +3586,7 @@ interface Coordinates { readonly speed: number | null; } -/** An interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. */ +/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ interface CountQueuingStrategy extends QueuingStrategy { highWaterMark: number; size(chunk: any): 1; @@ -3485,6 +3597,28 @@ declare var CountQueuingStrategy: { new(options: { highWaterMark: number }): CountQueuingStrategy; }; +interface Credential { + readonly id: string; + readonly type: string; +} + +declare var Credential: { + prototype: Credential; + new(): Credential; +}; + +interface CredentialsContainer { + create(options?: CredentialCreationOptions): Promise; + get(options?: CredentialRequestOptions): Promise; + preventSilentAccess(): Promise; + store(credential: Credential): Promise; +} + +declare var CredentialsContainer: { + prototype: CredentialsContainer; + new(): CredentialsContainer; +}; + /** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */ interface Crypto { readonly subtle: SubtleCrypto; @@ -3534,8 +3668,7 @@ declare var CustomElementRegistry: { interface CustomEvent extends Event { /** - * Returns any custom data event was created with. - * Typically used for synthetic events. + * Returns any custom data event was created with. Typically used for synthetic events. */ readonly detail: T; initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: T): void; @@ -3859,8 +3992,7 @@ interface DOMStringList { */ readonly length: number; /** - * Returns true if strings contains string, and false - * otherwise. + * Returns true if strings contains string, and false otherwise. */ contains(string: string): boolean; /** @@ -3893,15 +4025,16 @@ interface DOMTokenList { readonly length: number; /** * Returns the associated set as string. + * * Can be set, to change the associated attribute. */ value: string; /** * Adds all arguments passed, except those already present. - * Throws a "SyntaxError" DOMException if one of the arguments is the empty - * string. - * Throws an "InvalidCharacterError" DOMException if one of the arguments - * contains any ASCII whitespace. + * + * Throws a "SyntaxError" DOMException if one of the arguments is the empty string. + * + * Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace. */ add(...tokens: string[]): void; /** @@ -3909,32 +4042,42 @@ interface DOMTokenList { */ contains(token: string): boolean; /** - * tokenlist[index] + * Returns the token with index index. */ item(index: number): string | null; /** * Removes arguments passed, if they are present. - * Throws a "SyntaxError" DOMException if one of the arguments is the empty - * string. - * Throws an "InvalidCharacterError" DOMException if one of the arguments - * contains any ASCII whitespace. + * + * Throws a "SyntaxError" DOMException if one of the arguments is the empty string. + * + * Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace. */ remove(...tokens: string[]): void; /** * Replaces token with newToken. + * * Returns true if token was replaced with newToken, and false otherwise. - * Throws a "SyntaxError" DOMException if one of the arguments is the empty - * string. - * Throws an "InvalidCharacterError" DOMException if one of the arguments - * contains any ASCII whitespace. + * + * Throws a "SyntaxError" DOMException if one of the arguments is the empty string. + * + * Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace. */ replace(oldToken: string, newToken: string): void; /** - * Returns true if token is in the associated attribute's supported tokens. Returns - * false otherwise. + * Returns true if token is in the associated attribute's supported tokens. Returns false otherwise. + * * Throws a TypeError if the associated attribute has no supported tokens defined. */ supports(token: string): boolean; + /** + * If force is not given, "toggles" token, removing it if it's present and adding it if it's not present. If force is true, adds token (same as add()). If force is false, removes token (same as remove()). + * + * Returns true if token is now present, and false otherwise. + * + * Throws a "SyntaxError" DOMException if token is empty. + * + * Throws an "InvalidCharacterError" DOMException if token contains any spaces. + */ toggle(token: string, force?: boolean): boolean; forEach(callbackfn: (value: string, key: number, parent: DOMTokenList) => void, thisArg?: any): void; [index: number]: string; @@ -3960,7 +4103,21 @@ declare var DataCue: { /** Used to hold the data that is being dragged during a drag and drop operation. It may hold one or more data items, each of one or more data types. For more information about drag and drop, see HTML Drag and Drop API. */ interface DataTransfer { + /** + * Returns the kind of operation that is currently selected. If the kind of operation isn't one of those that is allowed by the effectAllowed attribute, then the operation will fail. + * + * Can be set, to change the selected operation. + * + * The possible values are "none", "copy", "link", and "move". + */ dropEffect: string; + /** + * Returns the kinds of operations that are to be allowed. + * + * Can be set (during the dragstart event), to change the allowed operations. + * + * The possible values are "none", "copy", "copyLink", "copyMove", "link", "linkMove", "move", "all", and "uninitialized", + */ effectAllowed: string; /** * Returns a FileList of the files being dragged, if any. @@ -3971,8 +4128,7 @@ interface DataTransfer { */ readonly items: DataTransferItemList; /** - * Returns a frozen array listing the formats that were set in the dragstart event. In addition, if any files are being - * dragged, then one of the types will be the string "Files". + * Returns a frozen array listing the formats that were set in the dragstart event. In addition, if any files are being dragged, then one of the types will be the string "Files". */ readonly types: ReadonlyArray; /** @@ -3988,8 +4144,7 @@ interface DataTransfer { */ setData(format: string, data: string): void; /** - * Uses the given element to update the drag feedback, replacing any previously specified - * feedback. + * Uses the given element to update the drag feedback, replacing any previously specified feedback. */ setDragImage(image: Element, x: number, y: number): void; } @@ -4002,8 +4157,7 @@ declare var DataTransfer: { /** One drag data item. During a drag operation, each drag event has a dataTransfer property which contains a list of drag data items. Each item in the list is a DataTransferItem object. */ interface DataTransferItem { /** - * Returns the drag data item kind, one of: "string", - * "file". + * Returns the drag data item kind, one of: "string", "file". */ readonly kind: string; /** @@ -4015,8 +4169,7 @@ interface DataTransferItem { */ getAsFile(): File | null; /** - * Invokes the callback with the string data as the argument, if the drag data item - * kind is Plain Unicode string. + * Invokes the callback with the string data as the argument, if the drag data item kind is Plain Unicode string. */ getAsString(callback: FunctionStringCallback | null): void; webkitGetAsEntry(): any; @@ -4034,9 +4187,7 @@ interface DataTransferItemList { */ readonly length: number; /** - * Adds a new entry for the given data to the drag data store. If the data is plain - * text then a type string has to be provided - * also. + * Adds a new entry for the given data to the drag data store. If the data is plain text then a type string has to be provided also. */ add(data: string, type: string): DataTransferItem | null; add(data: File): DataTransferItem | null; @@ -4182,53 +4333,53 @@ interface DocumentEventMap extends GlobalEventHandlersEventMap, DocumentAndEleme /** Any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree. */ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, ParentNode, XPathEvaluatorBase, GlobalEventHandlers, DocumentAndElementEventHandlers { - /** - * Sets or gets the URL for the current document. + /** + * Sets or gets the URL for the current document. */ readonly URL: string; - /** - * Gets the object that has the focus when the parent document has focus. + /** + * Gets the object that has the focus when the parent document has focus. */ readonly activeElement: Element | null; - /** - * Sets or gets the color of all active links in the document. + /** + * Sets or gets the color of all active links in the document. */ /** @deprecated */ alinkColor: string; - /** - * Returns a reference to the collection of elements contained by the object. + /** + * Returns a reference to the collection of elements contained by the object. */ /** @deprecated */ readonly all: HTMLAllCollection; - /** - * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. + /** + * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. */ /** @deprecated */ readonly anchors: HTMLCollectionOf; - /** - * Retrieves a collection of all applet objects in the document. + /** + * Retrieves a collection of all applet objects in the document. */ /** @deprecated */ readonly applets: HTMLCollectionOf; - /** - * Deprecated. Sets or retrieves a value that indicates the background color behind the object. + /** + * Deprecated. Sets or retrieves a value that indicates the background color behind the object. */ /** @deprecated */ bgColor: string; - /** - * Specifies the beginning and end of the document body. + /** + * Specifies the beginning and end of the document body. */ body: HTMLElement; /** * Returns document's encoding. */ readonly characterSet: string; - /** - * Gets or sets the character set used to encode the object. + /** + * Gets or sets the character set used to encode the object. */ readonly charset: string; - /** - * Gets a value that indicates whether standards-compliant mode is switched on for the object. + /** + * Gets a value that indicates whether standards-compliant mode is switched on for the object. */ readonly compatMode: string; /** @@ -4236,69 +4387,61 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par */ readonly contentType: string; /** - * Returns the HTTP cookies that apply to the Document. If there are no cookies or - * cookies can't be applied to this resource, the empty string will be returned. + * Returns the HTTP cookies that apply to the Document. If there are no cookies or cookies can't be applied to this resource, the empty string will be returned. + * * Can be set, to add a new cookie to the element's set of HTTP cookies. - * If the contents are sandboxed into a - * unique origin (e.g. in an iframe with the sandbox attribute), a - * "SecurityError" DOMException will be thrown on getting - * and setting. + * + * If the contents are sandboxed into a unique origin (e.g. in an iframe with the sandbox attribute), a "SecurityError" DOMException will be thrown on getting and setting. */ cookie: string; /** - * Returns the script element, or the SVG script element, - * that is currently executing, as long as the element represents a classic script. - * In the case of reentrant script execution, returns the one that most recently started executing - * amongst those that have not yet finished executing. - * Returns null if the Document is not currently executing a script - * or SVG script element (e.g., because the running script is an event - * handler, or a timeout), or if the currently executing script or SVG - * script element represents a module script. + * Returns the script element, or the SVG script element, that is currently executing, as long as the element represents a classic script. In the case of reentrant script execution, returns the one that most recently started executing amongst those that have not yet finished executing. + * + * Returns null if the Document is not currently executing a script or SVG script element (e.g., because the running script is an event handler, or a timeout), or if the currently executing script or SVG script element represents a module script. */ readonly currentScript: HTMLOrSVGScriptElement | null; readonly defaultView: WindowProxy | null; - /** - * Sets or gets a value that indicates whether the document can be edited. + /** + * Sets or gets a value that indicates whether the document can be edited. */ designMode: string; - /** - * Sets or retrieves a value that indicates the reading order of the object. + /** + * Sets or retrieves a value that indicates the reading order of the object. */ dir: string; - /** - * Gets an object representing the document type declaration associated with the current document. + /** + * Gets an object representing the document type declaration associated with the current document. */ readonly doctype: DocumentType | null; - /** - * Gets a reference to the root node of the document. + /** + * Gets a reference to the root node of the document. */ readonly documentElement: HTMLElement; /** * Returns document's URL. */ readonly documentURI: string; - /** - * Sets or gets the security domain of the document. + /** + * Sets or gets the security domain of the document. */ domain: string; - /** - * Retrieves a collection of all embed objects in the document. + /** + * Retrieves a collection of all embed objects in the document. */ readonly embeds: HTMLCollectionOf; - /** - * Sets or gets the foreground (text) color of the document. + /** + * Sets or gets the foreground (text) color of the document. */ /** @deprecated */ fgColor: string; - /** - * Retrieves a collection, in source order, of all form objects in the document. + /** + * Retrieves a collection, in source order, of all form objects in the document. */ readonly forms: HTMLCollectionOf; /** @deprecated */ readonly fullscreen: boolean; /** - * Returns true if document has the ability to display elements fullscreen - * and fullscreen is supported, or false otherwise. + * Returns true if document has the ability to display elements fullscreen and fullscreen is supported, or false otherwise. */ readonly fullscreenEnabled: boolean; /** @@ -4306,42 +4449,42 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par */ readonly head: HTMLHeadElement; readonly hidden: boolean; - /** - * Retrieves a collection, in source order, of img objects in the document. + /** + * Retrieves a collection, in source order, of img objects in the document. */ readonly images: HTMLCollectionOf; - /** - * Gets the implementation object of the current document. + /** + * Gets the implementation object of the current document. */ readonly implementation: DOMImplementation; - /** - * Returns the character encoding used to create the webpage that is loaded into the document object. + /** + * Returns the character encoding used to create the webpage that is loaded into the document object. */ readonly inputEncoding: string; - /** - * Gets the date that the page was last modified, if the page supplies one. + /** + * Gets the date that the page was last modified, if the page supplies one. */ readonly lastModified: string; - /** - * Sets or gets the color of the document links. + /** + * Sets or gets the color of the document links. */ /** @deprecated */ linkColor: string; - /** - * Retrieves a collection of all a objects that specify the href property and all area objects in the document. + /** + * Retrieves a collection of all a objects that specify the href property and all area objects in the document. */ readonly links: HTMLCollectionOf; - /** - * Contains information about the current URL. + /** + * Contains information about the current URL. */ location: Location; onfullscreenchange: ((this: Document, ev: Event) => any) | null; onfullscreenerror: ((this: Document, ev: Event) => any) | null; onpointerlockchange: ((this: Document, ev: Event) => any) | null; onpointerlockerror: ((this: Document, ev: Event) => any) | null; - /** - * Fires when the state of the object has changed. - * @param ev The event + /** + * Fires when the state of the object has changed. + * @param ev The event */ onreadystatechange: ((this: Document, ev: ProgressEvent) => any) | null; onvisibilitychange: ((this: Document, ev: Event) => any) | null; @@ -4353,34 +4496,34 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par * Return an HTMLCollection of the embed elements in the Document. */ readonly plugins: HTMLCollectionOf; - /** - * Retrieves a value that indicates the current state of the object. + /** + * Retrieves a value that indicates the current state of the object. */ readonly readyState: DocumentReadyState; - /** - * Gets the URL of the location that referred the user to the current page. + /** + * Gets the URL of the location that referred the user to the current page. */ readonly referrer: string; - /** - * Retrieves a collection of all script objects in the document. + /** + * Retrieves a collection of all script objects in the document. */ readonly scripts: HTMLCollectionOf; readonly scrollingElement: Element | null; readonly timeline: DocumentTimeline; - /** - * Contains the title of the document. + /** + * Contains the title of the document. */ title: string; readonly visibilityState: VisibilityState; - /** - * Sets or gets the color of the links that the user has visited. + /** + * Sets or gets the color of the links that the user has visited. */ /** @deprecated */ vlinkColor: string; /** * Moves node from another document and returns it. - * If node is a document, throws a "NotSupportedError" DOMException or, if node is a shadow root, throws a - * "HierarchyRequestError" DOMException. + * + * If node is a document, throws a "NotSupportedError" DOMException or, if node is a shadow root, throws a "HierarchyRequestError" DOMException. */ adoptNode(source: T): T; /** @deprecated */ @@ -4390,13 +4533,13 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par caretRangeFromPoint(x: number, y: number): Range; /** @deprecated */ clear(): void; - /** - * Closes an output stream and forces the sent data to display. + /** + * Closes an output stream and forces the sent data to display. */ close(): void; - /** - * Creates an attribute object with a specified name. - * @param name String that sets the attribute object's name. + /** + * Creates an attribute object with a specified name. + * @param name String that sets the attribute object's name. */ createAttribute(localName: string): Attr; createAttributeNS(namespace: string | null, qualifiedName: string): Attr; @@ -4404,35 +4547,36 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par * Returns a CDATASection node whose data is data. */ createCDATASection(data: string): CDATASection; - /** - * Creates a comment object with the specified data. - * @param data Sets the comment object's data. + /** + * Creates a comment object with the specified data. + * @param data Sets the comment object's data. */ createComment(data: string): Comment; - /** - * Creates a new document. + /** + * Creates a new document. */ createDocumentFragment(): DocumentFragment; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. + /** + * Creates an instance of the element for the specified tag. + * @param tagName The name of an element. */ createElement(tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K]; /** @deprecated */ createElement(tagName: K, options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K]; createElement(tagName: string, options?: ElementCreationOptions): HTMLElement; /** - * Returns an element with namespace namespace. Its namespace prefix will be everything before ":" (U+003E) in qualifiedName or null. Its local name will be everything after - * ":" (U+003E) in qualifiedName or qualifiedName. - * If localName does not match the Name production an - * "InvalidCharacterError" DOMException will be thrown. + * Returns an element with namespace namespace. Its namespace prefix will be everything before ":" (U+003E) in qualifiedName or null. Its local name will be everything after ":" (U+003E) in qualifiedName or qualifiedName. + * + * If localName does not match the Name production an "InvalidCharacterError" DOMException will be thrown. + * * If one of the following conditions is true a "NamespaceError" DOMException will be thrown: + * * localName does not match the QName production. * Namespace prefix is not null and namespace is the empty string. * Namespace prefix is "xml" and namespace is not the XML namespace. * qualifiedName or namespace prefix is "xmlns" and namespace is not the XMLNS namespace. - * namespace is the XMLNS namespace and - * neither qualifiedName nor namespace prefix is "xmlns". + * namespace is the XMLNS namespace and neither qualifiedName nor namespace prefix is "xmlns". + * * When supplied, options's is can be used to create a customized built-in element. */ createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement; @@ -4455,11 +4599,13 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par createEvent(eventInterface: "ErrorEvent"): ErrorEvent; createEvent(eventInterface: "Event"): Event; createEvent(eventInterface: "Events"): Event; + createEvent(eventInterface: "FileReaderProgressEvent"): FileReaderProgressEvent; createEvent(eventInterface: "FocusEvent"): FocusEvent; createEvent(eventInterface: "FocusNavigationEvent"): FocusNavigationEvent; createEvent(eventInterface: "GamepadEvent"): GamepadEvent; createEvent(eventInterface: "HashChangeEvent"): HashChangeEvent; createEvent(eventInterface: "IDBVersionChangeEvent"): IDBVersionChangeEvent; + createEvent(eventInterface: "InputEvent"): InputEvent; createEvent(eventInterface: "KeyboardEvent"): KeyboardEvent; createEvent(eventInterface: "ListeningStateChangedEvent"): ListeningStateChangedEvent; createEvent(eventInterface: "MSGestureEvent"): MSGestureEvent; @@ -4518,152 +4664,147 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par createEvent(eventInterface: "WebGLContextEvent"): WebGLContextEvent; createEvent(eventInterface: "WheelEvent"): WheelEvent; createEvent(eventInterface: string): Event; - /** - * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list - * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + /** + * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list + * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. */ createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter | null): NodeIterator; /** - * Returns a ProcessingInstruction node whose target is target and data is data. - * If target does not match the Name production an - * "InvalidCharacterError" DOMException will be thrown. - * If data contains "?>" an - * "InvalidCharacterError" DOMException will be thrown. + * Returns a ProcessingInstruction node whose target is target and data is data. If target does not match the Name production an "InvalidCharacterError" DOMException will be thrown. If data contains "?>" an "InvalidCharacterError" DOMException will be thrown. */ createProcessingInstruction(target: string, data: string): ProcessingInstruction; - /** - * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. + /** + * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. */ createRange(): Range; - /** - * Creates a text string from the specified value. - * @param data String that specifies the nodeValue property of the text node. + /** + * Creates a text string from the specified value. + * @param data String that specifies the nodeValue property of the text node. */ createTextNode(data: string): Text; - createTouch(view: WindowProxy, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; - createTouchList(...touches: Touch[]): TouchList; - /** - * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. - * @param filter A custom NodeFilter function to use. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. + /** + * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. + * @param filter A custom NodeFilter function to use. + * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. */ createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter | null): TreeWalker; /** @deprecated */ createTreeWalker(root: Node, whatToShow: number, filter: NodeFilter | null, entityReferenceExpansion?: boolean): TreeWalker; - /** - * Returns the element for the specified x coordinate and the specified y coordinate. - * @param x The x-offset - * @param y The y-offset + /** + * Returns the element for the specified x coordinate and the specified y coordinate. + * @param x The x-offset + * @param y The y-offset */ elementFromPoint(x: number, y: number): Element | null; elementsFromPoint(x: number, y: number): Element[]; - /** - * Executes a command on the current document, current selection, or the given range. - * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. - * @param showUI Display the user interface, defaults to false. - * @param value Value to assign. + /** + * Executes a command on the current document, current selection, or the given range. + * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. + * @param showUI Display the user interface, defaults to false. + * @param value Value to assign. */ execCommand(commandId: string, showUI?: boolean, value?: string): boolean; /** - * Stops document's fullscreen element from being displayed fullscreen and - * resolves promise when done. + * Stops document's fullscreen element from being displayed fullscreen and resolves promise when done. */ exitFullscreen(): Promise; exitPointerLock(): void; getAnimations(): Animation[]; - /** - * Returns a reference to the first object with the specified value of the ID or NAME attribute. - * @param elementId String that specifies the ID value. Case-insensitive. + /** + * Returns a reference to the first object with the specified value of the ID or NAME attribute. + * @param elementId String that specifies the ID value. Case-insensitive. */ getElementById(elementId: string): HTMLElement | null; /** - * collection = element . getElementsByClassName(classNames) + * Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes. */ getElementsByClassName(classNames: string): HTMLCollectionOf; - /** - * Gets a collection of objects based on the value of the NAME or ID attribute. - * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. + /** + * Gets a collection of objects based on the value of the NAME or ID attribute. + * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. */ getElementsByName(elementName: string): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. + /** + * Retrieves a collection of objects based on the specified element name. + * @param name Specifies the name of an element. */ getElementsByTagName(qualifiedName: K): HTMLCollectionOf; getElementsByTagName(qualifiedName: K): HTMLCollectionOf; getElementsByTagName(qualifiedName: string): HTMLCollectionOf; /** - * If namespace and localName are - * "*" returns a HTMLCollection of all descendant elements. + * If namespace and localName are "*" returns a HTMLCollection of all descendant elements. + * * If only namespace is "*" returns a HTMLCollection of all descendant elements whose local name is localName. + * * If only localName is "*" returns a HTMLCollection of all descendant elements whose namespace is namespace. + * * Otherwise, returns a HTMLCollection of all descendant elements whose namespace is namespace and local name is localName. */ getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - /** - * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. + /** + * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. */ getSelection(): Selection | null; - /** - * Gets a value indicating whether the object currently has focus. + /** + * Gets a value indicating whether the object currently has focus. */ hasFocus(): boolean; /** * Returns a copy of node. If deep is true, the copy also includes the node's descendants. - * If node is a document or a shadow root, throws a - * "NotSupportedError" DOMException. + * + * If node is a document or a shadow root, throws a "NotSupportedError" DOMException. */ importNode(importedNode: T, deep: boolean): T; - /** - * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. - * @param url Specifies a MIME type for the document. - * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. - * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. - * @param replace Specifies whether the existing entry for the document is replaced in the history list. + /** + * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. + * @param url Specifies a MIME type for the document. + * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. + * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. + * @param replace Specifies whether the existing entry for the document is replaced in the history list. */ open(url?: string, name?: string, features?: string, replace?: boolean): Document; - /** - * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. - * @param commandId Specifies a command identifier. + /** + * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. + * @param commandId Specifies a command identifier. */ queryCommandEnabled(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. - * @param commandId String that specifies a command identifier. + /** + * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. + * @param commandId String that specifies a command identifier. */ queryCommandIndeterm(commandId: string): boolean; - /** - * Returns a Boolean value that indicates the current state of the command. - * @param commandId String that specifies a command identifier. + /** + * Returns a Boolean value that indicates the current state of the command. + * @param commandId String that specifies a command identifier. */ queryCommandState(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the current command is supported on the current range. - * @param commandId Specifies a command identifier. + /** + * Returns a Boolean value that indicates whether the current command is supported on the current range. + * @param commandId Specifies a command identifier. */ queryCommandSupported(commandId: string): boolean; - /** - * Returns the current value of the document, range, or current selection for the given command. - * @param commandId String that specifies a command identifier. + /** + * Returns the current value of the document, range, or current selection for the given command. + * @param commandId String that specifies a command identifier. */ queryCommandValue(commandId: string): string; /** @deprecated */ releaseEvents(): void; - /** - * Writes one or more HTML expressions to a document in the specified window. - * @param content Specifies the text and HTML tags to write. + /** + * Writes one or more HTML expressions to a document in the specified window. + * @param content Specifies the text and HTML tags to write. */ write(...text: string[]): void; - /** - * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. - * @param content The text and HTML tags to write. + /** + * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. + * @param content The text and HTML tags to write. */ writeln(...text: string[]): void; addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; @@ -4709,11 +4850,13 @@ interface DocumentEvent { createEvent(eventInterface: "ErrorEvent"): ErrorEvent; createEvent(eventInterface: "Event"): Event; createEvent(eventInterface: "Events"): Event; + createEvent(eventInterface: "FileReaderProgressEvent"): FileReaderProgressEvent; createEvent(eventInterface: "FocusEvent"): FocusEvent; createEvent(eventInterface: "FocusNavigationEvent"): FocusNavigationEvent; createEvent(eventInterface: "GamepadEvent"): GamepadEvent; createEvent(eventInterface: "HashChangeEvent"): HashChangeEvent; createEvent(eventInterface: "IDBVersionChangeEvent"): IDBVersionChangeEvent; + createEvent(eventInterface: "InputEvent"): InputEvent; createEvent(eventInterface: "KeyboardEvent"): KeyboardEvent; createEvent(eventInterface: "ListeningStateChangedEvent"): ListeningStateChangedEvent; createEvent(eventInterface: "MSGestureEvent"): MSGestureEvent; @@ -4786,10 +4929,13 @@ declare var DocumentFragment: { interface DocumentOrShadowRoot { readonly activeElement: Element | null; + /** + * Returns document's fullscreen element. + */ readonly fullscreenElement: Element | null; readonly pointerLockElement: Element | null; - /** - * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. + /** + * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. */ readonly styleSheets: StyleSheetList; caretPositionFromPoint(x: number, y: number): CaretPosition | null; @@ -4883,13 +5029,11 @@ interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, readonly assignedSlot: HTMLSlotElement | null; readonly attributes: NamedNodeMap; /** - * Allows for manipulation of element's class content attribute as a - * set of whitespace-separated tokens through a DOMTokenList object. + * Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object. */ readonly classList: DOMTokenList; /** - * Returns the value of element's class content attribute. Can be set - * to change it. + * Returns the value of element's class content attribute. Can be set to change it. */ className: string; readonly clientHeight: number; @@ -4897,8 +5041,7 @@ interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, readonly clientTop: number; readonly clientWidth: number; /** - * Returns the value of element's id content attribute. Can be set to - * change it. + * Returns the value of element's id content attribute. Can be set to change it. */ id: string; /** @@ -4925,8 +5068,7 @@ interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, */ readonly shadowRoot: ShadowRoot | null; /** - * Returns the value of element's slot content attribute. Can be set to - * change it. + * Returns the value of element's slot content attribute. Can be set to change it. */ slot: string; /** @@ -4942,25 +5084,26 @@ interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, */ closest(selector: K): HTMLElementTagNameMap[K] | null; closest(selector: K): SVGElementTagNameMap[K] | null; - closest(selector: string): Element | null; + closest(selector: string): E | null; /** * Returns element's first attribute whose qualified name is qualifiedName, and null if there is no such attribute otherwise. */ getAttribute(qualifiedName: string): string | null; /** - * Returns element's attribute whose namespace is namespace and local name is localName, and null if there is - * no such attribute otherwise. + * Returns element's attribute whose namespace is namespace and local name is localName, and null if there is no such attribute otherwise. */ getAttributeNS(namespace: string | null, localName: string): string | null; /** - * Returns the qualified names of all element's attributes. - * Can contain duplicates. + * Returns the qualified names of all element's attributes. Can contain duplicates. */ getAttributeNames(): string[]; getAttributeNode(name: string): Attr | null; getAttributeNodeNS(namespaceURI: string, localName: string): Attr | null; getBoundingClientRect(): ClientRect | DOMRect; getClientRects(): ClientRectList | DOMRectList; + /** + * Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes. + */ getElementsByClassName(classNames: string): HTMLCollectionOf; getElementsByTagName(qualifiedName: K): HTMLCollectionOf; getElementsByTagName(qualifiedName: K): HTMLCollectionOf; @@ -5001,11 +5144,8 @@ interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, removeAttributeNode(attr: Attr): Attr; /** * Displays element fullscreen and resolves promise when done. - * When supplied, options's navigationUI member indicates whether showing - * navigation UI while in fullscreen is preferred or not. If set to "show", navigation - * simplicity is preferred over screen space, and if set to "hide", more screen space - * is preferred. User agents are always free to honor user preference over the application's. The - * default value "auto" indicates no application preference. + * + * When supplied, options's navigationUI member indicates whether showing navigation UI while in fullscreen is preferred or not. If set to "show", navigation simplicity is preferred over screen space, and if set to "hide", more screen space is preferred. User agents are always free to honor user preference over the application's. The default value "auto" indicates no application preference. */ requestFullscreen(options?: FullscreenOptions): Promise; requestPointerLock(): void; @@ -5028,8 +5168,8 @@ interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, setAttributeNodeNS(attr: Attr): Attr | null; setPointerCapture(pointerId: number): void; /** - * If force is not given, "toggles" qualifiedName, removing it if it is - * present and adding it if it is not present. If force is true, adds qualifiedName. If force is false, removes qualifiedName. + * If force is not given, "toggles" qualifiedName, removing it if it is present and adding it if it is not present. If force is true, adds qualifiedName. If force is false, removes qualifiedName. + * * Returns true if qualifiedName is now present, and false otherwise. */ toggleAttribute(qualifiedName: string, force?: boolean): boolean; @@ -5076,21 +5216,28 @@ interface Event { */ readonly bubbles: boolean; cancelBubble: boolean; + /** + * Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. + */ readonly cancelable: boolean; /** * Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. */ readonly composed: boolean; /** - * Returns the object whose event listener's callback is currently being - * invoked. + * Returns the object whose event listener's callback is currently being invoked. */ readonly currentTarget: EventTarget | null; + /** + * Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. + */ readonly defaultPrevented: boolean; + /** + * Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. + */ readonly eventPhase: number; /** - * Returns true if event was dispatched by the user agent, and - * false otherwise. + * Returns true if event was dispatched by the user agent, and false otherwise. */ readonly isTrusted: boolean; returnValue: boolean; @@ -5101,23 +5248,24 @@ interface Event { */ readonly target: EventTarget | null; /** - * Returns the event's timestamp as the number of milliseconds measured relative to - * the time origin. + * Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */ readonly timeStamp: number; /** - * Returns the type of event, e.g. - * "click", "hashchange", or - * "submit". + * Returns the type of event, e.g. "click", "hashchange", or "submit". */ readonly type: string; + /** + * Returns the item objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget. + */ composedPath(): EventTarget[]; initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void; + /** + * If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled. + */ preventDefault(): void; /** - * Invoking this method prevents event from reaching - * any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any - * other objects. + * Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects. */ stopImmediatePropagation(): void; /** @@ -5154,8 +5302,7 @@ interface EventSource extends EventTarget { onmessage: ((this: EventSource, ev: MessageEvent) => any) | null; onopen: ((this: EventSource, ev: Event) => any) | null; /** - * Returns the state of this EventSource object's connection. It can have the - * values described below. + * Returns the state of this EventSource object's connection. It can have the values described below. */ readonly readyState: number; /** @@ -5163,11 +5310,12 @@ interface EventSource extends EventTarget { */ readonly url: string; /** - * Returns true if the credentials mode - * for connection requests to the URL providing the - * event stream is set to "include", and false otherwise. + * Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise. */ readonly withCredentials: boolean; + /** + * Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED. + */ close(): void; readonly CLOSED: number; readonly CONNECTING: number; @@ -5190,18 +5338,20 @@ declare var EventSource: { interface EventTarget { /** * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched. - * The options argument sets listener-specific options. For compatibility this can be a - * boolean, in which case the method behaves exactly as if the value was specified as options's capture. + * + * The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture. + * * When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET. + * * When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in §2.8 Observing event listeners. - * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will - * be removed. + * + * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed. + * * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. */ addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void; /** - * Dispatches a synthetic event event to target and returns true - * if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. + * Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ dispatchEvent(event: Event): boolean; /** @@ -5239,6 +5389,11 @@ interface External { IsSearchProviderInstalled(): void; } +declare var External: { + prototype: External; + new(): External; +}; + /** Provides information about files and allows JavaScript in a web page to access their content. */ interface File extends Blob { readonly lastModified: number; @@ -5263,23 +5418,23 @@ declare var FileList: { }; interface FileReaderEventMap { - "abort": ProgressEvent; - "error": ProgressEvent; - "load": ProgressEvent; - "loadend": ProgressEvent; - "loadstart": ProgressEvent; - "progress": ProgressEvent; + "abort": FileReaderProgressEvent; + "error": FileReaderProgressEvent; + "load": FileReaderProgressEvent; + "loadend": FileReaderProgressEvent; + "loadstart": FileReaderProgressEvent; + "progress": FileReaderProgressEvent; } /** Lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read. */ interface FileReader extends EventTarget { readonly error: DOMException | null; - onabort: ((this: FileReader, ev: ProgressEvent) => any) | null; - onerror: ((this: FileReader, ev: ProgressEvent) => any) | null; - onload: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadend: ((this: FileReader, ev: ProgressEvent) => any) | null; - onloadstart: ((this: FileReader, ev: ProgressEvent) => any) | null; - onprogress: ((this: FileReader, ev: ProgressEvent) => any) | null; + onabort: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onerror: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onload: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadend: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onloadstart: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; + onprogress: ((this: FileReader, ev: FileReaderProgressEvent) => any) | null; readonly readyState: number; readonly result: string | ArrayBuffer | null; abort(): void; @@ -5304,15 +5459,18 @@ declare var FileReader: { readonly LOADING: number; }; +interface FileReaderProgressEvent extends ProgressEvent { + readonly target: FileReader | null; +} + /** Focus-related events like focus, blur, focusin, or focusout. */ interface FocusEvent extends UIEvent { - readonly relatedTarget: EventTarget; - initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; + readonly relatedTarget: EventTarget | null; } declare var FocusEvent: { prototype: FocusEvent; - new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent; + new(type: string, eventInitDict?: FocusEventInit): FocusEvent; }; interface FocusNavigationEvent extends Event { @@ -5355,7 +5513,7 @@ declare var GainNode: { new(context: BaseAudioContext, options?: GainOptions): GainNode; }; -/** An interface of the Gamepad API defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id. */ +/** This Gamepad API interface defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id. */ interface Gamepad { readonly axes: ReadonlyArray; readonly buttons: ReadonlyArray; @@ -5386,7 +5544,7 @@ declare var GamepadButton: { new(): GamepadButton; }; -/** An interface of the Gamepad API contains references to gamepads connected to the system, which is what the gamepad events Window.gamepadconnected and Window.gamepaddisconnected are fired in response to. */ +/** This Gamepad API interface contains references to gamepads connected to the system, which is what the gamepad events Window.gamepadconnected and Window.gamepaddisconnected are fired in response to. */ interface GamepadEvent extends Event { readonly gamepad: Gamepad; } @@ -5396,7 +5554,7 @@ declare var GamepadEvent: { new(type: string, eventInitDict: GamepadEventInit): GamepadEvent; }; -/** An interface of the Gamepad API represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware. */ +/** This Gamepad API interface represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware. */ interface GamepadHapticActuator { readonly type: GamepadHapticActuatorType; pulse(value: number, duration: number): Promise; @@ -5407,7 +5565,7 @@ declare var GamepadHapticActuator: { new(): GamepadHapticActuator; }; -/** An interface of the Gamepad API represents the pose of a WebVR controller at a given timestamp (which includes orientation, position, velocity, and acceleration information.) */ +/** This Gamepad API interface represents the pose of a WebVR controller at a given timestamp (which includes orientation, position, velocity, and acceleration information.) */ interface GamepadPose { readonly angularAcceleration: Float32Array | null; readonly angularVelocity: Float32Array | null; @@ -5425,13 +5583,23 @@ declare var GamepadPose: { }; interface GenericTransformStream { + /** + * Returns a readable stream whose chunks are strings resulting from running encoding's decoder on the chunks written to writable. + */ readonly readable: ReadableStream; /** - * Returns a writable stream which accepts string chunks and runs them through UTF-8's encoder before making them available to readable. + * Returns a writable stream which accepts BufferSource chunks and runs them through encoding's decoder before making them available to readable. + * * Typically this will be used via the pipeThrough() method on a ReadableStream source. - * textReadable - * .pipeThrough(new TextEncoderStream()) - * .pipeTo(byteWritable); + * + * ``` + * var decoder = new TextDecoderStream(encoding); + * byteReadable + * .pipeThrough(decoder) + * .pipeTo(textWritable); + * ``` + * + * If the error mode is "fatal" and encoding's decoder returns error, both readable and writable will be errored with a TypeError. */ readonly writable: WritableStream; } @@ -5473,6 +5641,8 @@ interface GlobalEventHandlersEventMap { "ended": Event; "error": ErrorEvent; "focus": FocusEvent; + "focusin": FocusEvent; + "focusout": FocusEvent; "gotpointercapture": PointerEvent; "input": Event; "invalid": Event; @@ -5533,9 +5703,9 @@ interface GlobalEventHandlersEventMap { } interface GlobalEventHandlers { - /** - * Fires when the user aborts the download. - * @param ev The event. + /** + * Fires when the user aborts the download. + * @param ev The event. */ onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null; onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; @@ -5543,177 +5713,177 @@ interface GlobalEventHandlers { onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; onauxclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - /** - * Fires when the object loses the input focus. - * @param ev The focus event. + /** + * Fires when the object loses the input focus. + * @param ev The focus event. */ onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null; oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when playback is possible, but would require further buffering. - * @param ev The event. + /** + * Occurs when playback is possible, but would require further buffering. + * @param ev The event. */ oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null; oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when the contents of the object or selection have changed. - * @param ev The event. + /** + * Fires when the contents of the object or selection have changed. + * @param ev The event. */ onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when the user clicks the left mouse button on the object - * @param ev The mouse event. + /** + * Fires when the user clicks the left mouse button on the object + * @param ev The mouse event. */ onclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when the user clicks the right mouse button in the client area, opening the context menu. - * @param ev The mouse event. + /** + * Fires when the user clicks the right mouse button in the client area, opening the context menu. + * @param ev The mouse event. */ oncontextmenu: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when the user double-clicks the object. - * @param ev The mouse event. + /** + * Fires when the user double-clicks the object. + * @param ev The mouse event. */ ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - /** - * Fires on the source object continuously during a drag operation. - * @param ev The event. + /** + * Fires on the source object continuously during a drag operation. + * @param ev The event. */ ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; - /** - * Fires on the source object when the user releases the mouse at the close of a drag operation. - * @param ev The event. + /** + * Fires on the source object when the user releases the mouse at the close of a drag operation. + * @param ev The event. */ ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; - /** - * Fires on the target element when the user drags the object to a valid drop target. - * @param ev The drag event. + /** + * Fires on the target element when the user drags the object to a valid drop target. + * @param ev The drag event. */ ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; ondragexit: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. - * @param ev The drag event. + /** + * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. + * @param ev The drag event. */ ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; - /** - * Fires on the target element continuously while the user drags the object over a valid drop target. - * @param ev The event. + /** + * Fires on the target element continuously while the user drags the object over a valid drop target. + * @param ev The event. */ ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; - /** - * Fires on the source object when the user starts to drag a text selection or selected object. - * @param ev The event. + /** + * Fires on the source object when the user starts to drag a text selection or selected object. + * @param ev The event. */ ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; - /** - * Occurs when the duration attribute is updated. - * @param ev The event. + /** + * Occurs when the duration attribute is updated. + * @param ev The event. */ ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when the media element is reset to its initial state. - * @param ev The event. + /** + * Occurs when the media element is reset to its initial state. + * @param ev The event. */ onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when the end of playback is reached. - * @param ev The event + /** + * Occurs when the end of playback is reached. + * @param ev The event */ onended: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when an error occurs during object loading. - * @param ev The event. + /** + * Fires when an error occurs during object loading. + * @param ev The event. */ onerror: OnErrorEventHandler; - /** - * Fires when the object receives focus. - * @param ev The event. + /** + * Fires when the object receives focus. + * @param ev The event. */ onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null; ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null; oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when the user presses a key. - * @param ev The keyboard event + /** + * Fires when the user presses a key. + * @param ev The keyboard event */ onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null; - /** - * Fires when the user presses an alphanumeric key. - * @param ev The event. + /** + * Fires when the user presses an alphanumeric key. + * @param ev The event. */ onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null; - /** - * Fires when the user releases a key. - * @param ev The keyboard event + /** + * Fires when the user releases a key. + * @param ev The keyboard event */ onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null; - /** - * Fires immediately after the browser loads the object. - * @param ev The event. + /** + * Fires immediately after the browser loads the object. + * @param ev The event. */ onload: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when media data is loaded at the current playback position. - * @param ev The event. + /** + * Occurs when media data is loaded at the current playback position. + * @param ev The event. */ onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when the duration and dimensions of the media have been determined. - * @param ev The event. + /** + * Occurs when the duration and dimensions of the media have been determined. + * @param ev The event. */ onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null; onloadend: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null; - /** - * Occurs when Internet Explorer begins looking for media data. - * @param ev The event. + /** + * Occurs when Internet Explorer begins looking for media data. + * @param ev The event. */ onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null; onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; - /** - * Fires when the user clicks the object with either mouse button. - * @param ev The mouse event. + /** + * Fires when the user clicks the object with either mouse button. + * @param ev The mouse event. */ onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - /** - * Fires when the user moves the mouse over the object. - * @param ev The mouse event. + /** + * Fires when the user moves the mouse over the object. + * @param ev The mouse event. */ onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - /** - * Fires when the user moves the mouse pointer outside the boundaries of the object. - * @param ev The mouse event. + /** + * Fires when the user moves the mouse pointer outside the boundaries of the object. + * @param ev The mouse event. */ onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - /** - * Fires when the user moves the mouse pointer into the object. - * @param ev The mouse event. + /** + * Fires when the user moves the mouse pointer into the object. + * @param ev The mouse event. */ onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - /** - * Fires when the user releases a mouse button while the mouse is over the object. - * @param ev The mouse event. + /** + * Fires when the user releases a mouse button while the mouse is over the object. + * @param ev The mouse event. */ onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; - /** - * Occurs when playback is paused. - * @param ev The event. + /** + * Occurs when playback is paused. + * @param ev The event. */ onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when the play method is requested. - * @param ev The event. + /** + * Occurs when the play method is requested. + * @param ev The event. */ onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when the audio or video has started playing. - * @param ev The event. + /** + * Occurs when the audio or video has started playing. + * @param ev The event. */ onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null; onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; @@ -5724,59 +5894,59 @@ interface GlobalEventHandlers { onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; - /** - * Occurs to indicate progress while downloading media data. - * @param ev The event. + /** + * Occurs to indicate progress while downloading media data. + * @param ev The event. */ onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null; - /** - * Occurs when the playback rate is increased or decreased. - * @param ev The event. + /** + * Occurs when the playback rate is increased or decreased. + * @param ev The event. */ onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when the user resets a form. - * @param ev The event. + /** + * Fires when the user resets a form. + * @param ev The event. */ onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null; onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null; - /** - * Fires when the user repositions the scroll box in the scroll bar on the object. - * @param ev The event. + /** + * Fires when the user repositions the scroll box in the scroll bar on the object. + * @param ev The event. */ onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null; onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null; - /** - * Occurs when the seek operation ends. - * @param ev The event. + /** + * Occurs when the seek operation ends. + * @param ev The event. */ onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when the current playback position is moved. - * @param ev The event. + /** + * Occurs when the current playback position is moved. + * @param ev The event. */ onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Fires when the current selection changes. - * @param ev The event. + /** + * Fires when the current selection changes. + * @param ev The event. */ onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null; onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when the download has stopped. - * @param ev The event. + /** + * Occurs when the download has stopped. + * @param ev The event. */ onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null; onsubmit: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs if the load operation has been intentionally halted. - * @param ev The event. + /** + * Occurs if the load operation has been intentionally halted. + * @param ev The event. */ onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs to indicate the current playback position. - * @param ev The event. + /** + * Occurs to indicate the current playback position. + * @param ev The event. */ ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null; ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null; @@ -5788,14 +5958,14 @@ interface GlobalEventHandlers { ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null; ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null; ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null; - /** - * Occurs when the volume is changed, or playback is muted or unmuted. - * @param ev The event. + /** + * Occurs when the volume is changed, or playback is muted or unmuted. + * @param ev The event. */ onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** - * Occurs when playback stops because the next frame of a video resource is not available. - * @param ev The event. + /** + * Occurs when playback stops because the next frame of a video resource is not available. + * @param ev The event. */ onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null; onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null; @@ -5805,21 +5975,21 @@ interface GlobalEventHandlers { removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } -interface GlobalFetch { - fetch(input: RequestInfo, init?: RequestInit): Promise; -} - interface HTMLAllCollection { /** * Returns the number of elements in the collection. */ readonly length: number; /** - * element = collection(index) + * Returns the item with index index from the collection (determined by tree order). */ item(nameOrIndex?: string): HTMLCollection | Element | null; /** - * element = collection(name) + * Returns the item with ID or name name from the collection. + * + * If there are multiple matching items, then an HTMLCollection object containing all those elements is returned. + * + * Only button, form, iframe, input, map, meta, object, select, and textarea elements can have a name for the purpose of this method; their name is given by the value of their name attribute. */ namedItem(name: string): HTMLCollection | Element | null; [index: number]: Element; @@ -5832,49 +6002,49 @@ declare var HTMLAllCollection: { /** Hyperlink elements and provides special properties and methods (beyond those of the regular HTMLElement object interface that they inherit from) for manipulating the layout and presentation of such elements. */ interface HTMLAnchorElement extends HTMLElement, HTMLHyperlinkElementUtils { - /** - * Sets or retrieves the character set used to encode the object. + /** + * Sets or retrieves the character set used to encode the object. */ /** @deprecated */ charset: string; - /** - * Sets or retrieves the coordinates of the object. + /** + * Sets or retrieves the coordinates of the object. */ /** @deprecated */ coords: string; download: string; - /** - * Sets or retrieves the language code of the object. + /** + * Sets or retrieves the language code of the object. */ hreflang: string; - /** - * Sets or retrieves the shape of the object. + /** + * Sets or retrieves the shape of the object. */ /** @deprecated */ name: string; ping: string; referrerPolicy: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. + /** + * Sets or retrieves the relationship between the object and the destination of the link. */ rel: string; readonly relList: DOMTokenList; - /** - * Sets or retrieves the relationship between the object and the destination of the link. + /** + * Sets or retrieves the relationship between the object and the destination of the link. */ /** @deprecated */ rev: string; - /** - * Sets or retrieves the shape of the object. + /** + * Sets or retrieves the shape of the object. */ /** @deprecated */ shape: string; - /** - * Sets or retrieves the window or frame at which to target content. + /** + * Sets or retrieves the window or frame at which to target content. */ target: string; - /** - * Retrieves or sets the text of the object as a string. + /** + * Retrieves or sets the text of the object as a string. */ text: string; type: string; @@ -5892,33 +6062,33 @@ declare var HTMLAnchorElement: { interface HTMLAppletElement extends HTMLElement { /** @deprecated */ align: string; - /** - * Sets or retrieves a text alternative to the graphic. + /** + * Sets or retrieves a text alternative to the graphic. */ /** @deprecated */ alt: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. + /** + * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. */ /** @deprecated */ archive: string; /** @deprecated */ code: string; - /** - * Sets or retrieves the URL of the component. + /** + * Sets or retrieves the URL of the component. */ /** @deprecated */ codeBase: string; readonly form: HTMLFormElement | null; - /** - * Sets or retrieves the height of the object. + /** + * Sets or retrieves the height of the object. */ /** @deprecated */ height: string; /** @deprecated */ hspace: number; - /** - * Sets or retrieves the shape of the object. + /** + * Sets or retrieves the shape of the object. */ /** @deprecated */ name: string; @@ -5941,17 +6111,17 @@ declare var HTMLAppletElement: { /** Provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of elements. */ interface HTMLAreaElement extends HTMLElement, HTMLHyperlinkElementUtils { - /** - * Sets or retrieves a text alternative to the graphic. + /** + * Sets or retrieves a text alternative to the graphic. */ alt: string; - /** - * Sets or retrieves the coordinates of the object. + /** + * Sets or retrieves the coordinates of the object. */ coords: string; download: string; - /** - * Sets or gets whether clicks in this region cause action. + /** + * Sets or gets whether clicks in this region cause action. */ /** @deprecated */ noHref: boolean; @@ -5959,12 +6129,12 @@ interface HTMLAreaElement extends HTMLElement, HTMLHyperlinkElementUtils { referrerPolicy: string; rel: string; readonly relList: DOMTokenList; - /** - * Sets or retrieves the shape of the object. + /** + * Sets or retrieves the shape of the object. */ shape: string; - /** - * Sets or retrieves the window or frame at which to target content. + /** + * Sets or retrieves the window or frame at which to target content. */ target: string; addEventListener(type: K, listener: (this: HTMLAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; @@ -5993,8 +6163,8 @@ declare var HTMLAudioElement: { /** A HTML line break element (
). It inherits from HTMLElement. */ interface HTMLBRElement extends HTMLElement { - /** - * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. + /** + * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. */ /** @deprecated */ clear: string; @@ -6011,12 +6181,12 @@ declare var HTMLBRElement: { /** Contains the base URI for a document. This object inherits all of the properties and methods as described in the HTMLElement interface. */ interface HTMLBaseElement extends HTMLElement { - /** - * Gets or sets the baseline URL on which relative links are based. + /** + * Gets or sets the baseline URL on which relative links are based. */ href: string; - /** - * Sets or retrieves the window or frame at which to target content. + /** + * Sets or retrieves the window or frame at which to target content. */ target: string; addEventListener(type: K, listener: (this: HTMLBaseElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; @@ -6032,13 +6202,13 @@ declare var HTMLBaseElement: { /** Provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating elements. */ interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { - /** - * Sets or retrieves the current typeface family. + /** + * Sets or retrieves the current typeface family. */ /** @deprecated */ face: string; - /** - * Sets or retrieves the font size of the object. + /** + * Sets or retrieves the font size of the object. */ /** @deprecated */ size: number; @@ -6089,68 +6259,68 @@ declare var HTMLBodyElement: { /** Provides properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating