Skip to content

Commit f990e4e

Browse files
committed
Merge branch 'master' into conditionalTypes
2 parents 4f2b5f3 + 6be98fa commit f990e4e

9 files changed

Lines changed: 101 additions & 24 deletions

File tree

.mailmap

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,13 @@ Zeeshan Ahmed <ziishaned@gmail.com>
291291
Orta <orta.therox+github@gmail.com> # Orta Therox
292292
IdeaHunter <admin@fckn.me> # @IdeaHunter
293293
kujon <jakub.korzeniowski@gmail.com> # Jakub Korzeniowski
294-
Matt <begincalendar@users.noreply.github.com> @begincalendar
294+
Matt <begincalendar@users.noreply.github.com> # @begincalendar
295295
meyer <github.com@meyer.fm> # @meyer
296296
micbou <contact@micbou.com> # @micbou
297297
Alan Agius <alan.agius4@gmail.com>
298298
Alex Khomchenko <akhomchenko@gmail.com>
299299
Oussama Ben Brahim <benbraou@gmail.com> benbraou <benbraou@users.noreply.github.com>
300300
Cameron Taggart <cameron.taggart@gmail.com>
301-
csigs <csigs@outlook.com> csigs <csigs@users.noreply.github.com>
302301
Eugene Timokhov <timocov@gmail.com>
303302
Kris Zyp <kriszyp@gmail.com>
304303
Jing Ma <mjingm87@qq.com>
@@ -312,4 +311,9 @@ Stanislav Iliev <gigobest2@gmail.com>
312311
Wenlu Wang <805037171@163.com> wenlu.wang <805037171@163.com> kingwl <805037171@163.com>
313312
Wilson Hobbs <wilsonhobbs1@gmail.com>
314313
Yuval Greenfield <ubershmekel@gmail.com>
315-
Daniel <nieltg@users.noreply.github.com> # @nieltg
314+
Daniel <nieltg@users.noreply.github.com> # @nieltg
315+
Adnan Chowdhury <bttf@users.noreply.github.com>
316+
Esakki Raj <esakkiraj.tce@gmail.com>
317+
Jack Williams <jw@jackw.io>
318+
Philippe Voinov <philippevoinov@gmail.com>
319+
Stephan Ginthör <26004708+Lazarus535@users.noreply.github.com>

AUTHORS.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ TypeScript is authored by:
33
* Abubaker Bashir
44
* Adam Freidin
55
* Adi Dahiya
6+
* Adnan Chowdhury
67
* Adrian Leonhard
78
* Ahmad Farid
89
* Akshar Patel
@@ -36,6 +37,7 @@ TypeScript is authored by:
3637
* Asad Saeeduddin
3738
* Avery Morin
3839
* Basarat Ali Syed
40+
* @begincalendar
3941
* Ben Duffield
4042
* Ben Mosher
4143
* Benjamin Bock
@@ -59,7 +61,6 @@ TypeScript is authored by:
5961
* Colby Russell
6062
* Colin Snover
6163
* Cotton Hou
62-
* csigs
6364
* Cyrus Najmabadi
6465
* Dafrok Zhang
6566
* Dahan Gong
@@ -87,6 +88,7 @@ TypeScript is authored by:
8788
* Eric Tsang
8889
* Erik Edrosa
8990
* Erik McClenney
91+
* Esakki Raj
9092
* Ethan Resnick
9193
* Ethan Rubio
9294
* Eugene Timokhov
@@ -124,6 +126,7 @@ TypeScript is authored by:
124126
* Ivan Enderlin
125127
* Ivo Gabe de Wolff
126128
* Iwata Hidetaka
129+
* Jack Williams
127130
* Jakub Korzeniowski
128131
* Jakub Młokosiewicz
129132
* James Henry
@@ -182,7 +185,6 @@ TypeScript is authored by:
182185
* Martin Hiller
183186
* Martin Vseticka
184187
* Masahiro Wakame
185-
* Matt
186188
* Matt Bierner
187189
* Matt McCutchen
188190
* Matt Mitchell
@@ -224,6 +226,7 @@ TypeScript is authored by:
224226
* Perry Jiang
225227
* Peter Burns
226228
* Philip Bulley
229+
* Philippe Voinov
227230
* Piero Cangianiello
228231
* @piloopin
229232
* Prayag Verma
@@ -261,6 +264,7 @@ TypeScript is authored by:
261264
* Stanislav Iliev
262265
* Stanislav Sysoev
263266
* Stas Vilchik
267+
* Stephan Ginthör
264268
* Steve Lucco
265269
* Sudheesh Singanamalla
266270
* Sébastien Arod

