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

Fix failing doctests from PR #31246. #31934

Merged
merged 1 commit into from
May 6, 2019
Merged
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
22 changes: 11 additions & 11 deletions base/meta.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export quot,
@dump

"""
quot(ex)::Expr
Meta.quot(ex)::Expr

Quote expression `ex` to produce an expression with head `quote`. This can for instance be used to represent objects of type `Expr` in the AST.
See also the manual section about [QuoteNode](@ref man-quote-node).
Expand All @@ -23,20 +23,20 @@ See also the manual section about [QuoteNode](@ref man-quote-node).
julia> eval(quot(:x))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
julia> eval(quot(:x))
julia> eval(Meta.quot(:x))

Copy link
Member Author

Choose a reason for hiding this comment

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

Huh, this passed CI, why?

:x

julia> dump(quot(:x))
julia> dump(Meta.quot(:x))
Expr
head: Symbol quote
args: Array{Any}((1,))
1: Symbol x

julia> eval(quot(:(1+2)))
julia> eval(Meta.quot(:(1+2)))
:(1 + 2)
```
"""
quot(ex) = Expr(:quote, ex)

"""
isexpr(ex, head[, n])::Bool
Meta.isexpr(ex, head[, n])::Bool

Check if `ex` is an expression with head `head` and `n` arguments.

Expand All @@ -45,19 +45,19 @@ Check if `ex` is an expression with head `head` and `n` arguments.
julia> ex = :(f(x))
:(f(x))

julia> isexpr(ex, :block)
julia> Meta.isexpr(ex, :block)
false

julia> isexpr(ex, :call)
julia> Meta.isexpr(ex, :call)
true

julia> isexpr(ex, [:block, :call]) # multiple possible heads
julia> Meta.isexpr(ex, [:block, :call]) # multiple possible heads
true

julia> isexpr(ex, :call, 1)
julia> Meta.isexpr(ex, :call, 1)
false

julia> isexpr(ex, :call, 2)
julia> Meta.isexpr(ex, :call, 2)
true
```
"""
Expand All @@ -66,13 +66,13 @@ isexpr(@nospecialize(ex), heads::Union{Set,Vector,Tuple}) = isa(ex, Expr) && in(
isexpr(@nospecialize(ex), heads, n::Int) = isexpr(ex, heads) && length(ex.args) == n

"""
show_sexpr([io::IO,], ex)
Meta.show_sexpr([io::IO,], ex)

Show expression `ex` as a lisp style S-expression.

# Examples
```jldoctest
julia> show_sexpr(:(f(x, g(y,z))))
julia> Meta.show_sexpr(:(f(x, g(y,z))))
(:call, :f, :x, (:call, :g, :y, :z))
```
"""
Expand Down
2 changes: 1 addition & 1 deletion doc/src/manual/metaprogramming.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ However, in some situations it is necessary to quote code *without* performing i
This kind of quoting does not yet have syntax, but is represented internally
as an object of type `QuoteNode`:
```jldoctest interp1
julia> eval(quot(Expr(:$, :(1+2))))
julia> eval(Meta.quot(Expr(:$, :(1+2))))
3

julia> eval(QuoteNode(Expr(:$, :(1+2))))
Expand Down