Skip to content

Commit 68e594a

Browse files
committed
Merge branch 'master' into use-trimmed-apparent-logic
2 parents 27dc985 + 22fbb8e commit 68e594a

File tree

422 files changed

+13240
-2720
lines changed

Some content is hidden

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

422 files changed

+13240
-2720
lines changed

.mailmap

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,13 @@ Zeeshan Ahmed <[email protected]>
291291
Orta <[email protected]> # Orta Therox
292292
IdeaHunter <[email protected]> # @IdeaHunter
293293
kujon <[email protected]> # Jakub Korzeniowski
294-
Matt <[email protected]> @begincalendar
294+
Matt <[email protected]> # @begincalendar
295295
meyer <[email protected]> # @meyer
296296
micbou <[email protected]> # @micbou
297297
Alan Agius <[email protected]>
298298
Alex Khomchenko <[email protected]>
299299
Oussama Ben Brahim <[email protected]> benbraou <[email protected]>
300300
Cameron Taggart <[email protected]>
301-
302301
Eugene Timokhov <[email protected]>
303302
304303
@@ -312,4 +311,9 @@ Stanislav Iliev <[email protected]>
312311
Wenlu Wang <[email protected]> wenlu.wang <[email protected]> kingwl <[email protected]>
313312
Wilson Hobbs <[email protected]>
314313
Yuval Greenfield <[email protected]>
315-
Daniel <[email protected]> # @nieltg
314+
Daniel <[email protected]> # @nieltg
315+
Adnan Chowdhury <[email protected]>
316+
Esakki Raj <[email protected]>
317+
Jack Williams <[email protected]>
318+
Philippe Voinov <[email protected]>
319+
Stephan Ginthör <[email protected]>

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] });

Jakefile.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ var child_process = require("child_process");
88
var fold = require("travis-fold");
99
var ts = require("./lib/typescript");
1010

11-
1211
// Variables
1312
var compilerDirectory = "src/compiler/";
1413
var serverDirectory = "src/server/";
@@ -86,7 +85,7 @@ var servicesSources = filesFromConfig("./src/services/tsconfig.json");
8685
var cancellationTokenSources = filesFromConfig(path.join(serverDirectory, "cancellationToken/tsconfig.json"));
8786
var typingsInstallerSources = filesFromConfig(path.join(serverDirectory, "typingsInstaller/tsconfig.json"));
8887
var watchGuardSources = filesFromConfig(path.join(serverDirectory, "watchGuard/tsconfig.json"));
89-
var serverSources = filesFromConfig(path.join(serverDirectory, "tsconfig.json"))
88+
var serverSources = filesFromConfig(path.join(serverDirectory, "tsconfig.json"));
9089
var languageServiceLibrarySources = filesFromConfig(path.join(serverDirectory, "tsconfig.library.json"));
9190

9291
var typesMapOutputPath = path.join(builtLocalDirectory, 'typesMap.json');
@@ -332,7 +331,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
332331
var startCompileTime = mark();
333332
opts = opts || {};
334333
var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler;
335-
var options = "--noImplicitAny --noImplicitThis --alwaysStrict --noEmitOnError --types "
334+
var options = "--noImplicitAny --noImplicitThis --alwaysStrict --noEmitOnError --types ";
336335
if (opts.types) {
337336
options += opts.types.join(",");
338337
}
@@ -381,10 +380,10 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
381380
}
382381
options += " --target es5";
383382
if (opts.lib) {
384-
options += " --lib " + opts.lib
383+
options += " --lib " + opts.lib;
385384
}
386385
else {
387-
options += " --lib es5"
386+
options += " --lib es5";
388387
}
389388
options += " --noUnusedLocals --noUnusedParameters";
390389

@@ -526,7 +525,7 @@ file(buildProtocolDts, [buildProtocolTs, buildProtocolJs, typescriptServicesDts]
526525
complete();
527526
});
528527
ex.run();
529-
}, { async: true })
528+
}, { async: true });
530529

