Skip to content

Commit

Permalink
Merge pull request #13357 from JuliaLang/tk/backports5
Browse files Browse the repository at this point in the history
[release-0.4] pending backports for final RC
  • Loading branch information
tkelman committed Oct 3, 2015
2 parents 483d548 + 1b4308f commit cde997c
Show file tree
Hide file tree
Showing 84 changed files with 1,826 additions and 1,227 deletions.
6 changes: 6 additions & 0 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# OPENBLAS build options
OPENBLAS_TARGET_ARCH=
OPENBLAS_SYMBOLSUFFIX=
OPENBLAS_LIBNAMESUFFIX=

# If OPENBLAS_TARGET_ARCH is set, we default to disabling OPENBLAS_DYNAMIC_ARCH
ifneq ($(OPENBLAS_TARGET_ARCH),)
Expand Down Expand Up @@ -836,6 +837,11 @@ endif
ifeq ($(USE_SYSTEM_BLAS), 0)
ifeq ($(USE_BLAS64), 1)
OPENBLAS_SYMBOLSUFFIX = 64_
OPENBLAS_LIBNAMESUFFIX = 64_
LIBBLAS = -L$(build_shlibdir) -lopenblas$(OPENBLAS_LIBNAMESUFFIX)
LIBLAPACK = $(LIBBLAS)
LIBBLASNAME = libopenblas$(OPENBLAS_LIBNAMESUFFIX)
LIBLAPACKNAME = $(LIBBLASNAME)
endif
endif

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ First, acquire the source code by cloning the git repository:

Be sure to also configure your system to use the appropriate proxy settings, e.g. by setting the `https_proxy` and `http_proxy` variables.)

By default you will be building the latest unstable version of Julia. However, most users should use the most recent stable version of Julia, which is currently the `0.3` series of releases. You can get this version by changing to the Julia directory and running
By default you will be building the latest unstable version of Julia. However, most users should use the most recent stable version of Julia, which is currently the `0.4` series of releases. You can get this version by changing to the Julia directory and running

git checkout release-0.3
git checkout release-0.4

