mirror of
https://github.com/morluto/rea.git
synced 2026-11-18 20:53:00 +00:00
fix: integrate 14 approved fix PRs (668,671,673,675,678-681,685-690) (#705)
* fix(javascript): preserve array index positions Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(javascript): respect object property overwrite order Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * test(javascript): cover uncertain spread discriminants Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(javascript): keep nonfinite values outside JSON lattice Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(dotnet): keep non-CIL method implementations unknown Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * test(package): separate CIL reconstruction from native imports Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(javascript): invalidate values on nontrivial binding writes Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(artifacts): align native DMG mount and detach lifecycle Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(browser): retain all literal worker import arguments Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(native): preserve final demangled symbol whitespace Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(dotnet): preserve C identifier underscores in native matching Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(browser): respect metadata key and overwrite semantics Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(javascript): keep optional parameter input unknown Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(dotnet): report observed method metadata changes Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * docs(dotnet): synchronize generated conformance skill digest Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(browser): reject malformed indexed source-map offsets Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(native): preserve numeric-looking Mach-O identifiers Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * docs: regenerate catalogs for integrated fix batch * docs: regenerate catalogs after merging main (#702) --------- Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> Co-authored-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com>
This commit is contained in:
1 parent
5bcb6645b5
commit
cf061159ab
32 files changed
+797
-73
No files matched your search
@@ -290,3 +290,186 @@ describe("primitive addition values", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("array positional value recovery", () => {
|
||||
it("keeps holes at their actual destructuring indices", () => {
|
||||
const ir = analyzeJavaScriptSemantics(`
|
||||
const list = ["zero", , "two"];
|
||||
const [first, second, third] = list;
|
||||
`);
|
||||
expect(topLevelBinding(ir, "first").value).toEqual({
|
||||
status: "literal",
|
||||
value: "zero",
|
||||
});
|
||||
expect(topLevelBinding(ir, "second").value.status).toBe("unknown");
|
||||
expect(topLevelBinding(ir, "third").value).toEqual({
|
||||
status: "literal",
|
||||
value: "two",
|
||||
});
|
||||
});
|
||||
|
||||
it("projects canonical array indices without treating arbitrary strings as indices", () => {
|
||||
const ir = analyzeJavaScriptSemantics(`
|
||||
const list = ["zero", "one"];
|
||||
const numeric = list[1];
|
||||
const quoted = list["1"];
|
||||
const leadingZero = list["01"];
|
||||
const negative = list[-1];
|
||||
`);
|
||||
for (const name of ["numeric", "quoted"])
|
||||
expect(topLevelBinding(ir, name).value).toEqual({
|
||||
status: "literal",
|
||||
value: "one",
|
||||
});
|
||||
for (const name of ["leadingZero", "negative"])
|
||||
expect(topLevelBinding(ir, name).value.status).toBe("unknown");
|
||||
});
|
||||
|
||||
it("does not shift trailing values across an unknown spread", () => {
|
||||
const ir = analyzeJavaScriptSemantics(`
|
||||
const values = ["first", ...unknownValues, "last"];
|
||||
const [first, second] = values;
|
||||
`);
|
||||
expect(topLevelBinding(ir, "first").value).toEqual({
|
||||
status: "literal",
|
||||
value: "first",
|
||||
});
|
||||
expect(topLevelBinding(ir, "second").value.status).toBe("unknown");
|
||||
});
|
||||
});
|
||||
|
||||
describe("object value overwrite boundaries", () => {
|
||||
it("uses the last named property and keeps later exact overwrites", () => {
|
||||
const ir = analyzeJavaScriptSemantics(`
|
||||
const duplicate = { key: "old", key: "new" };
|
||||
const selected = duplicate.key;
|
||||
const later = { key: "old", ...unknownObject, key: "final" };
|
||||
const final = later.key;
|
||||
`);
|
||||
expect(topLevelBinding(ir, "selected").value).toEqual({
|
||||
status: "literal",
|
||||
value: "new",
|
||||
});
|
||||
expect(topLevelBinding(ir, "final").value).toEqual({
|
||||
status: "literal",
|
||||
value: "final",
|
||||
});
|
||||
});
|
||||
it("does not retain an exact earlier value after an unknown overwrite", () => {
|
||||
const ir = analyzeJavaScriptSemantics(`
|
||||
const spread = { key: "old", ...unknownObject };
|
||||
const dynamic = { key: "old", [unknownKey]: "new" };
|
||||
const method = { key: "old", key() { return "new"; } };
|
||||
const spreadValue = spread.key;
|
||||
const dynamicValue = dynamic.key;
|
||||
const methodValue = method.key;
|
||||
`);
|
||||
for (const name of ["spreadValue", "dynamicValue", "methodValue"])
|
||||
expect(topLevelBinding(ir, name).value.status).toBe("unknown");
|
||||
});
|
||||
it("admits literal computed keys while excluding prototype setters", () => {
|
||||
const ir = analyzeJavaScriptSemantics(`
|
||||
const object = { ["key"]: "value", __proto__: { prototype: true } };
|
||||
const selected = object.key;
|
||||
const prototype = object.__proto__;
|
||||
`);
|
||||
expect(topLevelBinding(ir, "selected").value).toEqual({
|
||||
status: "literal",
|
||||
value: "value",
|
||||
});
|
||||
expect(topLevelBinding(ir, "prototype").value.status).toBe("unknown");
|
||||
});
|
||||
});
|
||||
|
||||
it("retains shorthand __proto__ as an own data property", () => {
|
||||
const ir = analyzeJavaScriptSemantics(`
|
||||
const __proto__ = "own";
|
||||
const object = { __proto__ };
|
||||
const selected = object.__proto__;
|
||||
`);
|
||||
expect(topLevelBinding(ir, "selected").value).toEqual({
|
||||
status: "literal",
|
||||
value: "own",
|
||||
});
|
||||
});
|
||||
|
||||
describe("nonfinite static values", () => {
|
||||
it.each(['+"not-a-number"', '-"not-a-number"', "1e308 + 1e308", "1e309"])(
|
||||
"keeps %s unknown instead of publishing a non-JSON number",
|
||||
(expression) => {
|
||||
const ir = analyzeJavaScriptSemantics(`const answer = ${expression};`);
|
||||
expect(topLevelBinding(ir, "answer").value.status).toBe("unknown");
|
||||
},
|
||||
);
|
||||
it("does not collapse an uncertain nonfinite branch to its finite alternative", () => {
|
||||
const ir = analyzeJavaScriptSemantics(
|
||||
'const answer = condition ? 1 : +"invalid";',
|
||||
);
|
||||
expect(topLevelBinding(ir, "answer").value.status).toBe("ambiguous");
|
||||
});
|
||||
});
|
||||
|
||||
describe("binding write invalidation", () => {
|
||||
it.each([
|
||||
"let value = 1; value++; const observed = value;",
|
||||
"let value = 1; --value; const observed = value;",
|
||||
'let value = "old"; [value] = ["new"]; const observed = value;',
|
||||
'let value = "old"; ({key: value} = {key: "new"}); const observed = value;',
|
||||
'let value = "old"; for (value of ["new"]) {} const observed = value;',
|
||||
'let value = "old"; for (value in {new: true}) {} const observed = value;',
|
||||
])("does not retain an exact initializer across %s", (source) => {
|
||||
const ir = analyzeJavaScriptSemantics(source);
|
||||
expect(topLevelBinding(ir, "observed").value.status).toBe("ambiguous");
|
||||
expect(
|
||||
topLevelBinding(ir, "value").definitions.some(
|
||||
({ kind }) => kind === "assignment",
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("does not treat destructuring keys or member owners as assigned bindings", () => {
|
||||
const ir = analyzeJavaScriptSemantics(`
|
||||
const key = "stable";
|
||||
const owner = "stable";
|
||||
let target = "old";
|
||||
({key: target} = {key: "new"});
|
||||
({owner: object.slot} = {owner: "new"});
|
||||
const preservedKey = key;
|
||||
const preservedOwner = owner;
|
||||
`);
|
||||
for (const name of ["preservedKey", "preservedOwner"])
|
||||
expect(topLevelBinding(ir, name).value).toEqual({
|
||||
status: "literal",
|
||||
value: "stable",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("JavaScript semantic analysis: unknown default inputs", () => {
|
||||
it.each([
|
||||
'function launch(mode = "safe") { return mode; }',
|
||||
'function launch({ mode } = { mode: "safe" }) { return mode; }',
|
||||
'function launch([mode] = ["safe"]) { return mode; }',
|
||||
])("does not assume an optional argument is omitted: %s", (source) => {
|
||||
const ir = analyzeJavaScriptSemantics(source);
|
||||
expect(onlyCallable(ir, "launch").returnSites[0]?.value.status).toBe(
|
||||
"unknown",
|
||||
);
|
||||
});
|
||||
|
||||
it("preserves known declaration inputs and unknown catch bindings", () => {
|
||||
const ir = analyzeJavaScriptSemantics(`
|
||||
const { mode: retained = "fallback" } = { mode: "actual" };
|
||||
function caught() {
|
||||
try { risky(); } catch ({ message = "fallback" }) { return message; }
|
||||
}
|
||||
`);
|
||||
expect(topLevelBinding(ir, "retained").value).toMatchObject({
|
||||
status: "literal",
|
||||
value: "actual",
|
||||
});
|
||||
expect(onlyCallable(ir, "caught").returnSites[0]?.value.status).toBe(
|
||||
"unknown",
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user