Skip to content

detect/prevent Func vs input name collisions#9145

Open
abadams wants to merge 1 commit into
mainfrom
abadams/fix_9142
Open

detect/prevent Func vs input name collisions#9145
abadams wants to merge 1 commit into
mainfrom
abadams/fix_9142

Conversation

@abadams
Copy link
Copy Markdown
Member

@abadams abadams commented May 16, 2026

ImageParams already reserved their name against later Funcs via a call to unique_name in create_func. Do the same for Generator Input<>s (buffer and scalar) in init_internals, and for named scalar Params in check_name, so that a Func declared with the same name afterward gets a distinct unique name instead of silently colliding.

For the reverse ordering (Func declared first), names can no longer be fixed up, so validate the environment in build_environment: if any input buffer or scalar Parameter shares a name with a Func in the pipeline, emit a clear user_error instead of crashing deeper in lowering. Output Funcs are exempted from the buffer check since they intentionally share names with their output buffer Parameters.

Tests:

  • correctness/input_func_name_unique exercises the three reservation paths (ImageParam, Param, Generator Input).
  • error/input_{buffer,param,generator_buffer}_func_name_collision exercises the three error paths.

Fixes #9142

ImageParams already reserved their name against later Funcs via a call
to unique_name in create_func. Do the same for Generator Input<>s
(buffer and scalar) in init_internals, and for named scalar Params in
check_name, so that a Func declared with the same name afterward gets
a distinct unique name instead of silently colliding.

For the reverse ordering (Func declared first), names can no longer be
fixed up, so validate the environment in build_environment: if any
input buffer or scalar Parameter shares a name with a Func in the
pipeline, emit a clear user_error instead of crashing deeper in
lowering. Output Funcs are exempted from the buffer check since they
intentionally share names with their output buffer Parameters.

Tests:
- correctness/input_func_name_unique exercises the three reservation
  paths (ImageParam, Param, Generator Input<Buffer>).
- error/input_{buffer,param,generator_buffer}_func_name_collision
  exercises the three error paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2026

Codecov Report

❌ Patch coverage is 74.35897% with 10 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@a56dea6). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/FindCalls.cpp 72.97% 8 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9145   +/-   ##
=======================================
  Coverage        ?   69.77%           
=======================================
  Files           ?      255           
  Lines           ?    77564           
  Branches        ?    18545           
=======================================
  Hits            ?    54124           
  Misses          ?    17951           
  Partials        ?     5489           

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Func and ImageParam names don't get uniqued against each other

2 participants