lean4-htt/src/Lean
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
..
Compiler fix: actively ignore borrow annotations for export functions (#12952) 2026-03-17 17:22:56 +00:00
Data feat: update RPC wire format (#12905) 2026-03-13 23:46:16 +00:00
DocString fix: error messages from Verso docstring parser (#12372) 2026-02-07 07:49:06 +00:00
Elab fix: segfault in idbgClientLoop (#12940) 2026-03-17 10:55:54 +00:00
Language chore: shake core (#12276) 2026-02-05 09:10:32 +00:00
LibrarySuggestions chore: fix core after rebootstrap 2026-02-25 11:40:02 +01:00
Linter fix: make option linter.unusedSimpArgs respect linter.all (#12560) 2026-03-09 15:12:02 +00:00
Meta fix: re-privatize constant name prefix in realizeConst to avoid diamond import collisions (#12964) 2026-03-18 13:54:50 +00:00
Parser feat: support expected type annotation in doPatDecl (#12866) 2026-03-10 11:42:03 +00:00
ParserCompiler
PrettyPrinter refactor: ignore borrow annotations at export/extern tricks (#12930) 2026-03-16 10:03:40 +00:00
Server chore: use IO.CancelToken in server (#12948) 2026-03-17 16:48:53 +00:00
Util feat: add structured TraceResult to TraceData (#12698) 2026-03-10 02:42:57 +00:00
Widget feat: use StateT.run instead of function application (#5121) 2026-03-03 03:12:26 +00:00
AddDecl.lean feat: add structured TraceResult to TraceData (#12698) 2026-03-10 02:42:57 +00:00
Attributes.lean fix: run @[init] declarations in declaration order (#12221) 2026-01-29 15:32:56 +00:00
AuxRecursor.lean perf: add introSubstEq shortcut (#12190) 2026-01-28 12:33:14 +00:00
BuiltinDocAttr.lean
Class.lean feat: add [univ_out_params] (#12423) 2026-02-11 15:42:00 +00:00
Compiler.lean feat: unify name demangling with single Lean implementation (#12539) 2026-03-06 12:29:35 +00:00
CoreM.lean doc: remark that CoreM.toIO ignores ctx.initHeartbeats (#12859) 2026-03-10 21:34:11 +00:00
Data.lean feat: persistent hash map iterator (#12852) 2026-03-10 08:01:32 +00:00
Declaration.lean chore: shake core (#12276) 2026-02-05 09:10:32 +00:00
DeclarationRange.lean
DefEqAttrib.lean
DocString.lean
Elab.lean feat: idbg interactive debug expression evaluator (#12648) 2026-02-23 17:22:44 +00:00
EnvExtension.lean fix: mark failed compilations as noncomputable (#12625) 2026-02-23 09:18:21 +00:00
Environment.lean refactor: ignore borrow annotations at export/extern tricks (#12930) 2026-03-16 10:03:40 +00:00
ErrorExplanation.lean chore: shake core (#12276) 2026-02-05 09:10:32 +00:00
Exception.lean refactor: move error explanation text to the manual (#11688) 2025-12-26 17:14:58 +00:00
Expr.lean chore: use terminology "non-recursive structure" instead of "struct-like" (#12749) 2026-03-09 03:44:38 +00:00
ExtraModUses.lean
HeadIndex.lean
Hygiene.lean
IdentifierSuggestion.lean chore: shake core (#12276) 2026-02-05 09:10:32 +00:00
ImportingFlag.lean
InternalExceptionId.lean chore: shake core (#12276) 2026-02-05 09:10:32 +00:00
KeyedDeclsAttribute.lean
LabelAttribute.lean chore: shake core (#12276) 2026-02-05 09:10:32 +00:00
Level.lean chore: deprecate levelZero and levelOne (#12720) 2026-03-04 01:03:08 +00:00
LibrarySuggestions.lean
Linter.lean
LoadDynlib.lean chore: shake core (#12276) 2026-02-05 09:10:32 +00:00
LocalContext.lean feat: new, extensible do elaborator (#12459) 2026-02-21 17:17:29 +00:00
Log.lean refactor: move error explanation text to the manual (#11688) 2025-12-26 17:14:58 +00:00
Message.lean feat: add structured TraceResult to TraceData (#12698) 2026-03-10 02:42:57 +00:00
Meta.lean refactor: have telescope support (#11914) 2026-01-06 19:20:25 +00:00
MetavarContext.lean perf: fuse fvar substitution into instantiateMVars (#12233) 2026-03-09 17:05:21 +00:00
Modifiers.lean
MonadEnv.lean refactor: ignore borrow annotations at export/extern tricks (#12930) 2026-03-16 10:03:40 +00:00
Namespace.lean
OriginalConstKind.lean refactor: move getOriginalConstKind? into its own module to avoid future import cycle (#12265) 2026-02-01 16:18:51 +00:00
Parser.lean
ParserCompiler.lean chore: shake core (#12276) 2026-02-05 09:10:32 +00:00
PrettyPrinter.lean chore: shake core (#12276) 2026-02-05 09:10:32 +00:00
PrivateName.lean
ProjFns.lean fix: detect stuck mvars through auxiliary parent projections (#12564) 2026-02-23 03:46:06 +00:00
ReducibilityAttrs.lean refactor: rename instance_reducible to implicit_reducible (#12567) 2026-02-18 22:19:16 +00:00
Replay.lean feat: add declaration name to leanchecker error messages (#12525) 2026-02-17 16:08:00 +00:00
ReservedNameAction.lean feat: add structured TraceResult to TraceData (#12698) 2026-03-10 02:42:57 +00:00
ResolveName.lean fix: pretty printing of constants should consider accessibility of names (#12654) 2026-02-25 00:01:19 +00:00
Runtime.lean
ScopedEnvExtension.lean
Server.lean
Setup.lean perf: separate meta and non-meta initializers (#12016) 2026-02-26 08:05:19 +00:00
Shell.lean refactor: port EmitC to LCNF (#12781) 2026-03-11 14:19:54 +00:00
Structure.lean chore: use terminology "non-recursive structure" instead of "struct-like" (#12749) 2026-03-09 03:44:38 +00:00
SubExpr.lean chore: shake core (#12276) 2026-02-05 09:10:32 +00:00
Syntax.lean feat: order instances for string positions (#12641) 2026-02-23 08:20:52 +00:00
ToExpr.lean
ToLevel.lean fix: address unused simp theorem warnings (#12829) 2026-03-06 23:12:03 +00:00
Util.lean
Widget.lean