Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into accumulate-itr
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Mar 22, 2020
2 parents 0098f07 + 6baa701 commit 78f3885
Show file tree
Hide file tree
Showing 513 changed files with 6,361 additions and 7,519 deletions.
3 changes: 3 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM julia:latest

RUN apt-get update && apt-get install -y build-essential libatomic1 python gfortran perl wget m4 cmake pkg-config git
8 changes: 8 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extensions": [
"julialang.language-julia",
"ms-vscode.cpptools"
],

"dockerFile": "Dockerfile"
}
22 changes: 0 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,6 @@ A useful bug report filed as a GitHub issue provides information about how to re

## Submitting contributions

### Contributing a Julia package

Julia has a built-in [package manager](https://julialang.github.io/Pkg.jl/v1/) based on `git`. A number of [packages](https://pkg.julialang.org) across many domains are already available for Julia. Developers are encouraged to provide their libraries as a Julia package. The manual provides instructions on [creating Julia packages](https://julialang.github.io/Pkg.jl/v1/creating-packages/).

For developers who need to wrap C libraries so that they can be called from Julia, the [Clang.jl](https://github.com/ihnorton/Clang.jl) package can help generate the wrappers automatically from the C header files.

### Package Compatibility Across Releases

Sometimes, you might find that while your package works
on the current release, it might not work on the upcoming release or nightly.
This is due to the fact that some Julia functions (after some discussion)
could be deprecated or removed altogether. This may cause your package to break or
throw a number of deprecation warnings on usage. Therefore it is highly recommended
to port your package to latest Julia release.

However, porting a package to the latest release may cause the package to break on
earlier Julia releases. To maintain compatibility across releases, use
[`Compat.jl`](https://github.com/JuliaLang/Compat.jl). Find the fix for your package
from the README, and specify the minimum version of Compat that provides the fix
in your REQUIRE file. To find the correct minimum version, refer to
[this guide](https://github.com/JuliaLang/Compat.jl/#tagging-the-correct-minimum-version-of-compat).

### Writing tests

There are never enough tests. Track [code coverage at Coveralls](https://coveralls.io/r/JuliaLang/julia), and help improve it.
Expand Down
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ New library functions
* Added `Base.hasproperty` and `Base.hasfield` ([#28850]).
* One argument `!=(x)`, `>(x)`, `>=(x)`, `<(x)`, `<=(x)` have been added, returning partially-applied
versions of the functions, similar to the existing `==(x)` and `isequal(x)` methods ([#30915]).
* The new `map!(f, values(::AbstractDict))` method allows to modify in-place values of a dictionary ([#31223]).

Standard library changes
------------------------
Expand Down
18 changes: 15 additions & 3 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1012,14 +1012,26 @@ endif

# We need python for things like BB triplet recognition. We don't really care
# about version, generally, so just find something that works:
PYTHON := $(shell which python 2>/dev/null || which python3 2>/dev/null || which python2 2>/dev/null || echo not found)
PYTHON := "$(shell which python 2>/dev/null || which python3 2>/dev/null || which python2 2>/dev/null || echo not found)"
PYTHON_SYSTEM := $(shell $(PYTHON) -c 'from __future__ import print_function; import platform; print(platform.system())')

# If we're running on Cygwin, but using a native-windows Python, we need to use cygpath -w
ifneq ($(and $(filter $(PYTHON_SYSTEM),Windows),$(findstring CYGWIN,$(BUILD_OS))),)
define invoke_python
$(PYTHON) "$$(cygpath -w "$(1)")"
endef
else
define invoke_python
$(PYTHON) "$(1)"
endef
endif

# BinaryBuilder options. We default to "on" for all the projects listed in BB_PROJECTS,
# but only if contrib/normalize_triplet.py works for our requested triplet.
ifeq ($(shell $(PYTHON) $(JULIAHOME)/contrib/normalize_triplet.py $(or $(XC_HOST),$(XC_HOST),$(BUILD_MACHINE)) >/dev/null 2>/dev/null; echo $$?),0)
ifeq ($(shell $(call invoke_python,$(JULIAHOME)/contrib/normalize_triplet.py) $(or $(XC_HOST),$(XC_HOST),$(BUILD_MACHINE)) >/dev/null 2>/dev/null; echo $$?),0)
USE_BINARYBUILDER ?= 1
else
ifneq ($(shell $(PYTHON) $(JULIAHOME)/contrib/normalize_triplet.py x86_64-linux-gnu),x86_64-linux-gnu)
ifneq ($(shell $(call invoke_python,$(JULIAHOME)/contrib/normalize_triplet.py) x86_64-linux-gnu),x86_64-linux-gnu)
$(warning normalize_triplet.py appears to be non-functional (used python interpreter "$(PYTHON)"), so BinaryBuilder disabled)
endif
USE_BINARYBUILDER ?= 0
Expand Down
18 changes: 8 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ else
JL_PRIVATE_LIBS-$(USE_SYSTEM_ZLIB) += libz
endif
ifeq ($(USE_LLVM_SHLIB),1)
JL_PRIVATE_LIBS-$(USE_SYSTEM_LLVM) += libLLVM libLLVM-9
JL_PRIVATE_LIBS-$(USE_SYSTEM_LLVM) += libLLVM libLLVM-9jl
endif

ifeq ($(USE_SYSTEM_LIBM),0)
Expand Down Expand Up @@ -272,7 +272,7 @@ endef
ifeq (,$(findstring $(OS),FreeBSD WINNT))
julia-base: $(build_libdir)/libgfortran*.$(SHLIB_EXT)*
$(build_libdir)/libgfortran*.$(SHLIB_EXT)*: | $(build_libdir) julia-deps
-$(CUSTOM_LD_LIBRARY_PATH) PATH="$(PATH):$(build_depsbindir)" PATCHELF="$(PATCHELF)" $(JULIAHOME)/contrib/fixup-libgfortran.sh --verbose $(build_libdir)
-$(CUSTOM_LD_LIBRARY_PATH) PATH="$(PATH):$(build_depsbindir)" PATCHELF="$(PATCHELF)" FC="$(FC)" $(JULIAHOME)/contrib/fixup-libgfortran.sh --verbose $(build_libdir)
JL_PRIVATE_LIBS-0 += libgfortran libgcc_s libquadmath
endif

Expand Down Expand Up @@ -465,17 +465,15 @@ endif
ifeq ($(OS), Darwin)
-cat $(JULIAHOME)/contrib/mac/startup.jl >> $(DESTDIR)$(prefix)/etc/julia/startup.jl
endif

ifeq ($(OS), WINNT)
cd $(BUILDROOT)/julia-$(JULIA_COMMIT)/bin && rm -f llvm* llc.exe lli.exe opt.exe LTO.dll bugpoint.exe macho-dump.exe
endif
cd $(BUILDROOT) && $(TAR) zcvf $(JULIA_BINARYDIST_FILENAME).tar.gz julia-$(JULIA_COMMIT)

# run Inno Setup to compile installer; /O flag specifies where to place installer and /F flag the installer name
$(call spawn,$(JULIAHOME)/dist-extras/inno/iscc.exe /DAppVersion=$(JULIA_VERSION) /DAppSourceFiles="$(call cygpath_w,$(BUILDROOT)/julia-$(JULIA_COMMIT))" /DAppHomeFiles="$(call cygpath_w,$(JULIAHOME))" /F"$(JULIA_BINARYDIST_FILENAME)" /O"$(call cygpath_w,$(BUILDROOT))" $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.iss))
exe:
# run Inno Setup to compile installer
$(call spawn,$(JULIAHOME)/dist-extras/inno/iscc.exe /DAppVersion=$(JULIA_VERSION) /DSourceDir="$(call cygpath_w,$(BUILDROOT)/julia-$(JULIA_COMMIT))" /DRepoDir="$(call cygpath_w,$(JULIAHOME))" /F"$(JULIA_BINARYDIST_FILENAME)" /O"$(call cygpath_w,$(BUILDROOT))" $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.iss))
chmod a+x "$(BUILDROOT)/$(JULIA_BINARYDIST_FILENAME).exe"
else
cd $(BUILDROOT) && $(TAR) zcvf $(JULIA_BINARYDIST_FILENAME).tar.gz julia-$(JULIA_COMMIT)
endif
rm -fr $(BUILDROOT)/julia-$(JULIA_COMMIT)

app:
$(MAKE) -C contrib/mac/app
Expand Down Expand Up @@ -594,7 +592,7 @@ win-extras:
@$(MAKE) -C $(BUILDROOT)/deps install-p7zip
mkdir -p $(JULIAHOME)/dist-extras
cd $(JULIAHOME)/dist-extras && \
$(JLDOWNLOAD) http://www.jrsoftware.org/download.php/is.exe && \
$(JLDOWNLOAD) https://www.jrsoftware.org/download.php/is.exe && \
chmod a+x is.exe && \
$(call spawn, $(JULIAHOME)/dist-extras/is.exe /DIR="$(call cygpath_w,$(JULIAHOME)/dist-extras/inno)" /PORTABLE=1 /CURRENTUSER /VERYSILENT)

Expand Down
27 changes: 25 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ New language features
* `` is now parsed as a binary operator with times precedence. It can be entered in the REPL
with `\bbsemi` followed by <kbd>TAB</kbd> ([#34722]).

* `±` and `` are now unary operators as well, like `+` or `-`. Attention has to be paid in
macros and matrix constructors, which are whitespace sensitive, because expressions like
`[a ±b]` now get parsed as `[a ±(b)]` instead of `[±(a, b)]`. ([#34200])

* Packages can now provide custom hints to help users resolve errors by using the
`register_error_hint` function. Packages that define custom exception types
can support hints by calling `show_error_hints` from their `showerror` method. ([#35094])

Language changes
----------------

Expand Down Expand Up @@ -36,6 +44,19 @@ Language changes

* The syntax `(;)` (which was deprecated in v1.4) now creates an empty named tuple ([#30115]).

* `@inline` macro can now be applied to short-form anonymous functions ([#34953]).

* In triple-quoted string literals, whitespace stripping is now done before processing
escape sequences instead of after. For example, the syntax
```
"""
a\n b"""
```
used to yield the string " a\nb", since the single space before `b` set the indent level.
Now the result is "a\n b", since the space before `b` is no longer considered to occur
at the start of a line. The old behavior is considered a bug ([#35001]).


Multi-threading changes
-----------------------

Expand All @@ -46,7 +67,7 @@ Build system changes

New library functions
---------------------

* The `@ccall` macro has been added added to Base. It is a near drop-in replacement for `ccall` with more Julia-like syntax. It also wraps the new `foreigncall` API for varargs of different types, though it lacks the the capability to specify an LLVM calling convention. ([#32748])
* New functions `mergewith` and `mergewith!` supersede `merge` and `merge!` with `combine`
argument. They don't have the restriction for `combine` to be a `Function` and also
provide one-argument method that returns a closure. The old methods of `merge` and
Expand All @@ -57,6 +78,7 @@ New library functions
expressions before they are evaluated ([#34595]).
* New function `bitreverse` for reversing the order of bits in a fixed-width integer ([#34791]).
* New function `bitrotate(x, k)` for rotating the bits in a fixed-width integer ([#33937]).
* One argument methods `startswith(x)` and `endswith(x)` have been added, returning partially-applied versions of the functions, similar to existing methods like `isequal(x)` ([#33193]).

New library features
--------------------
Expand All @@ -66,7 +88,8 @@ New library features
* `isapprox` (or ``) now has a one-argument "curried" method `isapprox(x)` which returns a function, like `isequal` (or `==`)` ([#32305]).
* `Ref{NTuple{N,T}}` can be passed to `Ptr{T}`/`Ref{T}` `ccall` signatures ([#34199])
* `accumulate`, `cumsum`, and `cumprod` now support `Tuple` ([#34654]) and arbitrary iterators ([#34656]).

* In `splice!` with no replacement, values to be removed can now be specified with an
arbitrary iterable (instead of a `UnitRange`) ([#34524]).

Standard library changes
------------------------
Expand Down
11 changes: 11 additions & 0 deletions base/abstractdict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,14 @@ end
getindex(t::AbstractDict, k1, k2, ks...) = getindex(t, tuple(k1,k2,ks...))
setindex!(t::AbstractDict, v, k1, k2, ks...) = setindex!(t, v, tuple(k1,k2,ks...))

get!(t::AbstractDict, key, default) = get!(() -> default, t, key)
function get!(default::Callable, t::AbstractDict{K,V}, key) where K where V
haskey(t, key) && return t[key]
val = default()
t[key] = val
return val
end

push!(t::AbstractDict, p::Pair) = setindex!(t, p.second, p.first)
push!(t::AbstractDict, p::Pair, q::Pair) = push!(push!(t, p), q)
push!(t::AbstractDict, p::Pair, q::Pair, r::Pair...) = push!(push!(push!(t, p), q), r...)
Expand Down Expand Up @@ -552,6 +560,9 @@ Modifies `dict` by transforming each value from `val` to `f(val)`.
Note that the type of `dict` cannot be changed: if `f(val)` is not an instance of the value type
of `dict` then it will be converted to the value type if possible and otherwise raise an error.
!!! compat "Julia 1.2"
`map!(f, values(dict::AbstractDict))` requires Julia 1.2 or later.
# Examples
```jldoctest
julia> d = Dict(:a => 1, :b => 2)
Expand Down
11 changes: 7 additions & 4 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1393,17 +1393,20 @@ function splice!(a::Vector, i::Integer, ins=_default_splice)
end

"""
splice!(a::Vector, range, [replacement]) -> items
splice!(a::Vector, indices, [replacement]) -> items
Remove items in the specified index range, and return a collection containing
Remove items at specified indices, and return a collection containing
the removed items.
Subsequent items are shifted left to fill the resulting gap.
Subsequent items are shifted left to fill the resulting gaps.
If specified, replacement values from an ordered collection will be spliced in
place of the removed items.
place of the removed items; in this case, `indices` must be a `UnitRange`.
To insert `replacement` before an index `n` without removing any items, use
`splice!(collection, n:n-1, replacement)`.
!!! compat "Julia 1.5"
Prior to Julia 1.5, `indices` must always be a `UnitRange`.
# Examples
```jldoctest
julia> A = [-1, -2, -3, 5, 4, 3, -1]; splice!(A, 4:3, 2)
Expand Down
32 changes: 21 additions & 11 deletions base/arrayshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,10 @@ _show_empty(io, X) = nothing # by default, we don't know this constructor
function show(io::IO, X::AbstractArray)
ndims(X) == 0 && return show_zero_dim(io, X)
ndims(X) == 1 && return show_vector(io, X)
prefix = typeinfo_prefix(io, X)
io = IOContext(io, :typeinfo => eltype(X))
prefix, implicit = typeinfo_prefix(io, X)
if !implicit
io = IOContext(io, :typeinfo => eltype(X))
end
isempty(X) ?
_show_empty(io, X) :
_show_nonempty(io, X, prefix)
Expand All @@ -453,9 +455,12 @@ end
# NOTE: v is not constrained to be a vector, as this function can work with iterables
# in general (it's used e.g. by show(::IO, ::Set))
function show_vector(io::IO, v, opn='[', cls=']')
print(io, typeinfo_prefix(io, v))
prefix, implicit = typeinfo_prefix(io, v)
print(io, prefix)
# directly or indirectly, the context now knows about eltype(v)
io = IOContext(io, :typeinfo => eltype(v))
if !implicit
io = IOContext(io, :typeinfo => eltype(v))
end
limited = get(io, :limit, false)

if limited && length(v) > 20
Expand Down Expand Up @@ -497,6 +502,7 @@ end
# X not constrained, can be any iterable (cf. show_vector)
function typeinfo_prefix(io::IO, X)
typeinfo = get(io, :typeinfo, Any)::Type

if !(X isa typeinfo)
typeinfo = Any
end
Expand All @@ -506,19 +512,23 @@ function typeinfo_prefix(io::IO, X)
eltype_X = eltype(X)

if X isa AbstractDict
if eltype_X == eltype_ctx || (!isempty(X) && typeinfo_implicit(keytype(X)) && typeinfo_implicit(valtype(X)))
string(typeof(X).name)
if eltype_X == eltype_ctx
string(typeof(X).name), false
elseif !isempty(X) && typeinfo_implicit(keytype(X)) && typeinfo_implicit(valtype(X))
string(typeof(X).name), true
else
string(typeof(X))
string(typeof(X)), false
end
else
# Types hard-coded here are those which are created by default for a given syntax
if eltype_X == eltype_ctx || (!isempty(X) && typeinfo_implicit(eltype_X))
""
if eltype_X == eltype_ctx
"", false
elseif !isempty(X) && typeinfo_implicit(eltype_X)
"", true
elseif print_without_params(eltype_X)
string(unwrap_unionall(eltype_X).name) # Print "Array" rather than "Array{T,N}"
string(unwrap_unionall(eltype_X).name), false # Print "Array" rather than "Array{T,N}"
else
string(eltype_X)
string(eltype_X), false
end
end
end
4 changes: 4 additions & 0 deletions base/bitset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,11 @@ function ==(s1::BitSet, s2::BitSet)

# compare overlap values
if overlap > 0
t1 = @_gc_preserve_begin a1
t2 = @_gc_preserve_begin a2
_memcmp(pointer(a1, b2-b1+1), pointer(a2), overlap<<3) == 0 || return false
@_gc_preserve_end t2
@_gc_preserve_end t1
end

return true
Expand Down
Loading

0 comments on commit 78f3885

Please sign in to comment.