Gulpfile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are:
11151115
const fileMatcher = cmdLineOptions.files;
11161116
const files = fileMatcher
11171117
? `src/**/${fileMatcher}`
1118-
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude 'src/lib/*.d.ts'";
1118+
: `Gulpfile.ts "scripts/generateLocalizedDiagnosticMessages.ts" "scripts/tslint/**/*.ts" "src/**/*.ts" --exclude "src/lib/*.d.ts"`;
11191119
const cmd = `node node_modules/tslint/bin/tslint ${files} --formatters-dir ./built/local/tslint/formatters --format autolinkableStylish`;
11201120
console.log("Linting: " + cmd);
11211121
child_process.execSync(cmd, { stdio: [0, 1, 2] });

src/compiler/checker.ts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8449,11 +8449,18 @@ namespace ts {
84498449

84508450
function instantiateList<T>(items: T[], mapper: TypeMapper, instantiator: (item: T, mapper: TypeMapper) => T): T[] {
84518451
if (items && items.length) {
8452-
const result: T[] = [];
8453-
for (const v of items) {
8454-
result.push(instantiator(v, mapper));
8452+
for (let i = 0; i < items.length; i++) {
8453+
const item = items[i];
8454+
const mapped = instantiator(item, mapper);
8455+
if (item !== mapped) {
8456+
const result = i === 0 ? [] : items.slice(0, i);
8457+
result.push(mapped);
8458+
for (i++; i < items.length; i++) {
8459+
result.push(instantiator(items[i], mapper));
8460+
}
8461+
return result;
8462+
}
84558463
}
8456-
return result;
84578464
}
84588465
return items;
84598466
}
@@ -8583,8 +8590,13 @@ namespace ts {
85838590
}
85848591

85858592
function instantiateSymbol(symbol: Symbol, mapper: TypeMapper): Symbol {
8593+
const links = getSymbolLinks(symbol);
8594+
if (links.type && !maybeTypeOfKind(links.type, TypeFlags.Object | TypeFlags.TypeVariable | TypeFlags.Index)) {
8595+
// If the type of the symbol is already resolved, and if that type could not possibly
8596+
// be affected by instantiation, simply return the symbol itself.
8597+
return symbol;
8598+
}
85868599
if (getCheckFlags(symbol) & CheckFlags.Instantiated) {
8587-
const links = getSymbolLinks(symbol);
85888600
// If symbol being instantiated is itself a instantiation, fetch the original target and combine the
85898601
// type mappers. This ensures that original type identities are properly preserved and that aliases
85908602
// always reference a non-aliases.
@@ -8748,14 +8760,20 @@ namespace ts {
87488760
return getAnonymousTypeInstantiation(<MappedType>type, mapper);
87498761
}
87508762
if ((<ObjectType>type).objectFlags & ObjectFlags.Reference) {
8751-
return createTypeReference((<TypeReference>type).target, instantiateTypes((<TypeReference>type).typeArguments, mapper));
8763+
const typeArguments = (<TypeReference>type).typeArguments;
8764+
const newTypeArguments = instantiateTypes(typeArguments, mapper);
8765+
return newTypeArguments !== typeArguments ? createTypeReference((<TypeReference>type).target, newTypeArguments) : type;
87528766
}
87538767
}
87548768
if (type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Primitive)) {
8755-
return getUnionType(instantiateTypes((<UnionType>type).types, mapper), UnionReduction.Literal, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));
8769+
const types = (<UnionType>type).types;
8770+
const newTypes = instantiateTypes(types, mapper);
8771+
return newTypes !== types ? getUnionType(newTypes, UnionReduction.Literal, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)) : type;
87568772
}
87578773
if (type.flags & TypeFlags.Intersection) {
8758-
return getIntersectionType(instantiateTypes((<IntersectionType>type).types, mapper), type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));
8774+
const types = (<IntersectionType>type).types;
8775+
const newTypes = instantiateTypes(types, mapper);
8776+
return newTypes !== types ? getIntersectionType(newTypes, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)) : type;
87598777
}
87608778
if (type.flags & TypeFlags.Index) {
87618779
return getIndexType(instantiateType((<IndexType>type).type, mapper));

src/compiler/program.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2363,9 +2363,30 @@ namespace ts {
23632363
return false;
23642364
}
23652365

2366-
return forEachEmittedFile(getEmitHost(), ({ jsFilePath, declarationFilePath }) =>
2367-
isSameFile(jsFilePath, file) ||
2368-
(declarationFilePath && isSameFile(declarationFilePath, file)));
2366+
// If this is source file, its not emitted file
2367+
const filePath = toPath(file);
2368+
if (getSourceFileByPath(filePath)) {
2369+
return false;
2370+
}
2371+
2372+
// If options have --outFile or --out just check that
2373+
const out = options.outFile || options.out;
2374+
if (out) {
2375+
return isSameFile(filePath, out) || isSameFile(filePath, removeFileExtension(out) + Extension.Dts);
2376+
}
2377+
2378+
// If --outDir, check if file is in that directory
2379+
if (options.outDir) {
2380+
return containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
2381+
}
2382+
2383+
if (fileExtensionIsOneOf(filePath, supportedJavascriptExtensions) || fileExtensionIs(filePath, Extension.Dts)) {
2384+
// Otherwise just check if sourceFile with the name exists
2385+
const filePathWithoutExtension = removeFileExtension(filePath);
2386+
return !!getSourceFileByPath(combinePaths(filePathWithoutExtension, Extension.Ts) as Path) ||
2387+
!!getSourceFileByPath(combinePaths(filePathWithoutExtension, Extension.Tsx) as Path);
2388+
}
2389+
return false;
23692390
}
23702391

