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

Backports for 1.1.0 #30309

Merged
merged 47 commits into from
Dec 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
797a24d
Some more compat annotations (#30297)
fredrikekre Dec 7, 2018
36b60b7
fix #30303, escaping $ when showing Symbols (#30304)
JeffBezanson Dec 8, 2018
1af3b18
Fix makefile not removing libjulia-debugon windows (#30059)
musm Dec 8, 2018
1fc30b5
Add LinearAlgebra as test dependency to Distributed. (#30311)
fredrikekre Dec 8, 2018
ae33118
Fix armv7l compilation (#30253)
staticfloat Dec 9, 2018
7fd07d9
Make `unique(f, itr)` and `unique!(f, itr)` faster (#30286)
andyferris Dec 9, 2018
c9baf5c
Unexport catch_stack
c42f Dec 8, 2018
0f8c505
Use `JL_AArch64_crc` instead of `HWCAP_CRC32` (#30324)
staticfloat Dec 9, 2018
7b52bed
NEWS edits for 1.1 (#30302)
JeffBezanson Dec 10, 2018
5fca9de
`@inbounds` annotations for filter (#30156)
andyferris Dec 11, 2018
ca1b40e
Expand and fix documentation of BitArray (#30340)
mbauman Dec 11, 2018
2be2ebf
oneunit of sparse matrix should return sparse matrix (#30228)
KlausC Dec 11, 2018
76ce618
Upgrade Pkg to version 1.1. (#30342)
fredrikekre Dec 11, 2018
acbb3cc
adding == for structured matrices (#30108)
mcognetta Dec 11, 2018
cef1167
Update to Documenter 0.21 and prepare for PDF documentation builds. (…
fredrikekre Dec 11, 2018
4ca7837
Adding rtol and atol for pinv and nullspace (#29998)
sam0410 Dec 11, 2018
adadb31
use non Pkg for workflow (#30194)
KristofferC Dec 11, 2018
5ccafa9
fix bug with max_values in union! (#30315)
rfourquet Dec 11, 2018
485ed65
Force specialization on the type argument of `_similar_for` (#30331)
martinholters Dec 12, 2018
7a26d7b
Allow dotted binary tilde (#30351)
ararslan Dec 12, 2018
7b9c0e8
Add compat annotation for NaN handling in (l|r)mul! (#30361)
tkf Dec 12, 2018
a2dcfe6
added doc for AbstractChannel (#30347)
matbesancon Dec 12, 2018
a9c886a
Update references to Base.SparseArrays (#30057)
dlfivefifty Dec 12, 2018
28d9ec2
codegen: disable Bool optimization for maybe-undef fields (#30350)
vtjnash Dec 12, 2018
f4d8ce1
fix #30346, specificity issue with DynamicPolynomials (#30360)
JeffBezanson Dec 12, 2018
9cb1b0e
Copy editing in "Environment variables" docs (#30330)
donm Dec 12, 2018
98e83f6
Add Float16 comparisons (#29916)
sam0410 Dec 13, 2018
7cbac07
improve printf performance by passing digit buffer around (#30373)
JeffBezanson Dec 13, 2018
e8c818f
Upgrade to Pkg 1.1.1. (#30378)
fredrikekre Dec 13, 2018
47bd2ba
fix #30335, regression in intersection of unions of typevars (#30353)
JeffBezanson Dec 13, 2018
0d9fee8
fix reinterpret for 0-dimensional arrays (#30376)
meggart Dec 14, 2018
c045cbe
stacktrace: prevent OOB-error in sysimage lookup (#30369)
vtjnash Dec 17, 2018
2348c7b
Fix #30006, getindex accessing fields that might not exist (#30405)
raghav9-97 Dec 17, 2018
7b9b3e3
Fix sparse cholesky to return Vector when the RHS is a Vector (#30416)
raghav9-97 Dec 17, 2018
3d8942d
spmatmul sparse matrix multiplication - performance improvements (#30…
KlausC Dec 17, 2018
5b766bb
fix #30394, an unsoundness in ml_matches (#30396)
JeffBezanson Dec 17, 2018
64db937
Try implementing N-dimensional indexing for fast linear SubArrays (#3…
mbauman Dec 17, 2018
c379fb0
loading: work on simplifications (and some corrections) of docs (#29946)
vtjnash Dec 17, 2018
898bf8f
fix #30124, broadcast regression due to removed pure annotation (#30420)
JeffBezanson Dec 18, 2018
9a40122
attempt to refine return type when it could be improved via PartialTuple
jrevels Dec 14, 2018
3c086d6
make `ndigits` more generic (#30384)
JeffBezanson Dec 19, 2018
235bdc7
Add link to the pdf version of the documentation to the html pages, f…
fredrikekre Dec 19, 2018
5125952
generalize sparse matrix slicing to integer types (#30319)
dpo Dec 20, 2018
3381093
Base.worker_timeout() mention in manual (#30439)
mgkuhn Dec 20, 2018
4e97adf
Only use llvm-config for library selection when building against syst…
maleadt Dec 21, 2018
949d8e3
Add Dates as a test dependency to SparseArrays. (#30519)
fredrikekre Dec 27, 2018
7cd0d20
Bump Pkg to 1.1.2. (#30521)
fredrikekre Dec 27, 2018
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
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,10 @@ ifeq ($(BUNDLE_DEBUG_LIBS),1)
$(INSTALL_M) $(build_bindir)/julia-debug $(DESTDIR)$(bindir)/
endif
ifeq ($(OS),WINNT)
-$(INSTALL_M) $(build_bindir)/*.dll $(DESTDIR)$(bindir)/
-$(INSTALL_M) $(filter-out $(build_bindir)/libjulia-debug.dll,$(wildcard $(build_bindir)/*.dll)) $(DESTDIR)$(bindir)/
-$(INSTALL_M) $(build_libdir)/libjulia.dll.a $(DESTDIR)$(libdir)/
ifeq ($(BUNDLE_DEBUG_LIBS),1)
-$(INSTALL_M) $(build_bindir)/libjulia-debug.dll $(DESTDIR)$(bindir)/
-$(INSTALL_M) $(build_libdir)/libjulia-debug.dll.a $(DESTDIR)$(libdir)/
endif
-$(INSTALL_M) $(build_bindir)/libopenlibm.dll.a $(DESTDIR)$(libdir)/
Expand Down
51 changes: 31 additions & 20 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
Julia v1.1 Release Notes
==========================
========================

New language features
---------------------

* An *exception stack* is maintained on each task to make exception handling more robust and enable root cause analysis using `catch_stack` ([#28878]).
* An *exception stack* is maintained on each task to make exception handling
more robust and enable root cause analysis. The stack may be accessed using
the experimental function `Base.catch_stack` ([#28878]).
* The experimental macro `Base.@locals` returns a dictionary of current local variable names
and values ([#29733]).
* Binary `~` can now be dotted, as in `x .~ y` ([#30341]).

Language changes
----------------
Expand All @@ -25,13 +28,14 @@ Language changes
the old behavior, or `CartesianIndices(a)[findall(in(b), a)]` to get the new behavior
on previous Julia versions ([#30226]).
* `findmin(::BitArray)` and `findmax(::BitArray)` now return a `CartesianIndex` when `a` is a matrix
or a higher-dimensional array, for consistency with for other array types.
or a higher-dimensional array, for consistency with other array types.
Use `LinearIndices(a)[findmin(a)[2]]` to get the old behavior, or `CartesianIndices(a)[findmin(a)[2]]`
to get the new behavior on previous Julia versions ([#30102]).
* Method signatures such as
`f(::Type{T}, ::T) where {T <: X}` and
`f(::Type{X}, ::Any)`
are now considered ambiguous. Previously a bug caused the first one to be considered more specific ([#30160]).
are now considered ambiguous. Previously a bug caused the first one to be considered more specific in
some cases ([#30160]).

Command-line option changes
---------------------------
Expand All @@ -43,13 +47,14 @@ Command-line option changes
New library functions
---------------------

* `splitpath(p::String)` function, which is the opposite of `joinpath(parts...)`: it splits a filepath into its components ([#28156]).
* `isnothing(::Any)` function, to check whether something is a `Nothing`, returns a `Bool` ([#29679]).
* `splitpath(p::String)` function, which is the opposite of `joinpath(parts...)`: it splits a filepath
into its components ([#28156]).
* `isnothing(::Any)` predicate, to check whether the argument is `nothing`. ([#29679]).
* `getpid(::Process)` method ([#24064]).
* `eachrow`, `eachcol` and `eachslice` functions provide efficient iterators over slices of arrays ([#29749]).
* `fieldtypes(T::Type)` which return the declared types of the field in type T ([#29600]).
* `fieldtypes(T::Type)` which returns the declared types of the field in type T ([#29600]).
* `uuid5` has been added to the `UUIDs` standard library ([#28761]).
* Predicate functions `Sys.isfreebsd`, `Sys.isopenbsd`, `Sys.isnetbsd`, and `Sys.isdragonfly` for
* Predicates `Sys.isfreebsd`, `Sys.isopenbsd`, `Sys.isnetbsd`, and `Sys.isdragonfly` for
detecting BSD systems have been added ([#30249]).
* Internal `Base.disable_library_threading` that sets libraries to use one thread.
It executes function hooks that have been registered with
Expand All @@ -70,7 +75,7 @@ Standard library changes
argument ([#29157]).
* The use of scientific notation when printing `BigFloat` values is now consistent with other floating point
types ([#29211]).
* `Regex` now behave like a scalar when used in broadcasting ([#29913]).
* `Regex` now behaves like a scalar when used in broadcasting ([#29913]).
* `Char` now behaves like a read-only 0-dimensional array ([#29819]).
* `parse` now allows strings representing integer 0 and 1 for type `Bool` ([#29980]).
* `Base.tail` now works on named tuples ([#29595]).
Expand All @@ -79,24 +84,21 @@ Standard library changes
* `Base.julia_cmd` now propagates the `--inline=(yes|no)` flag ([#29858]).
* `Base.@kwdef` can now be used for parametric structs, and for structs with supertypes ([#29316]).
* `merge(::NamedTuple, ::NamedTuple...)` can now be used with more than 2 `NamedTuple`s ([#29259]).
* `Future.copy!` has been moved to `Base` ([#29178]).
* New `ncodeunits(c::Char)` method as a fast equivalent to `ncodeunits(string(c))` ([#29153]).
* New `sort!(::AbstractArray; dims)` method that can sort the array along the `dims` dimension ([#28902]).
* `range` now accept `stop` as a positional argument ([#28708]).
* `get(A::AbstractArray, (), default)` now returns the result of `A[]` if it can instead of always
returning an empty array ([#30270]).
* `range` now accepts `stop` as a positional argument ([#28708]).
* `get(A::AbstractArray, (), default)` now returns `A[]` instead of an empty array ([#30270]).
* `parse(Bool, str)` is now supported ([#29997]).
* `copyto!(::AbstractMatrix, ::UniformScaling)` supports rectangular matrices now ([#28790]).
* In `put!(c::Channel{T}, v)`, `v` now gets converted to `T` as `put!` is being called ([#29092]).
* `copyto!(::AbstractMatrix, ::UniformScaling)` now supports rectangular matrices ([#28790]).
* `current_project()` now searches the parent directories of a Git repository for a `Project.toml` file.
This also affects the behavior of the `--project` command line option when using the default
`--project=@.` ([#29108]).
* The `spawn` API is now more flexible and supports taking IOBuffer directly as a I/O stream,
* The `spawn` API is now more flexible and supports taking IOBuffer directly as an I/O stream,
converting to a system pipe as needed ([#30278]).

#### Dates
* New `DateTime(::Date, ::Time)` constructor ([#29754]).
* `TimeZone` now behave like a scalar when used in broadcasting ([#30159]).
* `TimeZone` now behaves like a scalar when used in broadcasting ([#30159]).

#### InteractiveUtils
* `edit` can now be called on a module to edit the file that defines it ([#29636]).
Expand All @@ -108,7 +110,8 @@ Standard library changes
* `isdiag` and `isposdef` for `Diagonal` and `UniformScaling` ([#29638]).
* `mul!`, `rmul!` and `lmul!` methods for `UniformScaling` ([#29506]).
* `Symmetric` and `Hermitian` matrices now preserve the wrapper when scaled with a number ([#29469]).
* Exponentiation operator `^` now supports raising a `Irrational` to an `AbstractMatrix` power ([#29782]).
* Exponentiation operator `^` now supports raising an `Irrational` to an `AbstractMatrix` power ([#29782]).
* Added keyword arguments `rtol`, `atol` to `pinv`, `nullspace` and `rank` ([#29998], [#29926]).

#### Random
* `randperm` and `randcycle` now use the type of their argument to determine the element type of
Expand All @@ -120,7 +123,7 @@ Standard library changes
* `sprandn` now supports specifying the output element type ([#30083]).

#### Statistics
* `mean` and `var` now handles the empty case ([#29033]).
* `mean` and `var` now handle more kinds of empty inputs ([#29033]).

External dependencies
---------------------
Expand All @@ -131,6 +134,7 @@ External dependencies
* The source code for Pkg is no longer included in JuliaLang/julia. Pkg is instead
downloaded during the build process ([#29615]).
* LLVM has been upgraded to 6.0.1 and support for LLVM < 6.0 has been dropped ([#28745], [#28696]).
* Pkg has been upgraded to version 1.1 ([#30342]).

Deprecated or removed
---------------------
Expand Down Expand Up @@ -163,7 +167,6 @@ Deprecated or removed
[#29153]: https://github.com/JuliaLang/julia/issues/29153
[#29157]: https://github.com/JuliaLang/julia/issues/29157
[#29173]: https://github.com/JuliaLang/julia/issues/29173
[#29178]: https://github.com/JuliaLang/julia/issues/29178
[#29211]: https://github.com/JuliaLang/julia/issues/29211
[#29259]: https://github.com/JuliaLang/julia/issues/29259
[#29316]: https://github.com/JuliaLang/julia/issues/29316
Expand Down Expand Up @@ -198,8 +201,16 @@ Deprecated or removed
[#29978]: https://github.com/JuliaLang/julia/issues/29978
[#29980]: https://github.com/JuliaLang/julia/issues/29980
[#29997]: https://github.com/JuliaLang/julia/issues/29997
[#30004]: https://github.com/JuliaLang/julia/issues/30004
[#30022]: https://github.com/JuliaLang/julia/issues/30022
[#30035]: https://github.com/JuliaLang/julia/issues/30035
[#30083]: https://github.com/JuliaLang/julia/issues/30083
[#30102]: https://github.com/JuliaLang/julia/issues/30102
[#30151]: https://github.com/JuliaLang/julia/issues/30151
[#30159]: https://github.com/JuliaLang/julia/issues/30159
[#30160]: https://github.com/JuliaLang/julia/issues/30160
[#30226]: https://github.com/JuliaLang/julia/issues/30226
[#30249]: https://github.com/JuliaLang/julia/issues/30249
[#30270]: https://github.com/JuliaLang/julia/issues/30270
[#30278]: https://github.com/JuliaLang/julia/issues/30278
[#30342]: https://github.com/JuliaLang/julia/issues/30342
9 changes: 8 additions & 1 deletion base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,15 @@ endif
endif # WINNT

symlink_libLLVM: $(build_private_libdir)/libLLVM.dylib
ifneq ($(USE_SYSTEM_LLVM),0)
LLVM_CONFIG_HOST_LIBS := $(shell $(LLVM_CONFIG_HOST) --libfiles)
# HACK: llvm-config doesn't correctly point to shared libs on all platforms
# https://github.com/JuliaLang/julia/issues/29981
else
LLVM_CONFIG_HOST_LIBS := $(shell $(LLVM_CONFIG_HOST) --libdir)/libLLVM.$(SHLIB_EXT)
endif
$(build_private_libdir)/libLLVM.dylib:
REALPATH=`$(LLVM_CONFIG_HOST) --libfiles` && \
REALPATH=$(LLVM_CONFIG_HOST_LIBS) && \
$(call resolve_path,REALPATH) && \
[ -e "$$REALPATH" ] && \
([ ! -e "$@" ] || rm "$@") && \
Expand Down
6 changes: 4 additions & 2 deletions base/abstractset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ function union!(s::AbstractSet, sets...)
end

max_values(::Type) = typemax(Int)
max_values(T::Type{<:Union{Nothing,BitIntegerSmall}}) = 1 << (8*sizeof(T))
max_values(T::Union) = max(max_values(T.a), max_values(T.b))
max_values(T::Union{map(X -> Type{X}, BitIntegerSmall_types)...}) = 1 << (8*sizeof(T))
# saturated addition to prevent overflow with typemax(Int)
max_values(T::Union) = max(max_values(T.a), max_values(T.b), max_values(T.a) + max_values(T.b))
max_values(::Type{Bool}) = 2
max_values(::Type{Nothing}) = 1

function union!(s::AbstractSet{T}, itr) where T
haslength(itr) && sizehint!(s, length(s) + length(itr))
Expand Down
12 changes: 7 additions & 5 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,12 @@ function _collect(::Type{T}, itr, isz::SizeUnknown) where T
end

# make a collection similar to `c` and appropriate for collecting `itr`
_similar_for(c::AbstractArray, T, itr, ::SizeUnknown) = similar(c, T, 0)
_similar_for(c::AbstractArray, T, itr, ::HasLength) = similar(c, T, Int(length(itr)::Integer))
_similar_for(c::AbstractArray, T, itr, ::HasShape) = similar(c, T, axes(itr))
_similar_for(c, T, itr, isz) = similar(c, T)
_similar_for(c::AbstractArray, ::Type{T}, itr, ::SizeUnknown) where {T} = similar(c, T, 0)
_similar_for(c::AbstractArray, ::Type{T}, itr, ::HasLength) where {T} =
similar(c, T, Int(length(itr)::Integer))
_similar_for(c::AbstractArray, ::Type{T}, itr, ::HasShape) where {T} =
similar(c, T, axes(itr))
_similar_for(c, ::Type{T}, itr, isz) where {T} = similar(c, T)

"""
collect(collection)
Expand Down Expand Up @@ -2333,7 +2335,7 @@ function filter!(f, a::AbstractVector)

for acurr in a
if f(acurr)
a[i] = acurr
@inbounds a[i] = acurr
y = iterate(idx, state)
y === nothing && (i += 1; break)
i, state = y
Expand Down
11 changes: 9 additions & 2 deletions base/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
# notes: bits are stored in contiguous chunks
# unused bits must always be set to 0
"""
BitArray{N} <: DenseArray{Bool, N}
BitArray{N} <: AbstractArray{Bool, N}

Space-efficient `N`-dimensional boolean array, which stores one bit per boolean value.
Space-efficient `N`-dimensional boolean array, using just one bit for each boolean value.

`BitArray`s pack up to 64 values into every 8 bytes, resulting in an 8x space efficiency
over `Array{Bool, N}` and allowing some operations to work on 64 values at once.

By default, Julia returns `BitArrays` from [broadcasting](@ref Broadcasting) operations
that generate boolean elements (including dotted-comparisons like `.==`) as well as from
the functions [`trues`](@ref) and [`falses`](@ref).
"""
mutable struct BitArray{N} <: AbstractArray{Bool, N}
chunks::Vector{UInt64}
Expand Down
4 changes: 2 additions & 2 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ toInt8(x::UInt16) = checked_trunc_sint(Int8, check_top_bit(x))
toInt8(x::UInt32) = checked_trunc_sint(Int8, check_top_bit(x))
toInt8(x::UInt64) = checked_trunc_sint(Int8, check_top_bit(x))
toInt8(x::UInt128) = checked_trunc_sint(Int8, check_top_bit(x))
toInt8(x::Bool) = and_int(zext_int(Int8, x), Int8(1))
toInt8(x::Bool) = and_int(bitcast(Int8, x), Int8(1))
toInt16(x::Int8) = sext_int(Int16, x)
toInt16(x::Int16) = x
toInt16(x::Int32) = checked_trunc_sint(Int16, x)
Expand Down Expand Up @@ -679,7 +679,7 @@ toUInt8(x::UInt16) = checked_trunc_uint(UInt8, x)
toUInt8(x::UInt32) = checked_trunc_uint(UInt8, x)
toUInt8(x::UInt64) = checked_trunc_uint(UInt8, x)
toUInt8(x::UInt128) = checked_trunc_uint(UInt8, x)
toUInt8(x::Bool) = and_int(zext_int(UInt8, x), UInt8(1))
toUInt8(x::Bool) = and_int(bitcast(UInt8, x), UInt8(1))
toUInt16(x::Int8) = sext_int(UInt16, check_top_bit(x))
toUInt16(x::Int16) = bitcast(UInt16, check_top_bit(x))
toUInt16(x::Int32) = checked_trunc_uint(UInt16, x)
Expand Down
2 changes: 1 addition & 1 deletion base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ BroadcastStyle(a::AbstractArrayStyle, ::Style{Tuple}) = a
BroadcastStyle(::A, ::A) where A<:ArrayStyle = A()
BroadcastStyle(::ArrayStyle, ::ArrayStyle) = Unknown()
BroadcastStyle(::A, ::A) where A<:AbstractArrayStyle = A()
function BroadcastStyle(a::A, b::B) where {A<:AbstractArrayStyle{M},B<:AbstractArrayStyle{N}} where {M,N}
Base.@pure function BroadcastStyle(a::A, b::B) where {A<:AbstractArrayStyle{M},B<:AbstractArrayStyle{N}} where {M,N}
if Base.typename(A) === Base.typename(B)
return A(Val(max(M, N)))
end
Expand Down
5 changes: 5 additions & 0 deletions base/channels.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

"""
AbstractChannel{T}

Representation of a channel passing objects of type `T`.
"""
abstract type AbstractChannel{T} end

"""
Expand Down
8 changes: 4 additions & 4 deletions base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function abstract_call_gf_by_type(@nospecialize(f), argtypes::Vector{Any}, @nosp
# if there's a possibility we could constant-propagate a better result
# (hopefully without doing too much work), try to do that now
# TODO: it feels like this could be better integrated into abstract_call_method / typeinf_edge
const_rettype = abstract_call_method_with_const_args(f, argtypes, applicable[nonbot]::SimpleVector, sv)
const_rettype = abstract_call_method_with_const_args(rettype, f, argtypes, applicable[nonbot]::SimpleVector, sv)
if const_rettype ⊑ rettype
# use the better result, if it's a refinement of rettype
rettype = const_rettype
Expand Down Expand Up @@ -142,7 +142,7 @@ function abstract_call_gf_by_type(@nospecialize(f), argtypes::Vector{Any}, @nosp
return rettype
end

function abstract_call_method_with_const_args(@nospecialize(f), argtypes::Vector{Any}, match::SimpleVector, sv::InferenceState)
function abstract_call_method_with_const_args(@nospecialize(rettype), @nospecialize(f), argtypes::Vector{Any}, match::SimpleVector, sv::InferenceState)
method = match[3]::Method
nargs::Int = method.nargs
method.isva && (nargs -= 1)
Expand All @@ -159,7 +159,7 @@ function abstract_call_method_with_const_args(@nospecialize(f), argtypes::Vector
end
end
end
haveconst || return Any
haveconst || improvable_via_constant_propagation(rettype) || return Any
sig = match[1]
sparams = match[2]::SimpleVector
code = code_for_method(method, sig, sparams, sv.params.world)
Expand Down Expand Up @@ -1060,7 +1060,7 @@ function typeinf_local(frame::InferenceState)
elseif hd === :return
pc´ = n + 1
rt = widenconditional(abstract_eval(stmt.args[1], s[pc], frame))
if !isa(rt, Const) && !isa(rt, Type) && (!isa(rt, PartialTuple) || frame.cached)
if !isa(rt, Const) && !isa(rt, Type) && !isa(rt, PartialTuple)
# only propagate information we know we can store
# and is valid inter-procedurally
rt = widenconst(rt)
Expand Down
6 changes: 3 additions & 3 deletions base/compiler/ssair/inlining.jl
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ function analyze_method!(idx::Int, @nospecialize(f), @nospecialize(ft), @nospeci
return ConstantCase(quoted(linfo.inferred_const), method, Any[methsp...], metharg)
end

isconst, inferred = find_inferred(linfo, atypes, sv)
isconst, inferred = find_inferred(linfo, atypes, sv, stmttyp)
if isconst
return ConstantCase(inferred, method, Any[methsp...], metharg)
end
Expand Down Expand Up @@ -1152,7 +1152,7 @@ function ssa_substitute_op!(@nospecialize(val), arg_replacements::Vector{Any},
return urs[]
end

function find_inferred(linfo::MethodInstance, @nospecialize(atypes), sv::OptimizationState)
function find_inferred(linfo::MethodInstance, @nospecialize(atypes), sv::OptimizationState, @nospecialize(rettype))
# see if the method has a InferenceResult in the current cache
# or an existing inferred code info store in `.inferred`
haveconst = false
Expand All @@ -1163,7 +1163,7 @@ function find_inferred(linfo::MethodInstance, @nospecialize(atypes), sv::Optimiz
break
end
end
if haveconst
if haveconst || improvable_via_constant_propagation(rettype)
inf_result = cache_lookup(linfo, atypes, sv.params.cache) # Union{Nothing, InferenceResult}
else
inf_result = nothing
Expand Down
8 changes: 6 additions & 2 deletions base/compiler/typeinfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,19 @@ function typeinf_edge(method::Method, @nospecialize(atypes), sparams::SimpleVect
frame.parent = caller
end
typeinf(frame)
return frame.bestguess, frame.inferred ? frame.linfo : nothing
return widenconst_bestguess(frame.bestguess), frame.inferred ? frame.linfo : nothing
elseif frame === true
# unresolvable cycle
return Any, nothing
end
frame = frame::InferenceState
return frame.bestguess, nothing
return widenconst_bestguess(frame.bestguess), nothing
end

function widenconst_bestguess(bestguess)
!isa(bestguess, Const) && !isa(bestguess, Type) && return widenconst(bestguess)
return bestguess
end

#### entry points for inferring a MethodInstance given a type signature ####

Expand Down
9 changes: 9 additions & 0 deletions base/compiler/typeutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,12 @@ function unioncomplexity(t::DataType)
end
unioncomplexity(u::UnionAll) = max(unioncomplexity(u.body), unioncomplexity(u.var.ub))
unioncomplexity(@nospecialize(x)) = 0

function improvable_via_constant_propagation(@nospecialize(t))
if isconcretetype(t) && t <: Tuple
for p in t.parameters
p === DataType && return true
end
end
return false
end
3 changes: 2 additions & 1 deletion base/dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -760,4 +760,5 @@ isempty(t::ImmutableDict) = !isdefined(t, :parent)
empty(::ImmutableDict, ::Type{K}, ::Type{V}) where {K, V} = ImmutableDict{K,V}()

_similar_for(c::Dict, ::Type{Pair{K,V}}, itr, isz) where {K, V} = empty(c, K, V)
_similar_for(c::AbstractDict, T, itr, isz) = throw(ArgumentError("for AbstractDicts, similar requires an element type of Pair;\n if calling map, consider a comprehension instead"))
_similar_for(c::AbstractDict, ::Type{T}, itr, isz) where {T} =
throw(ArgumentError("for AbstractDicts, similar requires an element type of Pair;\n if calling map, consider a comprehension instead"))
3 changes: 2 additions & 1 deletion base/error.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ arbitrary task. This is useful for inspecting tasks which have failed due to
uncaught exceptions.

!!! compat "Julia 1.1"
This function requires at least Julia 1.1.
This function is experimental in Julia 1.1 and will likely be renamed in a
future release (see https://github.com/JuliaLang/julia/pull/29901).
"""
function catch_stack(task=current_task(); include_bt=true)
raw = ccall(:jl_get_excstack, Any, (Any,Cint,Cint), task, include_bt, typemax(Cint))
Expand Down
Loading