Title: isUsedOnce counts references against stale bindings during inlining · Issue #143 · purescript-lua/purescript-lua · GitHub
Open Graph Title: isUsedOnce counts references against stale bindings during inlining · Issue #143 · purescript-lua/purescript-lua
X Title: isUsedOnce counts references against stale bindings during inlining · Issue #143 · purescript-lua/purescript-lua
Description: Problem The reference counts that isUsedOnce consults are computed from the original uberModuleBindings (captured by the closure), while the fold's accumulator already contains bindings with earlier substitutions applied. Exports are cou...
Open Graph Description: Problem The reference counts that isUsedOnce consults are computed from the original uberModuleBindings (captured by the closure), while the fold's accumulator already contains bindings with earlie...
X Description: Problem The reference counts that isUsedOnce consults are computed from the original uberModuleBindings (captured by the closure), while the fold's accumulator already contains bindings with ea...
Opengraph URL: https://github.com/purescript-lua/purescript-lua/issues/143
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"isUsedOnce counts references against stale bindings during inlining","articleBody":"## Problem\n\nThe reference counts that `isUsedOnce` consults are computed from the original `uberModuleBindings` (captured by the closure), while the fold's accumulator already contains bindings with earlier substitutions applied. Exports are counted from the accumulated (fresh) versions, so the count mixes stale and fresh sources.\n\nThis cannot produce dangling references (substitution replaces all occurrences regardless of the count), but it can misjudge use-once: a large expression can get inlined into several sites (code bloat), or a legitimate inline can be skipped. `idempotently` partially self-corrects on later iterations, at the cost of extra passes.\n\n## Approach\n\nCompute counts against the same view of the module that the substitutions target. This falls out naturally from the incremental-counting rework in #142.\n\n## Prerequisites / Relations\n\nInliner correctness bug, found during the 2026-07-02 backend audit. Distinct from but closely related to #142: the fix for this defect falls out of #142's incremental-counting rework. Independent in the dependency graph.\n\n## Verification / Measurement\n\nUse-once is judged against the current (post-substitution) view of the module, not a stale snapshot: a binding genuinely referenced once is inlined, and one referenced at multiple sites is no longer duplicated into all of them due to a miscount.\n","author":{"url":"https://github.com/Unisay","@type":"Person","name":"Unisay"},"datePublished":"2026-07-02T18:17:50Z","url":"https://github.com/purescript-lua/purescript-lua/issues/143"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3e67701f-eadf-6288-b67a-4f89932b667e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BDB8:2E124E:6042C7:7C9942:6B00DFBB |
| html-safe-nonce | 30f72f538aa04b9a6ddccc1d577319ba7ce6b5d6a18a99e667cc09637d22f053 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREI4OjJFMTI0RTo2MDQyQzc6N0M5OTQyOjZCMDBERkJCIiwidmlzaXRvcl9pZCI6Ijg1NDg1MzQzMzg4NzcxODU5NzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fb37c3ff11017d4cd17fdd39e0c7de14cb39364d86f0a7b0ef470880995bc320 |
| hovercard-subject-tag | issue:4797139404 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/purescript-lua/purescript-lua/143/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6301ff05429e4ace7ec78e94fabaccd9585571ec362fe1bac96c243c508db4dd/purescript-lua/purescript-lua/issues/143 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6301ff05429e4ace7ec78e94fabaccd9585571ec362fe1bac96c243c508db4dd/purescript-lua/purescript-lua/issues/143 |
| og:image:alt | Problem The reference counts that isUsedOnce consults are computed from the original uberModuleBindings (captured by the closure), while the fold's accumulator already contains bindings with earlie... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Unisay |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| turbo-cache-control | no-preview |
| go-import | github.com/purescript-lua/purescript-lua git https://github.com/purescript-lua/purescript-lua.git |
| octolytics-dimension-user_id | 131581790 |
| octolytics-dimension-user_login | purescript-lua |
| octolytics-dimension-repository_id | 587200487 |
| octolytics-dimension-repository_nwo | purescript-lua/purescript-lua |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 587200487 |
| octolytics-dimension-repository_network_root_nwo | purescript-lua/purescript-lua |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width