From 884ca4edbc949a9a175c0e4a66567c694c4d8c43 Mon Sep 17 00:00:00 2001 From: Bryan Forbes Date: Tue, 5 May 2015 15:36:59 -0500 Subject: [PATCH 1/5] ProjectService passing incorrect object to parseConfigFile() The return signature of `readConfigFile()` changed in f8424d0b0c91a487a2c8cc226c89ffb359816b7b and the code using it in `ProjectService` was never updated to match. This lead to the language services attempting to parse an object that doesn't match what is expected and using the default compiler options instead of what is defined in `tsconfig.json`. Similarly, the return value of the closure in `getTSConfigFileInfo()` was never updated to match in both places it returns. --- src/server/editorServices.ts | 52 ++++++++++++++++++------------------ src/services/shims.ts | 26 +++++++++--------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index dbf3ff3e51c..9c87a20c851 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -398,7 +398,7 @@ module ts.server { export class ProjectService { filenameToScriptInfo: ts.Map = {}; - // open, non-configured root files + // open, non-configured root files openFileRoots: ScriptInfo[] = []; // projects built from openFileRoots inferredProjects: Project[] = []; @@ -421,7 +421,7 @@ module ts.server { hostInfo: "Unknown host" } } - + getFormatCodeOptions(file?: string) { if (file) { var info = this.filenameToScriptInfo[file]; @@ -448,7 +448,7 @@ module ts.server { } } } - + log(msg: string, type = "Err") { this.psLogger.msg(msg, type); } @@ -457,17 +457,17 @@ module ts.server { if (args.file) { var info = this.filenameToScriptInfo[args.file]; if (info) { - info.setFormatOptions(args.formatOptions); + info.setFormatOptions(args.formatOptions); this.log("Host configuration update for file " + args.file, "Info"); } } else { if (args.hostInfo !== undefined) { this.hostConfiguration.hostInfo = args.hostInfo; - this.log("Host information " + args.hostInfo, "Info"); + this.log("Host information " + args.hostInfo, "Info"); } if (args.formatOptions) { - mergeFormatOptions(this.hostConfiguration.formatCodeOptions, args.formatOptions); + mergeFormatOptions(this.hostConfiguration.formatCodeOptions, args.formatOptions); this.log("Format host information updated", "Info"); } } @@ -487,7 +487,7 @@ module ts.server { fileDeletedInFilesystem(info: ScriptInfo) { this.psLogger.info(info.fileName + " deleted"); - + if (info.fileWatcher) { info.fileWatcher.close(); info.fileWatcher = undefined; @@ -537,7 +537,7 @@ module ts.server { } return false; } - + addOpenFile(info: ScriptInfo) { if (this.setConfiguredProjectRoot(info)) { this.openFileRootsConfigured.push(info); @@ -561,7 +561,7 @@ module ts.server { copyListRemovingItem(r.defaultProject, this.inferredProjects); // put r in referenced open file list this.openFilesReferenced.push(r); - // set default project of r to the new project + // set default project of r to the new project r.defaultProject = info.defaultProject; } else { @@ -694,7 +694,7 @@ module ts.server { this.openFilesReferenced = openFilesReferenced; // Then, loop through all of the open files that are project roots. - // For each root file, note the project that it roots. Then see if + // For each root file, note the project that it roots. Then see if // any other projects newly reference the file. If zero projects // newly reference the file, keep it as a root. If one or more // projects newly references the file, remove its project from the @@ -719,7 +719,7 @@ module ts.server { // Finally, if we found any open, referenced files that are no longer // referenced by their default project, treat them as newly opened - // by the editor. + // by the editor. for (var i = 0, len = unattachedOpenFiles.length; i < len; i++) { this.addOpenFile(unattachedOpenFiles[i]); } @@ -809,7 +809,7 @@ module ts.server { } else { this.log("Opened configuration file " + configFileName,"Info"); - this.configuredProjects.push(configResult.project); + this.configuredProjects.push(configResult.project); } } var info = this.openFile(fileName, true); @@ -901,22 +901,22 @@ module ts.server { } return false; } - + openConfigFile(configFilename: string, clientFileName?: string): ProjectOpenResult { configFilename = ts.normalizePath(configFilename); // file references will be relative to dirPath (or absolute) var dirPath = ts.getDirectoryPath(configFilename); - var rawConfig = ts.readConfigFile(configFilename); - if (!rawConfig) { - return { errorMsg: "tsconfig syntax error" }; + var rawConfig: { config?: ProjectOptions; error?: Diagnostic; } = ts.readConfigFile(configFilename); + if (rawConfig.error) { + return rawConfig.error; } else { - var parsedCommandLine = ts.parseConfigFile(rawConfig, ts.sys, dirPath); + var parsedCommandLine = ts.parseConfigFile(rawConfig.config, ts.sys, dirPath); if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) { return { errorMsg: "tsconfig option errors" }; } else if (parsedCommandLine.fileNames) { - var projectOptions: ProjectOptions = { + var projectOptions: ProjectOptions = { files: parsedCommandLine.fileNames, compilerOptions: parsedCommandLine.options }; @@ -1040,7 +1040,7 @@ module ts.server { startPath: LineCollection[]; endBranch: LineCollection[] = []; branchNode: LineNode; - // path to current node + // path to current node stack: LineNode[]; state = CharRangeSection.Entire; lineCollectionAtBranch: LineCollection; @@ -1242,7 +1242,7 @@ module ts.server { } } - // text change information + // text change information class TextChange { constructor(public pos: number, public deleteLen: number, public insertedText?: string) { } @@ -1290,7 +1290,7 @@ module ts.server { if (cb) cb(); } - + // reload whole script, leaving no change history behind reload reload(script: string) { this.currentVersion++; @@ -1300,7 +1300,7 @@ module ts.server { snap.index = new LineIndex(); var lm = LineIndex.linesFromText(script); snap.index.load(lm.lines); - // REVIEW: could use linked list + // REVIEW: could use linked list for (var i = this.minVersion; i < this.currentVersion; i++) { this.versions[i] = undefined; } @@ -1381,7 +1381,7 @@ module ts.server { return this.index.root.charCount(); } - // this requires linear space so don't hold on to these + // this requires linear space so don't hold on to these getLineStartPositions(): number[] { var starts: number[] = [-1]; var count = 1; @@ -1643,7 +1643,7 @@ module ts.server { } walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) { - // assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars) + // assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars) var childIndex = 0; var child = this.children[0]; var childCharCount = child.charCount(); @@ -1729,7 +1729,7 @@ module ts.server { line: lineNumber, offset: charOffset } - } + } else if (childInfo.child.isLeaf()) { return { line: lineNumber, @@ -1917,4 +1917,4 @@ module ts.server { return 1; } } -} \ No newline at end of file +} diff --git a/src/services/shims.ts b/src/services/shims.ts index 906b8b59d3c..dc19b8eb79b 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -1,6 +1,6 @@ // // Copyright (c) Microsoft Corporation. All rights reserved. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -83,7 +83,7 @@ module ts { export interface Shim { dispose(dummy: any): void; } - + export interface LanguageServiceShim extends Shim { languageService: LanguageService; @@ -145,7 +145,7 @@ module ts { * { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[] */ getReferencesAtPosition(fileName: string, position: number): string; - + /** * Returns a JSON-encoded value of the type: * { definition: ; references: [] }[] @@ -162,8 +162,8 @@ module ts { /** * Returns a JSON-encoded value of the type: * { fileName: string; highlights: { start: number; length: number, isDefinition: boolean }[] }[] - * - * @param fileToSearch A JSON encoded string[] containing the file names that should be + * + * @param fileToSearch A JSON encoded string[] containing the file names that should be * considered when searching. */ getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string; @@ -244,7 +244,7 @@ module ts { export class LanguageServiceShimHostAdapter implements LanguageServiceHost { private files: string[]; - + constructor(private shimHost: LanguageServiceShimHost) { } @@ -255,7 +255,7 @@ module ts { public trace(s: string): void { this.shimHost.trace(s); } - + public error(s: string): void { this.shimHost.error(s); } @@ -322,7 +322,7 @@ module ts { } } } - + export class CoreServicesShimHostAdapter implements ParseConfigHost { constructor(private shimHost: CoreServicesShimHost) { @@ -587,7 +587,7 @@ module ts { /** * Computes the definition location and file for the symbol - * at the requested position. + * at the requested position. */ public getDefinitionAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( @@ -601,7 +601,7 @@ module ts { /** * Computes the definition location of the type of the symbol - * at the requested position. + * at the requested position. */ public getTypeDefinitionAtPosition(fileName: string, position: number): string { return this.forwardJSONCall( @@ -684,8 +684,8 @@ module ts { /// COMPLETION LISTS /** - * Get a string based representation of the completions - * to provide at the given source position and providing a member completion + * Get a string based representation of the completions + * to provide at the given source position and providing a member completion * list if requested. */ public getCompletionsAtPosition(fileName: string, position: number) { @@ -883,7 +883,7 @@ module ts { return { options: configFile.options, files: configFile.fileNames, - errors: realizeDiagnostics(configFile.errors, '\r\n') + errors: [realizeDiagnostics(configFile.errors, '\r\n')] }; }); } From 0c2ae8fc532fa93d895971176ff4f48ddc47868b Mon Sep 17 00:00:00 2001 From: Tingan Ho Date: Tue, 5 May 2015 23:37:31 +0800 Subject: [PATCH 2/5] Fixes iojs environment check issue --- src/harness/harness.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/harness/harness.ts b/src/harness/harness.ts index ee4e37c19f4..97d53a6b75e 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -45,10 +45,10 @@ module Utils { export function getExecutionEnvironment() { if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { return ExecutionEnvironment.CScript; - } else if (process && process.execPath && process.execPath.indexOf("node") !== -1) { - return ExecutionEnvironment.Node; - } else { + } else if (typeof window !== "undefined") { return ExecutionEnvironment.Browser; + } else { + return ExecutionEnvironment.Node; } } From e43680de11335ce872efba4c2f8de84563b5e8bf Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 6 May 2015 10:13:32 -0700 Subject: [PATCH 3/5] show more clearly error message when found missing module name Conflicts: src/compiler/diagnosticInformationMap.generated.ts src/compiler/diagnosticMessages.json --- src/compiler/checker.ts | 8 +- .../diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 + .../reference/aliasErrors.errors.txt | 12 +- ...torWithIncompleteTypeAnnotation.errors.txt | 5 +- .../declareModifierOnImport1.errors.txt | 4 +- .../importedModuleAddToGlobal.errors.txt | 4 +- .../invalidImportAliasIdentifiers.errors.txt | 16 +- .../invalidInstantiatedModule.errors.txt | 4 +- ...tyAccessAndArrowFunctionIndent1.errors.txt | 4 +- .../reference/parser519458.errors.txt | 5 +- .../parserGenericsInTypeContexts1.errors.txt | 8 +- .../parserGenericsInTypeContexts2.errors.txt | 8 +- .../parserImportDeclaration1.errors.txt | 4 +- ...nfinishedTypeNameBeforeKeyword1.errors.txt | 4 +- .../parserVariableDeclaration3.errors.txt | 4 +- .../reference/parserharness.errors.txt | 168 +++++++++--------- .../reference/parserindenter.errors.txt | 16 +- .../parservoidInQualifiedName2.errors.txt | 4 +- .../primaryExpressionMods.errors.txt | 4 +- .../scannerImportDeclaration1.errors.txt | 4 +- .../strictModeReservedWord.errors.txt | 20 +-- ...eReservedWordInClassDeclaration.errors.txt | 12 +- .../reference/unknownSymbols2.errors.txt | 4 +- 24 files changed, 172 insertions(+), 155 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f413110a34b..ce2d9150319 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -803,7 +803,13 @@ module ts { let symbol: Symbol; if (name.kind === SyntaxKind.Identifier) { - symbol = resolveName(name, (name).text, meaning, Diagnostics.Cannot_find_name_0, name); + let message: DiagnosticMessage; + if (meaning === SymbolFlags.Namespace) { + message = Diagnostics.Cannot_find_namespace_0; + } else { + message = Diagnostics.Cannot_find_name_0; + } + symbol = resolveName(name, (name).text, meaning, message, name); if (!symbol) { return undefined; } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 4eed4a85329..1f8edf8fee3 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -364,6 +364,7 @@ module ts { A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." }, _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." }, + Cannot_find_namespace_0: { code: 2503, category: DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index d7d1011ce7f..42eae83e269 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1444,6 +1444,10 @@ "category": "Error", "code": 2502 }, + "Cannot find namespace '{0}'.": { + "category": "Error", + "code": 2503 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/tests/baselines/reference/aliasErrors.errors.txt b/tests/baselines/reference/aliasErrors.errors.txt index ffc114f80e3..c74649618ba 100644 --- a/tests/baselines/reference/aliasErrors.errors.txt +++ b/tests/baselines/reference/aliasErrors.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/aliasErrors.ts(11,12): error TS2304: Cannot find name 'no'. -tests/cases/compiler/aliasErrors.ts(12,13): error TS2304: Cannot find name 'no'. +tests/cases/compiler/aliasErrors.ts(11,12): error TS2503: Cannot find namespace 'no'. +tests/cases/compiler/aliasErrors.ts(12,13): error TS2503: Cannot find namespace 'no'. tests/cases/compiler/aliasErrors.ts(13,12): error TS1003: Identifier expected. tests/cases/compiler/aliasErrors.ts(14,12): error TS1003: Identifier expected. tests/cases/compiler/aliasErrors.ts(15,12): error TS1003: Identifier expected. -tests/cases/compiler/aliasErrors.ts(16,12): error TS2304: Cannot find name 'undefined'. +tests/cases/compiler/aliasErrors.ts(16,12): error TS2503: Cannot find namespace 'undefined'. tests/cases/compiler/aliasErrors.ts(26,15): error TS2305: Module 'foo.bar.baz' has no exported member 'bar'. @@ -20,10 +20,10 @@ tests/cases/compiler/aliasErrors.ts(26,15): error TS2305: Module 'foo.bar.baz' h import m = no; ~~ -!!! error TS2304: Cannot find name 'no'. +!!! error TS2503: Cannot find namespace 'no'. import m2 = no.mod; ~~ -!!! error TS2304: Cannot find name 'no'. +!!! error TS2503: Cannot find namespace 'no'. import n = 5; ~ !!! error TS1003: Identifier expected. @@ -35,7 +35,7 @@ tests/cases/compiler/aliasErrors.ts(26,15): error TS2305: Module 'foo.bar.baz' h !!! error TS1003: Identifier expected. import r = undefined; ~~~~~~~~~ -!!! error TS2304: Cannot find name 'undefined'. +!!! error TS2503: Cannot find namespace 'undefined'. var p = new provide.Provide(); diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index 5d607c8f5b2..2818793948f 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -1,4 +1,5 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,13): error TS2304: Cannot find name 'module'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,13): error TS2503: Cannot find namespace 'module'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,19): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,35): error TS1005: ')' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,39): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -82,7 +83,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,55): error T tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS1128: Declaration or statement expected. -==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (82 errors) ==== +==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (83 errors) ==== declare module "fs" { export class File { constructor(filename: string); @@ -96,6 +97,8 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS import fs = module("fs"); ~~~~~~ !!! error TS2304: Cannot find name 'module'. + ~~~~~~ +!!! error TS2503: Cannot find namespace 'module'. ~ !!! error TS1005: ';' expected. diff --git a/tests/baselines/reference/declareModifierOnImport1.errors.txt b/tests/baselines/reference/declareModifierOnImport1.errors.txt index 776f2c07bcb..7260a8e48f3 100644 --- a/tests/baselines/reference/declareModifierOnImport1.errors.txt +++ b/tests/baselines/reference/declareModifierOnImport1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/declareModifierOnImport1.ts(1,1): error TS1079: A 'declare' modifier cannot be used with an import declaration. -tests/cases/compiler/declareModifierOnImport1.ts(1,20): error TS2304: Cannot find name 'b'. +tests/cases/compiler/declareModifierOnImport1.ts(1,20): error TS2503: Cannot find namespace 'b'. ==== tests/cases/compiler/declareModifierOnImport1.ts (2 errors) ==== @@ -7,4 +7,4 @@ tests/cases/compiler/declareModifierOnImport1.ts(1,20): error TS2304: Cannot fin ~~~~~~~ !!! error TS1079: A 'declare' modifier cannot be used with an import declaration. ~ -!!! error TS2304: Cannot find name 'b'. \ No newline at end of file +!!! error TS2503: Cannot find namespace 'b'. \ No newline at end of file diff --git a/tests/baselines/reference/importedModuleAddToGlobal.errors.txt b/tests/baselines/reference/importedModuleAddToGlobal.errors.txt index 8948c67f78b..aed680b89aa 100644 --- a/tests/baselines/reference/importedModuleAddToGlobal.errors.txt +++ b/tests/baselines/reference/importedModuleAddToGlobal.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/importedModuleAddToGlobal.ts(15,23): error TS2304: Cannot find name 'b'. +tests/cases/compiler/importedModuleAddToGlobal.ts(15,23): error TS2503: Cannot find namespace 'b'. ==== tests/cases/compiler/importedModuleAddToGlobal.ts (1 errors) ==== @@ -18,5 +18,5 @@ tests/cases/compiler/importedModuleAddToGlobal.ts(15,23): error TS2304: Cannot f import a = A; function hello(): b.B { return null; } ~ -!!! error TS2304: Cannot find name 'b'. +!!! error TS2503: Cannot find namespace 'b'. } \ No newline at end of file diff --git a/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt b/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt index 7794fb027d7..fb29c829947 100644 --- a/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt +++ b/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(5,12): error TS2304: Cannot find name 'V'. -tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(11,12): error TS2304: Cannot find name 'C'. -tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(17,12): error TS2304: Cannot find name 'E'. -tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(23,12): error TS2304: Cannot find name 'I'. +tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(5,12): error TS2503: Cannot find namespace 'V'. +tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(11,12): error TS2503: Cannot find namespace 'C'. +tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(17,12): error TS2503: Cannot find namespace 'E'. +tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(23,12): error TS2503: Cannot find namespace 'I'. ==== tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts (4 errors) ==== @@ -11,7 +11,7 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIde import v = V; ~ -!!! error TS2304: Cannot find name 'V'. +!!! error TS2503: Cannot find namespace 'V'. class C { name: string; @@ -19,7 +19,7 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIde import c = C; ~ -!!! error TS2304: Cannot find name 'C'. +!!! error TS2503: Cannot find namespace 'C'. enum E { Red, Blue @@ -27,7 +27,7 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIde import e = E; ~ -!!! error TS2304: Cannot find name 'E'. +!!! error TS2503: Cannot find namespace 'E'. interface I { id: number; @@ -35,5 +35,5 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIde import i = I; ~ -!!! error TS2304: Cannot find name 'I'. +!!! error TS2503: Cannot find namespace 'I'. \ No newline at end of file diff --git a/tests/baselines/reference/invalidInstantiatedModule.errors.txt b/tests/baselines/reference/invalidInstantiatedModule.errors.txt index 8bd7e6492c0..540f22f5951 100644 --- a/tests/baselines/reference/invalidInstantiatedModule.errors.txt +++ b/tests/baselines/reference/invalidInstantiatedModule.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(2,18): error TS2300: Duplicate identifier 'Point'. tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(3,16): error TS2300: Duplicate identifier 'Point'. -tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(12,8): error TS2304: Cannot find name 'm'. +tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts(12,8): error TS2503: Cannot find namespace 'm'. ==== tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedModule.ts (3 errors) ==== @@ -21,7 +21,7 @@ tests/cases/conformance/internalModules/moduleDeclarations/invalidInstantiatedMo var m = M2; var p: m.Point; // Error ~ -!!! error TS2304: Cannot find name 'm'. +!!! error TS2503: Cannot find namespace 'm'. \ No newline at end of file diff --git a/tests/baselines/reference/multiLinePropertyAccessAndArrowFunctionIndent1.errors.txt b/tests/baselines/reference/multiLinePropertyAccessAndArrowFunctionIndent1.errors.txt index c85e7584139..14b7769d22f 100644 --- a/tests/baselines/reference/multiLinePropertyAccessAndArrowFunctionIndent1.errors.txt +++ b/tests/baselines/reference/multiLinePropertyAccessAndArrowFunctionIndent1.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/multiLinePropertyAccessAndArrowFunctionIndent1.ts(1,1): error TS1108: A 'return' statement can only be used within a function body. tests/cases/compiler/multiLinePropertyAccessAndArrowFunctionIndent1.ts(2,18): error TS2304: Cannot find name 'Role'. -tests/cases/compiler/multiLinePropertyAccessAndArrowFunctionIndent1.ts(4,26): error TS2304: Cannot find name 'ng'. +tests/cases/compiler/multiLinePropertyAccessAndArrowFunctionIndent1.ts(4,26): error TS2503: Cannot find namespace 'ng'. ==== tests/cases/compiler/multiLinePropertyAccessAndArrowFunctionIndent1.ts (3 errors) ==== @@ -13,5 +13,5 @@ tests/cases/compiler/multiLinePropertyAccessAndArrowFunctionIndent1.ts(4,26): er this.roleService.add(role) .then((data: ng.IHttpPromiseCallbackArg) => data.data)); ~~ -!!! error TS2304: Cannot find name 'ng'. +!!! error TS2503: Cannot find namespace 'ng'. \ No newline at end of file diff --git a/tests/baselines/reference/parser519458.errors.txt b/tests/baselines/reference/parser519458.errors.txt index e618e38723f..66dae596b81 100644 --- a/tests/baselines/reference/parser519458.errors.txt +++ b/tests/baselines/reference/parser519458.errors.txt @@ -1,11 +1,14 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser519458.ts(1,15): error TS2304: Cannot find name 'module'. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser519458.ts(1,15): error TS2503: Cannot find namespace 'module'. tests/cases/conformance/parser/ecmascript5/RegressionTests/parser519458.ts(1,21): error TS1005: ';' expected. -==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser519458.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser519458.ts (3 errors) ==== import rect = module("rect"); var bar = new rect.Rect(); ~~~~~~ !!! error TS2304: Cannot find name 'module'. + ~~~~~~ +!!! error TS2503: Cannot find namespace 'module'. ~ !!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserGenericsInTypeContexts1.errors.txt b/tests/baselines/reference/parserGenericsInTypeContexts1.errors.txt index 8b9304d9165..75652c829ee 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts1.errors.txt +++ b/tests/baselines/reference/parserGenericsInTypeContexts1.errors.txt @@ -2,8 +2,8 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(1,33): error TS2304: Cannot find name 'B'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(4,9): error TS2315: Type 'C' is not generic. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(5,9): error TS2304: Cannot find name 'D'. -tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(6,9): error TS2304: Cannot find name 'E'. -tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(7,9): error TS2304: Cannot find name 'G'. +tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(6,9): error TS2503: Cannot find namespace 'E'. +tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(7,9): error TS2503: Cannot find namespace 'G'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(8,9): error TS2304: Cannot find name 'K'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(11,16): error TS2304: Cannot find name 'E'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(14,16): error TS2304: Cannot find name 'F'. @@ -26,10 +26,10 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts !!! error TS2304: Cannot find name 'D'. var v3: E.F; ~ -!!! error TS2304: Cannot find name 'E'. +!!! error TS2503: Cannot find namespace 'E'. var v3: G.H.I; ~ -!!! error TS2304: Cannot find name 'G'. +!!! error TS2503: Cannot find namespace 'G'. var v6: K[]; ~ !!! error TS2304: Cannot find name 'K'. diff --git a/tests/baselines/reference/parserGenericsInTypeContexts2.errors.txt b/tests/baselines/reference/parserGenericsInTypeContexts2.errors.txt index 0ef716d1804..c365f461b7c 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts2.errors.txt +++ b/tests/baselines/reference/parserGenericsInTypeContexts2.errors.txt @@ -2,8 +2,8 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(1,45): error TS2304: Cannot find name 'B'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(4,9): error TS2315: Type 'C' is not generic. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(5,9): error TS2304: Cannot find name 'D'. -tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(6,9): error TS2304: Cannot find name 'E'. -tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(7,9): error TS2304: Cannot find name 'G'. +tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(6,9): error TS2503: Cannot find namespace 'E'. +tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(7,9): error TS2503: Cannot find namespace 'G'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(8,9): error TS2304: Cannot find name 'K'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(11,16): error TS2304: Cannot find name 'E'. tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(14,16): error TS2304: Cannot find name 'F'. @@ -26,10 +26,10 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts !!! error TS2304: Cannot find name 'D'. var v3: E.F, Y>>; ~ -!!! error TS2304: Cannot find name 'E'. +!!! error TS2503: Cannot find namespace 'E'. var v4: G.H.I, Y>>; ~ -!!! error TS2304: Cannot find name 'G'. +!!! error TS2503: Cannot find namespace 'G'. var v6: K, Y>>[]; ~ !!! error TS2304: Cannot find name 'K'. diff --git a/tests/baselines/reference/parserImportDeclaration1.errors.txt b/tests/baselines/reference/parserImportDeclaration1.errors.txt index ec3397cd196..099474d3d41 100644 --- a/tests/baselines/reference/parserImportDeclaration1.errors.txt +++ b/tests/baselines/reference/parserImportDeclaration1.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/parserImportDeclaration1.ts(1,21): error TS2304: Cannot find name 'TypeScriptServices'. +tests/cases/conformance/parser/ecmascript5/parserImportDeclaration1.ts(1,21): error TS2503: Cannot find namespace 'TypeScriptServices'. ==== tests/cases/conformance/parser/ecmascript5/parserImportDeclaration1.ts (1 errors) ==== import TypeScript = TypeScriptServices.TypeScript; ~~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScriptServices'. \ No newline at end of file +!!! error TS2503: Cannot find namespace 'TypeScriptServices'. \ No newline at end of file diff --git a/tests/baselines/reference/parserUnfinishedTypeNameBeforeKeyword1.errors.txt b/tests/baselines/reference/parserUnfinishedTypeNameBeforeKeyword1.errors.txt index 569c960404c..7eed3dbe026 100644 --- a/tests/baselines/reference/parserUnfinishedTypeNameBeforeKeyword1.errors.txt +++ b/tests/baselines/reference/parserUnfinishedTypeNameBeforeKeyword1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts(1,8): error TS2304: Cannot find name 'TypeModule1'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts(1,8): error TS2503: Cannot find namespace 'TypeModule1'. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts(2,8): error TS1005: '=' expected. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts(2,8): error TS2304: Cannot find name 'TypeModule2'. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts(2,20): error TS1005: ',' expected. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNam ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnfinishedTypeNameBeforeKeyword1.ts (4 errors) ==== var x: TypeModule1. ~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeModule1'. +!!! error TS2503: Cannot find namespace 'TypeModule1'. module TypeModule2 { ~~~~~~~~~~~ !!! error TS1005: '=' expected. diff --git a/tests/baselines/reference/parserVariableDeclaration3.errors.txt b/tests/baselines/reference/parserVariableDeclaration3.errors.txt index bb4e5eceaf6..a2130449f4b 100644 --- a/tests/baselines/reference/parserVariableDeclaration3.errors.txt +++ b/tests/baselines/reference/parserVariableDeclaration3.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDeclaration3.ts(2,23): error TS2304: Cannot find name 'Harness'. tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDeclaration3.ts(3,22): error TS2304: Cannot find name 'Harness'. -tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDeclaration3.ts(4,21): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDeclaration3.ts(4,21): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDeclaration3.ts(4,55): error TS2304: Cannot find name 'TypeScript'. @@ -14,7 +14,7 @@ tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDe !!! error TS2304: Cannot find name 'Harness'. , compiler = new TypeScript.TypeScriptCompiler(outerr) ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. , code; diff --git a/tests/baselines/reference/parserharness.errors.txt b/tests/baselines/reference/parserharness.errors.txt index 2452cd76a18..66afa3d010f 100644 --- a/tests/baselines/reference/parserharness.errors.txt +++ b/tests/baselines/reference/parserharness.errors.txt @@ -13,25 +13,25 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(351,17): e tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(354,17): error TS2304: Cannot find name 'errorHandlerStack'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(354,35): error TS2304: Cannot find name 'errorHandlerStack'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(691,50): error TS2304: Cannot find name 'ITextWriter'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(716,47): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(716,47): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(721,62): error TS2304: Cannot find name 'ITextWriter'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(724,29): error TS2304: Cannot find name 'ITextWriter'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(754,53): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(764,56): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(764,56): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(765,37): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(767,47): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(776,13): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(776,42): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(781,23): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(781,23): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(794,49): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(795,49): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(987,53): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(987,89): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(987,115): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(987,115): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(987,145): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(988,43): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(999,40): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1041,43): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(999,40): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1041,43): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1044,26): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1045,26): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1046,26): error TS2304: Cannot find name 'TypeScript'. @@ -44,69 +44,69 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1052,26): tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1053,26): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1055,26): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1058,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1059,34): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1059,34): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1061,26): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1064,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1065,34): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1065,34): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1067,26): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1070,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1071,34): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1071,34): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1073,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1074,34): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1074,34): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1076,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1077,34): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1077,34): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1079,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1080,35): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1080,74): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1107,173): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1176,132): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1080,35): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1080,74): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1107,173): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1176,132): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1193,29): error TS2304: Cannot find name 'WScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1256,126): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1257,25): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1263,31): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1256,126): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1257,25): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1263,31): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1280,45): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1286,124): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1286,209): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1294,142): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1294,227): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1286,124): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1286,209): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1294,142): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1294,227): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1302,43): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1304,39): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1307,38): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1311,45): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1321,21): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1340,38): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1344,165): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1345,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1426,25): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1340,38): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1344,165): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1345,26): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1426,25): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1430,9): error TS1128: Declaration or statement expected. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1430,17): error TS2304: Cannot find name 'optionRegex'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1440,29): error TS2304: Cannot find name 'optionRegex'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1461,23): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1461,23): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1466,36): error TS2304: Cannot find name 'optionRegex'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1484,21): error TS2304: Cannot find name 'optionRegex'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1548,57): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1548,57): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1571,32): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1582,59): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1582,59): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1591,24): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1600,24): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1604,42): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1605,21): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1705,38): error TS2304: Cannot find name 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1604,42): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1605,21): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1705,38): error TS2503: Cannot find namespace 'Services'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1706,26): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1713,62): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1713,87): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1713,62): error TS2503: Cannot find namespace 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1713,87): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1714,30): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1724,34): error TS2304: Cannot find name 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1739,20): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1746,80): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1746,80): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1750,26): error TS2304: Cannot find name 'TypeScript'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1758,84): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1769,51): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1784,39): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1784,61): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1785,25): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1787,38): error TS2304: Cannot find name 'Services'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1787,68): error TS2304: Cannot find name 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1758,84): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1769,51): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1784,39): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1784,61): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1785,25): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1787,38): error TS2503: Cannot find namespace 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(1787,68): error TS2503: Cannot find namespace 'Services'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): error TS2304: Cannot find name 'Diff'. @@ -858,7 +858,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): /** Mimics having multiple files, later concatenated to a single file. */ export class EmitterIOHost implements TypeScript.EmitterIOHost { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. private fileCollection = {}; @@ -914,7 +914,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): export function makeDefaultCompilerForTest(c?: TypeScript.TypeScriptCompiler) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var compiler = c || new TypeScript.TypeScriptCompiler(stderr); ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. @@ -941,7 +941,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): var compiler: TypeScript.TypeScriptCompiler; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. recreate(); // pullUpdateUnit is sufficient if an existing unit is updated, if a new unit is added we need to do a full typecheck @@ -1157,7 +1157,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. var entries = new TypeScript.ScopeTraversal(compiler).getScopeEntries(enclosingScopeContext); @@ -1175,7 +1175,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): for (var m = 0; m < compiler.scripts.members.length; m++) { var script2 = compiler.scripts.members[m]; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. if (script2.locationInfo.filename !== 'lib.d.ts') { if (targetPosition > -1) { var tyInfo = compiler.pullGetTypeInfoAtPosition(targetPosition, script2); @@ -1219,7 +1219,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): private getTypeInfoName(ast : TypeScript.AST) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var name = ''; switch (ast.nodeType) { case TypeScript.NodeType.Name: // Type Name? @@ -1263,7 +1263,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): !!! error TS2304: Cannot find name 'TypeScript'. name = (ast).text; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. break; case TypeScript.NodeType.QString: ~~~~~~~~~~ @@ -1275,7 +1275,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): !!! error TS2304: Cannot find name 'TypeScript'. name = (ast).text; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. break; case TypeScript.NodeType.Return: ~~~~~~~~~~ @@ -1287,30 +1287,30 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): !!! error TS2304: Cannot find name 'TypeScript'. name = (ast).name.actualText; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. break; case TypeScript.NodeType.ModuleDeclaration: ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. name = (ast).name.actualText; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. break; case TypeScript.NodeType.ClassDeclaration: ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. name = (ast).name.actualText; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. break; case TypeScript.NodeType.FuncDecl: ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. name = !(ast).name ? "" : (ast).name.actualText; // name == null for lambdas ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. break; default: // TODO: is there a reason to mess with all the special cases above and not just do this (ie take whatever property is there and works?) @@ -1339,7 +1339,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): */ export function generateDeclFile(code: string, verifyNoDeclFile: boolean, unitName?: string, compilationContext?: Harness.Compiler.CompilationContext, references?: TypeScript.IFileReference[]): string { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. reset(); compiler.settings.generateDeclarationFiles = true; @@ -1410,7 +1410,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): /** @param fileResults an array of strings for the filename and an ITextWriter with its code */ constructor(public fileResults: { filename: string; file: WriterAggregator; }[], errorLines: string[], public scripts: TypeScript.Script[]) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var lines = []; fileResults.forEach(v => lines = lines.concat(v.file.lines)); this.code = lines.join("\n") @@ -1494,10 +1494,10 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): export function addUnit(code: string, unitName?: string, isResident?: boolean, isDeclareFile?: boolean, references?: TypeScript.IFileReference[]) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var script: TypeScript.Script = null; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var uName = unitName || '0' + (isDeclareFile ? '.d.ts' : '.ts'); for (var i = 0; i < compiler.units.length; i++) { @@ -1505,7 +1505,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): updateUnit(code, uName); script = compiler.scripts.members[i]; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. } } if (!script) { @@ -1532,9 +1532,9 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): export function compileFile(path: string, callback: (res: CompilerResult) => void , settingsCallback?: (settings?: TypeScript.CompilationSettings) => void , context?: CompilationContext, references?: TypeScript.IFileReference[]) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. path = switchToForwardSlashes(path); var filename = path.match(/[^\/]*$/)[0]; var code = readFile(path); @@ -1544,9 +1544,9 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): export function compileUnit(code: string, filename: string, callback: (res: CompilerResult) => void , settingsCallback?: (settings?: TypeScript.CompilationSettings) => void , context?: CompilationContext, references?: TypeScript.IFileReference[]) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. // not recursive function clone/* */(source: any, target: any) { for (var prop in source) { @@ -1604,16 +1604,16 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): export function emit(ioHost: TypeScript.EmitterIOHost, usePullEmitter?: boolean) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. compiler.emit(ioHost, usePullEmitter); } export function compileString(code: string, unitName: string, callback: (res: Compiler.CompilerResult) => void , context?: CompilationContext, references?: TypeScript.IFileReference[]) { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var scripts: TypeScript.Script[] = []; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. reset(); @@ -1696,7 +1696,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): originalFilePath: string; references: TypeScript.IFileReference[]; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. } // Regex for parsing options in the format "@Alpha: Value of any sort" @@ -1739,7 +1739,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): var currentFileName = null; var refs: TypeScript.IFileReference[] = []; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. for (var i = 0; i < lines.length; i++) { var line = lines[i]; @@ -1832,7 +1832,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): public version: number; public editRanges: { length: number; editRange: TypeScript.ScriptEditRange; }[] = []; ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. constructor(public name: string, public content: string, public isResident: boolean, public maxScriptVersions: number) { this.version = 1; @@ -1870,7 +1870,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): public getEditRangeSinceVersion(version: number): TypeScript.ScriptEditRange { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. if (this.version == version) { // No edits! return null; @@ -1898,10 +1898,10 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): export class TypeScriptLS implements Services.ILanguageServiceShimHost { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. private ls: Services.ILanguageServiceShim = null; ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. public scripts: ScriptInfo[] = []; public maxScriptVersions = 100; @@ -2003,7 +2003,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): */ public getLanguageService(): Services.ILanguageServiceShim { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. var ls = new Services.TypeScriptServicesFactory().createLanguageServiceShim(this); ~~~~~~~~ !!! error TS2304: Cannot find name 'Services'. @@ -2015,9 +2015,9 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): /** Parse file given its source text */ public parseSourceText(fileName: string, sourceText: TypeScript.ISourceText): TypeScript.Script { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var parser = new TypeScript.Parser(); ~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeScript'. @@ -2058,7 +2058,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): */ public positionToZeroBasedLineCol(fileName: string, position: number): TypeScript.ILineCol { ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. var script = this.ls.languageService.getScriptAST(fileName); assert.notNull(script); @@ -2074,7 +2074,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): /** Verify that applying edits to sourceFileName result in the content of the file baselineFileName */ public checkEdits(sourceFileName: string, baselineFileName: string, edits: Services.TextEdit[]) { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. var script = readFile(sourceFileName); var formattedScript = this.applyEdits(script, edits); var baseline = readFile(baselineFileName); @@ -2087,7 +2087,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): /** Apply an array of text edits to a string, and return the resulting string. */ public applyEdits(content: string, edits: Services.TextEdit[]): string { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. var result = content; edits = this.normalizeEdits(edits); @@ -2104,18 +2104,18 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserharness.ts(2030,32): /** Normalize an array of edits by removing overlapping entries and sorting entries on the minChar position. */ private normalizeEdits(edits: Services.TextEdit[]): Services.TextEdit[] { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. var result: Services.TextEdit[] = []; ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. function mapEdits(edits: Services.TextEdit[]): { edit: Services.TextEdit; index: number; }[] { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. var result = []; for (var i = 0; i < edits.length; i++) { result.push({ edit: edits[i], index: i }); diff --git a/tests/baselines/reference/parserindenter.errors.txt b/tests/baselines/reference/parserindenter.errors.txt index 3d8e5f7cc45..a332abab7bb 100644 --- a/tests/baselines/reference/parserindenter.errors.txt +++ b/tests/baselines/reference/parserindenter.errors.txt @@ -2,10 +2,10 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(16,1): er tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(20,38): error TS2304: Cannot find name 'ILineIndenationResolver'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(22,33): error TS2304: Cannot find name 'IndentationBag'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(24,42): error TS2304: Cannot find name 'Dictionary_int_int'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(27,28): error TS2304: Cannot find name 'TypeScript'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(27,28): error TS2503: Cannot find namespace 'TypeScript'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(28,26): error TS2304: Cannot find name 'ParseTree'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(29,30): error TS2304: Cannot find name 'ITextSnapshot'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(31,35): error TS2304: Cannot find name 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(31,35): error TS2503: Cannot find namespace 'Services'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(32,32): error TS2304: Cannot find name 'TokenSpan'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(35,39): error TS2304: Cannot find name 'IndentationBag'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(37,48): error TS2304: Cannot find name 'Dictionary_int_int'. @@ -27,9 +27,9 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(152,51): tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(152,63): error TS2304: Cannot find name 'List_TextEditInfo'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(153,30): error TS2304: Cannot find name 'List_TextEditInfo'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(155,32): error TS2304: Cannot find name 'AuthorTokenKind'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(182,79): error TS2304: Cannot find name 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(182,79): error TS2503: Cannot find namespace 'Services'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(183,20): error TS2304: Cannot find name 'GetIndentSizeFromText'. -tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(186,67): error TS2304: Cannot find name 'Services'. +tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(186,67): error TS2503: Cannot find namespace 'Services'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(207,50): error TS2304: Cannot find name 'TokenSpan'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(207,67): error TS2304: Cannot find name 'ParseNode'. tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(207,79): error TS2304: Cannot find name 'IndentationInfo'. @@ -165,7 +165,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(736,38): constructor( public logger: TypeScript.ILogger, ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScript'. +!!! error TS2503: Cannot find namespace 'TypeScript'. public tree: ParseTree, ~~~~~~~~~ !!! error TS2304: Cannot find name 'ParseTree'. @@ -175,7 +175,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(736,38): public languageHostIndentation: string, public editorOptions: Services.EditorOptions, ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. public firstToken: TokenSpan, ~~~~~~~~~ !!! error TS2304: Cannot find name 'TokenSpan'. @@ -370,7 +370,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(736,38): static GetIndentSizeFromIndentText(indentText: string, editorOptions: Services.EditorOptions): number { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. return GetIndentSizeFromText(indentText, editorOptions, /*includeNonIndentChars:*/ false); ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'GetIndentSizeFromText'. @@ -378,7 +378,7 @@ tests/cases/conformance/parser/ecmascript5/RealWorld/parserindenter.ts(736,38): static GetIndentSizeFromText(text: string, editorOptions: Services.EditorOptions, includeNonIndentChars: boolean): number { ~~~~~~~~ -!!! error TS2304: Cannot find name 'Services'. +!!! error TS2503: Cannot find namespace 'Services'. var indentSize = 0; for (var i = 0; i < text.length; i++) { diff --git a/tests/baselines/reference/parservoidInQualifiedName2.errors.txt b/tests/baselines/reference/parservoidInQualifiedName2.errors.txt index ad96679f0fd..7ca94a8989a 100644 --- a/tests/baselines/reference/parservoidInQualifiedName2.errors.txt +++ b/tests/baselines/reference/parservoidInQualifiedName2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/parservoidInQualifiedName2.ts(1,9): error TS2304: Cannot find name 'x'. +tests/cases/conformance/parser/ecmascript5/parservoidInQualifiedName2.ts(1,9): error TS2503: Cannot find namespace 'x'. tests/cases/conformance/parser/ecmascript5/parservoidInQualifiedName2.ts(1,11): error TS1003: Identifier expected. tests/cases/conformance/parser/ecmascript5/parservoidInQualifiedName2.ts(1,15): error TS1109: Expression expected. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/parservoidInQualifiedName2.ts(1,15): ==== tests/cases/conformance/parser/ecmascript5/parservoidInQualifiedName2.ts (3 errors) ==== var v : x.void; ~ -!!! error TS2304: Cannot find name 'x'. +!!! error TS2503: Cannot find namespace 'x'. ~~~~ !!! error TS1003: Identifier expected. ~ diff --git a/tests/baselines/reference/primaryExpressionMods.errors.txt b/tests/baselines/reference/primaryExpressionMods.errors.txt index 8de3d60c27d..197970591eb 100644 --- a/tests/baselines/reference/primaryExpressionMods.errors.txt +++ b/tests/baselines/reference/primaryExpressionMods.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/primaryExpressionMods.ts(7,8): error TS2304: Cannot find name 'M'. -tests/cases/compiler/primaryExpressionMods.ts(11,8): error TS2304: Cannot find name 'm'. +tests/cases/compiler/primaryExpressionMods.ts(11,8): error TS2503: Cannot find namespace 'm'. ==== tests/cases/compiler/primaryExpressionMods.ts (2 errors) ==== @@ -17,5 +17,5 @@ tests/cases/compiler/primaryExpressionMods.ts(11,8): error TS2304: Cannot find n var x2 = m.a; // Same as M.a var q: m.P; // Error ~ -!!! error TS2304: Cannot find name 'm'. +!!! error TS2503: Cannot find namespace 'm'. \ No newline at end of file diff --git a/tests/baselines/reference/scannerImportDeclaration1.errors.txt b/tests/baselines/reference/scannerImportDeclaration1.errors.txt index 243670c6854..d8378248d51 100644 --- a/tests/baselines/reference/scannerImportDeclaration1.errors.txt +++ b/tests/baselines/reference/scannerImportDeclaration1.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/scanner/ecmascript5/scannerImportDeclaration1.ts(1,21): error TS2304: Cannot find name 'TypeScriptServices'. +tests/cases/conformance/scanner/ecmascript5/scannerImportDeclaration1.ts(1,21): error TS2503: Cannot find namespace 'TypeScriptServices'. ==== tests/cases/conformance/scanner/ecmascript5/scannerImportDeclaration1.ts (1 errors) ==== import TypeScript = TypeScriptServices.TypeScript; ~~~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'TypeScriptServices'. \ No newline at end of file +!!! error TS2503: Cannot find namespace 'TypeScriptServices'. \ No newline at end of file diff --git a/tests/baselines/reference/strictModeReservedWord.errors.txt b/tests/baselines/reference/strictModeReservedWord.errors.txt index 9e76e36551d..9b7c0e03d0c 100644 --- a/tests/baselines/reference/strictModeReservedWord.errors.txt +++ b/tests/baselines/reference/strictModeReservedWord.errors.txt @@ -19,19 +19,19 @@ tests/cases/compiler/strictModeReservedWord.ts(13,28): error TS1212: Identifier tests/cases/compiler/strictModeReservedWord.ts(15,25): error TS9003: 'class' expressions are not currently supported. tests/cases/compiler/strictModeReservedWord.ts(17,9): error TS2300: Duplicate identifier 'b'. tests/cases/compiler/strictModeReservedWord.ts(17,12): error TS1215: Type expected. 'public' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(17,12): error TS2304: Cannot find name 'public'. +tests/cases/compiler/strictModeReservedWord.ts(17,12): error TS2503: Cannot find namespace 'public'. tests/cases/compiler/strictModeReservedWord.ts(19,21): error TS1215: Type expected. 'private' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(19,21): error TS2304: Cannot find name 'private'. +tests/cases/compiler/strictModeReservedWord.ts(19,21): error TS2503: Cannot find namespace 'private'. tests/cases/compiler/strictModeReservedWord.ts(20,22): error TS1215: Type expected. 'private' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(20,22): error TS2304: Cannot find name 'private'. +tests/cases/compiler/strictModeReservedWord.ts(20,22): error TS2503: Cannot find namespace 'private'. tests/cases/compiler/strictModeReservedWord.ts(20,30): error TS1215: Type expected. 'package' is a reserved word in strict mode tests/cases/compiler/strictModeReservedWord.ts(21,22): error TS1215: Type expected. 'private' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(21,22): error TS2304: Cannot find name 'private'. +tests/cases/compiler/strictModeReservedWord.ts(21,22): error TS2503: Cannot find namespace 'private'. tests/cases/compiler/strictModeReservedWord.ts(21,30): error TS1215: Type expected. 'package' is a reserved word in strict mode tests/cases/compiler/strictModeReservedWord.ts(21,38): error TS1215: Type expected. 'protected' is a reserved word in strict mode tests/cases/compiler/strictModeReservedWord.ts(22,9): error TS2300: Duplicate identifier 'b'. tests/cases/compiler/strictModeReservedWord.ts(22,12): error TS1215: Type expected. 'interface' is a reserved word in strict mode -tests/cases/compiler/strictModeReservedWord.ts(22,12): error TS2304: Cannot find name 'interface'. +tests/cases/compiler/strictModeReservedWord.ts(22,12): error TS2503: Cannot find namespace 'interface'. tests/cases/compiler/strictModeReservedWord.ts(22,22): error TS1215: Type expected. 'package' is a reserved word in strict mode tests/cases/compiler/strictModeReservedWord.ts(22,30): error TS1215: Type expected. 'implements' is a reserved word in strict mode tests/cases/compiler/strictModeReservedWord.ts(23,5): error TS2304: Cannot find name 'ublic'. @@ -100,25 +100,25 @@ tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: Cannot invok ~~~~~~ !!! error TS1215: Type expected. 'public' is a reserved word in strict mode ~~~~~~ -!!! error TS2304: Cannot find name 'public'. +!!! error TS2503: Cannot find namespace 'public'. function foo(x: private.x) { } ~~~~~~~ !!! error TS1215: Type expected. 'private' is a reserved word in strict mode ~~~~~~~ -!!! error TS2304: Cannot find name 'private'. +!!! error TS2503: Cannot find namespace 'private'. function foo1(x: private.package.x) { } ~~~~~~~ !!! error TS1215: Type expected. 'private' is a reserved word in strict mode ~~~~~~~ -!!! error TS2304: Cannot find name 'private'. +!!! error TS2503: Cannot find namespace 'private'. ~~~~~~~ !!! error TS1215: Type expected. 'package' is a reserved word in strict mode function foo2(x: private.package.protected) { } ~~~~~~~ !!! error TS1215: Type expected. 'private' is a reserved word in strict mode ~~~~~~~ -!!! error TS2304: Cannot find name 'private'. +!!! error TS2503: Cannot find namespace 'private'. ~~~~~~~ !!! error TS1215: Type expected. 'package' is a reserved word in strict mode ~~~~~~~~~ @@ -129,7 +129,7 @@ tests/cases/compiler/strictModeReservedWord.ts(24,5): error TS2349: Cannot invok ~~~~~~~~~ !!! error TS1215: Type expected. 'interface' is a reserved word in strict mode ~~~~~~~~~ -!!! error TS2304: Cannot find name 'interface'. +!!! error TS2503: Cannot find namespace 'interface'. ~~~~~~~ !!! error TS1215: Type expected. 'package' is a reserved word in strict mode ~~~~~~~~~~ diff --git a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt index b7876b1b849..43222495b9f 100644 --- a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt +++ b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt @@ -15,13 +15,13 @@ tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(21,9): error TS tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(21,17): error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(23,20): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(25,20): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(25,20): error TS2304: Cannot find name 'public'. +tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(25,20): error TS2503: Cannot find namespace 'public'. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(26,21): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(26,21): error TS2304: Cannot find name 'public'. +tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(26,21): error TS2503: Cannot find namespace 'public'. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(27,17): error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(27,17): error TS2304: Cannot find name 'package'. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error TS2304: Cannot find name 'package'. +tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error TS2503: Cannot find namespace 'package'. ==== tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts (24 errors) ==== @@ -85,12 +85,12 @@ tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error T ~~~~~~ !!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~ -!!! error TS2304: Cannot find name 'public'. +!!! error TS2503: Cannot find namespace 'public'. class F1 implements public.private.implements { } ~~~~~~ !!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~ -!!! error TS2304: Cannot find name 'public'. +!!! error TS2503: Cannot find namespace 'public'. class G extends package { } ~~~~~~~ !!! error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. @@ -100,4 +100,4 @@ tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error T ~~~~~~~ !!! error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~~ -!!! error TS2304: Cannot find name 'package'. \ No newline at end of file +!!! error TS2503: Cannot find namespace 'package'. \ No newline at end of file diff --git a/tests/baselines/reference/unknownSymbols2.errors.txt b/tests/baselines/reference/unknownSymbols2.errors.txt index e78b4a14b61..e85d3c2f3bc 100644 --- a/tests/baselines/reference/unknownSymbols2.errors.txt +++ b/tests/baselines/reference/unknownSymbols2.errors.txt @@ -7,7 +7,7 @@ tests/cases/compiler/unknownSymbols2.ts(15,13): error TS2304: Cannot find name ' tests/cases/compiler/unknownSymbols2.ts(16,14): error TS2304: Cannot find name 'qwerty'. tests/cases/compiler/unknownSymbols2.ts(22,19): error TS2304: Cannot find name 'asdf'. tests/cases/compiler/unknownSymbols2.ts(23,32): error TS2304: Cannot find name 'qwerty'. -tests/cases/compiler/unknownSymbols2.ts(29,16): error TS2304: Cannot find name 'asdf'. +tests/cases/compiler/unknownSymbols2.ts(29,16): error TS2503: Cannot find namespace 'asdf'. ==== tests/cases/compiler/unknownSymbols2.ts (10 errors) ==== @@ -59,5 +59,5 @@ tests/cases/compiler/unknownSymbols2.ts(29,16): error TS2304: Cannot find name ' import c = N; import d = asdf; ~~~~ -!!! error TS2304: Cannot find name 'asdf'. +!!! error TS2503: Cannot find namespace 'asdf'. } \ No newline at end of file From ee4a15c60207e2b14f313578bf54994cde187291 Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 6 May 2015 22:49:52 +0900 Subject: [PATCH 4/5] PR feedback --- src/compiler/checker.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ce2d9150319..f3604ab49ba 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -803,12 +803,8 @@ module ts { let symbol: Symbol; if (name.kind === SyntaxKind.Identifier) { - let message: DiagnosticMessage; - if (meaning === SymbolFlags.Namespace) { - message = Diagnostics.Cannot_find_namespace_0; - } else { - message = Diagnostics.Cannot_find_name_0; - } + let message = meaning === SymbolFlags.Namespace ? Diagnostics.Cannot_find_namespace_0 : Diagnostics.Cannot_find_name_0; + symbol = resolveName(name, (name).text, meaning, message, name); if (!symbol) { return undefined; From 61a404d3e5f3236b216c7cc2c87b5319ca414e91 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 6 May 2015 11:26:55 -0700 Subject: [PATCH 5/5] Update LKG --- bin/tsc.js | 136 ++++++++++++++++++--------------- bin/tsserver.js | 142 ++++++++++++++++++++--------------- bin/typescript.js | 153 +++++++++++++++++++++++--------------- bin/typescriptServices.js | 153 +++++++++++++++++++++++--------------- 4 files changed, 345 insertions(+), 239 deletions(-) diff --git a/bin/tsc.js b/bin/tsc.js index 4912544383a..8a47fd26443 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -1277,6 +1277,8 @@ var ts; An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." }, + _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." }, + Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1431,7 +1433,6 @@ var ts; Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, @@ -8583,7 +8584,6 @@ var ts; var undefinedType = createIntrinsicType(32 | 262144, "undefined"); var nullType = createIntrinsicType(64 | 262144, "null"); var unknownType = createIntrinsicType(1, "unknown"); - var resolvingType = createIntrinsicType(1, "__resolving__"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -8613,6 +8613,8 @@ var ts; var emitExtends = false; var emitDecorate = false; var emitParam = false; + var resolutionTargets = []; + var resolutionResults = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; @@ -8832,9 +8834,9 @@ var ts; } else if (location.kind === 228 || (location.kind === 206 && location.name.kind === 8)) { - result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931); + result = getSymbolOfNode(location).exports["default"]; var localSymbol = ts.getLocalSymbolForExportDefault(result); - if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { + if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; } result = undefined; @@ -9163,7 +9165,8 @@ var ts; } var symbol; if (name.kind === 65) { - symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; + symbol = resolveName(name, name.text, meaning, message, name); if (!symbol) { return undefined; } @@ -10134,6 +10137,26 @@ var ts; }); } } + function pushTypeResolution(target) { + var i = 0; + var count = resolutionTargets.length; + while (i < count && resolutionTargets[i] !== target) { + i++; + } + if (i < count) { + do { + resolutionResults[i++] = false; + } while (i < count); + return false; + } + resolutionTargets.push(target); + resolutionResults.push(true); + return true; + } + function popTypeResolution() { + resolutionTargets.pop(); + return resolutionResults.pop(); + } function getRootDeclaration(node) { while (node.kind === 153) { node = node.parent.parent; @@ -10311,20 +10334,23 @@ var ts; if (declaration.kind === 215) { return links.type = checkExpression(declaration.expression); } - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var type = getWidenedTypeForVariableLikeDeclaration(declaration, true); - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; - error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); + if (!popTypeResolution()) { + if (symbol.valueDeclaration.type) { + type = unknownType; + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } + else { + type = anyType; + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + } } + links.type = type; } return links.type; } @@ -10345,13 +10371,10 @@ var ts; } function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); - checkAndStoreTypeOfAccessors(symbol, links); - return links.type; - } - function checkAndStoreTypeOfAccessors(symbol, links) { - links = links || getSymbolLinks(symbol); if (!links.type) { - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var getter = ts.getDeclarationOfKind(symbol, 137); var setter = ts.getDeclarationOfKind(symbol, 138); var type; @@ -10376,17 +10399,16 @@ var ts; } } } - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 137); - error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var getter_1 = ts.getDeclarationOfKind(symbol, 137); + error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + } } + links.type = type; } + return links.type; } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); @@ -10548,17 +10570,16 @@ var ts; function getDeclaredTypeOfTypeAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { - links.declaredType = resolvingType; + if (!pushTypeResolution(links)) { + return unknownType; + } var declaration = ts.getDeclarationOfKind(symbol, 204); var type = getTypeFromTypeNode(declaration.type); - if (links.declaredType === resolvingType) { - links.declaredType = type; + if (!popTypeResolution()) { + type = unknownType; + error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } - } - else if (links.declaredType === resolvingType) { - links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 204); - error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + links.declaredType = type; } return links.declaredType; } @@ -11097,7 +11118,9 @@ var ts; } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { - signature.resolvedReturnType = resolvingType; + if (!pushTypeResolution(signature)) { + return unknownType; + } var type; if (signature.target) { type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); @@ -11108,21 +11131,19 @@ var ts; else { type = getReturnTypeFromBody(signature.declaration); } - if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = type; - } - } - else if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = anyType; - if (compilerOptions.noImplicitAny) { - var declaration = signature.declaration; - if (declaration.name) { - error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); - } - else { - error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); + } + else { + error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + } } } + signature.resolvedReturnType = type; } return signature.resolvedReturnType; } @@ -14372,10 +14393,9 @@ var ts; if (isContextSensitive(node)) { assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); } - if (!node.type) { - signature.resolvedReturnType = resolvingType; + if (!node.type && !signature.resolvedReturnType) { var returnType = getReturnTypeFromBody(node, contextualMapper); - if (signature.resolvedReturnType === resolvingType) { + if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } } @@ -15156,7 +15176,7 @@ var ts; } } } - checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); + getTypeOfAccessors(getSymbolOfNode(node)); } checkFunctionLikeDeclaration(node); } diff --git a/bin/tsserver.js b/bin/tsserver.js index e492912a282..7538e43029a 100644 --- a/bin/tsserver.js +++ b/bin/tsserver.js @@ -1277,6 +1277,8 @@ var ts; An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." }, + _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." }, + Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1431,7 +1433,6 @@ var ts; Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, @@ -8967,7 +8968,6 @@ var ts; var undefinedType = createIntrinsicType(32 | 262144, "undefined"); var nullType = createIntrinsicType(64 | 262144, "null"); var unknownType = createIntrinsicType(1, "unknown"); - var resolvingType = createIntrinsicType(1, "__resolving__"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -8997,6 +8997,8 @@ var ts; var emitExtends = false; var emitDecorate = false; var emitParam = false; + var resolutionTargets = []; + var resolutionResults = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; @@ -9216,9 +9218,9 @@ var ts; } else if (location.kind === 228 || (location.kind === 206 && location.name.kind === 8)) { - result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931); + result = getSymbolOfNode(location).exports["default"]; var localSymbol = ts.getLocalSymbolForExportDefault(result); - if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { + if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; } result = undefined; @@ -9547,7 +9549,8 @@ var ts; } var symbol; if (name.kind === 65) { - symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; + symbol = resolveName(name, name.text, meaning, message, name); if (!symbol) { return undefined; } @@ -10518,6 +10521,26 @@ var ts; }); } } + function pushTypeResolution(target) { + var i = 0; + var count = resolutionTargets.length; + while (i < count && resolutionTargets[i] !== target) { + i++; + } + if (i < count) { + do { + resolutionResults[i++] = false; + } while (i < count); + return false; + } + resolutionTargets.push(target); + resolutionResults.push(true); + return true; + } + function popTypeResolution() { + resolutionTargets.pop(); + return resolutionResults.pop(); + } function getRootDeclaration(node) { while (node.kind === 153) { node = node.parent.parent; @@ -10695,20 +10718,23 @@ var ts; if (declaration.kind === 215) { return links.type = checkExpression(declaration.expression); } - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var type = getWidenedTypeForVariableLikeDeclaration(declaration, true); - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; - error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); + if (!popTypeResolution()) { + if (symbol.valueDeclaration.type) { + type = unknownType; + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } + else { + type = anyType; + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + } } + links.type = type; } return links.type; } @@ -10729,13 +10755,10 @@ var ts; } function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); - checkAndStoreTypeOfAccessors(symbol, links); - return links.type; - } - function checkAndStoreTypeOfAccessors(symbol, links) { - links = links || getSymbolLinks(symbol); if (!links.type) { - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var getter = ts.getDeclarationOfKind(symbol, 137); var setter = ts.getDeclarationOfKind(symbol, 138); var type; @@ -10760,17 +10783,16 @@ var ts; } } } - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 137); - error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var getter_1 = ts.getDeclarationOfKind(symbol, 137); + error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + } } + links.type = type; } + return links.type; } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); @@ -10932,17 +10954,16 @@ var ts; function getDeclaredTypeOfTypeAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { - links.declaredType = resolvingType; + if (!pushTypeResolution(links)) { + return unknownType; + } var declaration = ts.getDeclarationOfKind(symbol, 204); var type = getTypeFromTypeNode(declaration.type); - if (links.declaredType === resolvingType) { - links.declaredType = type; + if (!popTypeResolution()) { + type = unknownType; + error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } - } - else if (links.declaredType === resolvingType) { - links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 204); - error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + links.declaredType = type; } return links.declaredType; } @@ -11481,7 +11502,9 @@ var ts; } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { - signature.resolvedReturnType = resolvingType; + if (!pushTypeResolution(signature)) { + return unknownType; + } var type; if (signature.target) { type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); @@ -11492,21 +11515,19 @@ var ts; else { type = getReturnTypeFromBody(signature.declaration); } - if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = type; - } - } - else if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = anyType; - if (compilerOptions.noImplicitAny) { - var declaration = signature.declaration; - if (declaration.name) { - error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); - } - else { - error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); + } + else { + error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + } } } + signature.resolvedReturnType = type; } return signature.resolvedReturnType; } @@ -14756,10 +14777,9 @@ var ts; if (isContextSensitive(node)) { assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); } - if (!node.type) { - signature.resolvedReturnType = resolvingType; + if (!node.type && !signature.resolvedReturnType) { var returnType = getReturnTypeFromBody(node, contextualMapper); - if (signature.resolvedReturnType === resolvingType) { + if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } } @@ -15540,7 +15560,7 @@ var ts; } } } - checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); + getTypeOfAccessors(getSymbolOfNode(node)); } checkFunctionLikeDeclaration(node); } @@ -36854,11 +36874,11 @@ var ts; configFilename = ts.normalizePath(configFilename); var dirPath = ts.getDirectoryPath(configFilename); var rawConfig = ts.readConfigFile(configFilename); - if (!rawConfig) { - return { errorMsg: "tsconfig syntax error" }; + if (rawConfig.error) { + return rawConfig.error; } else { - var parsedCommandLine = ts.parseConfigFile(rawConfig, ts.sys, dirPath); + var parsedCommandLine = ts.parseConfigFile(rawConfig.config, ts.sys, dirPath); if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) { return { errorMsg: "tsconfig option errors" }; } diff --git a/bin/typescript.js b/bin/typescript.js index ad70519a3fa..9cee921f435 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -2020,6 +2020,8 @@ var ts; An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." }, + _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." }, + Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2174,7 +2176,6 @@ var ts; Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, @@ -10804,7 +10805,6 @@ var ts; var undefinedType = createIntrinsicType(32 /* Undefined */ | 262144 /* ContainsUndefinedOrNull */, "undefined"); var nullType = createIntrinsicType(64 /* Null */ | 262144 /* ContainsUndefinedOrNull */, "null"); var unknownType = createIntrinsicType(1 /* Any */, "unknown"); - var resolvingType = createIntrinsicType(1 /* Any */, "__resolving__"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -10834,6 +10834,8 @@ var ts; var emitExtends = false; var emitDecorate = false; var emitParam = false; + var resolutionTargets = []; + var resolutionResults = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; @@ -11063,9 +11065,9 @@ var ts; } else if (location.kind === 228 /* SourceFile */ || (location.kind === 206 /* ModuleDeclaration */ && location.name.kind === 8 /* StringLiteral */)) { - result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931 /* ModuleMember */); + result = getSymbolOfNode(location).exports["default"]; var localSymbol = ts.getLocalSymbolForExportDefault(result); - if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { + if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; } result = undefined; @@ -11481,7 +11483,8 @@ var ts; } var symbol; if (name.kind === 65 /* Identifier */) { - symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + var message = meaning === 1536 /* Namespace */ ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; + symbol = resolveName(name, name.text, meaning, message, name); if (!symbol) { return undefined; } @@ -12573,6 +12576,35 @@ var ts; }); } } + // Push an entry on the type resolution stack. If an entry with the given target is not already on the stack, + // a new entry with that target and an associated result value of true is pushed on the stack, and the value + // true is returned. Otherwise, a circularity has occurred and the result values of the existing entry and + // all entries pushed after it are changed to false, and the value false is returned. The target object provides + // a unique identity for a particular type resolution result: Symbol instances are used to track resolution of + // SymbolLinks.type, SymbolLinks instances are used to track resolution of SymbolLinks.declaredType, and + // Signature instances are used to track resolution of Signature.resolvedReturnType. + function pushTypeResolution(target) { + var i = 0; + var count = resolutionTargets.length; + while (i < count && resolutionTargets[i] !== target) { + i++; + } + if (i < count) { + do { + resolutionResults[i++] = false; + } while (i < count); + return false; + } + resolutionTargets.push(target); + resolutionResults.push(true); + return true; + } + // Pop an entry from the type resolution stack and return its associated result value. The result value will + // be true if no circularities were detected, or false if a circularity was found. + function popTypeResolution() { + resolutionTargets.pop(); + return resolutionResults.pop(); + } function getRootDeclaration(node) { while (node.kind === 153 /* BindingElement */) { node = node.parent.parent; @@ -12815,20 +12847,25 @@ var ts; return links.type = checkExpression(declaration.expression); } // Handle variable, parameter or property - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var type = getWidenedTypeForVariableLikeDeclaration(declaration, true); - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; - error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); + if (!popTypeResolution()) { + if (symbol.valueDeclaration.type) { + // Variable has type annotation that circularly references the variable itself + type = unknownType; + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } + else { + // Variable has initializer that circularly references the variable itself + type = anyType; + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + } } + links.type = type; } return links.type; } @@ -12849,13 +12886,10 @@ var ts; } function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); - checkAndStoreTypeOfAccessors(symbol, links); - return links.type; - } - function checkAndStoreTypeOfAccessors(symbol, links) { - links = links || getSymbolLinks(symbol); if (!links.type) { - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); var setter = ts.getDeclarationOfKind(symbol, 138 /* SetAccessor */); var type; @@ -12883,17 +12917,16 @@ var ts; } } } - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); - error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var getter_1 = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); + error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + } } + links.type = type; } + return links.type; } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); @@ -13058,17 +13091,18 @@ var ts; function getDeclaredTypeOfTypeAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { - links.declaredType = resolvingType; + // Note that we use the links object as the target here because the symbol object is used as the unique + // identity for resolution of the 'type' property in SymbolLinks. + if (!pushTypeResolution(links)) { + return unknownType; + } var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); - if (links.declaredType === resolvingType) { - links.declaredType = type; + if (!popTypeResolution()) { + type = unknownType; + error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } - } - else if (links.declaredType === resolvingType) { - links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */); - error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + links.declaredType = type; } return links.declaredType; } @@ -13634,7 +13668,9 @@ var ts; } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { - signature.resolvedReturnType = resolvingType; + if (!pushTypeResolution(signature)) { + return unknownType; + } var type; if (signature.target) { type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); @@ -13645,21 +13681,19 @@ var ts; else { type = getReturnTypeFromBody(signature.declaration); } - if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = type; - } - } - else if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = anyType; - if (compilerOptions.noImplicitAny) { - var declaration = signature.declaration; - if (declaration.name) { - error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); - } - else { - error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); + } + else { + error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + } } } + signature.resolvedReturnType = type; } return signature.resolvedReturnType; } @@ -17486,10 +17520,9 @@ var ts; if (isContextSensitive(node)) { assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); } - if (!node.type) { - signature.resolvedReturnType = resolvingType; + if (!node.type && !signature.resolvedReturnType) { var returnType = getReturnTypeFromBody(node, contextualMapper); - if (signature.resolvedReturnType === resolvingType) { + if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } } @@ -18405,7 +18438,7 @@ var ts; } } } - checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); + getTypeOfAccessors(getSymbolOfNode(node)); } checkFunctionLikeDeclaration(node); } @@ -41620,7 +41653,7 @@ var ts; })(ts || (ts = {})); // // Copyright (c) Microsoft Corporation. All rights reserved. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -42190,7 +42223,7 @@ var ts; return { options: configFile.options, files: configFile.fileNames, - errors: realizeDiagnostics(configFile.errors, '\r\n') + errors: [realizeDiagnostics(configFile.errors, '\r\n')] }; }); }; diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index ad70519a3fa..9cee921f435 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -2020,6 +2020,8 @@ var ts; An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." }, + _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." }, + Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2174,7 +2176,6 @@ var ts; Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, @@ -10804,7 +10805,6 @@ var ts; var undefinedType = createIntrinsicType(32 /* Undefined */ | 262144 /* ContainsUndefinedOrNull */, "undefined"); var nullType = createIntrinsicType(64 /* Null */ | 262144 /* ContainsUndefinedOrNull */, "null"); var unknownType = createIntrinsicType(1 /* Any */, "unknown"); - var resolvingType = createIntrinsicType(1 /* Any */, "__resolving__"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -10834,6 +10834,8 @@ var ts; var emitExtends = false; var emitDecorate = false; var emitParam = false; + var resolutionTargets = []; + var resolutionResults = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; @@ -11063,9 +11065,9 @@ var ts; } else if (location.kind === 228 /* SourceFile */ || (location.kind === 206 /* ModuleDeclaration */ && location.name.kind === 8 /* StringLiteral */)) { - result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931 /* ModuleMember */); + result = getSymbolOfNode(location).exports["default"]; var localSymbol = ts.getLocalSymbolForExportDefault(result); - if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { + if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; } result = undefined; @@ -11481,7 +11483,8 @@ var ts; } var symbol; if (name.kind === 65 /* Identifier */) { - symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + var message = meaning === 1536 /* Namespace */ ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; + symbol = resolveName(name, name.text, meaning, message, name); if (!symbol) { return undefined; } @@ -12573,6 +12576,35 @@ var ts; }); } } + // Push an entry on the type resolution stack. If an entry with the given target is not already on the stack, + // a new entry with that target and an associated result value of true is pushed on the stack, and the value + // true is returned. Otherwise, a circularity has occurred and the result values of the existing entry and + // all entries pushed after it are changed to false, and the value false is returned. The target object provides + // a unique identity for a particular type resolution result: Symbol instances are used to track resolution of + // SymbolLinks.type, SymbolLinks instances are used to track resolution of SymbolLinks.declaredType, and + // Signature instances are used to track resolution of Signature.resolvedReturnType. + function pushTypeResolution(target) { + var i = 0; + var count = resolutionTargets.length; + while (i < count && resolutionTargets[i] !== target) { + i++; + } + if (i < count) { + do { + resolutionResults[i++] = false; + } while (i < count); + return false; + } + resolutionTargets.push(target); + resolutionResults.push(true); + return true; + } + // Pop an entry from the type resolution stack and return its associated result value. The result value will + // be true if no circularities were detected, or false if a circularity was found. + function popTypeResolution() { + resolutionTargets.pop(); + return resolutionResults.pop(); + } function getRootDeclaration(node) { while (node.kind === 153 /* BindingElement */) { node = node.parent.parent; @@ -12815,20 +12847,25 @@ var ts; return links.type = checkExpression(declaration.expression); } // Handle variable, parameter or property - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var type = getWidenedTypeForVariableLikeDeclaration(declaration, true); - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; - error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); + if (!popTypeResolution()) { + if (symbol.valueDeclaration.type) { + // Variable has type annotation that circularly references the variable itself + type = unknownType; + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } + else { + // Variable has initializer that circularly references the variable itself + type = anyType; + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + } } + links.type = type; } return links.type; } @@ -12849,13 +12886,10 @@ var ts; } function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); - checkAndStoreTypeOfAccessors(symbol, links); - return links.type; - } - function checkAndStoreTypeOfAccessors(symbol, links) { - links = links || getSymbolLinks(symbol); if (!links.type) { - links.type = resolvingType; + if (!pushTypeResolution(symbol)) { + return unknownType; + } var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); var setter = ts.getDeclarationOfKind(symbol, 138 /* SetAccessor */); var type; @@ -12883,17 +12917,16 @@ var ts; } } } - if (links.type === resolvingType) { - links.type = type; - } - } - else if (links.type === resolvingType) { - links.type = anyType; - if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); - error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var getter_1 = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); + error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + } } + links.type = type; } + return links.type; } function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); @@ -13058,17 +13091,18 @@ var ts; function getDeclaredTypeOfTypeAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { - links.declaredType = resolvingType; + // Note that we use the links object as the target here because the symbol object is used as the unique + // identity for resolution of the 'type' property in SymbolLinks. + if (!pushTypeResolution(links)) { + return unknownType; + } var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); - if (links.declaredType === resolvingType) { - links.declaredType = type; + if (!popTypeResolution()) { + type = unknownType; + error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } - } - else if (links.declaredType === resolvingType) { - links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */); - error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + links.declaredType = type; } return links.declaredType; } @@ -13634,7 +13668,9 @@ var ts; } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { - signature.resolvedReturnType = resolvingType; + if (!pushTypeResolution(signature)) { + return unknownType; + } var type; if (signature.target) { type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); @@ -13645,21 +13681,19 @@ var ts; else { type = getReturnTypeFromBody(signature.declaration); } - if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = type; - } - } - else if (signature.resolvedReturnType === resolvingType) { - signature.resolvedReturnType = anyType; - if (compilerOptions.noImplicitAny) { - var declaration = signature.declaration; - if (declaration.name) { - error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); - } - else { - error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + if (!popTypeResolution()) { + type = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); + } + else { + error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + } } } + signature.resolvedReturnType = type; } return signature.resolvedReturnType; } @@ -17486,10 +17520,9 @@ var ts; if (isContextSensitive(node)) { assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); } - if (!node.type) { - signature.resolvedReturnType = resolvingType; + if (!node.type && !signature.resolvedReturnType) { var returnType = getReturnTypeFromBody(node, contextualMapper); - if (signature.resolvedReturnType === resolvingType) { + if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } } @@ -18405,7 +18438,7 @@ var ts; } } } - checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); + getTypeOfAccessors(getSymbolOfNode(node)); } checkFunctionLikeDeclaration(node); } @@ -41620,7 +41653,7 @@ var ts; })(ts || (ts = {})); // // Copyright (c) Microsoft Corporation. All rights reserved. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -42190,7 +42223,7 @@ var ts; return { options: configFile.options, files: configFile.fileNames, - errors: realizeDiagnostics(configFile.errors, '\r\n') + errors: [realizeDiagnostics(configFile.errors, '\r\n')] }; }); };