Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More doctests and cleanup for intfuncs #22515

Merged
merged 10 commits into from
Jun 27, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix some failing doctests
  • Loading branch information
kshyatt committed Jun 25, 2017
commit 4613c2cf6cb9e0eae319f6c6e251e1f99169791f
4 changes: 2 additions & 2 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -906,8 +906,8 @@ julia> deleteat!([6, 5, 4, 3, 2, 1], [true, false, true, false, true, false])
julia> deleteat!([6, 5, 4, 3, 2, 1], (2, 2))
ERROR: ArgumentError: indices must be unique and sorted
Stacktrace:
[1] _deleteat!(::Array{Int64,1}, ::Tuple{Int64,Int64}) at ./array.jl:880
[2] deleteat!(::Array{Int64,1}, ::Tuple{Int64,Int64}) at ./array.jl:867
[1] _deleteat!(::Array{Int64,1}, ::Tuple{Int64,Int64}) at ./array.jl:926
[2] deleteat!(::Array{Int64,1}, ::Tuple{Int64,Int64}) at ./array.jl:913
```
"""
deleteat!(a::Vector, inds) = _deleteat!(a, inds)
Expand Down
4 changes: 2 additions & 2 deletions base/docs/helpdb/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ If `T` does not have a specific size, an error is thrown.
julia> sizeof(Base.LinAlg.LU)
ERROR: argument is an abstract type; size is indeterminate
Stacktrace:
[1] sizeof(::Type{T} where T) at ./essentials.jl:160
[1] sizeof(::Type{T} where T) at ./essentials.jl:150
```
"""
sizeof(::Type)
Expand Down Expand Up @@ -1414,7 +1414,7 @@ key is present.

# Examples
```jldoctest
julia> d = Dict("a"=>1, "b"=>2)
julia> d = Dict("a"=>1, "b"=>2);

julia> get(d, "a", 3)
Copy link
Contributor

Choose a reason for hiding this comment

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

does this pass? where does d come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops, forgot to copy paste

1
Expand Down
4 changes: 2 additions & 2 deletions base/linalg/eigen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ julia> A = [0 im; -1 0]
julia> eigmax(A)
ERROR: DomainError:
Stacktrace:
[1] #eigmax#46(::Bool, ::Bool, ::Function, ::Array{Complex{Int64},2}) at ./linalg/eigen.jl:238
[1] #eigmax#52(::Bool, ::Bool, ::Function, ::Array{Complex{Int64},2}) at ./linalg/eigen.jl:238
[2] eigmax(::Array{Complex{Int64},2}) at ./linalg/eigen.jl:236
```
"""
Expand Down Expand Up @@ -270,7 +270,7 @@ julia> A = [0 im; -1 0]
julia> eigmin(A)
ERROR: DomainError:
Stacktrace:
[1] #eigmin#47(::Bool, ::Bool, ::Function, ::Array{Complex{Int64},2}) at ./linalg/eigen.jl:280
[1] #eigmin#53(::Bool, ::Bool, ::Function, ::Array{Complex{Int64},2}) at ./linalg/eigen.jl:280
[2] eigmin(::Array{Complex{Int64},2}) at ./linalg/eigen.jl:278
```
"""
Expand Down
2 changes: 1 addition & 1 deletion base/sparse/sparsematrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ Removes stored numerical zeros from `A`, optionally trimming resulting excess sp
`A.rowval` and `A.nzval` when `trim` is `true`.

For an out-of-place version, see [`dropzeros`](@ref). For
algorithmic information, see [`fkeep!`](@ref).
algorithmic information, see `fkeep!`.
"""
dropzeros!(A::SparseMatrixCSC, trim::Bool = true) = fkeep!(A, (i, j, x) -> x != 0, trim)
"""
Expand Down
2 changes: 1 addition & 1 deletion base/sparse/sparsevector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1920,7 +1920,7 @@ Removes stored numerical zeros from `x`, optionally trimming resulting excess sp
`x.nzind` and `x.nzval` when `trim` is `true`.

For an out-of-place version, see [`dropzeros`](@ref). For
algorithmic information, see [`fkeep!`](@ref).
algorithmic information, see `fkeep!`.
"""
dropzeros!(x::SparseVector, trim::Bool = true) = fkeep!(x, (i, x) -> x != 0, trim)
"""
Expand Down
4 changes: 2 additions & 2 deletions doc/src/manual/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ ERROR: DomainError:
Cannot raise an integer x to a negative power -n.
Make x a float by adding a zero decimal (e.g. 2.0^-n instead of 2^-n), or write 1/x^n, float(x)^-n, or (x//1)^-n.
Stacktrace:
[1] power_by_squaring(::Int64, ::Int64) at ./intfuncs.jl:170
[2] literal_pow(::Base.#^, ::Int64, ::Type{Val{-5}}) at ./intfuncs.jl:205
[1] power_by_squaring(::Int64, ::Int64) at ./intfuncs.jl:173
[2] literal_pow(::Base.#^, ::Int64, ::Type{Val{-5}}) at ./intfuncs.jl:208
```

This behavior is an inconvenient consequence of the requirement for type-stability. In the case
Expand Down
6 changes: 3 additions & 3 deletions doc/src/manual/mathematical-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ julia> Int8(127)
julia> Int8(128)
ERROR: InexactError()
Stacktrace:
[1] Int8(::Int64) at ./sysimg.jl:77
[1] Int8(::Int64) at ./sysimg.jl:102

julia> Int8(127.0)
127
Expand All @@ -406,13 +406,13 @@ julia> Int8(3.14)
ERROR: InexactError()
Stacktrace:
[1] convert(::Type{Int8}, ::Float64) at ./float.jl:659
[2] Int8(::Float64) at ./sysimg.jl:77
[2] Int8(::Float64) at ./sysimg.jl:102

julia> Int8(128.0)
ERROR: InexactError()
Stacktrace:
[1] convert(::Type{Int8}, ::Float64) at ./float.jl:659
[2] Int8(::Float64) at ./sysimg.jl:77
[2] Int8(::Float64) at ./sysimg.jl:102

julia> 127 % Int8
127
Expand Down
2 changes: 1 addition & 1 deletion doc/src/manual/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ ERROR: MethodError: Cannot `convert` an object of type Float64 to an object of t
This may have arisen from a call to the constructor Point{Float64}(...),
since type constructors fall back to convert methods.
Stacktrace:
[1] Point{Float64}(::Float64) at ./sysimg.jl:77
[1] Point{Float64}(::Float64) at ./sysimg.jl:102

julia> Point{Float64}(1.0,2.0,3.0)
ERROR: MethodError: no method matching Point{Float64}(::Float64, ::Float64, ::Float64)
Expand Down