Now run `make` to build the `julia` executable. To perform a parallel build, use `make -j N` and supply the maximum number of concurrent processes.
When compiled the first time, it will automatically download and build its [external dependencies](#Required-Build-Tools-External-Libraries).
Expand Down
2 changes: 1 addition & 1 deletion base/Enums.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ macro enum(T,syms...)
end
blk = quote
# enum definition
bitstype 32 $(esc(T)) <: Enum
Base.@__doc__(bitstype 32 $(esc(T)) <: Enum)
function Base.convert(::Type{$(esc(typename))}, x::Integer)
$(membershiptest(:x, values)) || enum_argument_error($(Expr(:quote, typename)), x)
Intrinsics.box($(esc(typename)), convert(Int32, x))
Expand Down
7 changes: 3 additions & 4 deletions base/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export
StreamREPL

import Base:
AsyncStream,
Display,
display,
writemime,
Expand Down Expand Up @@ -58,7 +57,7 @@ function eval_user_input(ast::ANY, backend::REPLBackend)
ans = backend.ans
# note: value wrapped in a non-syntax value to avoid evaluating
# possibly-invalid syntax (issue #6763).
eval(Main, :(ans = $(Any[ans])[1]))
eval(Main, :(ans = $(getindex)($(Any[ans]), 1)))
backend.in_eval = true
value = eval(Main, ast)
backend.in_eval = false
Expand Down Expand Up @@ -885,15 +884,15 @@ end

outstream(s::StreamREPL) = s.stream

StreamREPL(stream::AsyncStream) = StreamREPL(stream, julia_green, Base.text_colors[:white], Base.answer_color())
StreamREPL(stream::IO) = StreamREPL(stream, julia_green, Base.text_colors[:white], Base.answer_color())

answer_color(r::LineEditREPL) = r.envcolors ? Base.answer_color() : r.answer_color
answer_color(r::StreamREPL) = r.answer_color
input_color(r::LineEditREPL) = r.envcolors ? Base.input_color() : r.input_color
input_color(r::StreamREPL) = r.input_color


function run_repl(stream::AsyncStream)
function run_repl(stream::IO)
repl =
@async begin
repl_channel = Channel(1)
Expand Down
6 changes: 3 additions & 3 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,10 @@ function getindex{T<:Real}(A::Array, I::Range{T})
end

## Indexing: setindex! ##
setindex!{T}(A::Array{T}, x, i1::Real) = arrayset(A, convert(T,x), to_index(i1))
setindex!{T}(A::Array{T}, x, i1::Real, i2::Real, I::Real...) = arrayset(A, convert(T,x), to_index(i1), to_index(i2), to_indexes(I...)...)
setindex!{T}(A::Array{T}, x, i1::Real) = arrayset(A, convert(T,x)::T, to_index(i1))
setindex!{T}(A::Array{T}, x, i1::Real, i2::Real, I::Real...) = arrayset(A, convert(T,x)::T, to_index(i1), to_index(i2), to_indexes(I...)...)

unsafe_setindex!{T}(A::Array{T}, x, i1::Real, I::Real...) = @inbounds return arrayset(A, convert(T,x), to_index(i1), to_indexes(I...)...)
unsafe_setindex!{T}(A::Array{T}, x, i1::Real, I::Real...) = @inbounds return arrayset(A, convert(T,x)::T, to_index(i1), to_indexes(I...)...)

# These are redundant with the abstract fallbacks but needed for bootstrap
function setindex!(A::Array, x, I::AbstractVector{Int})
Expand Down
4 changes: 4 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -828,3 +828,7 @@ end
@deprecate cartesianmap(f, dims) for idx in CartesianRange(dims); f(idx.I...); end

@deprecate Union(args...) Union{args...}

# 12839
const AsyncStream = IO
deprecate(:AsyncStream)
126 changes: 74 additions & 52 deletions base/docs/Docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ function doc(b::Binding)
`$(b.mod === Main ? b.var : join((b.mod, b.var),'.'))` is $(isgeneric(v) ? "a generic" : "an anonymous") `Function`.
"""), functionsummary(v))
elseif isa(v,DataType)
d = catdoc(Markdown.parse("""
No documentation found.
"""), typesummary(v))
else
T = typeof(v)
d = catdoc(Markdown.parse("""
Expand Down Expand Up @@ -234,37 +239,6 @@ function doc!(f::Function, sig::ANY, data, source)
fd.source[sig] = source
end

doc(f::Function) = doc(f, Tuple)

function doc(f::Function, sig::Type)
isgeneric(f) && isempty(methods(f,sig)) && return nothing
results, funcdocs = [], []
for mod in modules
if (haskey(meta(mod), f) && isa(meta(mod)[f], FuncDoc))
fd = meta(mod)[f]
push!(funcdocs, fd)
for msig in fd.order
# try to find specific matching method signatures
if sig <: msig
push!(results, (msig, fd.meta[msig]))
end
end
end
end
# if all method signatures are Union{} ( ⊥ ), concat all docstrings
if isempty(results)
for fd in funcdocs
append!(results, [fd.meta[msig] for msig in reverse(fd.order)])
end
else
sort!(results, lt = (a, b) -> type_morespecific(first(a), first(b)))
results = [last(r) for r in results]
end
catdoc(results...)
end
doc(f::Function,args::Any...) = doc(f, Tuple{args...})


"""
`catdoc(xs...)`: Combine the documentation metadata `xs` into a single meta object.
"""
Expand Down Expand Up @@ -317,35 +291,42 @@ function doc!(T::DataType, sig::ANY, data, source)
td.meta[sig] = data
end

function doc(T::DataType)
docs = []
for mod in modules
if haskey(meta(mod), T)
Td = meta(mod)[T]
if isa(Td, TypeDoc)
if length(docs) == 0 && Td.main !== nothing
push!(docs, Td.main)
function doc(obj::Base.Callable, sig::Type = Union)
isgeneric(obj) && sig !== Union && isempty(methods(obj, sig)) && return nothing
results, groups = [], []
for m in modules
if haskey(meta(m), obj)
docs = meta(m)[obj]
if isa(docs, FuncDoc) || isa(docs, TypeDoc)
push!(groups, docs)
for msig in docs.order
if sig <: msig
push!(results, (msig, docs.meta[msig]))
end
end
for m in Td.order
push!(docs, Td.meta[m])
if isempty(results) && docs.main !== nothing
push!(results, (Union{}, docs.main))
end
elseif length(docs) == 0
return Td
else
push!(results, (Union{}, docs))
end
end
end
if isempty(docs)
catdoc(Markdown.parse("""
No documentation found.
"""), typesummary(T))
else
catdoc(docs...)
# If all method signatures are Union{} ( ⊥ ), concat all docstrings.
if isempty(results)
for group in groups
append!(results, [group.meta[s] for s in reverse(group.order)])
end
else
sort!(results, lt = (a, b) -> type_morespecific(first(a), first(b)))
results = map(last, results)
end
catdoc(results...)
end
doc(f::Base.Callable, args::Any...) = doc(f, Tuple{args...})

function typesummary(T::DataType)
parts = [
parts = UTF8String[
"""
**Summary:**
```julia
Expand Down Expand Up @@ -496,9 +477,49 @@ end

multidoc(meta, objs) = quote $([:(@doc $(esc(meta)) $(esc(obj))) for obj in objs]...) end

doc"""
@__doc__(ex)
Low-level macro used to mark expressions returned by a macro that should be documented. If
more than one expression is marked then the same docstring is applied to each expression.
macro example(f)
quote
$(f)() = 0
@__doc__ $(f)(x) = 1
$(f)(x, y) = 2
end |> esc
end
`@__doc__` has no effect when a macro that uses it is not documented.
"""
:(Base.@__doc__)

function __doc__!(meta, def::Expr)
if isexpr(def, :block) && length(def.args) == 2 && def.args[1] == symbol("#doc#")
# Convert `Expr(:block, :#doc#, ...)` created by `@__doc__` to an `@doc`.
def.head = :macrocall
def.args = [symbol("@doc"), meta, def.args[end]]
true
else
found = false
for each in def.args
found |= __doc__!(meta, each)
end
found
end
end
__doc__!(meta, def) = false

fexpr(ex) = isexpr(ex, :function, :stagedfunction, :(=)) && isexpr(ex.args[1], :call)

function docm(meta, def, define = true)

err = (
"invalid doc expression:", def, isexpr(def, :macrocall) ?
"'$(def.args[1])' is not documentable. See 'help?> Base.@__doc__' for details." : ""
)

def′ = unblock(def)

isexpr(def′, :quote) && isexpr(def′.args[1], :macrocall) &&
Expand All @@ -522,7 +543,8 @@ function docm(meta, def, define = true)
:global) ? vardoc(meta, def, namify(def′)) :
isvar(def′) ? objdoc(meta, def′) :
isexpr(def′, :tuple) ? multidoc(meta, def′.args) :
isa(def′, Expr) ? error("invalid doc expression $def′") :
__doc__!(meta, def′) ? esc(def′) :
isa(def′, Expr) ? error(strip(join(err, "\n\n"))) :
objdoc(meta, def′)
end

Expand Down
12 changes: 6 additions & 6 deletions base/docs/basedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -580,12 +580,12 @@ Construct a regex, such as `r"^[a-z]*$"`. The regex also accepts
one or more flags, listed after the ending quote, to change its
behaviour:
• `i` enables case-insensitive matching
• `m` treats the `^` and `$` tokens as matching the start and
and end of individual lines, as opposed to the whole string.
• `s` allows the `.` modifier to match newlines.
• `x` enables "comment mode": whitespace is enabled except when
escaped with `\`, and `#` is treated as starting a comment.
• `i` enables case-insensitive matching
• `m` treats the `^` and `$` tokens as matching the start and
end of individual lines, as opposed to the whole string.
• `s` allows the `.` modifier to match newlines.
• `x` enables "comment mode": whitespace is enabled except when
escaped with `\`, and `#` is treated as starting a comment.
For example, this regex has all three flags enabled:
Expand Down
17 changes: 15 additions & 2 deletions base/docs/bootstrap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ macro doc(args...)
DocBootstrap._expand_(args...)
end

macro __doc__(ex) esc(Expr(:block, symbol("#doc#"), ex)) end

module DocBootstrap

type List
Expand All @@ -17,11 +19,22 @@ _expand_ = nothing

setexpand!(f) = global _expand_ = f

setexpand!() do str, obj
function __bootexpand(str, obj)
global docs = List((ccall(:jl_get_current_module, Any, ()), str, obj), docs)
(isa(obj, Expr) && obj.head == :call) ? nothing : esc(Expr(:toplevel, obj))
(isa(obj, Expr) && obj.head == :call) && return nothing
(isa(obj, Expr) && obj.head == :module) && return esc(Expr(:toplevel, obj))
esc(obj)
end

function __bootexpand(expr::Expr)
if expr.head !== :->
throw(ArgumentError("Wrong argument to @doc"))
end
__bootexpand(expr.args...)
end

setexpand!(__bootexpand)

"""
DocBootstrap :: Module
Expand Down
Loading

0 comments on commit cde997c

Please sign in to comment.