Files
scriptc/tests/corpus/3059-arguments-property-names.ts
Chris TateandArtem Gurtovoi c1634d4167 fix: distinguish arguments property names from reads (#475)
* fix: distinguish arguments property names from reads

- Share one runtime arguments scan across type mapping and call lowering.
- Add Node differential coverage for names in keys, types, bindings, and labels.

Fixes #431

Co-authored-by: Artem Gurtovoi <1233869+temich@users.noreply.github.com>

* test: record TypeScript 7 parity for arguments properties

- Add the new corpus case to the preflight and module order baseline.

Fixes #431

Co-authored-by: Artem Gurtovoi <1233869+temich@users.noreply.github.com>

---------

Co-authored-by: Artem Gurtovoi <1233869+temich@users.noreply.github.com>
2026-09-26 17:07:06 -05:00

38 lines
1.0 KiB
TypeScript

// Property names in an arrow body are not reads of the enclosing arguments object.
interface Options { keys: string[]; arguments: string[] }
const make = (): { arguments: number } => ({ arguments: 1 });
console.log("literal", make().arguments);
const count = (options: Options): number => options.keys.length + options.arguments.length;
const later = (): number => count({ keys: ["a"], arguments: ["b", "c"] });
console.log("options", later());
const unpack = (): number => {
const { arguments: value } = { arguments: 4 };
return value;
};
console.log("binding", unpack());
const typed = (): number => {
const value: { arguments: number } = { arguments: 5 };
return value.arguments;
};
console.log("type", typed());
const withMethod = (): number => {
const value = { arguments(): number { return 6; } };
return value.arguments();
};
console.log("method", withMethod());
const withLabel = (): number => {
let result = 0;
arguments: {
result = 7;
break arguments;
}
return result;
};
console.log("label", withLabel());