Skip to content

Commit 924228b

Browse files
committed
Merge branch 'master' into errorInFileWithDeepImport
2 parents 8ea9502 + 50f442f commit 924228b

File tree

4,326 files changed

+15808
-63601
lines changed

Some content is hidden

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

4,326 files changed

+15808
-63601
lines changed

.github/ISSUE_TEMPLATE/Bug_report.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ Please fill in the *entire* template below.
1616
-->
1717

1818
<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
19-
**TypeScript Version:** 3.0.0-dev.201xxxxx
19+
**TypeScript Version:** 3.1.0-dev.201xxxxx
2020

2121
<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
22-
**Search Terms:**
22+
**Search Terms:**
2323

2424
**Code**
2525

@@ -32,6 +32,6 @@ Please fill in the *entire* template below.
3232

3333
**Actual behavior:**
3434

35-
**Playground Link:** <!-- A link to a TypeScript Playground "Share" link which demonstrates this behavior -->
35+
**Playground Link:** <!-- A link to a TypeScript Playground "Share" link which demonstrates this behavior -->
3636

3737
**Related Issues:** <!-- Did you find other bugs that looked similar? -->

.mailmap

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Rostislav Galimsky <[email protected]>
163163
Richard Knoll <[email protected]> Richard Knoll <[email protected]>
164164
Richard Karmazín <[email protected]>
165165
Rowan Wyborn <[email protected]>
166-
Ryan Cavanaugh <[email protected]> Ryan Cavanaugh <[email protected]> Ryan Cavanaugh <[email protected]>
166+
Ryan Cavanaugh <[email protected]> Ryan Cavanaugh <[email protected]> Ryan Cavanaugh <[email protected]> Ryan Cavanaugh <[email protected]>
167167
Ryohei Ikegami <[email protected]>
168168
Sarangan Rajamanickam <[email protected]>
169169
Sébastien Arod <[email protected]>
@@ -340,4 +340,22 @@ EcoleKeine <[email protected]> # Ecole Keine
340340
341341
rhysd <[email protected]> # @rhysd
342342
Zen <[email protected]> Zzzen <[email protected]> # @Zzzen
343-
bluelovers <[email protected]> # @bluelovers
343+
bluelovers <[email protected]> # @bluelovers
344+
Dan Freeman <[email protected]>
345+
David Sherret <[email protected]>
346+
David Staheli <[email protected]>
347+
Elizabeth Dinella <[email protected]>
348+
349+
Kevin Gibbons <[email protected]>
350+
Markus Johnsson <[email protected]>
351+
Martin Probst <[email protected]>
352+
Mateusz Burzyński <[email protected]>
353+
Steven <[email protected]> # @styfle
354+
Pi Lanningham <[email protected]>
355+
Sam Bostock <[email protected]>
356+
Vimal Raghubir <[email protected]>
357+
Vyacheslav Pukhanov <[email protected]>
358+
dangoo <[email protected]> # Daniel Gooss
359+
krk <[email protected]> # Kerem Kat
360+
micnic <[email protected]> # Nicu Micleușanu
361+
rflorian <[email protected]> # @rflorian

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ Jakefile.js
1919
.circleci
2020
.vscode/
2121
.parallelperf.json
22+
.mailmap
2223
test.config
2324
package-lock.json
2425
yarn.lock
2526
.github/
2627
CONTRIBUTING.md
28+
TEST-results.xml

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ branches:
1919
- release-2.7
2020
- release-2.8
2121
- release-2.9
22+
- release-3.0
2223

2324
install:
2425
- npm uninstall typescript --no-save

