|
1 | | --- This will be restored after an update-stage0 |
2 | | --- import Lean.LibrarySuggestions |
3 | | --- import Lean.Meta.Basic |
| 1 | +import Lean.LibrarySuggestions |
| 2 | +import Lean.Meta.Basic |
4 | 3 |
|
5 | | --- /-! |
6 | | --- # Test that library suggestions persist across file boundaries |
| 4 | +/-! |
| 5 | +# Test that library suggestions persist across file boundaries |
7 | 6 |
|
8 | | --- This test verifies that the default library suggestion engine set in |
9 | | --- `Lean.LibrarySuggestions.Default` is correctly persisted when imported via `Lean.LibrarySuggestions`. |
| 7 | +This test verifies that the default library suggestion engine set in |
| 8 | +`Lean.LibrarySuggestions.Default` is correctly persisted when imported via `Lean.LibrarySuggestions`. |
10 | 9 |
|
11 | | --- We do NOT call `set_library_suggestions` in this file - the selector should |
12 | | --- already be set from importing Lean.LibrarySuggestions (which imports Default). |
13 | | --- -/ |
| 10 | +We do NOT call `set_library_suggestions` in this file - the selector should |
| 11 | +already be set from importing Lean.LibrarySuggestions (which imports Default). |
| 12 | +-/ |
14 | 13 |
|
15 | | --- /-- |
16 | | --- info: ✓ Selector registered in imported state |
17 | | --- --- |
18 | | --- info: ✓ getSelector succeeded |
19 | | --- -/ |
20 | | --- #guard_msgs in |
21 | | --- open Lean Lean.LibrarySuggestions in |
22 | | --- run_cmd do |
23 | | --- -- Check if a selector is registered |
24 | | --- let hasSelector := (librarySuggestionsExt.getState (← getEnv)).isSome |
25 | | --- if hasSelector then |
26 | | --- Lean.logInfo "✓ Selector registered in imported state" |
27 | | --- -- Try to retrieve the selector using getSelector |
28 | | --- Elab.Command.liftTermElabM do |
29 | | --- let selector? ← getSelector |
30 | | --- match selector? with |
31 | | --- | none => Lean.logInfo " ❌ getSelector returned none" |
32 | | --- | some _ => Lean.logInfo " ✓ getSelector succeeded" |
33 | | --- else |
34 | | --- Lean.logInfo "❌ No selector registered in imported state!" |
| 14 | +/-- |
| 15 | +info: ✓ Selector registered in imported state |
| 16 | +--- |
| 17 | +info: ✓ getSelector succeeded |
| 18 | +-/ |
| 19 | +#guard_msgs in |
| 20 | +open Lean Lean.LibrarySuggestions in |
| 21 | +run_cmd do |
| 22 | + -- Check if a selector is registered |
| 23 | + let hasSelector := (librarySuggestionsExt.getState (← getEnv)).isSome |
| 24 | + if hasSelector then |
| 25 | + Lean.logInfo "✓ Selector registered in imported state" |
| 26 | + -- Try to retrieve the selector using getSelector |
| 27 | + Elab.Command.liftTermElabM do |
| 28 | + let selector? ← getSelector |
| 29 | + match selector? with |
| 30 | + | none => Lean.logInfo " ❌ getSelector returned none" |
| 31 | + | some _ => Lean.logInfo " ✓ getSelector succeeded" |
| 32 | + else |
| 33 | + Lean.logInfo "❌ No selector registered in imported state!" |
35 | 34 |
|
36 | | --- -- These examples should work with grind +suggestions but not grind alone |
37 | | --- -- (proving that the suggestions engine is active and helping) |
| 35 | +-- These examples should work with grind +suggestions but not grind alone |
| 36 | +-- (proving that the suggestions engine is active and helping) |
38 | 37 |
|
39 | | --- example {x : Dyadic} {prec : Int} : x.roundDown prec ≤ x := by |
40 | | --- fail_if_success grind |
41 | | --- grind +suggestions |
| 38 | +example {x : Dyadic} {prec : Int} : x.roundDown prec ≤ x := by |
| 39 | + fail_if_success grind |
| 40 | + grind +suggestions |
42 | 41 |
|
43 | | --- example {x : Dyadic} {prec : Int} : (x.roundUp prec).precision ≤ some prec := by |
44 | | --- fail_if_success grind |
45 | | --- grind +suggestions |
| 42 | +example {x : Dyadic} {prec : Int} : (x.roundUp prec).precision ≤ some prec := by |
| 43 | + fail_if_success grind |
| 44 | + grind +suggestions |
0 commit comments