Title: `@inline never` is silently ignored and does not prevent inlining · Issue #131 · purescript-lua/purescript-lua · GitHub
Open Graph Title: `@inline never` is silently ignored and does not prevent inlining · Issue #131 · purescript-lua/purescript-lua
X Title: `@inline never` is silently ignored and does not prevent inlining · Issue #131 · purescript-lua/purescript-lua
Description: Summary The @inline
Open Graph Description: Summary The @inline
X Description: Summary The @inline <name> never pragma parses and is stored, but it has no effect on the optimizer. A binding annotated never is still inlined whenever the ordinary heuristics would inline i...
Opengraph URL: https://github.com/purescript-lua/purescript-lua/issues/131
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`@inline never` is silently ignored and does not prevent inlining","articleBody":"## Summary\n\nThe `@inline \u003cname> never` pragma parses and is stored, but it has no effect on the optimizer. A binding annotated `never` is still inlined whenever the ordinary heuristics would inline it, so the annotation is a no-op. `@inline always` works as expected; only `never` is broken.\n\nThis surfaced while documenting the inliner for #44.\n\n## Root cause\n\nThe annotation reaches the optimizer as the binding expression's annotation, but the only place that reads it, `isInlinableExpr` in `Backend.IR.Optimizer`, collapses `Just Never` to the same result as `Nothing`:\n\n```haskell\nhasInlineAnnotation = getAnn >>> \\case\n Just Always -> True\n Just Never -> False\n Nothing -> False\n```\n\nBoth inlining sites then decide with `isInlinableExpr expr || \u003cused once>`:\n\n- `optimizeModule` inlines a top-level binding if `isInlinableExpr expr || isUsedOnce qname`.\n- `inlineLocalBindings` inlines a `let` binding if `isInlinableExpr inlinee || countFreeRef name body == 1`.\n\nSo a `never`-annotated binding that is a reference, a small literal, or used exactly once is still inlined through the second disjunct. `Never` never blocks anything `Nothing` would not also allow.\n\n## Expected\n\n`@inline \u003cname> never` should prevent that binding from being inlined, overriding both the `isInlinableExpr` heuristic and the single-use rule.\n\n## Suggested fix\n\nTreat `Just Never` as a veto at both inlining sites (for example a shared `getAnn expr == Just Never` guard that short-circuits the whole decision), and update `Note [Inline annotations and inlining heuristics]`, which currently documents the broken behavior.\n\nA regression test should assert that a `never`-annotated, single-use binding is left in place by the optimizer.\n","author":{"url":"https://github.com/Unisay","@type":"Person","name":"Unisay"},"datePublished":"2026-06-25T19:01:09Z","url":"https://github.com/purescript-lua/purescript-lua/issues/131"}
| 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:9dbdcf5a-e33c-d63e-63fe-83eae15c949c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA3C:213839:A390D1:D4B1B6:6B00E455 |
| html-safe-nonce | 325e3d9d100057762346adeefc5ce8333e94f9fcdc61ac15d4c1e156f8375930 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTNDOjIxMzgzOTpBMzkwRDE6RDRCMUI2OjZCMDBFNDU1IiwidmlzaXRvcl9pZCI6IjQ4MTQ2OTQ4MDQ4ODM1NjM2MDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e0eacdec44ac063d510d84ef60bebb5a8268594e335445abd02bac6586615ed3 |
| hovercard-subject-tag | issue:4746641543 |
| 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/131/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7acb7cfd28a228a3613b9fff68b5ae8a4a361d2ed63bb54ad126b46178c7e06f/purescript-lua/purescript-lua/issues/131 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7acb7cfd28a228a3613b9fff68b5ae8a4a361d2ed63bb54ad126b46178c7e06f/purescript-lua/purescript-lua/issues/131 |
| og:image:alt | Summary The @inline |
| 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 | 27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14 |
| 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 | 624179fb8b88d26ba5bba08894eb60a1c5a1d93d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width