Skip to content

Commit 0609cb4

Browse files
committed
test(pm): pin the [-only guard with a brace a REFUSING call opened
Once the refusal stands on a closed vocabulary, `defineRegistry({` answers `unread` with the guard and without it, so the two cases that used to pin the guard went quiet about it — ablation green. A `{` opened by `.default(` is the shape where the guard is the only thing between the arm and a silence. Claude-Session: https://claude.ai/code/session_01AmH9bKvGoLjiY86Q4Z3og2 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5aca73c commit 0609cb4

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎scripts/pm/check-widening-tells.mjs‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1698,7 +1698,7 @@ const SELF_TEST_BATTERIES = Object.freeze({
16981698
'#18702 — a declaring factory PRIVATE to one file, resolved through its own DEFINITION': 54,
16991699
"#18721 — a hunk's LEADING CONTEXT is not a reason to abandon the parameter reading": 14,
17001700
'#19099 — the enclosing-delimiter walk says when it STOPPED READING and started guessing': 15,
1701-
'#19384 — a bare element is not a member until the hunk shows one of the four forms above it': 64,
1701+
'#19384 — a bare element is not a member until the hunk shows one of the four forms above it': 66,
17021702
});
17031703

17041704
// DELETING an entry silences that battery's floor exactly as effectively as
@@ -6056,6 +6056,15 @@ export function selfTest() {
60566056
const BRACE_IN_CALL = [CTX('export const registry = defineRegistry({'), CTX(' UserSchema,')];
60576057
t('⭐ a `{` frame a CALL opened carries that call\'s paren in its head — the `[`-only guard is what keeps the arm inside it `unread` instead of refused', enclosingDelimiters(BRACE_IN_CALL, 1).frames.at(-1)?.opener === '{' && enclosingDelimiters(BRACE_IN_CALL, 1).frames.at(-1)?.head.endsWith('(') && closedSetMembership(BRACE_IN_CALL, 1) === 'unread');
60586058
t('…and the ROW survives it, which is the half a reader-only case cannot pin', tells({ filename: 'packages/spec/src/a.zod.ts', patch: patchOf(3, '+export const registry = defineRegistry({', '+ UserSchema,') }).some((r) => r.line === 4 && r.tell === 'T2'));
6059+
// ⛔ …and the case that actually PINS the guard once the refusal is a closed
6060+
// vocabulary: `defineRegistry` is a name the vocabulary does not carry, so
6061+
// dropping the guard leaves that arm `unread` either way and the two cases
6062+
// above go quiet about it. The `{` has to be opened by a call this file DOES
6063+
// refuse on, and then the guard is the only thing between the arm and a
6064+
// silence.
6065+
const BRACE_IN_REFUSING_CALL = [CTX('export const S = z.object({}).default({'), CTX(' UserSchema,')];
6066+
t('⭐ a `{` frame opened by a REFUSING call is what the `[`-only guard exists for — without it the arm inside `.default({` would be swallowed, in the quiet direction', enclosingDelimiters(BRACE_IN_REFUSING_CALL, 1).frames.at(-1)?.opener === '{' && calleeOfFrameHead(enclosingDelimiters(BRACE_IN_REFUSING_CALL, 1).frames.at(-1)?.head) === 'default' && closedSetMembership(BRACE_IN_REFUSING_CALL, 1) === 'unread');
6067+
t('…and its ROW survives too', tells({ filename: 'packages/spec/src/a.zod.ts', patch: patchOf(3, '+export const S = z.object({}).default({', '+ UserSchema,') }).some((r) => r.line === 4 && r.tell === 'T2'));
60596068
// -- the refusal is a CALL, never "any head ending in `(`" -----------------
60606069
t('⭐ a GROUPING paren is not a call — `const X = ([` … `] as const)` is the fourth form wrapped, and it keeps its row', closedSetMembership([CTX('const X = (['), CTX(" 'read',")], 1) === 'unread');
60616070
t('…and the ROW survives it too', tells({ filename: 'packages/spec/src/a.zod.ts', patch: patchOf(3, '+const X = ([', "+ 'read',") }).some((r) => r.line === 4 && r.tell === 'T2'));

0 commit comments

Comments
 (0)