Skip to content

Commit bbfb25f

Browse files
committed
Merge branch 'master' into add-unmeasurable-variance-kind
2 parents 33b6e42 + b010010 commit bbfb25f

File tree

215 files changed

+3589
-2606
lines changed

Some content is hidden

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

215 files changed

+3589
-2606
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ Run `gulp` to build a version of the compiler/language service that reflects cha
5959

6060
## Contributing bug fixes
6161

62-
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.
62+
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 (labelled ["help wanted"](https://github.com/Microsoft/TypeScript/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22)) 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.
6363

6464
## Contributing features
6565

66-
Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved (marked as "Milestone == Community" by a TypeScript coordinator with the message "Approved") in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted.
66+
Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved ([labelled "help wanted"](https://github.com/Microsoft/TypeScript/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) by a TypeScript project maintainer) in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted.
6767

6868
Design changes will not be accepted at this time. If you have a design change proposal, please log a suggestion issue.
6969

Gulpfile.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,10 @@ const configureInsiders = () => exec(process.execPath, ["scripts/configurePrerel
545545
task("configure-insiders", series(buildScripts, configureInsiders));
546546
task("configure-insiders").description = "Runs scripts/configurePrerelease.ts to prepare a build for insiders publishing";
547547

548+
const configureExperimental = () => exec(process.execPath, ["scripts/configurePrerelease.js", "experimental", "package.json", "src/compiler/core.ts"])
549+
task("configure-experimental", series(buildScripts, configureExperimental));
550+
task("configure-experimental").description = "Runs scripts/configurePrerelease.ts to prepare a build for experimental publishing";
551+
548552
const publishNightly = () => exec("npm", ["publish", "--tag", "next"]);
549553
task("publish-nightly", series(task("clean"), task("LKG"), task("clean"), task("runtests-parallel"), publishNightly));
550554
task("publish-nightly").description = "Runs `npm publish --tag next` to create a new nightly build on npm";

lib/tsserverlibrary.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ declare namespace ts {
626626
initializer?: Expression;
627627
}
628628
interface ObjectLiteralElement extends NamedDeclaration {
629-
_objectLiteralBrandBrand: any;
629+
_objectLiteralBrand: any;
630630
name?: PropertyName;
631631
}
632632
/** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */

lib/typescript.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ declare namespace ts {
626626
initializer?: Expression;
627627
}
628628
interface ObjectLiteralElement extends NamedDeclaration {
629-
_objectLiteralBrandBrand: any;
629+
_objectLiteralBrand: any;
630630
name?: PropertyName;
631631
}
632632
/** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */

lib/typescriptServices.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ declare namespace ts {
626626
initializer?: Expression;
627627
}
628628
interface ObjectLiteralElement extends NamedDeclaration {
629-
_objectLiteralBrandBrand: any;
629+
_objectLiteralBrand: any;
630630
name?: PropertyName;
631631
}
632632
/** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
"gulp-rename": "latest",
6969
"gulp-sourcemaps": "latest",
7070
"istanbul": "latest",
71-
"lodash": "^4.17.11",
7271
"merge2": "latest",
7372
"minimist": "latest",
7473
"mkdirp": "latest",

scripts/configurePrerelease.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function main(): void {
2222
}
2323

2424
const tag = args[0];
25-
if (tag !== "dev" && tag !== "insiders") {
25+
if (tag !== "dev" && tag !== "insiders" && tag !== "experimental") {
2626
throw new Error(`Unexpected tag name '${tag}'.`);
2727
}
2828

scripts/open-user-pr.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
/// <reference lib="esnext.asynciterable" />
22
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
3-
import cp = require("child_process");
43
import Octokit = require("@octokit/rest");
5-
6-
const opts = { timeout: 100_000, shell: true, stdio: "inherit" }
7-
function runSequence(tasks: [string, string[]][]) {
8-
for (const task of tasks) {
9-
console.log(`${task[0]} ${task[1].join(" ")}`);
10-
const result = cp.spawnSync(task[0], task[1], opts);
11-
if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && result.stderr.toString()}`);
12-
}
13-
}
4+
import {runSequence} from "./run-sequence";
145

156
function padNum(number: number) {
167
const str = "" + number;

scripts/run-sequence.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// @ts-check
2+
const cp = require("child_process");
3+
/**
4+
*
5+
* @param {[string, string[]][]} tasks
6+
* @param {cp.SpawnSyncOptions} opts
7+
*/
8+
function runSequence(tasks, opts = { timeout: 100000, shell: true, stdio: "inherit" }) {
9+
let lastResult;
10+
for (const task of tasks) {
11+
console.log(`${task[0]} ${task[1].join(" ")}`);
12+
const result = cp.spawnSync(task[0], task[1], opts);
13+
if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && result.stderr.toString()}`);
14+
lastResult = result;
15+
}
16+
return lastResult && lastResult.stdout && lastResult.stdout.toString();
17+
}
18+
19+
exports.runSequence = runSequence;
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
// @ts-check
2+
/// <reference lib="esnext.asynciterable" />
3+
const Octokit = require("@octokit/rest");
4+
const {runSequence} = require("./run-sequence");
5+
6+
/**
7+
* This program should be invoked as `node ./scripts/update-experimental-branches <GithubAccessToken> <Branch1> [Branch2] [...]`
8+
*/
9+
async function main() {
10+
const branchesRaw = process.argv[3];
11+
const branches = process.argv.slice(3);
12+
if (!branches.length) {
13+
throw new Error(`No experimental branches, aborting...`);
14+
}
15+
console.log(`Performing experimental branch updating and merging for branches ${branchesRaw}`);
16+
17+
const gh = new Octokit();
18+
gh.authenticate({
19+
type: "token",
20+
token: process.argv[2]
21+
});
22+
23+
// Fetch all relevant refs
24+
runSequence([
25+
["git", ["fetch", "origin", "master:master", ...branches.map(b => `${b}:${b}`)]]
26+
])
27+
28+
// Forcibly cleanup workspace
29+
runSequence([
30+
["git", ["clean", "-fdx"]],
31+
["git", ["checkout", "."]],
32+
["git", ["checkout", "master"]],
33+
]);
34+
35+
// Update branches
36+
for (const branch of branches) {
37+
// Checkout, then get the merge base
38+
const mergeBase = runSequence([
39+
["git", ["checkout", branch]],
40+
["git", ["merge-base", branch, "master"]],
41+
]);
42+
// Simulate the merge and abort if there are conflicts
43+
const mergeTree = runSequence([
44+
["git", ["merge-tree", mergeBase, branch, "master"]]
45+
]);
46+
if (mergeTree.indexOf(`===${"="}===`)) { // 7 equals is the center of the merge conflict marker
47+
const res = await gh.pulls.list({owner: "Microsoft", repo: "TypeScript", base: branch});
48+
if (res && res.data && res.data[0]) {
49+
const pr = res.data[0];
50+
await gh.issues.createComment({
51+
owner: "Microsoft",
52+
repo: "TypeScript",
53+
number: pr.number,
54+
body: `This PR is configured as an experiment, and currently has merge conflicts with master - please rebase onto master and fix the conflicts.`
55+
});
56+
}
57+
throw new Error(`Merge conflict detected on branch ${branch} with master`);
58+
}
59+
// Merge is good - apply a rebase and (force) push
60+
runSequence([
61+
["git", ["rebase", "master"]],
62+
["git", ["push", "-f", "-u", "origin", branch]],
63+
]);
64+
}
65+
66+
// Return to `master` and make a new `experimental` branch
67+
runSequence([
68+
["git", ["checkout", "master"]],
69+
["git", ["branch", "-D", "experimental"]],
70+
["git", ["checkout", "-b", "experimental"]],
71+
]);
72+
73+
// Merge each branch into `experimental` (which, if there is a conflict, we now know is from inter-experiment conflict)
74+
for (const branch of branches) {
75+
// Find the merge base
76+
const mergeBase = runSequence([
77+
["git", ["merge-base", branch, "experimental"]],
78+
]);
79+
// Simulate the merge and abort if there are conflicts
80+
const mergeTree = runSequence([
81+
["git", ["merge-tree", mergeBase, branch, "experimental"]]
82+
]);
83+
if (mergeTree.indexOf(`===${"="}===`)) { // 7 equals is the center of the merge conflict marker
84+
throw new Error(`Merge conflict detected on branch ${branch} with other experiment`);
85+
}
86+
// Merge (always producing a merge commit)
87+
runSequence([
88+
["git", ["merge", branch, "--no-ff"]],
89+
]);
90+
}
91+
// Every branch merged OK, force push the replacement `experimental` branch
92+
runSequence([
93+
["git", ["push", "-f", "-u", "origin", "experimental"]],
94+
]);
95+
}
96+
97+
main().catch(e => (console.error(e), process.exitCode = 2));

0 commit comments

Comments
 (0)