Skip to content

Commit

Permalink
Merge branch 'master' into avi/typedslot
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk authored Feb 17, 2023
2 parents c751080 + 8068e44 commit 0f6f75a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
2 changes: 1 addition & 1 deletion deps/openblas.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ OPENBLAS_GIT_URL := https://github.com/xianyi/OpenBLAS.git
OPENBLAS_TAR_URL = https://api.github.com/repos/xianyi/OpenBLAS/tarball/$1
$(eval $(call git-external,openblas,OPENBLAS,,,$(BUILDDIR)))

OPENBLAS_BUILD_OPTS := CC="$(CC) $(SANITIZE_OPTS)" FC="$(FC) $(SANITIZE_OPTS) -L/home/keno/julia-msan/usr/lib" LD="$(LD) $(SANITIZE_LDFLAGS)" RANLIB="$(RANLIB)" BINARY=$(BINARY)
OPENBLAS_BUILD_OPTS := CC="$(CC) $(SANITIZE_OPTS)" FC="$(FC) $(SANITIZE_OPTS)" LD="$(LD) $(SANITIZE_LDFLAGS)" RANLIB="$(RANLIB)" BINARY=$(BINARY)

# Thread support
ifeq ($(OPENBLAS_USE_THREAD), 1)
Expand Down
18 changes: 12 additions & 6 deletions src/subtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -2715,7 +2715,7 @@ static jl_value_t *finish_unionall(jl_value_t *res JL_MAYBE_UNROOTED, jl_varbind

// remove/replace/rewrap free occurrences of this var in the environment
jl_varbinding_t *btemp = e->vars;
int wrap = 1;
jl_varbinding_t *wrap = NULL;
while (btemp != NULL) {
if (jl_has_typevar(btemp->lb, vb->var)) {
if (vb->lb == (jl_value_t*)btemp->var) {
Expand All @@ -2736,14 +2736,11 @@ static jl_value_t *finish_unionall(jl_value_t *res JL_MAYBE_UNROOTED, jl_varbind
!jl_has_typevar(vb->ub, btemp->var) && jl_has_typevar(btemp->ub, vb->var)) {
// if our variable is T, and some outer variable has constraint S = Ref{T},
// move the `where T` outside `where S` instead of putting it here. issue #21243.
if (btemp->innervars == NULL)
btemp->innervars = jl_alloc_array_1d(jl_array_any_type, 0);
if (newvar != vb->var) {
btemp->lb = jl_substitute_var(btemp->lb, vb->var, (jl_value_t*)newvar);
btemp->ub = jl_substitute_var(btemp->ub, vb->var, (jl_value_t*)newvar);
}
jl_array_ptr_1d_push(btemp->innervars, (jl_value_t*)newvar);
wrap = 0;
wrap = btemp;
btemp = btemp->prev;
continue;
}
Expand Down Expand Up @@ -2776,6 +2773,15 @@ static jl_value_t *finish_unionall(jl_value_t *res JL_MAYBE_UNROOTED, jl_varbind
btemp = btemp->prev;
}

if (wrap) {
// We only assign the newvar with the outmost var.
// This make sure we never create a UnionAll with 2 identical vars.
if (wrap->innervars == NULL)
wrap->innervars = jl_alloc_array_1d(jl_array_any_type, 0);
jl_array_ptr_1d_push(wrap->innervars, (jl_value_t*)newvar);
}


// if `v` still occurs, re-wrap body in `UnionAll v` or eliminate the UnionAll
if (jl_has_typevar(res, vb->var)) {
if (varval) {
Expand All @@ -2796,7 +2802,7 @@ static jl_value_t *finish_unionall(jl_value_t *res JL_MAYBE_UNROOTED, jl_varbind
if (newvar != vb->var)
res = jl_substitute_var(res, vb->var, (jl_value_t*)newvar);
varval = (jl_value_t*)newvar;
if (wrap)
if (!wrap)
res = jl_type_unionall((jl_tvar_t*)newvar, res);
}
}
Expand Down
7 changes: 2 additions & 5 deletions stdlib/LinearAlgebra/src/adjtrans.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

using Base: @propagate_inbounds
import Base: length, size, axes, IndexStyle, getindex, setindex!, parent, vec, convert, similar

### basic definitions (types, aliases, constructors, abstractarray interface, sundry similar)

# note that Adjoint and Transpose must be able to wrap not only vectors and matrices
Expand All @@ -12,7 +9,7 @@ import Base: length, size, axes, IndexStyle, getindex, setindex!, parent, vec, c
Adjoint
Lazy wrapper type for an adjoint view of the underlying linear algebra object,
usually an `AbstractVector`/`AbstractMatrix`, but also some `Factorization`, for instance.
usually an `AbstractVector`/`AbstractMatrix`.
Usually, the `Adjoint` constructor should not be called directly, use [`adjoint`](@ref)
instead. To materialize the view use [`copy`](@ref).
Expand All @@ -39,7 +36,7 @@ end
Transpose
Lazy wrapper type for a transpose view of the underlying linear algebra object,
usually an `AbstractVector`/`AbstractMatrix`, but also some `Factorization`, for instance.
usually an `AbstractVector`/`AbstractMatrix`.
Usually, the `Transpose` constructor should not be called directly, use [`transpose`](@ref)
instead. To materialize the view use [`copy`](@ref).
Expand Down
2 changes: 1 addition & 1 deletion stdlib/LinearAlgebra/test/abstractq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ n = 5
@test I*Q Q.Q*I rtol=2eps(real(T))
@test I*Q' I*Q.Q' rtol=2eps(real(T))
@test abs(det(Q)) 1
@test logabsdet(Q)[1] 0 atol=2eps(real(T))
@test logabsdet(Q)[1] 0 atol=2n*eps(real(T))
y = rand(T, n)
@test Q * y Q.Q * y Q' \ y ldiv!(Q', copy(y)) ldiv!(zero(y), Q', y)
@test Q'y Q.Q' * y Q \ y ldiv!(Q, copy(y)) ldiv!(zero(y), Q, y)
Expand Down
11 changes: 11 additions & 0 deletions test/subtype.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2447,3 +2447,14 @@ end
#issue 48582
@test !<:(Tuple{Pair{<:T,<:T}, Val{S} where {S}} where {T<:Base.BitInteger},
Tuple{Pair{<:T,<:T}, Val{Int}} where {T<:Base.BitInteger})

struct T48695{T, N, H<:AbstractArray} <: AbstractArray{Union{Missing, T}, N} end
struct S48695{T, N, H<:AbstractArray{T, N}} <: AbstractArray{T, N} end
let S = Tuple{Type{S48695{T, 2, T48695{B, 2, C}}} where {T<:(Union{Missing, A} where A), B, C}, T48695{T, 2} where T},
T = Tuple{Type{S48695{T, N, H}}, H} where {T, N, H<:AbstractArray{T, N}}
V = typeintersect(S, T)
vars_in_unionall(s) = s isa UnionAll ? (s.var, vars_in_unionall(s.body)...) : ()
@test V != Union{}
@test allunique(vars_in_unionall(V))
@test typeintersect(V, T) != Union{}
end

0 comments on commit 0f6f75a

Please sign in to comment.