Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(ci): ignore angle brackets inside braced const expressions

Steven Enamakelb460de6e6e67
diff --git a/scripts/__tests__/process-statics.test.mjs b/scripts/__tests__/process-statics.test.mjs
index d3affcc86b..6a312df1e0 100644
--- a/scripts/__tests__/process-statics.test.mjs
+++ b/scripts/__tests__/process-statics.test.mjs
@@ -122,7 +122,10 @@ test("const generic equality and function arrows do not terminate a type", () =>
);
});
test("comparisons and shifts inside const blocks are not generic brackets", () => {
- assert.equal(scan("static X: Wrapper<{1 << 2}, {1 < 2}> = x;")[0].type, "Wrapper<{1<<2},{1<2}>");
+ assert.equal(
+ scan("static X: Wrapper<{1 << 2}, {1 < 2}> = x;")[0].type,
+ "Wrapper<{1<<2},{1<2}>",
+ );
});
test("repository scan reads the merge base, enforces records, and fails without history", () => {
const root = mkdtempSync(join(tmpdir(), "process-statics-"));
diff --git a/scripts/ci/check-process-statics.mjs b/scripts/ci/check-process-statics.mjs
index a2e7a59075..7c2b0146cc 100644
--- a/scripts/ci/check-process-statics.mjs
+++ b/scripts/ci/check-process-statics.mjs
@@ -28,6 +28,8 @@ export function declarations(text, file) {
for (; end < code.length; end++) {
const char = code[end];
if (!stack.length && (char === "=" || char === ";")) break;
+ // Operators inside a braced const expression are not type brackets.
+ if ((char === "<" || char === ">") && stack.includes("{")) continue;
if ("<([{".includes(char)) stack.push(char);
else if (">)]}".includes(char) && stack.length) {
// An arrow inside a function type is not a generic closing bracket.