lean4-htt/tests/elab/string_cases.lean
Sebastian Ullrich 8dc4c16fce
fix: correct String cases codegen to use String.toByteArray (#13242)
This PR fixes the compiler handling of pattern matching on the `String`
constructor to conform to the new `String` representation.
2026-04-02 08:17:20 +00:00

10 lines
266 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Test that pattern matching on the `String.ofByteArray` constructor works correctly
-- at runtime.
def getBytes (s : String) : ByteArray :=
match s with
| ⟨bs, _⟩ => bs
#eval getBytes "hello" |>.size
#eval getBytes "" |>.size
#eval getBytes "α" |>.size