Skip to content

Analyze more complex factory functions - #99

Merged
fantazio merged 3 commits into
LexiFi:masterfrom
fantazio:factory
Aug 22, 2026
Merged

Analyze more complex factory functions#99
fantazio merged 3 commits into
LexiFi:masterfrom
fantazio:factory

Conversation

@fantazio

Copy link
Copy Markdown
Collaborator

Fix #67

Factory function's methods were only analyzed when the function returned a immediate object in a single branch.
Now, functions with branches and intermediate bindings to the returned object are tolerated.

The tests for the factory_fun_indir limitation have been enhanced, are now passing and have been moved to code_constructs. The documentation is updated to reflect the fix and reference the examples in the Factory Function's documentation.

The limitation was only testing for a single unused method. Now it tests
methods unused, used locally, and methods used outside the factory.
In `add_var`, new expr constructs are now traversed to link the locally
defined return value to the new value, and explore the branches on ifs,
matches and tries.

In `repr_exp`, `Texp_let` is not traversed.

As a result, the FP/FN of the limitation are fixes.
It is referenced by the factory function documentation, and not a
limitation anymore. The tests have been moved accordingly.
@fantazio
fantazio merged commit 5cc6553 into LexiFi:master Aug 22, 2026
5 checks passed
@fantazio
fantazio deleted the factory branch August 22, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Methods are not analyzed if a factory function's object is bound before returning

1 participant