diff --git a/base/coreio.jl b/base/coreio.jl index b5c543a25d5ad..de2e4669250b6 100644 --- a/base/coreio.jl +++ b/base/coreio.jl @@ -1,5 +1,8 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license +function print end +typeof(print).name.max_methods = UInt8(1) + print(x) = print(stdout, x) print(x1, x2) = print(stdout, x1, x2) println(x) = print(stdout, x, "\n") diff --git a/base/io.jl b/base/io.jl index 0f13e59baea8d..df1145a4ceb5f 100644 --- a/base/io.jl +++ b/base/io.jl @@ -66,6 +66,7 @@ false ``` """ function isopen end +typeof(isopen).name.max_methods = UInt8(1) """ close(io::IO) @@ -83,6 +84,7 @@ closed IO does not cause undefined behaviour. See also: [`isopen`](@ref) """ function close end +typeof(close).name.max_methods = UInt8(1) """ closewrite(stream) @@ -110,6 +112,7 @@ julia> read(io, String) ``` """ function closewrite end +typeof(closewrite).name.max_methods = UInt8(1) """ flush(io::IO) @@ -119,6 +122,7 @@ This has a default implementation `flush(::IO) = nothing`, so may be called in generic IO code. """ function flush end +typeof(flush).name.max_methods = UInt8(1) """ bytesavailable(io) @@ -134,6 +138,7 @@ julia> bytesavailable(io) ``` """ function bytesavailable end +typeof(bytesavailable).name.max_methods = UInt8(1) """ readavailable(stream) @@ -147,8 +152,11 @@ data has already been buffered. The result is a `Vector{UInt8}`. should generally be used instead. """ function readavailable end +typeof(readavailable).name.max_methods = UInt8(1) function isexecutable end +typeof(isexecutable).name.max_methods = UInt8(1) + """ isreadable(io)::Bool @@ -219,6 +227,7 @@ true ``` """ function eof end +typeof(eof).name.max_methods = UInt8(1) function copy end function wait_readnb end @@ -318,6 +327,7 @@ Base.RefValue{MyStruct}(MyStruct(42.0)) ``` """ function write end +typeof(write).name.max_methods = UInt8(1) read(s::IO, ::Type{UInt8}) = error(typeof(s)," does not support byte I/O") write(s::IO, x::UInt8) = error(typeof(s)," does not support byte I/O") @@ -530,6 +540,7 @@ read(filename::AbstractString, ::Type{T}) where {T} = open(io->read(io, T), conv Read binary data from an I/O stream or file, filling in `array`. """ function read! end +typeof(read!).name.max_methods = UInt8(1) read!(filename::AbstractString, a) = open(io->read!(io, a), convert(String, filename)::String) diff --git a/base/strings/annotated_io.jl b/base/strings/annotated_io.jl index 60c91be24ebfb..e3c26a2c0d8e2 100644 --- a/base/strings/annotated_io.jl +++ b/base/strings/annotated_io.jl @@ -42,7 +42,7 @@ end write(io::AnnotatedIOBuffer, c::AnnotatedChar) = write(io, AnnotatedString(string(c), [(region=1:ncodeunits(c), a...) for a in c.annotations])) -write(io::AnnotatedIOBuffer, x::AbstractString) = write(io.io, x) +write(io::AnnotatedIOBuffer, x::AbstractString) = write(io.io, x)::Int write(io::AnnotatedIOBuffer, s::Union{SubString{String}, String}) = write(io.io, s) write(io::AnnotatedIOBuffer, b::UInt8) = write(io.io, b)