Skip to content

fix(semantic): narrow rawget doc-function guards - #1055

Merged
CppCXY merged 1 commit into
EmmyLuaLs:mainfrom
lewis6991:split/structural-query-state
May 6, 2026
Merged

CppCXY merged 1 commit into
EmmyLuaLs:mainfrom
lewis6991:split/structural-query-state

Conversation

@lewis6991

Copy link
Copy Markdown
Collaborator

Rawget guards already narrow matching index expressions when the callee
is the built-in signature. The same helper can be exposed through a
documented function field, where its return type is stored directly on
the doc function.

Handle std.RawGet returns from doc functions in guard flow so
utils.get(t, "x") narrows t.x like rawget(t, "x").

Rawget guards already narrow matching index expressions when the callee
is the built-in signature. The same helper can be exposed through a
documented function field, where its return type is stored directly on
the doc function.

Handle std.RawGet returns from doc functions in guard flow so
utils.get(t, "x") narrows t.x like rawget(t, "x").

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for type narrowing when using functions documented with std.RawGet as condition guards. It updates the call flow inference logic to handle LuaType::Call and adds a corresponding test case to verify that optional fields are correctly narrowed within conditional blocks. I have no feedback to provide as there were no review comments to evaluate.

@CppCXY
CppCXY merged commit db2caf7 into EmmyLuaLs:main May 6, 2026
16 checks passed
@lewis6991
lewis6991 deleted the split/structural-query-state branch May 7, 2026 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants