Skip to content

Commit ec72d37

Browse files
committed
Merge branch 'master' into ntuple-inlined
2 parents 72d264b + e6f8180 commit ec72d37

File tree

146 files changed

+2447
-1369
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+2447
-1369
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,15 @@ script:
121121
install -pm755 usr/lib/lib${name}*.dylib* /tmp/julia/lib/julia/;
122122
done;
123123
fi
124+
- make $BUILDOPTS NO_GIT=1 prefix=/tmp/julia -C examples
124125
- cd .. && mv julia julia2
125126
- /tmp/julia/bin/julia --precompiled=no -e 'true' &&
126127
/tmp/julia/bin/julia-debug --precompiled=no -e 'true'
127128
- /tmp/julia/bin/julia -e 'versioninfo()'
128129
- export JULIA_CPU_CORES=2 && export JULIA_TEST_MAXRSS_MB=600 &&
129130
cd /tmp/julia/share/julia/test &&
130131
/tmp/julia/bin/julia --check-bounds=yes runtests.jl $TESTSTORUN &&
131-
/tmp/julia/bin/julia --check-bounds=yes runtests.jl libgit2-online download pkg
132+
/tmp/julia/bin/julia --check-bounds=yes runtests.jl libgit2-online download pkg embedding
132133
- cd `dirname $TRAVIS_BUILD_DIR` && mv julia2 julia &&
133134
rm -f julia/deps/scratch/libgit2-*/CMakeFiles/CMakeOutput.log
134135
# uncomment the following if failures are suspected to be due to the out-of-memory killer

Make.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ endif
177177
USE_GPL_LIBS ?= 1
178178

179179
# Directories where said libraries get installed to
180-
prefix ?= $(abspath julia-$(JULIA_COMMIT))
180+
prefix ?= $(BUILDROOT)/julia-$(JULIA_COMMIT)
181181
bindir := $(prefix)/bin
182182
libdir := $(prefix)/lib
183183
libexecdir := $(prefix)/libexec
@@ -219,6 +219,7 @@ libdir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(bindir) $(libdir))
219219
build_private_libdir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(build_bindir) $(build_private_libdir))
220220
private_libdir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(bindir) $(private_libdir))
221221
datarootdir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(bindir) $(datarootdir))
222+
libexecdir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(bindir) $(libexecdir))
222223
docdir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(bindir) $(docdir))
223224
sysconfdir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(bindir) $(sysconfdir))
224225
includedir_rel := $(shell $(JULIAHOME)/contrib/relative_path.sh $(bindir) $(includedir))

