lean4-htt/tests/pkg/issue12825/Repro
Joachim Breitner b2aec782eb
fix: re-privatize constant name prefix in realizeConst to avoid diamond import collisions (#12964)
This PR fixes an issue where `realizeConst` would generate auxiliary
declarations
(like `_sparseCasesOn`) using the original defining module's private
name prefix
rather than the realizing module's prefix. When two modules
independently realized
the same imported constant, they produced identically-named auxiliary
declarations,
causing "environment already contains" errors on diamond import.

The fix re-privatizes the constant name under the current module before
passing it
to `withDeclNameForAuxNaming`, ensuring each realizing module generates
distinctly
named auxiliary declarations.

Fixes #12825

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 13:54:50 +00:00
..
A.lean fix: re-privatize constant name prefix in realizeConst to avoid diamond import collisions (#12964) 2026-03-18 13:54:50 +00:00
B1.lean fix: re-privatize constant name prefix in realizeConst to avoid diamond import collisions (#12964) 2026-03-18 13:54:50 +00:00
B2.lean fix: re-privatize constant name prefix in realizeConst to avoid diamond import collisions (#12964) 2026-03-18 13:54:50 +00:00
C.lean fix: re-privatize constant name prefix in realizeConst to avoid diamond import collisions (#12964) 2026-03-18 13:54:50 +00:00