23712392
function isSameFile(file1: string, file2: string) {

src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<Cmt Name="LcxAdmin" />
1515
<Cmt Name="Loc" />
1616
<Cmt Name="Note" />
17-
<Cmt Name="RCCX" />
17+
<Cmt Name="Rccx" />
1818
</OwnedComments>
1919
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
2020
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -5103,6 +5103,15 @@
51035103
</Str>
51045104
<Disp Icon="Str" />
51055105
</Item>
5106+
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
5107+
<Str Cat="Text">
5108+
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
5109+
<Tgt Cat="Text" Stat="Loc" Orig="New">
5110+
<Val><![CDATA[仅发出 ".d.ts" 声明文件。 ]]></Val>
5111+
</Tgt>
5112+
</Str>
5113+
<Disp Icon="Str" />
5114+
</Item>
51065115
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
51075116
<Str Cat="Text">
51085117
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>

src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<Cmt Name="ManifestData" />
2020
<Cmt Name="Mnemonic" />
2121
<Cmt Name="Note" />
22-
<Cmt Name="RCCX" />
22+
<Cmt Name="Rccx" />
2323
<Cmt Name="UIType" />
2424
<Cmt Name="UTSData" />
2525
<Cmt Name="UTSUI" />
@@ -5112,6 +5112,15 @@
51125112
</Str>
51135113
<Disp Icon="Str" />
51145114
</Item>
5115+
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
5116+
<Str Cat="Text">
5117+
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
5118+
<Tgt Cat="Text" Stat="Loc" Orig="New">
5119+
<Val><![CDATA[Émettez uniquement les fichiers de déclaration '.d.ts'.]]></Val>
5120+
</Tgt>
5121+
</Str>
5122+
<Disp Icon="Str" />
5123+
</Item>
51155124
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
51165125
<Str Cat="Text">
51175126
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
@@ -8656,7 +8665,7 @@
86568665
<Str Cat="Text">
86578666
<Val><![CDATA['enum declarations' can only be used in a .ts file.]]></Val>
86588667
<Tgt Cat="Text" Stat="Loc" Orig="New">
8659-
<Val><![CDATA[Les déclarations 'enum' peuvent uniquement être utilisées dans un fichier .ts.]]></Val>
8668+
<Val><![CDATA['Les déclarations enum' peuvent uniquement être utilisées dans un fichier .ts.]]></Val>
86608669
</Tgt>
86618670
</Str>
86628671
<Disp Icon="Str" />

src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<Cmt Name="LcxAdmin" />
1515
<Cmt Name="Loc" />
1616
<Cmt Name="Note" />
17-
<Cmt Name="RCCX" />
17+
<Cmt Name="Rccx" />
1818
</OwnedComments>
1919
<Settings Name="@vsLocTools@\current\default.lss" Type="LSS" />
2020
<Item ItemId=";String Table" ItemType="0" PsrId="306" Leaf="false">
@@ -5103,6 +5103,15 @@
51035103
</Str>
51045104
<Disp Icon="Str" />
51055105
</Item>
5106+
<Item ItemId=";Only_emit_d_ts_declaration_files_6014" ItemType="0" PsrId="306" Leaf="true">
5107+
<Str Cat="Text">
5108+
<Val><![CDATA[Only emit '.d.ts' declaration files.]]></Val>
5109+
<Tgt Cat="Text" Stat="Loc" Orig="New">
5110+
<Val><![CDATA[Crea solo i file di dichiarazione '.d.ts'.]]></Val>
5111+
</Tgt>
5112+
</Str>
5113+
<Disp Icon="Str" />
5114+
</Item>
51065115
<Item ItemId=";Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002" ItemType="0" PsrId="306" Leaf="true">
51075116
<Str Cat="Text">
51085117
<Val><![CDATA[Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.]]></Val>
@@ -8647,7 +8656,7 @@
86478656
<Str Cat="Text">
86488657
<Val><![CDATA['enum declarations' can only be used in a .ts file.]]></Val>
86498658
<Tgt Cat="Text" Stat="Loc" Orig="New">
8650-
<Val><![CDATA['enum declarations' può essere usato solo in un file con estensione ts.]]></Val>
8659+
<Val><![CDATA[Le dichiarazioni 'enum' possono essere usate solo in un file con estensione ts.]]></Val>
86518660
</Tgt>
86528661
</Str>
86538662
<Disp Icon="Str" />

src/server/server.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ namespace ts.server {
3333
const os: {
3434
homedir?(): string;
3535
tmpdir(): string;
36+
platform(): string;
3637
} = require("os");
3738

3839
interface NodeSocket {
@@ -824,8 +825,9 @@ namespace ts.server {
824825
const logger = createLogger();
825826

826827
const sys = <ServerHost>ts.sys;
828+
const nodeVersion = getNodeMajorVersion();
827829
// use watchGuard process on Windows when node version is 4 or later
828-
const useWatchGuard = process.platform === "win32" && getNodeMajorVersion() >= 4;
830+
const useWatchGuard = process.platform === "win32" && nodeVersion >= 4;
829831
const originalWatchDirectory: ServerHost["watchDirectory"] = sys.watchDirectory.bind(sys);
830832
const noopWatcher: FileWatcher = { close: noop };
831833
// 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 {
980982
};
981983

982984
logger.info(`Starting TS Server`);
983-
logger.info(`Version: ${versionMajorMinor}`);
985+
logger.info(`Version: ${version}`);
984986
logger.info(`Arguments: ${process.argv.join(" ")}`);
987+
logger.info(`Platform: ${os.platform()} NodeVersion: ${nodeVersion} CaseSensitive: ${sys.useCaseSensitiveFileNames}`);
985988

986989
const ioSession = new IOSession(options);
987990
process.on("uncaughtException", err => {

0 commit comments

Comments
 (0)