diff --git a/base/strings/unicode.jl b/base/strings/unicode.jl index cc02412925d14..b659ec080680b 100644 --- a/base/strings/unicode.jl +++ b/base/strings/unicode.jl @@ -157,15 +157,15 @@ function utf8proc_decompose(str, options, buffer, nwords, chartransform::typeof( ret < 0 && utf8proc_error(ret) return ret end -function utf8proc_decompose(str, options, buffer, nwords, chartransform::T) where T - ret = ccall(:utf8proc_decompose_custom, Int, (Ptr{UInt8}, Int, Ptr{UInt8}, Int, Cint, Ptr{Cvoid}, Ref{T}), +function utf8proc_decompose(str, options, buffer, nwords, chartransform::F) where F + ret = ccall(:utf8proc_decompose_custom, Int, (Ptr{UInt8}, Int, Ptr{UInt8}, Int, Cint, Ptr{Cvoid}, Ref{F}), str, sizeof(str), buffer, nwords, options, - @cfunction(utf8proc_custom_func, UInt32, (UInt32, Ref{T})), chartransform) + @cfunction(utf8proc_custom_func, UInt32, (UInt32, Ref{F})), chartransform) ret < 0 && utf8proc_error(ret) return ret end -function utf8proc_map(str::Union{String,SubString{String}}, options::Integer, chartransform=identity) +function utf8proc_map(str::Union{String,SubString{String}}, options::Integer, chartransform::F = identity) where F nwords = utf8proc_decompose(str, options, C_NULL, 0, chartransform) buffer = Base.StringVector(nwords*4) nwords = utf8proc_decompose(str, options, buffer, nwords, chartransform) @@ -184,7 +184,7 @@ const _julia_charmap = Dict{UInt32,UInt32}( 0x210F => 0x0127, ) -utf8proc_map(s::AbstractString, flags::Integer, chartransform=identity) = utf8proc_map(String(s), flags, chartransform) +utf8proc_map(s::AbstractString, flags::Integer, chartransform::F = identity) where F = utf8proc_map(String(s), flags, chartransform) # Documented in Unicode module function normalize(