Skip to content

Commit 481094b

Browse files
Fix sensitivity to comments and whitespaces in the header
1 parent 405c080 commit 481094b

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

REPL/Frontend.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def processInput (input : String) (cmdState? : Option Command.State)
7878
match cmdState? with
7979
| none => do
8080
let (header, parserState, messages) ← Parser.parseHeader inputCtx
81-
let importKey := (input.take parserState.pos.byteIdx).trim
81+
let importKey := toString header.raw -- do not contain comments and whitespace
8282
match headerCache.get? importKey with
8383
| some cachedHeaderState => do
8484
-- Header is cached, use it as the base command state

test/Mathlib/test/incrementality.expected.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,5 @@
6666
"data": "9227465"}],
6767
"env": 1}
6868

69+
{"env": 2}
70+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{"cmd": "import Mathlib\ntheorem mathd_numbertheory_188 : Nat.gcd 180 168 = 12 := by norm_num\ndef fib : Nat → Nat\n | 0 => 0\n | 1 => 1\n | n + 2 => fib (n + 1) + fib n\n\n#eval fib 35\ntheorem foo : n = n := by\n rfl", "allTactics": true}
22

33
{"cmd": "import Mathlib\ntheorem mathd_numbertheory_188 : Nat.gcd 180 168 = 12 := by norm_num\ndef fib : Nat → Nat\n | 0 => 0\n | 1 => 1\n | n + 2 => fib (n + 1) + fib n\n\n#eval fib 35\ntheorem foo2 : n = n+0 := by\n rfl", "allTactics": true}
4+
5+
{"cmd": "import Mathlib\n-- comment to test if header is reused even when a comment is added"}

0 commit comments

Comments
 (0)