Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions base/coreio.jl
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
11 changes: 11 additions & 0 deletions base/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ false
```
"""
function isopen end
typeof(isopen).name.max_methods = UInt8(1)

"""
close(io::IO)
Expand All @@ -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)
Expand Down Expand Up @@ -110,6 +112,7 @@ julia> read(io, String)
```
"""
function closewrite end
typeof(closewrite).name.max_methods = UInt8(1)

"""
flush(io::IO)
Expand All @@ -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)
Expand All @@ -134,6 +138,7 @@ julia> bytesavailable(io)
```
"""
function bytesavailable end
typeof(bytesavailable).name.max_methods = UInt8(1)

"""
readavailable(stream)
Expand All @@ -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
Expand Down Expand Up @@ -219,6 +227,7 @@ true
```
"""
function eof end
typeof(eof).name.max_methods = UInt8(1)

function copy end
function wait_readnb end
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if a method of read! gets defined and a method instance gets compiled/inferred before you change max_methods here? Would it cause miscompilation?


read!(filename::AbstractString, a) = open(io->read!(io, a), convert(String, filename)::String)

Expand Down
2 changes: 1 addition & 1 deletion base/strings/annotated_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down