[PR #776] [MERGED] fix(semantics): isolate named function expression bindings #2234

Closed
opened 2026-10-16 21:16:02 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/776
Author: @rudycelekli
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @morluto

Base: main ← Head: fix/named-function-expression-environments-20261006


📝 Commits (1)

  • d407fbf fix(semantics): isolate named function expression bindings

📊 Changes

3 files changed (+149 additions, -11 deletions)

View changed files

➕ src/domain/javascriptSemanticAnalysis.function_names.test.ts (+54 -0)
📝 src/domain/javascriptSemanticAnalysis.ts (+34 -11)
➕ tests/acceptance/applications/javascriptFunctionNameCli.test.ts (+61 -0)

📄 Description

Summary

Give named function expressions their private name environment outside the parameter/body scope. The current analyzer combines the immutable expression name with a same-name parameter or local declaration, inventing recursive calls or losing a directly known local target.

Native reproduction

const task = function execute(execute) { return execute(); }; task(() => 'CALLBACK') returns CALLBACK in Node. The built public analyzer currently reports an exact recursive call to the named expression. After this fix the callback target remains unresolved, consistent with the existing conservative parameter input model.

A body-local var execute = () => 'LOCAL' now resolves to its local callable. Unshadowed recursion and the private name's visibility in parameter defaults remain controls; the name does not leak into the enclosing scope.

Verification

  • Before: nine regression failures and two passing controls across the IR and public CLI.
  • After: 215 focused semantic/graph and public CLI tests pass across 11 files.
  • npm run build:cached, npm run check, and npm run check:fast pass (125 lint warnings, zero errors).
  • Combined compatibility with independent parameter-expression environment fix #775: 231 tests across 14 files plus a native default-name/body-shadow check pass. These PRs share a source file but correct distinct runtime environments and are independently based on main.
  • Signed DCO head: d407fbf5f445735215517be41d37f1b70c8e4c1c.

No schema, provider, or packaged-artifact behavior changes are claimed. This does not claim complete ECMAScript binding or cross-function value analysis. Codex assisted on behalf of @rudycelekli with reproduction, implementation, tests, and an independent source review. Hosted CI runs separately.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/776 **Author:** [@rudycelekli](https://github.com/rudycelekli) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/named-function-expression-environments-20261006` --- ### 📝 Commits (1) - [`d407fbf`](https://github.com/morluto/rea/commit/d407fbf5f445735215517be41d37f1b70c8e4c1c) fix(semantics): isolate named function expression bindings ### 📊 Changes **3 files changed** (+149 additions, -11 deletions) <details> <summary>View changed files</summary> ➕ `src/domain/javascriptSemanticAnalysis.function_names.test.ts` (+54 -0) 📝 `src/domain/javascriptSemanticAnalysis.ts` (+34 -11) ➕ `tests/acceptance/applications/javascriptFunctionNameCli.test.ts` (+61 -0) </details> ### 📄 Description ## Summary Give named function expressions their private name environment outside the parameter/body scope. The current analyzer combines the immutable expression name with a same-name parameter or local declaration, inventing recursive calls or losing a directly known local target. ## Native reproduction `const task = function execute(execute) { return execute(); }; task(() => 'CALLBACK')` returns `CALLBACK` in Node. The built public analyzer currently reports an exact recursive call to the named expression. After this fix the callback target remains unresolved, consistent with the existing conservative parameter input model. A body-local `var execute = () => 'LOCAL'` now resolves to its local callable. Unshadowed recursion and the private name's visibility in parameter defaults remain controls; the name does not leak into the enclosing scope. ## Verification - Before: nine regression failures and two passing controls across the IR and public CLI. - After: 215 focused semantic/graph and public CLI tests pass across 11 files. - `npm run build:cached`, `npm run check`, and `npm run check:fast` pass (125 lint warnings, zero errors). - Combined compatibility with independent parameter-expression environment fix #775: 231 tests across 14 files plus a native default-name/body-shadow check pass. These PRs share a source file but correct distinct runtime environments and are independently based on main. - Signed DCO head: `d407fbf5f445735215517be41d37f1b70c8e4c1c`. No schema, provider, or packaged-artifact behavior changes are claimed. This does not claim complete ECMAScript binding or cross-function value analysis. Codex assisted on behalf of @rudycelekli with reproduction, implementation, tests, and an independent source review. Hosted CI runs separately. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:16:02 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2234
No description provided.