AUTHORS.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,19 @@ TypeScript is authored by:
7474
* Dafrok Zhang
7575
* Dahan Gong
7676
* Dan Corder
77+
* Dan Freeman
7778
* Dan Quirk
79+
* Daniel Gooss
7880
* Daniel Hollocher
7981
* Daniel Król
8082
* Daniel Lehenbauer
8183
* Daniel Rosenwasser
8284
* David Kmenta
8385
* David Li
8486
* David Sheldrick
87+
* David Sherret
8588
* David Souther
89+
* David Staheli
8690
* Denis Nedelyaev
8791
* Derek P Sifford
8892
* Dhruv Rajvanshi
@@ -96,6 +100,7 @@ TypeScript is authored by:
96100
* @e-cloud
97101
* Ecole Keine
98102
* Elisée Maurer
103+
* Elizabeth Dinella
99104
* Emilio García-Pumarino
100105
* Eric Grube
101106
* Eric Tsang
@@ -161,6 +166,7 @@ TypeScript is authored by:
161166
* Joel Day
162167
* Joey Wilson
163168
* Johannes Rieken
169+
* John Doe
164170
* John Vilk
165171
* Jonathan Bond-Caron
166172
* Jonathan Park
@@ -184,7 +190,9 @@ TypeScript is authored by:
184190
* Keith Mashinter
185191
* Ken Howard
186192
* Kenji Imamula
193+
* Kerem Kat
187194
* Kevin Donnelly
195+
* Kevin Gibbons
188196
* Kevin Lang
189197
* Khải
190198
* Kitson Kelly
@@ -201,10 +209,13 @@ TypeScript is authored by:
201209
* Manish Giri
202210
* Marin Marinov
203211
* Marius Schulz
212+
* Markus Johnsson
204213
* Martin Hiller
214+
* Martin Probst
205215
* Martin Vseticka
206216
* Martyn Janes
207217
* Masahiro Wakame
218+
* Mateusz Burzyński
208219
* Matt Bierner
209220
* Matt McCutchen
210221
* Matt Mitchell
@@ -223,10 +234,10 @@ TypeScript is authored by:
223234
* Mohamed Hegazy
224235
* Mohsen Azimi
225236
* Myles Megyesi
226-
* Natalie Coley
227237
* Nathan Shively-Sanders
228238
* Nathan Yee
229239
* Nicolas Henry
240+
* Nicu Micleușanu
230241
* @nieltg
231242
* Nima Zahedi
232243
* Noah Chen
@@ -248,6 +259,7 @@ TypeScript is authored by:
248259
* Peter Burns
249260
* Philip Bulley
250261
* Philippe Voinov
262+
* Pi Lanningham
251263
* Piero Cangianiello
252264
* @piloopin
253265
* Prayag Verma
@@ -270,6 +282,7 @@ TypeScript is authored by:
270282
* Rowan Wyborn
271283
* Ryan Cavanaugh
272284
* Ryohei Ikegami
285+
* Sam Bostock
273286
* Sam El-Husseini
274287
* Sarangan Rajamanickam
275288
* Sean Barag
@@ -290,6 +303,7 @@ TypeScript is authored by:
290303
* Stas Vilchik
291304
* Stephan Ginthör
292305
* Steve Lucco
306+
* @styfle
293307
* Sudheesh Singanamalla
294308
* Sébastien Arod
295309
* @T18970237136
@@ -316,8 +330,10 @@ TypeScript is authored by:
316330
* Vidar Tonaas Fauske
317331
* Viktor Zozulyak
318332
* Vilic Vane
333+
* Vimal Raghubir
319334
* Vladimir Kurchatkin
320335
* Vladimir Matveev
336+
* Vyacheslav Pukhanov
321337
* Wenlu Wang
322338
* Wesley Wigham
323339
* William Orr

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Design changes will not be accepted at this time. If you have a design change pr
6161

6262
You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright.
6363