Makefile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ all: debug release
2121
# sort is used to remove potential duplicates
2222
DIRS := $(sort $(build_bindir) $(build_depsbindir) $(build_libdir) $(build_private_libdir) $(build_libexecdir) $(build_includedir) $(build_includedir)/julia $(build_sysconfdir)/julia $(build_datarootdir)/julia $(build_man1dir))
2323
ifneq ($(BUILDROOT),$(JULIAHOME))
24-
BUILDDIRS := $(BUILDROOT) $(addprefix $(BUILDROOT)/,base src ui doc deps test test/perf)
24+
BUILDDIRS := $(BUILDROOT) $(addprefix $(BUILDROOT)/,base src ui doc deps test test/perf examples examples/embedding)
2525
BUILDDIRMAKE := $(addsuffix /Makefile,$(BUILDDIRS))
2626
DIRS := $(DIRS) $(BUILDDIRS)
2727
$(BUILDDIRMAKE): | $(BUILDDIRS)
@@ -62,12 +62,16 @@ $(BUILDROOT)/doc/_build/html/en/index.html: $(shell find $(BUILDROOT)/base $(BUI
6262
CLEAN_TARGETS += clean-docdir
6363
clean-docdir:
6464
@-rm -fr $(abspath $(build_docdir))
65-
$(build_prefix)/.examples: $(wildcard $(JULIAHOME)/examples/*.jl) $(shell find $(JULIAHOME)/examples/clustermanager)
65+
66+
$(build_prefix)/.examples: $(wildcard $(JULIAHOME)/examples/*.jl) \
67+
$(shell find $(JULIAHOME)/examples/clustermanager)
6668
@echo Copying in usr/share/doc/julia/examples
6769
@-rm -fr $(build_docdir)/examples
6870
@mkdir -p $(build_docdir)/examples
6971
@cp -R $(JULIAHOME)/examples/*.jl $(build_docdir)/examples/
72+
@cp -R $(JULIAHOME)/examples/Makefile $(build_docdir)/examples/
7073
@cp -R $(JULIAHOME)/examples/clustermanager $(build_docdir)/examples/
74+
@cp -R $(JULIAHOME)/examples/embedding $(build_docdir)/examples
7175
@echo 1 > $@
7276

7377
julia-symlink: julia-ui-$(JULIA_BUILD_MODE)
@@ -335,16 +339,15 @@ install: $(build_depsbindir)/stringreplace $(BUILDROOT)/doc/_build/html/en/index
335339
done
336340

337341
$(INSTALL_M) $(build_bindir)/julia* $(DESTDIR)$(bindir)/
342+
-cp -a $(build_libexecdir) $(DESTDIR)$(prefix)
338343
ifeq ($(OS),WINNT)
339344
-$(INSTALL_M) $(build_bindir)/*.dll $(DESTDIR)$(bindir)/
340345
-$(INSTALL_M) $(build_libdir)/libjulia.dll.a $(DESTDIR)$(libdir)/
341346
-$(INSTALL_M) $(build_libdir)/libjulia-debug.dll.a $(DESTDIR)$(libdir)/
342347
-$(INSTALL_M) $(build_bindir)/libopenlibm.dll.a $(DESTDIR)$(libdir)/
343348
else
344-
-cp -a $(build_libexecdir) $(DESTDIR)$(prefix)
345-
346-
# Copy over .dSYM directories directly
347349
ifeq ($(OS),Darwin)
350+
# Copy over .dSYM directories directly
348351
-cp -a $(build_libdir)/*.dSYM $(DESTDIR)$(libdir)
349352
-cp -a $(build_private_libdir)/*.dSYM $(DESTDIR)$(private_libdir)
350353
endif
@@ -522,6 +525,7 @@ clean: | $(CLEAN_TARGETS)
522525
@-$(MAKE) -C $(BUILDROOT)/src clean
523526
@-$(MAKE) -C $(BUILDROOT)/ui clean
524527
@-$(MAKE) -C $(BUILDROOT)/test clean
528+
@-$(MAKE) -C $(BUILDROOT)/examples clean
525529
-rm -f $(BUILDROOT)/julia
526530
-rm -f $(BUILDROOT)/*.tar.gz
527531
-rm -f $(build_depsbindir)/stringreplace \
@@ -548,7 +552,7 @@ distcleanall: cleanall
548552
test testall testall1 test clean distcleanall cleanall clean-* \
549553
run-julia run-julia-debug run-julia-release run \
550554
install binary-dist light-source-dist.tmp light-source-dist \
551-
dist full-source-dist source-dist
555+
dist full-source-dist source-dist examples
552556

553557
test: check-whitespace $(JULIA_BUILD_MODE)
554558
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/test default JULIA_BUILD_MODE=$(JULIA_BUILD_MODE)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ Julia does not install anything outside the directory it was cloned into. Julia
185185

186186
Julia can be built for a non-generic architecture by configuring the `ARCH` Makefile variable. See the appropriate section of `Make.inc` for additional customization options, such as `MARCH` and `JULIA_CPU_TARGET`.
187187

188-
For example, to build for Pentium 4, set `MARCH=pentium4` and install the necessary system libraries for linking. On Ubuntu, these may include lib32gfortran3 (also manually call `ln -s /usr/lib32/libgfortran3.so.0 /usr/lib32/libgfortran3.so`) and lib32gcc1, lib32stdc++6, among others.
188+
For example, to build for Pentium 4, set `MARCH=pentium4` and install the necessary system libraries for linking. On Ubuntu, these may include lib32gfortran-6-dev, lib32gcc1, and lib32stdc++6, among others.
189189

190190
You can also set `MARCH=native` for a maximum-performance build customized for the current machine CPU.
191191

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ build_script:
5555
test_script:
5656
- usr\bin\julia -e "versioninfo()"
5757
- usr\bin\julia --precompiled=no -e "true"
58-
- cd test && ..\usr\bin\julia --check-bounds=yes runtests.jl all &&
59-
..\usr\bin\julia --check-bounds=yes runtests.jl libgit2-online download pkg
58+
- cd julia-* && .\bin\julia.exe --check-bounds=yes share\julia\test\runtests.jl all &&
59+
.\bin\julia.exe --check-bounds=yes share\julia\test\runtests.jl libgit2-online download pkg embedding

base/LineEdit.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ function keymap_merge(target,source)
864864
for key in setdiff(keys(source), keys(direct_keys))
865865
# We first resolve redirects in the source
866866
value = source[key]
867-
visited = Array{Any}(0)
867+
visited = Vector{Any}(0)
868868
while isa(value, Union{Char,AbstractString})
869869
value = normalize_key(value)
870870
if value in visited

base/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ endif
6262
@echo "const DATAROOTDIR = \"$(datarootdir_rel)\"" >> $@
6363
@echo "const DOCDIR = \"$(docdir_rel)\"" >> $@
6464
@echo "const LIBDIR = \"$(libdir_rel)\"" >> $@
65+
@echo "const PRIVATE_LIBDIR = \"$(private_libdir_rel)\"" >> $@
66+
@echo "const LIBEXECDIR = \"$(libexecdir_rel)\"" >> $@
6567
@echo "const INCLUDEDIR = \"$(includedir_rel)\"" >> $@
6668

6769
@# This to ensure that we always rebuild this file, but only when it is modified do we touch build_h.jl,

base/REPL.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ terminal(r::LineEditREPL) = r.t
268268

269269
LineEditREPL(t::TextTerminal, envcolors = false) = LineEditREPL(t,
270270
true,
271-
Base.text_colors[:light_green],
271+
Base.text_colors[:green],
272272
Base.input_color(),
273273
Base.answer_color(),
274274
Base.text_colors[:red],
@@ -960,7 +960,7 @@ mutable struct StreamREPL <: AbstractREPL
960960
waserror::Bool
961961
StreamREPL(stream,pc,ic,ac) = new(stream,pc,ic,ac,false)
962962
end
963-
StreamREPL(stream::IO) = StreamREPL(stream, Base.text_colors[:light_green], Base.input_color(), Base.answer_color())
963+
StreamREPL(stream::IO) = StreamREPL(stream, Base.text_colors[:green], Base.input_color(), Base.answer_color())
964964
run_repl(stream::IO) = run_repl(StreamREPL(stream))
965965

966966
outstream(s::StreamREPL) = s.stream

base/abstractarray.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ julia> size(A,3,2)
1919
(4, 3)
2020
```
2121
"""
22-
size{T,N}(t::AbstractArray{T,N}, d) = d <= N ? size(t)[d] : 1
23-
size{N}(x, d1::Integer, d2::Integer, dx::Vararg{Integer, N}) =
22+
size(t::AbstractArray{T,N}, d) where {T,N} = d <= N ? size(t)[d] : 1
23+
size(x, d1::Integer, d2::Integer, dx::Vararg{Integer, N}) where {N} =
2424
(size(x, d1), size(x, d2), ntuple(k->size(x, dx[k]), Val{N})...)
2525

2626
"""
@@ -91,7 +91,7 @@ julia> extrema(b)
9191
linearindices(A) = (@_inline_meta; OneTo(_length(A)))
9292
linearindices(A::AbstractVector) = (@_inline_meta; indices1(A))
9393
eltype(::Type{<:AbstractArray{E}}) where {E} = E
94-
elsize{T}(::AbstractArray{T}) = sizeof(T)
94+
elsize(::AbstractArray{T}) where {T} = sizeof(T)
9595

9696
"""
9797
ndims(A::AbstractArray) -> Integer
@@ -824,11 +824,11 @@ isempty(a::AbstractArray) = (_length(a) == 0)
824824

825825
## Conversions ##
826826

827-
convert{T,N }(::Type{AbstractArray{T,N}}, A::AbstractArray{T,N}) = A
828-
convert{T,S,N}(::Type{AbstractArray{T,N}}, A::AbstractArray{S,N}) = copy!(similar(A,T), A)
829-
convert{T,S,N}(::Type{AbstractArray{T }}, A::AbstractArray{S,N}) = convert(AbstractArray{T,N}, A)
827+
convert(::Type{AbstractArray{T,N}}, A::AbstractArray{T,N}) where {T,N } = A
828+
convert(::Type{AbstractArray{T,N}}, A::AbstractArray{S,N}) where {T,S,N} = copy!(similar(A,T), A)
829+
convert(::Type{AbstractArray{T }}, A::AbstractArray{S,N}) where {T,S,N} = convert(AbstractArray{T,N}, A)
830830

831-
convert{T,N}(::Type{Array}, A::AbstractArray{T,N}) = convert(Array{T,N}, A)
831+
convert(::Type{Array}, A::AbstractArray{T,N}) where {T,N} = convert(Array{T,N}, A)
832832

833833
"""
834834
of_indices(x, y)

base/array.jl

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,35 +74,36 @@ size(a::Array, d) = arraysize(a, d)
7474
size(a::Vector) = (arraysize(a,1),)
7575
size(a::Matrix) = (arraysize(a,1), arraysize(a,2))
7676
size(a::Array) = (@_inline_meta; _size((), a))
77-
_size{_,N}(out::NTuple{N}, A::Array{_,N}) = out
78-
function _size{_,M,N}(out::NTuple{M}, A::Array{_,N})
77+
_size(out::NTuple{N}, A::Array{_,N}) where {_,N} = out
78+
function _size(out::NTuple{M}, A::Array{_,N}) where _ where M where N
7979
@_inline_meta
8080
_size((out..., size(A,M+1)), A)
8181
end
8282

8383
asize_from(a::Array, n) = n > ndims(a) ? () : (arraysize(a,n), asize_from(a, n+1)...)
8484

8585
length(a::Array) = arraylen(a)
86-
elsize{T}(a::Array{T}) = isbits(T) ? sizeof(T) : sizeof(Ptr)
86+
elsize(a::Array{T}) where {T} = isbits(T) ? sizeof(T) : sizeof(Ptr)
8787
sizeof(a::Array) = elsize(a) * length(a)
8888

8989
function isassigned(a::Array, i::Int...)
90-
ii = sub2ind(size(a), i...)
91-
1 <= ii <= length(a) || return false
92-
ccall(:jl_array_isassigned, Cint, (Any, UInt), a, ii-1) == 1
90+
@_inline_meta
91+
ii = (sub2ind(size(a), i...) % UInt) - 1
92+
ii < length(a) % UInt || return false
93+
ccall(:jl_array_isassigned, Cint, (Any, UInt), a, ii) == 1
9394
end
9495

9596
## copy ##
9697

97-
function unsafe_copy!{T}(dest::Ptr{T}, src::Ptr{T}, n)
98+
function unsafe_copy!(dest::Ptr{T}, src::Ptr{T}, n) where T
9899
# Do not use this to copy data between pointer arrays.
99100
# It can't be made safe no matter how carefully you checked.
100101
ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt),
101102
dest, src, n*sizeof(T))
102103
return dest
103104
end
104105

105-
function unsafe_copy!{T}(dest::Array{T}, doffs, src::Array{T}, soffs, n)
106+
function unsafe_copy!(dest::Array{T}, doffs, src::Array{T}, soffs, n) where T
106107
if isbits(T)
107108
unsafe_copy!(pointer(dest, doffs), pointer(src, soffs), n)
108109
else
@@ -121,9 +122,9 @@ function copy!{T}(dest::Array{T}, doffs::Integer, src::Array{T}, soffs::Integer,
121122
unsafe_copy!(dest, doffs, src, soffs, n)
122123
end
123124

124-
copy!{T}(dest::Array{T}, src::Array{T}) = copy!(dest, 1, src, 1, length(src))
125+
copy!(dest::Array{T}, src::Array{T}) where {T} = copy!(dest, 1, src, 1, length(src))
125126

126-
copy{T<:Array}(a::T) = ccall(:jl_array_copy, Ref{T}, (Any,), a)
127+
copy(a::T) where {T<:Array} = ccall(:jl_array_copy, Ref{T}, (Any,), a)
127128

128129
function reinterpret{T,S}(::Type{T}, a::Array{S,1})
129130
nel = Int(div(length(a)*sizeof(S),sizeof(T)))
@@ -317,14 +318,14 @@ oneunit{T}(x::AbstractMatrix{T}) = _one(oneunit(T), x)
317318

318319
## Conversions ##
319320

320-
convert{T}(::Type{Vector}, x::AbstractVector{T}) = convert(Vector{T}, x)
321-
convert{T}(::Type{Matrix}, x::AbstractMatrix{T}) = convert(Matrix{T}, x)
321+
convert(::Type{Vector}, x::AbstractVector{T}) where {T} = convert(Vector{T}, x)
322+
convert(::Type{Matrix}, x::AbstractMatrix{T}) where {T} = convert(Matrix{T}, x)
322323

323-
convert{T,n}(::Type{Array{T}}, x::Array{T,n}) = x
324-
convert{T,n}(::Type{Array{T,n}}, x::Array{T,n}) = x
324+
convert(::Type{Array{T}}, x::Array{T,n}) where {T,n} = x
325+
convert(::Type{Array{T,n}}, x::Array{T,n}) where {T,n} = x
325326

326-
convert{T,n,S}(::Type{Array{T}}, x::AbstractArray{S, n}) = convert(Array{T, n}, x)
327-
convert{T,n,S}(::Type{Array{T,n}}, x::AbstractArray{S,n}) = copy!(Array{T,n}(size(x)), x)
327+
convert(::Type{Array{T}}, x::AbstractArray{S,n}) where {T,n,S} = convert(Array{T,n}, x)
328+
convert(::Type{Array{T,n}}, x::AbstractArray{S,n}) where {T,n,S} = copy!(Array{T,n}(size(x)), x)
328329

329330
promote_rule{T,n,S}(::Type{Array{T,n}}, ::Type{Array{S,n}}) = Array{promote_type(T,S),n}
330331

base/associative.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ length(v::Union{KeyIterator,ValueIterator}) = length(v.dict)
4141
isempty(v::Union{KeyIterator,ValueIterator}) = isempty(v.dict)
4242
_tt1{A,B}(::Type{Pair{A,B}}) = A
4343
_tt2{A,B}(::Type{Pair{A,B}}) = B
44-
eltype{D}(::Type{KeyIterator{D}}) = _tt1(eltype(D))
45-
eltype{D}(::Type{ValueIterator{D}}) = _tt2(eltype(D))
44+
eltype(::Type{KeyIterator{D}}) where {D} = _tt1(eltype(D))
45+
eltype(::Type{ValueIterator{D}}) where {D} = _tt2(eltype(D))
4646

4747
start(v::Union{KeyIterator,ValueIterator}) = start(v.dict)
4848
done(v::Union{KeyIterator,ValueIterator}, state) = done(v.dict, state)
@@ -318,7 +318,7 @@ function filter(f, d::Associative)
318318
return df
319319
end
320320

321-
eltype{K,V}(::Type{Associative{K,V}}) = Pair{K,V}
321+
eltype(::Type{Associative{K,V}}) where {K,V} = Pair{K,V}
322322

323323
function isequal(l::Associative, r::Associative)
324324
l === r && return true

base/atomics.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ julia> x[]
302302
"""
303303
function atomic_min! end
304304

305-
unsafe_convert{T}(::Type{Ptr{T}}, x::Atomic{T}) = convert(Ptr{T}, pointer_from_objref(x))
305+
unsafe_convert(::Type{Ptr{T}}, x::Atomic{T}) where {T} = convert(Ptr{T}, pointer_from_objref(x))
306306
setindex!{T}(x::Atomic{T}, v) = setindex!(x, convert(T, v))
307307

308308
const llvmtypes = Dict(

base/bitarray.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mutable struct BitArray{N} <: DenseArray{Bool, N}
1717
i += 1
1818
end
1919
nc = num_bit_chunks(n)
20-
chunks = Array{UInt64}(nc)
20+
chunks = Vector{UInt64}(nc)
2121
nc > 0 && (chunks[end] = UInt64(0))
2222
b = new(chunks, n)
2323
N != 1 && (b.dims = dims)
@@ -476,7 +476,7 @@ function reshape{N}(B::BitArray, dims::NTuple{N,Int})
476476
prod(dims) == length(B) ||
477477
throw(DimensionMismatch("new dimensions $(dims) must be consistent with array size $(length(B))"))
478478
dims == size(B) && return B
479-
Br = BitArray{N}(ntuple(i->0,N)...)
479+
Br = BitArray{N}(ntuple(i->0,Val{N})...)
480480
Br.chunks = B.chunks
481481
Br.len = prod(dims)
482482
N != 1 && (Br.dims = dims)
@@ -485,8 +485,8 @@ end
485485

486486
## Conversions ##
487487

488-
convert{T,N}(::Type{Array{T}}, B::BitArray{N}) = convert(Array{T,N}, B)
489-
convert{T,N}(::Type{Array{T,N}}, B::BitArray{N}) = _convert(Array{T,N}, B) # see #15801
488+
convert(::Type{Array{T}}, B::BitArray{N}) where {T,N} = convert(Array{T,N}, B)
489+
convert(::Type{Array{T,N}}, B::BitArray{N}) where {T,N} = _convert(Array{T,N}, B) # see #15801
490490
function _convert{T,N}(::Type{Array{T,N}}, B::BitArray{N})
491491
A = Array{T}(size(B))
492492
Bc = B.chunks
@@ -496,8 +496,8 @@ function _convert{T,N}(::Type{Array{T,N}}, B::BitArray{N})
496496
return A
497497
end
498498

499-
convert{T,N}(::Type{BitArray}, A::AbstractArray{T,N}) = convert(BitArray{N}, A)
500-
function convert{T,N}(::Type{BitArray{N}}, A::AbstractArray{T,N})
499+
convert(::Type{BitArray}, A::AbstractArray{T,N}) where {T,N} = convert(BitArray{N}, A)
500+
function convert(::Type{BitArray{N}}, A::AbstractArray{T,N}) where N where T
501501
B = BitArray(size(A))
502502
Bc = B.chunks
503503
l = length(B)
@@ -522,7 +522,7 @@ function convert{T,N}(::Type{BitArray{N}}, A::AbstractArray{T,N})
522522
return B
523523
end
524524

525-
function convert{N}(::Type{BitArray{N}}, A::Array{Bool,N})
525+
function convert(::Type{BitArray{N}}, A::Array{Bool,N}) where N
526526
B = BitArray(size(A))
527527
Bc = B.chunks
528528
l = length(B)
@@ -531,8 +531,8 @@ function convert{N}(::Type{BitArray{N}}, A::Array{Bool,N})
531531
return B
532532
end
533533

534-
convert{N}(::Type{BitArray{N}}, B::BitArray{N}) = B
535-
convert{T,N}(::Type{AbstractArray{T,N}}, B::BitArray{N}) = convert(Array{T,N}, B)
534+
convert(::Type{BitArray{N}}, B::BitArray{N}) where {N} = B
535+
convert(::Type{AbstractArray{T,N}}, B::BitArray{N}) where {T,N} = convert(Array{T,N}, B)
536536

537537
reinterpret{N}(::Type{Bool}, B::BitArray, dims::NTuple{N,Int}) = reinterpret(B, dims)
538538
reinterpret{N}(B::BitArray, dims::NTuple{N,Int}) = reshape(B, dims)
@@ -1684,7 +1684,7 @@ end
16841684
function find(B::BitArray)
16851685
l = length(B)
16861686
nnzB = countnz(B)
1687-
I = Array{Int}(nnzB)
1687+
I = Vector{Int}(nnzB)
16881688
nnzB == 0 && return I
16891689
Bc = B.chunks
16901690
Bcount = 1
@@ -1718,8 +1718,8 @@ findn(B::BitVector) = find(B)
17181718

17191719
function findn(B::BitMatrix)
17201720
nnzB = countnz(B)
1721-
I = Array{Int}(nnzB)
1722-
J = Array{Int}(nnzB)
1721+
I = Vector{Int}(nnzB)
1722+
J = Vector{Int}(nnzB)
17231723
count = 1
17241724
for j = 1:size(B,2), i = 1:size(B,1)
17251725
if B[i,j]

base/boot.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ Task(f::ANY) = ccall(:jl_new_task, Ref{Task}, (Any, Int), f, 0)
294294
# note that there is no actual conversion defined here,
295295
# so the methods and ccall's in Core aren't permitted to use convert
296296
convert(::Type{Any}, x::ANY) = x
297-
convert{T}(::Type{T}, x::T) = x
297+
convert(::Type{T}, x::T) where {T} = x
298298
cconvert{T}(::Type{T}, x) = convert(T, x)
299-
unsafe_convert{T}(::Type{T}, x::T) = x
299+
unsafe_convert(::Type{T}, x::T) where {T} = x
300300

301301
NTuple{N,T} = Tuple{Vararg{T,N}}
302302

0 commit comments

Comments
 (0)