Skip to content

Commit 2231c00

Browse files
authored
prevent unnecessary compilation while defining Base.TOML.ValidSigs (#57747)
Decreases the invalidation count on running the following code from 219 to 191: ```julia struct I <: Integer end Base.Int(::I) = 7 ```
1 parent e14fb0c commit 2231c00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

base/toml_parser.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ isvalid_hex(c::Char) = isdigit(c) || ('a' <= c <= 'f') || ('A' <= c <= 'F')
770770
isvalid_oct(c::Char) = '0' <= c <= '7'
771771
isvalid_binary(c::Char) = '0' <= c <= '1'
772772

773-
const ValidSigs = Union{typeof.([isvalid_hex, isvalid_oct, isvalid_binary, isdigit])...}
773+
const ValidSigs = Union{typeof(isvalid_hex), typeof(isvalid_oct), typeof(isvalid_binary), typeof(isdigit)}
774774
# This function eats things accepted by `f` but also allows eating `_` in between
775775
# digits. Returns if it ate at lest one character and if it ate an underscore
776776
function accept_batch_underscore(l::Parser, f::ValidSigs, fail_if_underscore=true)::Err{Tuple{Bool, Bool}}

0 commit comments

Comments
 (0)