Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em committed Jan 30, 2025
1 parent f434d67 commit 62b4ae0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ImportGraph/RequiredModules.lean
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ partial def Environment.transitivelyRequiredModules' (env : Environment) (module
if verbose then
IO.println s!"Processing module {m}"
let mut r : BitVec N := 0
for n in env.header.moduleData[((env.header.moduleNames.indexOf? m).map Fin.val).getD 0]!.constNames do
for n in env.header.moduleData[(env.header.moduleNames.idxOf? m).getD 0]!.constNames do
if ! n.isInternal then
-- This is messy: Mathlib is big enough that writing a recursive function causes a stack overflow.
-- So we use an explicit stack instead. We visit each constant twice:
Expand Down Expand Up @@ -140,7 +140,7 @@ partial def Environment.transitivelyRequiredModules' (env : Environment) (module
return result
where
toBitVec {N : Nat} (s : NameSet) : BitVec N :=
s.fold (init := 0) (fun b n => b ||| BitVec.twoPow _ (((env.header.moduleNames.indexOf? n).map Fin.val).getD 0))
s.fold (init := 0) (fun b n => b ||| BitVec.twoPow _ ((env.header.moduleNames.idxOf? n).getD 0))
toNameSet {N : Nat} (b : BitVec N) : NameSet :=
env.header.moduleNames.zipIdx.foldl (init := {}) (fun s (n, i) => if b.getLsbD i then s.insert n else s)

Expand Down

0 comments on commit 62b4ae0

Please sign in to comment.