diff --git a/.mailmap b/.mailmap index b246515e467..bc99382425f 100644 --- a/.mailmap +++ b/.mailmap @@ -291,14 +291,13 @@ Zeeshan Ahmed Orta # Orta Therox IdeaHunter # @IdeaHunter kujon # Jakub Korzeniowski -Matt @begincalendar +Matt # @begincalendar meyer # @meyer micbou # @micbou Alan Agius Alex Khomchenko Oussama Ben Brahim benbraou Cameron Taggart -csigs csigs Eugene Timokhov Kris Zyp Jing Ma @@ -312,4 +311,9 @@ Stanislav Iliev Wenlu Wang <805037171@163.com> wenlu.wang <805037171@163.com> kingwl <805037171@163.com> Wilson Hobbs Yuval Greenfield -Daniel # @nieltg \ No newline at end of file +Daniel # @nieltg +Adnan Chowdhury +Esakki Raj +Jack Williams +Philippe Voinov +Stephan Ginthör <26004708+Lazarus535@users.noreply.github.com> \ No newline at end of file diff --git a/AUTHORS.md b/AUTHORS.md index 7662a5642e7..839971f37eb 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -3,6 +3,7 @@ TypeScript is authored by: * Abubaker Bashir * Adam Freidin * Adi Dahiya +* Adnan Chowdhury * Adrian Leonhard * Ahmad Farid * Akshar Patel @@ -36,6 +37,7 @@ TypeScript is authored by: * Asad Saeeduddin * Avery Morin * Basarat Ali Syed +* @begincalendar * Ben Duffield * Ben Mosher * Benjamin Bock @@ -59,7 +61,6 @@ TypeScript is authored by: * Colby Russell * Colin Snover * Cotton Hou -* csigs * Cyrus Najmabadi * Dafrok Zhang * Dahan Gong @@ -87,6 +88,7 @@ TypeScript is authored by: * Eric Tsang * Erik Edrosa * Erik McClenney +* Esakki Raj * Ethan Resnick * Ethan Rubio * Eugene Timokhov @@ -124,6 +126,7 @@ TypeScript is authored by: * Ivan Enderlin * Ivo Gabe de Wolff * Iwata Hidetaka +* Jack Williams * Jakub Korzeniowski * Jakub Młokosiewicz * James Henry @@ -182,7 +185,6 @@ TypeScript is authored by: * Martin Hiller * Martin Vseticka * Masahiro Wakame -* Matt * Matt Bierner * Matt McCutchen * Matt Mitchell @@ -224,6 +226,7 @@ TypeScript is authored by: * Perry Jiang * Peter Burns * Philip Bulley +* Philippe Voinov * Piero Cangianiello * @piloopin * Prayag Verma @@ -261,6 +264,7 @@ TypeScript is authored by: * Stanislav Iliev * Stanislav Sysoev * Stas Vilchik +* Stephan Ginthör * Steve Lucco * Sudheesh Singanamalla * Sébastien Arod diff --git a/Gulpfile.ts b/Gulpfile.ts index 0c410bdfb08..7222c9bcd6a 100644 --- a/Gulpfile.ts +++ b/Gulpfile.ts @@ -1115,7 +1115,7 @@ gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are: const fileMatcher = cmdLineOptions.files; const files = fileMatcher ? `src/**/${fileMatcher}` - : "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude 'src/lib/*.d.ts'"; + : `Gulpfile.ts "scripts/generateLocalizedDiagnosticMessages.ts" "scripts/tslint/**/*.ts" "src/**/*.ts" --exclude "src/lib/*.d.ts"`; const cmd = `node node_modules/tslint/bin/tslint ${files} --formatters-dir ./built/local/tslint/formatters --format autolinkableStylish`; console.log("Linting: " + cmd); child_process.execSync(cmd, { stdio: [0, 1, 2] }); diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2c734aff209..8c97259107b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8449,11 +8449,18 @@ namespace ts { function instantiateList(items: T[], mapper: TypeMapper, instantiator: (item: T, mapper: TypeMapper) => T): T[] { if (items && items.length) { - const result: T[] = []; - for (const v of items) { - result.push(instantiator(v, mapper)); + for (let i = 0; i < items.length; i++) { + const item = items[i]; + const mapped = instantiator(item, mapper); + if (item !== mapped) { + const result = i === 0 ? [] : items.slice(0, i); + result.push(mapped); + for (i++; i < items.length; i++) { + result.push(instantiator(items[i], mapper)); + } + return result; + } } - return result; } return items; } @@ -8583,8 +8590,13 @@ namespace ts { } function instantiateSymbol(symbol: Symbol, mapper: TypeMapper): Symbol { + const links = getSymbolLinks(symbol); + if (links.type && !maybeTypeOfKind(links.type, TypeFlags.Object | TypeFlags.TypeVariable | TypeFlags.Index)) { + // If the type of the symbol is already resolved, and if that type could not possibly + // be affected by instantiation, simply return the symbol itself. + return symbol; + } if (getCheckFlags(symbol) & CheckFlags.Instantiated) { - const links = getSymbolLinks(symbol); // If symbol being instantiated is itself a instantiation, fetch the original target and combine the // type mappers. This ensures that original type identities are properly preserved and that aliases // always reference a non-aliases. @@ -8748,14 +8760,20 @@ namespace ts { return getAnonymousTypeInstantiation(type, mapper); } if ((type).objectFlags & ObjectFlags.Reference) { - return createTypeReference((type).target, instantiateTypes((type).typeArguments, mapper)); + const typeArguments = (type).typeArguments; + const newTypeArguments = instantiateTypes(typeArguments, mapper); + return newTypeArguments !== typeArguments ? createTypeReference((type).target, newTypeArguments) : type; } } if (type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Primitive)) { - return getUnionType(instantiateTypes((type).types, mapper), UnionReduction.Literal, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)); + const types = (type).types; + const newTypes = instantiateTypes(types, mapper); + return newTypes !== types ? getUnionType(newTypes, UnionReduction.Literal, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)) : type; } if (type.flags & TypeFlags.Intersection) { - return getIntersectionType(instantiateTypes((type).types, mapper), type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)); + const types = (type).types; + const newTypes = instantiateTypes(types, mapper); + return newTypes !== types ? getIntersectionType(newTypes, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)) : type; } if (type.flags & TypeFlags.Index) { return getIndexType(instantiateType((type).type, mapper)); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 23f9b08aa79..6ea50b30f6f 100755 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2363,9 +2363,30 @@ namespace ts { return false; } - return forEachEmittedFile(getEmitHost(), ({ jsFilePath, declarationFilePath }) => - isSameFile(jsFilePath, file) || - (declarationFilePath && isSameFile(declarationFilePath, file))); + // If this is source file, its not emitted file + const filePath = toPath(file); + if (getSourceFileByPath(filePath)) { + return false; + } + + // If options have --outFile or --out just check that + const out = options.outFile || options.out; + if (out) { + return isSameFile(filePath, out) || isSameFile(filePath, removeFileExtension(out) + Extension.Dts); + } + + // If --outDir, check if file is in that directory + if (options.outDir) { + return containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames()); + } + + if (fileExtensionIsOneOf(filePath, supportedJavascriptExtensions) || fileExtensionIs(filePath, Extension.Dts)) { + // Otherwise just check if sourceFile with the name exists + const filePathWithoutExtension = removeFileExtension(filePath); + return !!getSourceFileByPath(combinePaths(filePathWithoutExtension, Extension.Ts) as Path) || + !!getSourceFileByPath(combinePaths(filePathWithoutExtension, Extension.Tsx) as Path); + } + return false; } function isSameFile(file1: string, file2: string) { diff --git a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl index 5d67c5c6cdc..363a0ac6a41 100644 --- a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -14,7 +14,7 @@ - + @@ -5103,6 +5103,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl index 99776a461cc..3507c91d278 100644 --- a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -19,7 +19,7 @@ - + @@ -5112,6 +5112,15 @@ + + + + + + + + + @@ -8656,7 +8665,7 @@ - + diff --git a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl index e13e8191eb2..a2ee47c3620 100644 --- a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -14,7 +14,7 @@ - + @@ -5103,6 +5103,15 @@ + + + + + + + + + @@ -8647,7 +8656,7 @@ - + diff --git a/src/server/server.ts b/src/server/server.ts index 8e53c4d5109..722193829f9 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -33,6 +33,7 @@ namespace ts.server { const os: { homedir?(): string; tmpdir(): string; + platform(): string; } = require("os"); interface NodeSocket { @@ -824,8 +825,9 @@ namespace ts.server { const logger = createLogger(); const sys = ts.sys; + const nodeVersion = getNodeMajorVersion(); // use watchGuard process on Windows when node version is 4 or later - const useWatchGuard = process.platform === "win32" && getNodeMajorVersion() >= 4; + const useWatchGuard = process.platform === "win32" && nodeVersion >= 4; const originalWatchDirectory: ServerHost["watchDirectory"] = sys.watchDirectory.bind(sys); const noopWatcher: FileWatcher = { close: noop }; // This is the function that catches the exceptions when watching directory, and yet lets project service continue to function @@ -980,8 +982,9 @@ namespace ts.server { }; logger.info(`Starting TS Server`); - logger.info(`Version: ${versionMajorMinor}`); + logger.info(`Version: ${version}`); logger.info(`Arguments: ${process.argv.join(" ")}`); + logger.info(`Platform: ${os.platform()} NodeVersion: ${nodeVersion} CaseSensitive: ${sys.useCaseSensitiveFileNames}`); const ioSession = new IOSession(options); process.on("uncaughtException", err => {