Skip to content

Commit 2c87dd7

Browse files
committed
Merge branch 'master' into genericObjectExpressionCompletion
2 parents ff6ceb5 + 9920da2 commit 2c87dd7

File tree

417 files changed

+11123
-2894
lines changed

Some content is hidden

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

417 files changed

+11123
-2894
lines changed

.github/ISSUE_TEMPLATE/Feature_request.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ about: Suggest an idea for this project
66

77
<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨
88
9-
Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Please read the FAQ first, especially the "Common Feature Requests" section.
9+
Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker.
10+
11+
Please help us by doing the following steps before logging an issue:
12+
* Search: https://github.com/Microsoft/TypeScript/search?type=Issues
13+
* Read the FAQ, especially the "Common Feature Requests" section: https://github.com/Microsoft/TypeScript/wiki/FAQ
1014
1115
-->
1216

README.md

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
# TypeScript
33

4-
[![Join the chat at https://gitter.im/Microsoft/TypeScript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5-
[![Build Status](https://travis-ci.org/microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript)
4+
[![Join the chat at https://gitter.im/microsoft/TypeScript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5+
[![Build Status](https://travis-ci.org/microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/microsoft/TypeScript)
66
[![VSTS Build Status](https://dev.azure.com/typescript/TypeScript/_apis/build/status/Typescript/node10)](https://dev.azure.com/typescript/TypeScript/_build/latest?definitionId=4&view=logs)
77
[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
88
[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)
@@ -27,14 +27,14 @@ npm install -g typescript@next
2727

2828
## Contribute
2929

30-
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
31-
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
32-
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
30+
There are many ways to [contribute](https://github.com/microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
31+
* [Submit bugs](https://github.com/microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
32+
* Review the [source code changes](https://github.com/microsoft/TypeScript/pulls).
3333
* Engage with other TypeScript users and developers on [StackOverflow](https://stackoverflow.com/questions/tagged/typescript).
3434
* Join the [#typescript](https://twitter.com/search?q=%23TypeScript) discussion on Twitter.
35-
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
36-
* Read the language specification ([docx](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.docx?raw=true),
37-
[pdf](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.pdf?raw=true), [md](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md)).
35+
* [Contribute bug fixes](https://github.com/microsoft/TypeScript/blob/master/CONTRIBUTING.md).
36+
* Read the language specification ([docx](https://github.com/microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.docx?raw=true),
37+
[pdf](https://github.com/microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.pdf?raw=true), [md](https://github.com/microsoft/TypeScript/blob/master/doc/spec.md)).
3838

3939
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see
4040
the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected])
@@ -44,7 +44,7 @@ with any additional questions or comments.
4444

4545
* [Quick tutorial](https://www.typescriptlang.org/docs/tutorial.html)
4646
* [Programming handbook](https://www.typescriptlang.org/docs/handbook/basic-types.html)
47-
* [Language specification](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md)
47+
* [Language specification](https://github.com/microsoft/TypeScript/blob/master/doc/spec.md)
4848
* [Homepage](https://www.typescriptlang.org/)
4949

5050
## Building
@@ -54,7 +54,7 @@ In order to build the TypeScript compiler, ensure that you have [Git](https://gi
5454
Clone a copy of the repo:
5555

5656
```bash
57-
git clone https://github.com/Microsoft/TypeScript.git
57+
git clone https://github.com/microsoft/TypeScript.git
5858
```
5959

6060
Change to the TypeScript directory:
@@ -73,17 +73,25 @@ npm install
7373
Use one of the following to build and test:
7474

7575
```
76-
gulp local # Build the compiler into built/local
77-
gulp clean # Delete the built compiler
78-
gulp LKG # Replace the last known good with the built one.
79-
# Bootstrapping step to be executed when the built compiler reaches a stable state.
80-
gulp tests # Build the test infrastructure using the built compiler.
81-
gulp runtests # Run tests using the built compiler and test infrastructure.
82-
# You can override the host or specify a test for this command.
83-
# Use --host=<hostName> or --tests=<testPath>.
84-
gulp baseline-accept # This replaces the baseline test results with the results obtained from gulp runtests.
85-
gulp lint # Runs tslint on the TypeScript source.
86-
gulp help # List the above commands.
76+
gulp local # Build the compiler into built/local.
77+
gulp clean # Delete the built compiler.
78+
gulp LKG # Replace the last known good with the built one.
79+
# Bootstrapping step to be executed when the built compiler reaches a stable state.
80+
gulp tests # Build the test infrastructure using the built compiler.
81+
gulp runtests # Run tests using the built compiler and test infrastructure.
82+
# Some low-value tests are skipped when not on a CI machine - you can use the
83+
# --skipPercent=0 command to override this behavior and run all tests locally.
84+
# You can override the specific suite runner used or specify a test for this command.
85+
# Use --tests=<testPath> for a specific test and/or --runner=<runnerName> for a specific suite.
86+
# Valid runners include conformance, compiler, fourslash, project, user, and docker
87+
# The user and docker runners are extended test suite runners - the user runner
88+
# works on disk in the tests/cases/user directory, while the docker runner works in containers.
89+
# You'll need to have the docker executable in your system path for the docker runner to work.
90+
gulp runtests-parallel # Like runtests, but split across multiple threads. Uses a number of threads equal to the system
91+
# core count by default. Use --workers=<number> to adjust this.
92+
gulp baseline-accept # This replaces the baseline test results with the results obtained from gulp runtests.
93+
gulp lint # Runs tslint on the TypeScript source.
94+
gulp help # List the above commands.
8795
```
8896

8997

@@ -96,4 +104,4 @@ node built/local/tsc.js hello.ts
96104

97105
## Roadmap
98106

99-
For details on our planned features and future direction please refer to our [roadmap](https://github.com/Microsoft/TypeScript/wiki/Roadmap).
107+
For details on our planned features and future direction please refer to our [roadmap](https://github.com/microsoft/TypeScript/wiki/Roadmap).

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": "https://www.typescriptlang.org/",
5-
"version": "3.6.0",
5+
"version": "3.7.0",
66
"license": "Apache-2.0",
77
"description": "TypeScript is a language for application scale JavaScript development",
88
"keywords": [

scripts/build/options.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module.exports = minimist(process.argv.slice(2), {
1515
"r": "reporter",
1616
"c": "colors", "color": "colors",
1717
"skip-percent": "skipPercent",
18+
"skippercent": "skipPercent",
1819
"w": "workers",
1920
"f": "fix"
2021
},

scripts/open-cherry-pick-pr.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const userName = process.env.GH_USERNAME;
1111
const reviewers = process.env.REQUESTING_USER ? [process.env.REQUESTING_USER] : ["weswigham", "RyanCavanaugh"];
1212
const branchName = `pick/${process.env.SOURCE_ISSUE}/${process.env.TARGET_BRANCH}`;
1313
const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`;
14+
const produceLKG = !!process.env.PRODUCE_LKG;
1415

1516
async function main() {
1617
if (!process.env.TARGET_BRANCH) {
@@ -52,7 +53,16 @@ ${logText.trim()}`
5253
runSequence([
5354
["git", ["checkout", process.env.TARGET_BRANCH]], // checkout the target branch
5455
["git", ["checkout", "-b", branchName]], // create a new branch
55-
["git", ["cherry-pick", squashSha.trim()]], //
56+
["git", ["cherry-pick", squashSha.trim()]],
57+
]);
58+
if (produceLKG) {
59+
runSequence([
60+
["gulp", ["LKG"]],
61+
["git", ["add", "lib"]],
62+
["git", ["commit", "-m", `"Update LKG"`]]
63+
]);
64+
}
65+
runSequence([
5666
["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork
5767
["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch
5868
]);
@@ -71,7 +81,7 @@ ${logText.trim()}`
7181
base: process.env.TARGET_BRANCH,
7282
body:
7383
`This cherry-pick was triggerd by a request on https://github.com/Microsoft/TypeScript/pull/${process.env.SOURCE_ISSUE}
74-
Please review the diff and merge if no changes are unexpected.
84+
Please review the diff and merge if no changes are unexpected.${produceLKG ? ` An LKG update commit is included seperately from the base change.` : ""}
7585
You can view the cherry-pick log [here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary).
7686
7787
cc ${reviewers.map(r => "@" + r).join(" ")}`,

src/compiler/binder.ts

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ namespace ts {
227227
symbol.flags |= symbolFlags;
228228

229229
node.symbol = symbol;
230-
symbol.declarations = append(symbol.declarations, node);
230+
symbol.declarations = appendIfUnique(symbol.declarations, node);
231231

232232
if (symbolFlags & (SymbolFlags.Class | SymbolFlags.Enum | SymbolFlags.Module | SymbolFlags.Variable) && !symbol.exports) {
233233
symbol.exports = createSymbolTable();
@@ -737,6 +737,9 @@ namespace ts {
737737
case SyntaxKind.JSDocEnumTag:
738738
bindJSDocTypeAlias(node as JSDocTypedefTag | JSDocCallbackTag | JSDocEnumTag);
739739
break;
740+
case SyntaxKind.JSDocClassTag:
741+
bindJSDocClassTag(node as JSDocClassTag);
742+
break;
740743
// In source files and blocks, bind functions first to match hoisting that occurs at runtime
741744
case SyntaxKind.SourceFile: {
742745
bindEachFunctionsFirst((node as SourceFile).statements);
@@ -778,7 +781,7 @@ namespace ts {
778781
function isNarrowableReference(expr: Expression): boolean {
779782
return expr.kind === SyntaxKind.Identifier || expr.kind === SyntaxKind.ThisKeyword || expr.kind === SyntaxKind.SuperKeyword ||
780783
(isPropertyAccessExpression(expr) || isNonNullExpression(expr) || isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression) ||
781-
isElementAccessExpression(expr) && expr.argumentExpression &&
784+
isElementAccessExpression(expr) &&
782785
(isStringLiteral(expr.argumentExpression) || isNumericLiteral(expr.argumentExpression)) &&
783786
isNarrowableReference(expr.expression);
784787
}
@@ -1446,6 +1449,14 @@ namespace ts {
14461449
}
14471450
}
14481451

1452+
function bindJSDocClassTag(node: JSDocClassTag) {
1453+
bindEachChild(node);
1454+
const host = getHostSignatureFromJSDoc(node);
1455+
if (host && host.kind !== SyntaxKind.MethodDeclaration) {
1456+
addDeclarationToSymbol(host.symbol, host, SymbolFlags.Class);
1457+
}
1458+
}
1459+
14491460
function bindCallExpressionFlow(node: CallExpression) {
14501461
// If the target of the call expression is a function expression or arrow function we have
14511462
// an immediately invoked function expression (IIFE). Initialize the flowNode property to
@@ -1813,9 +1824,26 @@ namespace ts {
18131824
// typedef anchored to an A.B.C assignment - we need to bind into B's namespace under name C
18141825
const isTopLevel = isTopLevelNamespaceAssignment(declName.parent);
18151826
if (isTopLevel) {
1816-
bindPotentiallyMissingNamespaces(file.symbol, declName.parent, isTopLevel, !!findAncestor(declName, d => isPropertyAccessExpression(d) && d.name.escapedText === "prototype"));
1827+
bindPotentiallyMissingNamespaces(file.symbol, declName.parent, isTopLevel,
1828+
!!findAncestor(declName, d => isPropertyAccessExpression(d) && d.name.escapedText === "prototype"), /*containerIsClass*/ false);
18171829
const oldContainer = container;
1818-
container = isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
1830+
switch (getAssignmentDeclarationPropertyAccessKind(declName.parent)) {
1831+
case AssignmentDeclarationKind.ExportsProperty:
1832+
case AssignmentDeclarationKind.ModuleExports:
1833+
container = file;
1834+
break;
1835+
case AssignmentDeclarationKind.ThisProperty:
1836+
container = declName.parent.expression;
1837+
break;
1838+
case AssignmentDeclarationKind.PrototypeProperty:
1839+
container = (declName.parent.expression as PropertyAccessExpression).name;
1840+
break;
1841+
case AssignmentDeclarationKind.Property:
1842+
container = isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
1843+
break;
1844+
case AssignmentDeclarationKind.None:
1845+
return Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
1846+
}
18191847
declareModuleMember(typeAlias, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes);
18201848
container = oldContainer;
18211849
}
@@ -2510,6 +2538,7 @@ namespace ts {
25102538
constructorSymbol.members = constructorSymbol.members || createSymbolTable();
25112539
// It's acceptable for multiple 'this' assignments of the same identifier to occur
25122540
declareSymbol(constructorSymbol.members, constructorSymbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property);
2541+
addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, SymbolFlags.Class);
25132542
}
25142543
break;
25152544

@@ -2558,7 +2587,7 @@ namespace ts {
25582587
node.left.parent = node;
25592588
node.right.parent = node;
25602589
const lhs = node.left as PropertyAccessEntityNameExpression;
2561-
bindPropertyAssignment(lhs.expression, lhs, /*isPrototypeProperty*/ false);
2590+
bindPropertyAssignment(lhs.expression, lhs, /*isPrototypeProperty*/ false, /*containerIsClass*/ true);
25622591
}
25632592

25642593
function bindObjectDefinePrototypeProperty(node: BindableObjectDefinePropertyCall) {
@@ -2581,13 +2610,13 @@ namespace ts {
25812610
constructorFunction.parent = classPrototype;
25822611
classPrototype.parent = lhs;
25832612

2584-
bindPropertyAssignment(constructorFunction, lhs, /*isPrototypeProperty*/ true);
2613+
bindPropertyAssignment(constructorFunction, lhs, /*isPrototypeProperty*/ true, /*containerIsClass*/ true);
25852614
}
25862615

25872616
function bindObjectDefinePropertyAssignment(node: BindableObjectDefinePropertyCall) {
25882617
let namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]);
25892618
const isToplevel = node.parent.parent.kind === SyntaxKind.SourceFile;
2590-
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false);
2619+
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false, /*containerIsClass*/ false);
25912620
bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false);
25922621
}
25932622

@@ -2618,10 +2647,10 @@ namespace ts {
26182647
*/
26192648
function bindStaticPropertyAssignment(node: PropertyAccessEntityNameExpression) {
26202649
node.expression.parent = node;
2621-
bindPropertyAssignment(node.expression, node, /*isPrototypeProperty*/ false);
2650+
bindPropertyAssignment(node.expression, node, /*isPrototypeProperty*/ false, /*containerIsClass*/ false);
26222651
}
26232652

2624-
function bindPotentiallyMissingNamespaces(namespaceSymbol: Symbol | undefined, entityName: EntityNameExpression, isToplevel: boolean, isPrototypeProperty: boolean) {
2653+
function bindPotentiallyMissingNamespaces(namespaceSymbol: Symbol | undefined, entityName: EntityNameExpression, isToplevel: boolean, isPrototypeProperty: boolean, containerIsClass: boolean) {
26252654
if (isToplevel && !isPrototypeProperty) {
26262655
// make symbols or add declarations for intermediate containers
26272656
const flags = SymbolFlags.Module | SymbolFlags.Assignment;
@@ -2638,6 +2667,9 @@ namespace ts {
26382667
}
26392668
});
26402669
}
2670+
if (containerIsClass && namespaceSymbol) {
2671+
addDeclarationToSymbol(namespaceSymbol, namespaceSymbol.valueDeclaration, SymbolFlags.Class);
2672+
}
26412673
return namespaceSymbol;
26422674
}
26432675

@@ -2663,10 +2695,10 @@ namespace ts {
26632695
: propertyAccess.parent.parent.kind === SyntaxKind.SourceFile;
26642696
}
26652697

2666-
function bindPropertyAssignment(name: EntityNameExpression, propertyAccess: PropertyAccessEntityNameExpression, isPrototypeProperty: boolean) {
2698+
function bindPropertyAssignment(name: EntityNameExpression, propertyAccess: PropertyAccessEntityNameExpression, isPrototypeProperty: boolean, containerIsClass: boolean) {
26672699
let namespaceSymbol = lookupSymbolForPropertyAccess(name);
26682700
const isToplevel = isTopLevelNamespaceAssignment(propertyAccess);
2669-
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty);
2701+
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty, containerIsClass);
26702702
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
26712703
}
26722704

0 commit comments

Comments
 (0)