mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 17:44:27 +00:00
fix(javascript): retain iterator prototype effects through array spreads (#12563)
* fix(javascript): retain ambient references through array spread * fix(javascript): retain spread aliases to inherited iterator close hooks * fix(javascript): share dense inline array spread layout (#12564) * fix(javascript): share dense inline array spread layout * fix(javascript): report exhausted dense spread layout allowance * fix(javascript): preserve getter receivers through array spread * fix(javascript): guard native array iteration from opaque global code * test(javascript): group spread receiver controls * test(javascript): preserve getter fixture tuple types * fix(javascript): preserve spread slot projections for iterator receivers
This commit is contained in:
1 parent
1a070dee80
commit
7cb3f1090c
20 files changed
+907
-98
No files matched your search
@@ -149,6 +149,46 @@ it("projects bounded alias selection as a resource-limit unknown", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
["a bounded inline spread", "[...[1]]", 1, true],
|
||||
["a backed inline spread", "[...[1]]", 2, false],
|
||||
[
|
||||
"an unsupported spread after a backed spread",
|
||||
"[...[1], ...opaque]",
|
||||
2,
|
||||
false,
|
||||
],
|
||||
["a second inline spread", "[...[1], ...[2]]", 2, true],
|
||||
] as const)(
|
||||
"reports the alias selection limit only when it blocks %s",
|
||||
(_name, array, aliasSelections, bounded) => {
|
||||
const source = `export const answer = ${array};`;
|
||||
const ir = analyzeJavaScriptSemantics(source, {
|
||||
alias_selections: aliasSelections,
|
||||
});
|
||||
const graph = graphFor(source, ir);
|
||||
const unknown = graph.unknowns.find(
|
||||
({ reason, detail }) =>
|
||||
reason === "resource-limit" &&
|
||||
/Alias selection expansion/u.test(detail),
|
||||
);
|
||||
if (bounded) {
|
||||
expect(ir.coverage).toMatchObject({
|
||||
status: "partial",
|
||||
resourceLimits: ["alias-selections"],
|
||||
});
|
||||
expect(unknown?.detail).toContain(
|
||||
`semantic_precision.alias_selections=${aliasSelections}`,
|
||||
);
|
||||
} else {
|
||||
expect(ir.coverage.resourceLimits ?? []).not.toContain(
|
||||
"alias-selections",
|
||||
);
|
||||
expect(unknown).toBeUndefined();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
it.each([
|
||||
["plain export", "const answer = 42; export { answer };", 0],
|
||||
["aliased export", "const answer = 42; export { answer as result };", 0],
|
||||
|
||||
Reference in new issue
Block a user