chore: add private getUtf8Byte' to Init.Meta (#10140)

This PR adds a private `Lean.Name.getUtf8Byte'` to `Init.Meta` for a
future PR that optimizes `Lean.Name.escapePart`.
`Lean.Name.getUtf8Byte'` should be replaced with `String.getUtf8Byte`
once the string refactor is through.
This commit is contained in:
Marc Huisinga 2025-08-26 18:54:02 +02:00 committed by GitHub
parent 425bebe99e
commit 2324c0939d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View file

@ -131,6 +131,12 @@ def isInaccessibleUserName : Name → Bool
| Name.num p _ => isInaccessibleUserName p
| _ => false
-- FIXME: `getUtf8Byte` is in `Init.Data.String.Extra`, which causes an import cycle with
-- `Init.Meta`. Moving `getUtf8Byte` up to `Init.Data.String.Basic` creates another import cycle.
-- Please replace this definition with `getUtf8Byte` when the string refactor is through.
@[extern "lean_string_get_byte_fast"]
private opaque getUtf8Byte' (s : @& String) (n : Nat) (h : n < s.utf8ByteSize) : UInt8
/--
Creates a round-trippable string name component if possible, otherwise returns `none`.
Names that are valid identifiers are not escaped, and otherwise, if they do not contain `»`, they are escaped.

View file

@ -1,5 +1,7 @@
#include "util/options.h"
// Please update stage0, dear CI
namespace lean {
options get_default_options() {
options opts;