Skip to content

Fix UndefVarError(ImVec2) in generated pOut wrappers#20

Merged
JamesWrigley merged 1 commit into
JuliaImGui:masterfrom
aplavin:fix-imvec2-curly-rename
Jun 2, 2026
Merged

Fix UndefVarError(ImVec2) in generated pOut wrappers#20
JamesWrigley merged 1 commit into
JuliaImGui:masterfrom
aplavin:fix-imvec2-curly-rename

Conversation

@aplavin
Copy link
Copy Markdown
Contributor

@aplavin aplavin commented May 20, 2026

Depends on #19. Branched off aarch64-darwin-static-cfunc, so until #19 merges the diff shows all 6 commits; only the last two belong here. Diff cleans up automatically once #19 lands.

ImGuiTestEngine.GetWindowTitlebarPoint("any-window") (and GetPosOnVoid / GetMainMonitorWorkPos / GetMainMonitorWorkSize) throws UndefVarError: ImVec2not defined inImGuiTestEngine`` — src/wrapper.jl emits a bare `Ref{ImVec2}()` and `ImVec2` isn't bound at the wrapper module's scope. Bug pre-dates #19 — same four sites exist on `master`.

Root cause: the renamer in gen/generator.jl rewrites Im* symbols inside function-call args (@capture(x, f_(args__))) but skips curly type expressions like Ref{ImVec2}. The pOut boilerplate splices the raw ccall type into a curly, so the renamer never qualifies it.

Fix: symmetric elseif @capture(x, T_{params__}) branch with the same rewrite. Regenerating gives Ref{libig.ImVec2}() at the 4 load-bearing sites plus 16 cosmetic Ref{ImGuiTestRef}Ref{lib.ImGuiTestRef} rewrites (functionally identical via the existing top-of-file aliases).

@JamesWrigley
Copy link
Copy Markdown
Member

If it's only ImVec2 causing issues then I'd lean towards just adding it to the wrapper.jl preamble. I wonder if JET could detect this sort of thing, might be worth adding it to CI in the future.

Depends on #19. Branched off aarch64-darwin-static-cfunc, so until #19 merges the diff shows all 6 commits; only the last two belong here. Diff cleans up automatically once #19 lands.

This only happens if you set the target branch to the parent branch.

@aplavin aplavin force-pushed the fix-imvec2-curly-rename branch from e755c38 to c0d9043 Compare June 2, 2026 14:33
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 28.22%. Comparing base (a298c85) to head (3500e8a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #20      +/-   ##
==========================================
+ Coverage   26.14%   28.22%   +2.08%     
==========================================
  Files           5        5              
  Lines         960      960              
==========================================
+ Hits          251      271      +20     
+ Misses        709      689      -20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aplavin aplavin force-pushed the fix-imvec2-curly-rename branch from c0d9043 to 3500e8a Compare June 2, 2026 18:07
Copy link
Copy Markdown
Member

@JamesWrigley JamesWrigley left a comment

Choose a reason for hiding this comment

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

LGTM!

@JamesWrigley JamesWrigley merged commit 7bccc5a into JuliaImGui:master Jun 2, 2026
6 checks passed
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