Skip to content

Commit 9f47415

Browse files
committed
Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint
2 parents ab28ee7 + 3e68561 commit 9f47415

372 files changed

Lines changed: 5855 additions & 3125 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.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ tests/webTestServer.js.map
3434
tests/webhost/*.d.ts
3535
tests/webhost/webtsc.js
3636
tests/cases/**/*.js
37+
!tests/cases/docker/*.js/
3738
tests/cases/**/*.js.map
3839
*.config
3940
scripts/debug.bat

Gulpfile.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,8 @@ task("runtests").flags = {
404404
" --no-lint": "Disables lint",
405405
" --timeout=<ms>": "Overrides the default test timeout.",
406406
" --built": "Compile using the built version of the compiler.",
407+
" --shards": "Total number of shards running tests (default: 1)",
408+
" --shardId": "1-based ID of this shard (default: 1)",
407409
}
408410

409411
const runTestsParallel = () => runConsoleTests("built/local/run.js", "min", /*runInParallel*/ true, /*watchMode*/ false);
@@ -419,6 +421,8 @@ task("runtests-parallel").flags = {
419421
" --timeout=<ms>": "Overrides the default test timeout.",
420422
" --built": "Compile using the built version of the compiler.",
421423
" --skipPercent=<number>": "Skip expensive tests with <percent> chance to miss an edit. Default 5%.",
424+
" --shards": "Total number of shards running tests (default: 1)",
425+
" --shardId": "1-based ID of this shard (default: 1)",
422426
};
423427

424428
task("diff", () => exec(getDiffTool(), [refBaseline, localBaseline], { ignoreExitCode: true }));

