Skip to content

Commit 16cfcc4

Browse files
committed
Merge branch 'master' into vfs
2 parents 97a842f + e7ddb84 commit 16cfcc4

File tree

52 files changed

+664
-90
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+664
-90
lines changed

.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
@@ -1151,7 +1151,7 @@ gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are:
11511151
const fileMatcher = cmdLineOptions.files;
11521152
const files = fileMatcher
11531153
? `src/**/${fileMatcher}`
1154-
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude 'src/lib/*.d.ts'";
1154+
: `Gulpfile.ts "scripts/generateLocalizedDiagnosticMessages.ts" "scripts/tslint/**/*.ts" "src/**/*.ts" --exclude "src/lib/*.d.ts"`;
11551155
const cmd = `node node_modules/tslint/bin/tslint ${files} --formatters-dir ./built/local/tslint/formatters --format autolinkableStylish`;
11561156
console.log("Linting: " + cmd);
11571157
child_process.execSync(cmd, { stdio: [0, 1, 2] });

src/compiler/checker.ts

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8330,11 +8330,18 @@ namespace ts {
83308330

83318331
function instantiateList<T>(items: T[], mapper: TypeMapper, instantiator: (item: T, mapper: TypeMapper) => T): T[] {
83328332
if (items && items.length) {
8333-
const result: T[] = [];
8334-
for (const v of items) {
8335-
result.push(instantiator(v, mapper));
8333+
for (let i = 0; i < items.length; i++) {
8334+
const item = items[i];
8335+
const mapped = instantiator(item, mapper);
8336+
if (item !== mapped) {
8337+
const result = i === 0 ? [] : items.slice(0, i);
8338+
result.push(mapped);
8339+
for (i++; i < items.length; i++) {
8340+
result.push(instantiator(items[i], mapper));
8341+
}
8342+
return result;
8343+
}
83368344
}
8337-
return result;
83388345
}
83398346
return items;
83408347
}
@@ -8456,8 +8463,13 @@ namespace ts {
84568463
}
84578464

84588465
function instantiateSymbol(symbol: Symbol, mapper: TypeMapper): Symbol {
8466+
const links = getSymbolLinks(symbol);
8467+
if (links.type && !maybeTypeOfKind(links.type, TypeFlags.Object | TypeFlags.TypeVariable | TypeFlags.Index)) {
8468+
// If the type of the symbol is already resolved, and if that type could not possibly
8469+
// be affected by instantiation, simply return the symbol itself.
8470+
return symbol;
8471+
}
84598472
if (getCheckFlags(symbol) & CheckFlags.Instantiated) {
8460-
const links = getSymbolLinks(symbol);
84618473
// If symbol being instantiated is itself a instantiation, fetch the original target and combine the
84628474
// type mappers. This ensures that original type identities are properly preserved and that aliases
84638475
// always reference a non-aliases.
@@ -8600,14 +8612,20 @@ namespace ts {
86008612
return getAnonymousTypeInstantiation(<MappedType>type, mapper);
86018613
}
86028614
if ((<ObjectType>type).objectFlags & ObjectFlags.Reference) {
8603-
return createTypeReference((<TypeReference>type).target, instantiateTypes((<TypeReference>type).typeArguments, mapper));
8615+
const typeArguments = (<TypeReference>type).typeArguments;
8616+
const newTypeArguments = instantiateTypes(typeArguments, mapper);
8617+
return newTypeArguments !== typeArguments ? createTypeReference((<TypeReference>type).target, newTypeArguments) : type;
86048618
}
86058619
}
86068620
if (type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Primitive)) {
8607-
return getUnionType(instantiateTypes((<UnionType>type).types, mapper), UnionReduction.Literal, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));
8621+
const types = (<UnionType>type).types;
8622+
const newTypes = instantiateTypes(types, mapper);
8623+
return newTypes !== types ? getUnionType(newTypes, UnionReduction.Literal, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)) : type;
86088624
}
86098625
if (type.flags & TypeFlags.Intersection) {
8610-
return getIntersectionType(instantiateTypes((<IntersectionType>type).types, mapper), type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper));
8626+
const types = (<IntersectionType>type).types;
8627+
const newTypes = instantiateTypes(types, mapper);
8628+
return newTypes !== types ? getIntersectionType(newTypes, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)) : type;
86118629
}
86128630
if (type.flags & TypeFlags.Index) {
86138631
return getIndexType(instantiateType((<IndexType>type).type, mapper));
@@ -20255,6 +20273,8 @@ namespace ts {
2025520273
case SyntaxKind.ClassDeclaration:
2025620274
case SyntaxKind.EnumDeclaration:
2025720275
return DeclarationSpaces.ExportType | DeclarationSpaces.ExportValue;
20276+
case SyntaxKind.SourceFile:
20277+
return DeclarationSpaces.ExportType | DeclarationSpaces.ExportValue | DeclarationSpaces.ExportNamespace;
2025820278
// The below options all declare an Alias, which is allowed to merge with other values within the importing module
2025920279
case SyntaxKind.ImportEqualsDeclaration:
2026020280
case SyntaxKind.NamespaceImport:

src/compiler/commandLineParser.ts

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,9 +1425,9 @@ namespace ts {
14251425
}
14261426

14271427
function directoryOfCombinedPath(fileName: string, basePath: string) {
1428-
// Use the `identity` function to avoid canonicalizing the path, as it must remain noncanonical
1428+
// Use the `getNormalizedAbsolutePath` function to avoid canonicalizing the path, as it must remain noncanonical
14291429
// until consistient casing errors are reported
1430-
return getDirectoryPath(toPath(fileName, basePath, identity));
1430+
return getDirectoryPath(getNormalizedAbsolutePath(fileName, basePath));
14311431
}
14321432

14331433
/**
@@ -1452,8 +1452,7 @@ namespace ts {
14521452
Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined));
14531453
const errors: Diagnostic[] = [];
14541454

1455-
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames);
1456-
const parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, getCanonicalFileName, resolutionStack, errors);
1455+
const parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors);
14571456
const { raw } = parsedConfig;
14581457
const options = extend(existingOptions, parsedConfig.options || {});
14591458
options.configFilePath = configFileName;
@@ -1547,7 +1546,10 @@ namespace ts {
15471546
raw: any;
15481547
options?: CompilerOptions;
15491548
typeAcquisition?: TypeAcquisition;
1550-
extendedConfigPath?: Path;
1549+
/**
1550+
* Note that the case of the config path has not yet been normalized, as no files have been imported into the project yet
1551+
*/
1552+
extendedConfigPath?: string;
15511553
}
15521554

15531555
function isSuccessfulParsedTsconfig(value: ParsedTsconfig) {
@@ -1564,27 +1566,25 @@ namespace ts {
15641566
host: ParseConfigHost,
15651567
basePath: string,
15661568
configFileName: string,
1567-
getCanonicalFileName: GetCanonicalFileName,
1568-
resolutionStack: Path[],
1569+
resolutionStack: string[],
15691570
errors: Push<Diagnostic>,
15701571
): ParsedTsconfig {
15711572
basePath = normalizeSlashes(basePath);
1572-
const resolvedPath = toPath(configFileName || "", basePath, getCanonicalFileName);
1573+
const resolvedPath = getNormalizedAbsolutePath(configFileName || "", basePath);
15731574

15741575
if (resolutionStack.indexOf(resolvedPath) >= 0) {
15751576
errors.push(createCompilerDiagnostic(Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, [...resolutionStack, resolvedPath].join(" -> ")));
15761577
return { raw: json || convertToObject(sourceFile, errors) };
15771578
}
15781579

15791580
const ownConfig = json ?
1580-
parseOwnConfigOfJson(json, host, basePath, getCanonicalFileName, configFileName, errors) :
1581-
parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, getCanonicalFileName, configFileName, errors);
1581+
parseOwnConfigOfJson(json, host, basePath, configFileName, errors) :
1582+
parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors);
15821583

15831584
if (ownConfig.extendedConfigPath) {
15841585
// copy the resolution stack so it is never reused between branches in potential diamond-problem scenarios.
15851586
resolutionStack = resolutionStack.concat([resolvedPath]);
1586-
const extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, getCanonicalFileName,
1587-
resolutionStack, errors);
1587+
const extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors);
15881588
if (extendedConfig && isSuccessfulParsedTsconfig(extendedConfig)) {
15891589
const baseRaw = extendedConfig.raw;
15901590
const raw = ownConfig.raw;
@@ -1612,7 +1612,6 @@ namespace ts {
16121612
json: any,
16131613
host: ParseConfigHost,
16141614
basePath: string,
1615-
getCanonicalFileName: GetCanonicalFileName,
16161615
configFileName: string | undefined,
16171616
errors: Push<Diagnostic>
16181617
): ParsedTsconfig {
@@ -1625,15 +1624,15 @@ namespace ts {
16251624
// It should be removed in future releases - use typeAcquisition instead.
16261625
const typeAcquisition = convertTypeAcquisitionFromJsonWorker(json.typeAcquisition || json.typingOptions, basePath, errors, configFileName);
16271626
json.compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors);
1628-
let extendedConfigPath: Path;
1627+
let extendedConfigPath: string;
16291628

16301629
if (json.extends) {
16311630
if (!isString(json.extends)) {
16321631
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", "string"));
16331632
}
16341633
else {
16351634
const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
1636-
extendedConfigPath = getExtendsConfigPath(json.extends, host, newBase, getCanonicalFileName, errors, createCompilerDiagnostic);
1635+
extendedConfigPath = getExtendsConfigPath(json.extends, host, newBase, errors, createCompilerDiagnostic);
16371636
}
16381637
}
16391638
return { raw: json, options, typeAcquisition, extendedConfigPath };
@@ -1643,13 +1642,12 @@ namespace ts {
16431642
sourceFile: JsonSourceFile,
16441643
host: ParseConfigHost,
16451644
basePath: string,
1646-
getCanonicalFileName: GetCanonicalFileName,
16471645
configFileName: string | undefined,
16481646
errors: Push<Diagnostic>
16491647
): ParsedTsconfig {
16501648
const options = getDefaultCompilerOptions(configFileName);
16511649
let typeAcquisition: TypeAcquisition, typingOptionstypeAcquisition: TypeAcquisition;
1652-
let extendedConfigPath: Path;
1650+
let extendedConfigPath: string;
16531651

16541652
const optionsIterator: JsonConversionNotifier = {
16551653
onSetValidOptionKeyValueInParent(parentOption: string, option: CommandLineOption, value: CompilerOptionsValue) {
@@ -1670,7 +1668,6 @@ namespace ts {
16701668
<string>value,
16711669
host,
16721670
newBase,
1673-
getCanonicalFileName,
16741671
errors,
16751672
(message, arg0) =>
16761673
createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0)
@@ -1712,7 +1709,6 @@ namespace ts {
17121709
extendedConfig: string,
17131710
host: ParseConfigHost,
17141711
basePath: string,
1715-
getCanonicalFileName: GetCanonicalFileName,
17161712
errors: Push<Diagnostic>,
17171713
createDiagnostic: (message: DiagnosticMessage, arg1?: string) => Diagnostic) {
17181714
extendedConfig = normalizeSlashes(extendedConfig);
@@ -1721,9 +1717,9 @@ namespace ts {
17211717
errors.push(createDiagnostic(Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig));
17221718
return undefined;
17231719
}
1724-
let extendedConfigPath = toPath(extendedConfig, basePath, getCanonicalFileName);
1720+
let extendedConfigPath = getNormalizedAbsolutePath(extendedConfig, basePath);
17251721
if (!host.fileExists(extendedConfigPath) && !endsWith(extendedConfigPath, Extension.Json)) {
1726-
extendedConfigPath = `${extendedConfigPath}.json` as Path;
1722+
extendedConfigPath = `${extendedConfigPath}.json`;
17271723
if (!host.fileExists(extendedConfigPath)) {
17281724
errors.push(createDiagnostic(Diagnostics.File_0_does_not_exist, extendedConfig));
17291725
return undefined;
@@ -1734,11 +1730,10 @@ namespace ts {
17341730

17351731
function getExtendedConfig(
17361732
sourceFile: JsonSourceFile,
1737-
extendedConfigPath: Path,
1733+
extendedConfigPath: string,
17381734
host: ts.ParseConfigHost,
17391735
basePath: string,
1740-
getCanonicalFileName: GetCanonicalFileName,
1741-
resolutionStack: Path[],
1736+
resolutionStack: string[],
17421737
errors: Push<Diagnostic>,
17431738
): ParsedTsconfig | undefined {
17441739
const extendedResult = readJsonConfigFile(extendedConfigPath, path => host.readFile(path));
@@ -1752,14 +1747,14 @@ namespace ts {
17521747

17531748
const extendedDirname = getDirectoryPath(extendedConfigPath);
17541749
const extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname,
1755-
getBaseFileName(extendedConfigPath), getCanonicalFileName, resolutionStack, errors);
1750+
getBaseFileName(extendedConfigPath), resolutionStack, errors);
17561751
if (sourceFile) {
17571752
sourceFile.extendedSourceFiles.push(...extendedResult.extendedSourceFiles);
17581753
}
17591754

17601755
if (isSuccessfulParsedTsconfig(extendedConfig)) {
17611756
// Update the paths to reflect base path
1762-
const relativeDifference = convertToRelativePath(extendedDirname, basePath, getCanonicalFileName);
1757+
const relativeDifference = convertToRelativePath(extendedDirname, basePath, identity);
17631758
const updatePath = (path: string) => isRootedDiskPath(path) ? path : combinePaths(relativeDifference, path);
17641759
const mapPropertiesInRawIfNotUndefined = (propertyName: string) => {
17651760
if (raw[propertyName]) {

0 commit comments

Comments
 (0)