Skip to content

Commit 9d828e3

Browse files
committed
Merge remote-tracking branch 'origin/master' into pathMappingModuleResolution
2 parents 39ad077 + ebfdeaa commit 9d828e3

336 files changed

Lines changed: 9878 additions & 841 deletions

File tree

Some content is hidden

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

CONTRIBUTING.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
# Instructions for Logging Issues
2+
3+
## 1. Read the FAQ
4+
5+
Please [read the FAQ](https://github.com/Microsoft/TypeScript/wiki/FAQ) before logging new issues, even if you think you have found a bug.
6+
7+
Issues that ask questions answered in the FAQ will be closed without elaboration.
8+
9+
## 2. Search for Duplicates
10+
11+
[Search the existing issues](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=is%3Aissue) before logging a new one.
12+
13+
## 3. Do you have a question?
14+
15+
The issue tracker is for **issues**, in other words, bugs and suggestions.
16+
If you have a *question*, please use [http://stackoverflow.com/questions/tagged/typescript](Stack Overflow), [https://gitter.im/Microsoft/TypeScript](Gitter), your favorite search engine, or other resources.
17+
Due to increased traffic, we can no longer answer questions in the issue tracker.
18+
19+
## 4. Did you find a bug?
20+
21+
When logging a bug, please be sure to include the following:
22+
* What version of TypeScript you're using (run `tsc --v`)
23+
* If at all possible, an *isolated* way to reproduce the behavior
24+
* The behavior you expect to see, and the actual behavior
25+
26+
You can try out the nightly build of TypeScript (`npm install typescript@next`) to see if the bug has already been fixed.
27+
28+
## 5. Do you have a suggestion?
29+
30+
We also accept suggestions in the issue tracker.
31+
Be sure to [check the FAQ](https://github.com/Microsoft/TypeScript/wiki/FAQ) and [search](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=is%3Aissue) first.
32+
33+
In general, things we find useful when reviewing suggestins are:
34+
* A description of the problem you're trying to solve
35+
* An overview of the suggested solution
36+
* Examples of how the suggestion would work in various places
37+
* Code examples showing e.g. "this would be an error, this wouldn't"
38+
* Code examples showing the generated JavaScript (if applicable)
39+
* If relevant, precedent in other languages can be useful for establishing context and expected behavior
40+
41+
# Instructions for Contributing Code
42+
143
## Contributing bug fixes
244

345
TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved ("Milestone == Community") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.

Jakefile.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,13 @@ var harnessSources = harnessCoreSources.concat([
163163
}));
164164

165165
var librarySourceMap = [
166-
{ target: "lib.core.d.ts", sources: ["core.d.ts"] },
166+
{ target: "lib.core.d.ts", sources: ["header.d.ts", "core.d.ts"] },
167167
{ target: "lib.dom.d.ts", sources: ["importcore.d.ts", "intl.d.ts", "dom.generated.d.ts"], },
168168
{ target: "lib.webworker.d.ts", sources: ["importcore.d.ts", "intl.d.ts", "webworker.generated.d.ts"], },
169169
{ target: "lib.scriptHost.d.ts", sources: ["importcore.d.ts", "scriptHost.d.ts"], },
170-
{ target: "lib.d.ts", sources: ["core.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
171-
{ target: "lib.core.es6.d.ts", sources: ["core.d.ts", "es6.d.ts"]},
172-
{ target: "lib.es6.d.ts", sources: ["es6.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] }
170+
{ target: "lib.d.ts", sources: ["header.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
171+
{ target: "lib.core.es6.d.ts", sources: ["header.d.ts", "core.d.ts", "es6.d.ts"]},
172+
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es6.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] }
173173
];
174174

175175
var libraryTargets = librarySourceMap.map(function (f) {
@@ -893,6 +893,7 @@ function getLinterOptions() {
893893

894894
function lintFileContents(options, path, contents) {
895895
var ll = new Linter(path, contents, options);
896+
console.log("Linting '" + path + "'.")
896897
return ll.lint();
897898
}
898899

lib/typescript.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5037,7 +5037,7 @@ var ts;
50375037
* Given an super call\property node returns a closest node where either
50385038
* - super call\property is legal in the node and not legal in the parent node the node.
50395039
* i.e. super call is legal in constructor but not legal in the class body.
5040-
* - node is arrow function (so caller might need to call getSuperContainer in case if he needs to climb higher)
5040+
* - node is arrow function (so caller might need to call getSuperContainer in case it needs to climb higher)
50415041
* - super call\property is definitely illegal in the node (but might be legal in some subnode)
50425042
* i.e. super property access is illegal in function declaration but can be legal in the statement list
50435043
*/

lib/typescriptServices.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5037,7 +5037,7 @@ var ts;
50375037
* Given an super call\property node returns a closest node where either
50385038
* - super call\property is legal in the node and not legal in the parent node the node.
50395039
* i.e. super call is legal in constructor but not legal in the class body.
5040-
* - node is arrow function (so caller might need to call getSuperContainer in case if he needs to climb higher)
5040+
* - node is arrow function (so caller might need to call getSuperContainer in case it needs to climb higher)
50415041
* - super call\property is definitely illegal in the node (but might be legal in some subnode)
50425042
* i.e. super property access is illegal in function declaration but can be legal in the statement list
50435043
*/

src/compiler/binder.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ namespace ts {
131131
options = opts;
132132
inStrictMode = !!file.externalModuleIndicator;
133133
classifiableNames = {};
134+
134135
Symbol = objectAllocator.getSymbolConstructor();
135136

136137
if (!file.locals) {
@@ -191,8 +192,8 @@ namespace ts {
191192
// unless it is a well known Symbol.
192193
function getDeclarationName(node: Declaration): string {
193194
if (node.name) {
194-
if (node.kind === SyntaxKind.ModuleDeclaration && node.name.kind === SyntaxKind.StringLiteral) {
195-
return `"${(<LiteralExpression>node.name).text}"`;
195+
if (isAmbientModule(node)) {
196+
return isGlobalScopeAugmentation(<ModuleDeclaration>node) ? "__global" : `"${(<LiteralExpression>node.name).text}"`;
196197
}
197198
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
198199
const nameExpression = (<ComputedPropertyName>node.name).expression;
@@ -348,7 +349,12 @@ namespace ts {
348349
// 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol,
349350
// but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way
350351
// when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope.
351-
if (hasExportModifier || container.flags & NodeFlags.ExportContext) {
352+
353+
// NOTE: Nested ambient modules always should go to to 'locals' table to prevent their automatic merge
354+
// during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation
355+
// and this case is specially handled. Module augmentations should only be merged with original module definition
356+
// and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.
357+
if (!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) {
352358
const exportKind =
353359
(symbolFlags & SymbolFlags.Value ? SymbolFlags.ExportValue : 0) |
354360
(symbolFlags & SymbolFlags.Type ? SymbolFlags.ExportType : 0) |
@@ -843,7 +849,10 @@ namespace ts {
843849

844850
function bindModuleDeclaration(node: ModuleDeclaration) {
845851
setExportContextFlag(node);
846-
if (node.name.kind === SyntaxKind.StringLiteral) {
852+
if (isAmbientModule(node)) {
853+
if (node.flags & NodeFlags.Export) {
854+
errorOnFirstToken(node, Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible);
855+
}
847856
declareSymbolAndAddToSymbolTable(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes);
848857
}
849858
else {

0 commit comments

Comments
 (0)