Prerequisites
Description
Imports providing a typeclass instance are incorrectly removed by shake when the instance is resolved via
inferInstanceAs rather than by direct name reference. Minimal example provided in https://github.com/bryangingechen/shake-bug-inferInstanceAs .
Context
Found while running lake shake against mathlib4. Zulip thread.
Steps to Reproduce
git clone https://github.com/bryangingechen/shake-bug-inferInstanceAs && cd shake-bug-inferInstanceAs
lake build: succeeds
lake shake --fix
lake build: now fails
Expected behavior: Such imports should not be removed.
Actual behavior: Imports are removed, breaking the build.
Versions
v4.30.0-rc1
Impact
Add π to issues you consider important. If others are impacted by this issue, please ask them to add π to it.
Prerequisites
https://github.com/leanprover/lean4/issues
Avoid dependencies to Mathlib or Batteries.
v4.30.0-rc1 andnightly-2026-04-15`)Description
Imports providing a typeclass instance are incorrectly removed by
shakewhen the instance is resolved viainferInstanceAsrather than by direct name reference. Minimal example provided in https://github.com/bryangingechen/shake-bug-inferInstanceAs .Context
Found while running
lake shakeagainstmathlib4. Zulip thread.Steps to Reproduce
git clone https://github.com/bryangingechen/shake-bug-inferInstanceAs && cd shake-bug-inferInstanceAslake build: succeedslake shake --fixlake build: now failsExpected behavior: Such imports should not be removed.
Actual behavior: Imports are removed, breaking the build.
Versions
v4.30.0-rc1
Impact
Add π to issues you consider important. If others are impacted by this issue, please ask them to add π to it.