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 Julia 1.10.8 #56653

Merged
merged 26 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
78de77e
Restrict binary ops for Diagonal and Symmetric to Number eltypes (#55…
jishnub Jul 28, 2024
ab4f153
Add compat entry for `Base.donotdelete` (#55773)
LilithHafner Sep 14, 2024
cc996c7
Fix `log_quasitriu` for internal scaling `s=0` (#56311)
aravindh-krishnamoorthy Oct 28, 2024
ace962e
🤖 [backports-release-1.10] Bump the Pkg stdlib from 06f7a7e5b to 8459…
DilumAluthgeBot Nov 24, 2024
87c83b0
Prevent pre-compilation package from triggering its own extensions (#…
topolarity Nov 24, 2024
64e0f11
Add preference for version named manifest files (#43845) (#56600)
IanButterworth Nov 28, 2024
4f7d79e
bump SparseArrays to latest v1.10
KristofferC Dec 1, 2024
964fdf0
Handle no-postdominator case in finalizer pass
topolarity Jun 11, 2024
0c205c9
update irutils.jl and fix the irpasses.jl test
aviatesk Dec 3, 2024
70b34b2
subtype: fast path for Type == TypeVar (#56640)
N5N3 Nov 26, 2024
708c42d
fix `exp(weirdNaN)` (#56784)
oscardssmith Dec 10, 2024
e295286
Fix partially_inline for unreachable (#56787)
wsmoses Dec 12, 2024
1ddd0b6
bump Pkg to latest 1.10
Dec 13, 2024
4675b3b
Revert "Restrict binary ops for Diagonal and Symmetric to Number elty…
Jan 2, 2025
e62a06c
xref `UnionAll` in the doc string of `where` (#56411)
nsajko Dec 15, 2024
a76b887
docs: fix edge case in rational number conversion `float(a//b)` (#56772)
Priynsh Dec 18, 2024
fffbe5c
dict docs: document that ordering of keys/values/pairs match iterate …
cossio Dec 18, 2024
2215785
Extend `Base.rationalize` instead of defining new function (#56793)
sostock Dec 19, 2024
84ec1cc
Don't report only-inferred methods as recompiles (#56914)
IanButterworth Jan 2, 2025
befc611
[BinaryPlatforms] Parse `rc64`/`riscv64` triplets
giordano Jan 8, 2025
c7ff203
🤖 [backports-release-1.10] Bump the SparseArrays stdlib from 78035e1 …
DilumAluthgeBot Jan 10, 2025
0c13b15
🤖 [backports-release-1.10] Bump the Pkg stdlib from 0ac49eb3e to 6390…
DilumAluthgeBot Jan 10, 2025
24062bf
Backport "serialization: fix relocatability bug" to 1.10 (#56973)
vchuravy Jan 10, 2025
c872119
disable flaky tests - part backport from #53682
IanButterworth Jan 12, 2025
926eedc
REPL: Limit method lookup when completing kwargs (#56963)
IanButterworth Jan 6, 2025
4d7bdbf
fix kwarg limit method backport
KristofferC Jan 13, 2025
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
Prev Previous commit
Next Next commit
subtype: fast path for Type == TypeVar (#56640)
close #56606

(cherry picked from commit 7df1dfa)
  • Loading branch information
N5N3 authored and KristofferC committed Jan 13, 2025
commit 70b34b2f9c588a8c84a5f0a767f89fa5f49b8169
42 changes: 42 additions & 0 deletions src/subtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -1572,6 +1572,42 @@ static int local_forall_exists_subtype(jl_value_t *x, jl_value_t *y, jl_stenv_t
return sub;
}

static int equal_var(jl_tvar_t *v, jl_value_t *x, jl_stenv_t *e)
{
assert(e->Loffset == 0);
// Theoretically bounds change would be merged for union inputs.
// But intersection is not happy as splitting helps to avoid circular env.
assert(!e->intersection || !jl_is_uniontype(x));
jl_varbinding_t *vb = lookup(e, v);
if (e->intersection && vb != NULL && vb->lb == vb->ub && jl_is_typevar(vb->lb))
return equal_var((jl_tvar_t *)vb->lb, x, e);
record_var_occurrence(vb, e, 2);
if (vb == NULL)
return e->ignore_free || (
local_forall_exists_subtype(x, v->lb, e, 2, !jl_has_free_typevars(x)) &&
local_forall_exists_subtype(v->ub, x, e, 0, 0));
if (!vb->right)
return local_forall_exists_subtype(x, vb->lb, e, 2, !jl_has_free_typevars(x)) &&
local_forall_exists_subtype(vb->ub, x, e, 0, 0);
if (vb->lb == x)
return var_lt(v, x, e, 0);
if (!subtype_ccheck(x, vb->ub, e))
return 0;
jl_value_t *lb = simple_join(vb->lb, x);
JL_GC_PUSH1(&lb);
if (!e->intersection || !jl_is_typevar(lb) || !reachable_var(lb, v, e))
vb->lb = lb;
JL_GC_POP();
if (vb->ub == x)
return 1;
if (!subtype_ccheck(vb->lb, x, e))
return 0;
// skip `simple_meet` here as we have proven `x <: vb->ub`
if (!e->intersection || !reachable_var(x, v, e))
vb->ub = x;
return 1;
}

static int forall_exists_equal(jl_value_t *x, jl_value_t *y, jl_stenv_t *e)
{
if (obviously_egal(x, y)) return 1;
Expand Down Expand Up @@ -1602,6 +1638,12 @@ static int forall_exists_equal(jl_value_t *x, jl_value_t *y, jl_stenv_t *e)
}
}

if (e->Loffset == 0 && jl_is_typevar(y) && jl_is_type(x) && (!e->intersection || !jl_is_uniontype(x))) {
// Fastpath for Type == TypeVar.
// Avoid duplicated `<:` check between adjacent `var_gt` and `var_lt`
return equal_var((jl_tvar_t *)y, x, e);
}

jl_saved_unionstate_t oldLunions; push_unionstate(&oldLunions, &e->Lunions);

int sub = local_forall_exists_subtype(x, y, e, 2, -1);
Expand Down
16 changes: 16 additions & 0 deletions test/subtype.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2679,3 +2679,19 @@ let S = Dict{V,V} where {V},
@test A <: typeintersect(S, T)
@test A <: typeintersect(T, S)
end

#issue 56606
let
A = Tuple{Val{1}}
B = Tuple{Val}
for _ in 1:30
A = Tuple{Val{A}}
B = Tuple{Val{<:B}}
end
@test A <: B
end
@testintersect(
Val{Tuple{Int,S,T}} where {S<:Any,T<:Vector{Vector{Int}}},
Val{Tuple{T,R,S}} where {T,R<:Vector{T},S<:Vector{R}},
Val{Tuple{Int, Vector{Int}, T}} where T<:Vector{Vector{Int}},
)