fix: list the constants of the byte expansion of `String` literals in `Lean.Replay` and `lake check` The kernel now unfolds a `String` literal to `String.ofByteArray ⟨⟨[UInt8.ofNat b, ...]⟩⟩ (String.isValidUTF8 _)`, so `String.isValidUTF8` and `UInt8.ofNat` replace `String.ofList` and `Char.ofNat` among the constants that are replayed up front and that a `lake check` challenge must contain. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
diff --git a/src/Lean/Replay.lean b/src/Lean/Replay.lean index 6222aeb..27c7646 100644 --- a/src/Lean/Replay.lean +++ b/src/Lean/Replay.lean
@@ -202,12 +202,13 @@ remaining := remaining.insert n let (_, s) ← StateRefT'.run (s := { env, remaining }) do ReaderT.run (r := { newConstants }) do - -- The kernel unfolds string literals to `String.ofList [Char.ofNat n, ...]` + -- The kernel unfolds string literals to + -- `String.ofByteArray ⟨⟨[UInt8.ofNat b, ...]⟩⟩ (String.isValidUTF8 _)` -- (see `string_lit_to_constructor`), so these constants are needed to check any declaration -- that reduces a string literal, but `getUsedConstants` does not report them. -- Replay them (if present) before anything else. - replayConstant ``String.ofList - replayConstant ``Char.ofNat + replayConstant ``String.isValidUTF8 + replayConstant ``UInt8.ofNat for n in remaining do replayConstant n checkPostponedConstructors
diff --git a/src/lake/Lake/CLI/Check.lean b/src/lake/Lake/CLI/Check.lean index 67b4ec6..67a3464 100644 --- a/src/lake/Lake/CLI/Check.lean +++ b/src/lake/Lake/CLI/Check.lean
@@ -651,8 +651,11 @@ ``Nat.xor, ``Nat.shiftLeft, ``Nat.shiftRight, - ``String.ofList, - ``Char.ofNat, + ``String.isValidUTF8, + ``UInt8.ofNat, + ``UInt8, + ``ByteArray, + ``Array, ``List, ``eagerReduce, ``Nat,