scripts/build/options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const os = require("os");
55
/** @type {CommandLineOptions} */
66
module.exports = minimist(process.argv.slice(2), {
77
boolean: ["debug", "dirty", "inspect", "light", "colors", "lint", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built"],
8-
string: ["browser", "tests", "host", "reporter", "stackTraceLimit", "timeout"],
8+
string: ["browser", "tests", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"],
99
alias: {
1010
"b": "browser",
1111
"d": "debug", "debug-brk": "debug",

scripts/build/tests.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode,
3636
const testConfigFile = "test.config";
3737
const failed = cmdLineOptions.failed;
3838
const keepFailed = cmdLineOptions.keepFailed;
39+
const shards = +cmdLineOptions.shards || undefined;
40+
const shardId = +cmdLineOptions.shardId || undefined;
3941
if (!cmdLineOptions.dirty) {
4042
await cleanTestDirs();
4143
cancelToken.throwIfCancellationRequested();
@@ -63,8 +65,8 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode,
6365
testTimeout = 400000;
6466
}
6567

66-
if (tests || runners || light || testTimeout || taskConfigsFolder || keepFailed || skipPercent !== undefined) {
67-
writeTestConfigFile(tests, runners, light, skipPercent, taskConfigsFolder, workerCount, stackTraceLimit, testTimeout, keepFailed);
68+
if (tests || runners || light || testTimeout || taskConfigsFolder || keepFailed || skipPercent !== undefined || shards || shardId) {
69+
writeTestConfigFile(tests, runners, light, skipPercent, taskConfigsFolder, workerCount, stackTraceLimit, testTimeout, keepFailed, shards, shardId);
6870
}
6971

7072
const colors = cmdLineOptions.colors;
@@ -165,8 +167,10 @@ exports.cleanTestDirs = cleanTestDirs;
165167
* @param {string} [stackTraceLimit]
166168
* @param {string | number} [timeout]
167169
* @param {boolean} [keepFailed]
170+
* @param {number | undefined} [shards]
171+
* @param {number | undefined} [shardId]
168172
*/
169-
function writeTestConfigFile(tests, runners, light, skipPercent, taskConfigsFolder, workerCount, stackTraceLimit, timeout, keepFailed) {
173+
function writeTestConfigFile(tests, runners, light, skipPercent, taskConfigsFolder, workerCount, stackTraceLimit, timeout, keepFailed, shards, shardId) {
170174
const testConfigContents = JSON.stringify({
171175
test: tests ? [tests] : undefined,
172176
runners: runners ? runners.split(",") : undefined,
@@ -177,7 +181,9 @@ function writeTestConfigFile(tests, runners, light, skipPercent, taskConfigsFold
177181
taskConfigsFolder,
178182
noColor: !cmdLineOptions.colors,
179183
timeout,
180-
keepFailed
184+
keepFailed,
185+
shards,
186+
shardId
181187
});
182188
log.info("Running tests with config: " + testConfigContents);
183189
fs.writeFileSync("test.config", testConfigContents);

scripts/open-user-pr.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference lib="esnext.asynciterable" />
2+
/// <reference lib="es2015.promise" />
23
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
34
import Octokit = require("@octokit/rest");
45
import {runSequence} from "./run-sequence";
@@ -29,7 +30,7 @@ gh.authenticate({
2930
token: process.argv[2]
3031
});
3132
gh.pulls.create({
32-
owner: process.env.TARGET_FORK,
33+
owner: process.env.TARGET_FORK!,
3334
repo: "TypeScript",
3435
maintainer_can_modify: true,
3536
title: `🤖 User test baselines have changed` + (process.env.TARGET_BRANCH ? ` for ${process.env.TARGET_BRANCH}` : ""),
@@ -45,9 +46,9 @@ cc ${reviewers.map(r => "@" + r).join(" ")}`,
4546
console.log(`Pull request ${num} created.`);
4647
if (!process.env.SOURCE_ISSUE) {
4748
await gh.pulls.createReviewRequest({
48-
owner: process.env.TARGET_FORK,
49+
owner: process.env.TARGET_FORK!,
4950
repo: "TypeScript",
50-
number: num,
51+
pull_number: num,
5152
reviewers,
5253
});
5354
}

scripts/update-experimental-branches.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,23 @@ const { runSequence } = require("./run-sequence");
77
const triggeredPR = process.env.SOURCE_ISSUE || process.env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER;
88

99
/**
10-
* This program should be invoked as `node ./scripts/update-experimental-branches <GithubAccessToken> <PR1> [PR2] [...]`
11-
* The order PR numbers are passed controls the order in which they are merged together.
10+
* This program should be invoked as `node ./scripts/update-experimental-branches <GithubAccessToken>`
1211
* TODO: the following is racey - if two experiment-enlisted PRs trigger simultaneously and witness one another in an unupdated state, they'll both produce
1312
* a new experimental branch, but each will be missing a change from the other. There's no _great_ way to fix this beyond setting the maximum concurrency
1413
* of this task to 1 (so only one job is allowed to update experiments at a time).
1514
*/
1615
async function main() {
17-
const prnums = process.argv.slice(3);
18-
if (!prnums.length) {
19-
return; // No enlisted PRs, nothing to update
20-
}
21-
if (triggeredPR && !prnums.some(n => n === triggeredPR)) {
16+
const gh = new Octokit({
17+
auth: process.argv[2]
18+
});
19+
const prnums = (await gh.issues.listForRepo({
20+
labels: "typescript@experimental",
21+
sort: "created",
22+
state: "open",
23+
owner: "Microsoft",
24+
repo: "TypeScript",
25+
})).data.filter(i => !!i.pull_request).map(i => i.number);
26+
if (triggeredPR && !prnums.some(n => n === +triggeredPR)) {
2227
return; // Only have work to do for enlisted PRs
2328
}
2429
console.log(`Performing experimental branch updating and merging for pull requests ${prnums.join(", ")}`);
@@ -34,9 +39,6 @@ async function main() {
3439
["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork
3540
]);
3641

37-
const gh = new Octokit({
38-
auth: process.argv[2]
39-
});
4042
for (const numRaw of prnums) {
4143
const num = +numRaw;
4244
if (num) {

src/compiler/binder.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ namespace ts {
274274
if (isStringOrNumericLiteralLike(nameExpression)) {
275275
return escapeLeadingUnderscores(nameExpression.text);
276276
}
277+
if (isSignedNumericLiteral(nameExpression)) {
278+
return tokenToString(nameExpression.operator) + nameExpression.operand.text as __String;
279+
}
277280

278281
Debug.assert(isWellKnownSymbolSyntactically(nameExpression));
279282
return getPropertyNameForKnownSymbolName(idText((<PropertyAccessExpression>nameExpression).name));

0 commit comments

Comments
 (0)