Skip to content

Commit 6d07c9d

Browse files
authored
Merge branch 'master' into test_for_no_invalidations
2 parents bd269ba + 787e0d9 commit 6d07c9d

File tree

21 files changed

+126
-37
lines changed

21 files changed

+126
-37
lines changed

Compiler/LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2009-2024: Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors: https://github.com/JuliaLang/julia/contributors
3+
Copyright (c) 2009-2025: Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors: https://github.com/JuliaLang/julia/contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining
66
a copy of this software and associated documentation files (the

Compiler/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Compiler"
22
uuid = "807dbc54-b67e-4c79-8afb-eafe4df6f2e1"
3-
version = "0.1.0"
3+
version = "0.1.1"
44

55
[compat]
66
julia = "1.10"

Compiler/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ Compiler = "807dbc54-b67e-4c79-8afb-eafe4df6f2e1"
1919
Compiler = "0.1"
2020
```
2121

22-
With the setup above, [the special placeholder version (v0.1.0)](https://github.com/JuliaLang/BaseCompiler.jl)
22+
With the setup above, [the special placeholder version (v0.1)](https://github.com/JuliaLang/BaseCompiler.jl)
2323
will be installed by default.[^1]
2424

25-
[^1]: Currently, only version v0.1.0 is registered in the [General](https://github.com/JuliaRegistries/General) registry.
25+
[^1]: Currently, only version v0.1 is registered in the [General](https://github.com/JuliaRegistries/General) registry.
2626

2727
If needed, you can switch to a custom implementation of the `Compiler` module by running
2828
```julia-repl

Compiler/src/tfuncs.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,9 @@ end
405405
return isdefined_tfunc(𝕃, arg1, sym)
406406
end
407407
@nospecs function isdefined_tfunc(𝕃::AbstractLattice, arg1, sym)
408+
if arg1 isa MustAlias
409+
arg1 = widenmustalias(arg1)
410+
end
408411
arg1t = arg1 isa Const ? typeof(arg1.val) : isconstType(arg1) ? typeof(arg1.parameters[1]) : widenconst(arg1)
409412
a1 = unwrap_unionall(arg1t)
410413
if isa(a1, DataType) && !isabstracttype(a1)

Compiler/test/inference.jl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,12 +2313,6 @@ let 𝕃ᵢ = InferenceLattice(MustAliasesLattice(BaseInferenceLattice.instance)
23132313
@test ifelse_tfunc(MustAlias(2, AliasableField{Any}, 1, Int), Int, Int) === Union{}
23142314
end
23152315

2316-
@testset "issue #56913: `BoundsError` in type inference" begin
2317-
R = UnitRange{Int}
2318-
@test Type{AbstractVector} == Base.infer_return_type(Base.promote_typeof, Tuple{R, R, Vector{Any}, Vararg{R}})
2319-
@test Type{AbstractVector} == Base.infer_return_type(Base.promote_typeof, Tuple{R, R, Vector{Any}, R, Vararg{R}})
2320-
end
2321-
23222316
maybeget_mustalias_tmerge(x::AliasableField) = x.f
23232317
maybeget_mustalias_tmerge(x) = x
23242318
@test Base.return_types((Union{Nothing,AliasableField{Any}},); interp=MustAliasInterpreter()) do x
@@ -2593,6 +2587,19 @@ end |> only === Compiler.InterMustAlias
25932587
return 0
25942588
end == Integer
25952589

2590+
# `isdefined` accuracy for `MustAlias`
2591+
@test Base.infer_return_type((Any,); interp=MustAliasInterpreter()) do x
2592+
xx = Ref{Any}(x)
2593+
xxx = Some{Any}(xx)
2594+
Val(isdefined(xxx.value, :x))
2595+
end == Val{true}
2596+
2597+
@testset "issue #56913: `BoundsError` in type inference" begin
2598+
R = UnitRange{Int}
2599+
@test Type{AbstractVector} == Base.infer_return_type(Base.promote_typeof, Tuple{R, R, Vector{Any}, Vararg{R}})
2600+
@test Type{AbstractVector} == Base.infer_return_type(Base.promote_typeof, Tuple{R, R, Vector{Any}, R, Vararg{R}})
2601+
end
2602+
25962603
function f25579(g)
25972604
h = g[]
25982605
t = (h === nothing)

base/multidimensional.jl

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,24 @@ module IteratorsMD
189189
step(r), ", ", length(r), ")")
190190
end
191191

192+
Base.in(x::CartesianIndex, r::AbstractRange{<:CartesianIndex}) = false
193+
function Base.in(x::CartesianIndex{N}, r::AbstractRange{CartesianIndex{N}}) where {N}
194+
isempty(r) && return false
195+
f, st, l = first(r), step(r), last(r)
196+
# The n-th element of the range is a CartesianIndex
197+
# whose elements are the n-th along each dimension
198+
# Find the first dimension along which the index is changing,
199+
# so that n may be uniquely determined
200+
for i in 1:N
201+
iszero(st[i]) && continue
202+
n = findfirst(==(x[i]), f[i]:st[i]:l[i])
203+
isnothing(n) && return false
204+
return r[n] == x
205+
end
206+
# if the step is zero, the elements are identical, so compare with the first
207+
return x == f
208+
end
209+
192210
# Iteration
193211
const OrdinalRangeInt = OrdinalRange{Int, Int}
194212
"""
@@ -454,12 +472,12 @@ module IteratorsMD
454472
end
455473
@inline function __inc(state::Tuple{Int,Int,Vararg{Int}}, indices::Tuple{OrdinalRangeInt,OrdinalRangeInt,Vararg{OrdinalRangeInt}})
456474
rng = indices[1]
457-
I = state[1] + step(rng)
458475
if state[1] != last(rng)
476+
I = state[1] + step(rng)
459477
return true, (I, tail(state)...)
460478
end
461-
valid, I = __inc(tail(state), tail(indices))
462-
return valid, (first(rng), I...)
479+
valid, Itail = __inc(tail(state), tail(indices))
480+
return valid, (first(rng), Itail...)
463481
end
464482

465483
# 0-d cartesian ranges are special-cased to iterate once and only once
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fdf2e62fcaed6aa5ad69bca405329675
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2361fc4ccad83139cf728f14fa38466f075fbf93dddfac533af8f5c0c35d6b86511881b7b97a95ee59f858ba9a33428d3514ac3bd605b745b002a673acfc3190

deps/checksums/Distributed-51e52978481835413d15b589919aba80dd85f890.tar.gz/md5

Lines changed: 0 additions & 1 deletion
This file was deleted.

deps/checksums/Distributed-51e52978481835413d15b589919aba80dd85f890.tar.gz/sha512

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)