Skip to content

Commit

Permalink
Better support for old Lean
Browse files Browse the repository at this point in the history
  • Loading branch information
david-christiansen committed Aug 9, 2024
1 parent 23583f8 commit fd30933
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Extract.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Copyright (c) 2023-2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import SubVerso.Compat
import SubVerso.Examples.Env

open Lean
Expand All @@ -13,7 +14,7 @@ def main : (args : List String) → IO UInt32
try
initSearchPath (← findSysroot)
let modName := mod.toName
let env ← importModules #[{module := modName, runtimeOnly := false}] {}
let env ← SubVerso.Compat.importModules #[{module := modName, runtimeOnly := false}] {}
let modExamples := highlighted.getState env
let useful := relevant modName modExamples
let exJson := Json.mkObj useful
Expand Down
3 changes: 3 additions & 0 deletions src/compat/SubVerso/Compat.lean
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ open Command in
elab "%if_bound" x:ident cmd:command : command => do
if (← getEnv).contains x.getId then elabCommand cmd

def importModules (imports : Array Import) (opts : Options) (trustLevel : UInt32 := 0) : IO Environment :=
Lean.importModules (%first_succeeding [imports, imports.toList]) opts (trustLevel := trustLevel)

def mkRefIdentFVar [Monad m] [MonadEnv m] (id : FVarId) : m Lean.Lsp.RefIdent := do
pure %first_succeeding [
.fvar (← getEnv).mainModule id,
Expand Down

0 comments on commit fd30933

Please sign in to comment.