64-
Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.docx](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=822190) or [Microsoft Contribution License Agreement.pdf](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=921298)), sign, scan, and email it back to <[email protected]>. Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request.
64+
Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.pdf](https://opensource.microsoft.com/pdf/microsoft-contribution-license-agreement.pdf)), sign, scan, and email it back to <[email protected]>. Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request.
6565

6666
## Housekeeping
6767

Jakefile.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ const TaskNames = {
5151
configureInsiders: "configure-insiders",
5252
publishInsiders: "publish-insiders",
5353
configureNightly: "configure-nightly",
54-
publishNightly: "publish-nightly"
54+
publishNightly: "publish-nightly",
55+
help: "help"
5556
};
5657

5758
const Paths = {};
@@ -258,6 +259,11 @@ task(TaskNames.publishNightly, [TaskNames.coreBuild, TaskNames.configureNightly,
258259
exec(cmd, () => complete());
259260
}, { async: true });
260261

262+
task(TaskNames.help, function() {
263+
var cmd = "jake --tasks";
264+
exec(cmd, () => complete());
265+
})
266+
261267
task(TaskNames.configureInsiders, [TaskNames.scripts], function () {
262268
const cmd = `${host} ${Paths.scripts.configurePrerelease} insiders ${Paths.packageJson} ${Paths.versionFile}`;
263269
exec(cmd, () => complete());
@@ -817,7 +823,7 @@ function diagnosticsToString(diagnostics, pretty) {
817823
* Concatenate a list of sourceFiles to a destinationFile
818824
* @param {string} destinationFile
819825
* @param {string[]} sourceFiles
820-
* @param {string} extraContent
826+
* @param {string=} extraContent
821827
*/
822828
function concatenateFiles(destinationFile, sourceFiles, extraContent) {
823829
var temp = "temptemp";

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": "3.0.0",
5+
"version": "3.1.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: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,11 @@ namespace ts {
225225
node.symbol = symbol;
226226
symbol.declarations = append(symbol.declarations, node);
227227

228-
if (symbolFlags & SymbolFlags.HasExports && !symbol.exports) {
228+
if (symbolFlags & (SymbolFlags.Class | SymbolFlags.Enum | SymbolFlags.Module | SymbolFlags.Variable) && !symbol.exports) {
229229
symbol.exports = createSymbolTable();
230230
}
231231

232-
if (symbolFlags & SymbolFlags.HasMembers && !symbol.members) {
232+
if (symbolFlags & (SymbolFlags.Class | SymbolFlags.Interface | SymbolFlags.TypeLiteral | SymbolFlags.ObjectLiteral) && !symbol.members) {
233233
symbol.members = createSymbolTable();
234234
}
235235

@@ -306,7 +306,7 @@ namespace ts {
306306
}
307307

308308
function getDisplayName(node: Declaration): string {
309-
return isNamedDeclaration(node) ? declarationNameToString(node.name) : unescapeLeadingUnderscores(getDeclarationName(node)!); // TODO: GH#18217
309+
return isNamedDeclaration(node) ? declarationNameToString(node.name) : unescapeLeadingUnderscores(Debug.assertDefined(getDeclarationName(node)));
310310
}
311311

312312
/**
@@ -383,9 +383,11 @@ namespace ts {
383383
let message = symbol.flags & SymbolFlags.BlockScopedVariable
384384
? Diagnostics.Cannot_redeclare_block_scoped_variable_0
385385
: Diagnostics.Duplicate_identifier_0;
386+
let messageNeedsName = true;
386387

387388
if (symbol.flags & SymbolFlags.Enum || includes & SymbolFlags.Enum) {
388389
message = Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations;
390+
messageNeedsName = false;
389391
}
390392

391393
if (symbol.declarations && symbol.declarations.length) {
@@ -394,6 +396,7 @@ namespace ts {
394396
// We'll know whether we have other default exports depending on if `symbol` already has a declaration list set.
395397
if (isDefaultExport) {
396398
message = Diagnostics.A_module_cannot_have_multiple_default_exports;
399+
messageNeedsName = false;
397400
}
398401
else {
399402
// This is to properly report an error in the case "export default { }" is after export default of class declaration or function declaration.
@@ -403,14 +406,16 @@ namespace ts {
403406
if (symbol.declarations && symbol.declarations.length &&
404407
(node.kind === SyntaxKind.ExportAssignment && !(<ExportAssignment>node).isExportEquals)) {
405408
message = Diagnostics.A_module_cannot_have_multiple_default_exports;
409+
messageNeedsName = false;
406410
}
407411
}
408412
}
409413

410-
forEach(symbol.declarations, declaration => {
411-
file.bindDiagnostics.push(createDiagnosticForNode(getNameOfDeclaration(declaration) || declaration, message, getDisplayName(declaration)));
412-
});
413-
file.bindDiagnostics.push(createDiagnosticForNode(getNameOfDeclaration(node) || node, message, getDisplayName(node)));
414+
const addError = (decl: Declaration): void => {
415+
file.bindDiagnostics.push(createDiagnosticForNode(getNameOfDeclaration(decl) || decl, message, messageNeedsName ? getDisplayName(decl) : undefined));
416+
};
417+
forEach(symbol.declarations, addError);
418+
addError(node);
414419

415420
symbol = createSymbol(SymbolFlags.None, name);
416421
}
@@ -1913,6 +1918,15 @@ namespace ts {
19131918
}
19141919
}
19151920

1921+
function checkStrictModeLabeledStatement(node: LabeledStatement) {
1922+
// Grammar checking for labeledStatement
1923+
if (inStrictMode && options.target! >= ScriptTarget.ES2015) {
1924+
if (isDeclarationStatement(node.statement) || isVariableStatement(node.statement)) {
1925+
errorOnFirstToken(node.label, Diagnostics.A_label_is_not_allowed_here);
1926+
}
1927+
}
1928+
}
1929+
19161930
function errorOnFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any) {
19171931
const span = getSpanOfTokenAtPosition(file, node.pos);
19181932
file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2));
@@ -2058,6 +2072,13 @@ namespace ts {
20582072
if (isSpecialPropertyDeclaration(node as PropertyAccessExpression)) {
20592073
bindSpecialPropertyDeclaration(node as PropertyAccessExpression);
20602074
}
2075+
if (isInJavaScriptFile(node) &&
2076+
file.commonJsModuleIndicator &&
2077+
isModuleExportsPropertyAccessExpression(node as PropertyAccessExpression) &&
2078+
!lookupSymbolForNameWorker(container, "module" as __String)) {
2079+
declareSymbol(container.locals!, /*parent*/ undefined, (node as PropertyAccessExpression).expression as Identifier,
2080+
SymbolFlags.FunctionScopedVariable | SymbolFlags.ModuleExports, SymbolFlags.FunctionScopedVariableExcludes);
2081+
}
20612082
break;
20622083
case SyntaxKind.BinaryExpression:
20632084
const specialKind = getSpecialPropertyAssignmentKind(node as BinaryExpression);
@@ -2099,6 +2120,8 @@ namespace ts {
20992120
return checkStrictModePrefixUnaryExpression(<PrefixUnaryExpression>node);
21002121
case SyntaxKind.WithStatement:
21012122
return checkStrictModeWithStatement(<WithStatement>node);
2123+
case SyntaxKind.LabeledStatement:
2124+
return checkStrictModeLabeledStatement(<LabeledStatement>node);
21022125
case SyntaxKind.ThisType:
21032126
seenThisKeyword = true;
21042127
return;

0 commit comments

Comments
 (0)