531530
// The generated diagnostics map; built for the compiler and for the 'generate-diagnostics' task
532531
file(diagnosticInfoMapTs, [processDiagnosticMessagesJs, diagnosticMessagesJson], function () {
@@ -594,7 +593,7 @@ task("configure-insiders", [configurePrereleaseJs], function () {
594593
}, { async: true });
595594

596595
desc("Configure, build, test, and publish the insiders release.");
597-
task("publish-insiders", ["configure-nightly", "LKG", "clean", "setDebugMode", "runtests-parallel"], function () {
596+
task("publish-insiders", ["configure-insiders", "LKG", "clean", "setDebugMode", "runtests-parallel"], function () {
598597
var cmd = "npm publish --tag insiders";
599598
console.log(cmd);
600599
exec(cmd);
@@ -646,7 +645,7 @@ compileFile(servicesFile, servicesSources, [builtLocalDirectory, copyright].conc
646645
// Stanalone/web definition file using global 'ts' namespace
647646
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, { silent: true });
648647
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
649-
definitionFileContents = removeConstModifierFromEnumDeclarations(definitionFileContents)
648+
definitionFileContents = removeConstModifierFromEnumDeclarations(definitionFileContents);
650649
fs.writeFileSync(standaloneDefinitionsFile, definitionFileContents);
651650

652651
// Official node package definition file, pointed to by 'typings' in package.json
@@ -1253,15 +1252,15 @@ task("build-rules-end", [], function () {
12531252
var lintTargets = compilerSources
12541253
.concat(harnessSources)
12551254
// Other harness sources
1256-
.concat(["instrumenter.ts"].map(function (f) { return path.join(harnessDirectory, f) }))
1255+
.concat(["instrumenter.ts"].map(function (f) { return path.join(harnessDirectory, f); }))
12571256
.concat(serverSources)
12581257
.concat(tslintRulesFiles)
12591258
.concat(servicesSources)
12601259
.concat(typingsInstallerSources)
12611260
.concat(cancellationTokenSources)
12621261
.concat(["Gulpfile.ts"])
12631262
.concat([nodeServerInFile, perftscPath, "tests/perfsys.ts", webhostPath])
1264-
.map(function (p) { return path.resolve(p) });
1263+
.map(function (p) { return path.resolve(p); });
12651264
// keep only unique items
12661265
lintTargets = Array.from(new Set(lintTargets));
12671266

@@ -1303,9 +1302,10 @@ desc("Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex
13031302
task("lint", ["build-rules"], () => {
13041303
if (fold.isTravis()) console.log(fold.start("lint"));
13051304
const fileMatcher = process.env.f || process.env.file || process.env.files;
1305+
13061306
const files = fileMatcher
13071307
? `src/**/${fileMatcher}`
1308-
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude 'src/lib/*.d.ts'";
1308+
: `Gulpfile.ts scripts/generateLocalizedDiagnosticMessages.ts "scripts/tslint/**/*.ts" "src/**/*.ts" --exclude "src/lib/*.d.ts"`;
13091309
const cmd = `node node_modules/tslint/bin/tslint ${files} --formatters-dir ./built/local/tslint/formatters --format autolinkableStylish`;
13101310
console.log("Linting: " + cmd);
13111311
jake.exec([cmd], { interactive: true }, () => {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "typescript",
33
"author": "Microsoft Corp.",
44
"homepage": "http://typescriptlang.org/",
5-
"version": "2.7.0",
5+
"version": "2.8.0",
66
"license": "Apache-2.0",
77
"description": "TypeScript is a language for application scale JavaScript development",
88
"keywords": [

src/compiler/binder.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ namespace ts {
101101
HasLocals = 1 << 5,
102102
IsInterface = 1 << 6,
103103
IsObjectLiteralOrClassExpressionMethod = 1 << 7,
104+
IsInferenceContainer = 1 << 8,
104105
}
105106

106107
const binder = createBinder();
@@ -119,6 +120,7 @@ namespace ts {
119120
let parent: Node;
120121
let container: Node;
121122
let blockScopeContainer: Node;
123+
let inferenceContainer: Node;
122124
let lastContainer: Node;
123125
let seenThisKeyword: boolean;
124126

@@ -186,6 +188,7 @@ namespace ts {
186188
parent = undefined;
187189
container = undefined;
188190
blockScopeContainer = undefined;
191+
inferenceContainer = undefined;
189192
lastContainer = undefined;
190193
seenThisKeyword = false;
191194
currentFlow = undefined;
@@ -561,6 +564,13 @@ namespace ts {
561564
bindChildren(node);
562565
node.flags = seenThisKeyword ? node.flags | NodeFlags.ContainsThis : node.flags & ~NodeFlags.ContainsThis;
563566
}
567+
else if (containerFlags & ContainerFlags.IsInferenceContainer) {
568+
const saveInferenceContainer = inferenceContainer;
569+
inferenceContainer = node;
570+
node.locals = undefined;
571+
bindChildren(node);
572+
inferenceContainer = saveInferenceContainer;
573+
}
564574
else {
565575
bindChildren(node);
566576
}
@@ -1417,6 +1427,9 @@ namespace ts {
14171427
case SyntaxKind.MappedType:
14181428
return ContainerFlags.IsContainer | ContainerFlags.HasLocals;
14191429

1430+
case SyntaxKind.ConditionalType:
1431+
return ContainerFlags.IsInferenceContainer;
1432+
14201433
case SyntaxKind.SourceFile:
14211434
return ContainerFlags.IsContainer | ContainerFlags.IsControlFlowContainer | ContainerFlags.HasLocals;
14221435

@@ -2059,7 +2072,7 @@ namespace ts {
20592072
case SyntaxKind.TypePredicate:
20602073
return checkTypePredicate(node as TypePredicateNode);
20612074
case SyntaxKind.TypeParameter:
2062-
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes);
2075+
return bindTypeParameter(node as TypeParameterDeclaration);
20632076
case SyntaxKind.Parameter:
20642077
return bindParameter(<ParameterDeclaration>node);
20652078
case SyntaxKind.VariableDeclaration:
@@ -2576,6 +2589,23 @@ namespace ts {
25762589
: declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);
25772590
}
25782591

2592+
function bindTypeParameter(node: TypeParameterDeclaration) {
2593+
if (node.parent.kind === SyntaxKind.InferType) {
2594+
if (inferenceContainer) {
2595+
if (!inferenceContainer.locals) {
2596+
inferenceContainer.locals = createSymbolTable();
2597+
}
2598+
declareSymbol(inferenceContainer.locals, /*parent*/ undefined, node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes);
2599+
}
2600+
else {
2601+
bindAnonymousDeclaration(node, SymbolFlags.TypeParameter, getDeclarationName(node));
2602+
}
2603+
}
2604+
else {
2605+
declareSymbolAndAddToSymbolTable(node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes);
2606+
}
2607+
}
2608+
25792609
// reachability checks
25802610

25812611
function shouldReportErrorOnModuleDeclaration(node: ModuleDeclaration): boolean {
@@ -3440,6 +3470,8 @@ namespace ts {
34403470
case SyntaxKind.TupleType:
34413471
case SyntaxKind.UnionType:
34423472
case SyntaxKind.IntersectionType:
3473+
case SyntaxKind.ConditionalType:
3474+
case SyntaxKind.InferType:
34433475
case SyntaxKind.ParenthesizedType:
34443476
case SyntaxKind.InterfaceDeclaration:
34453477
case SyntaxKind.TypeAliasDeclaration:

0 commit comments

Comments
 (0)