Skip to content

Commit cd1d523

Browse files
committed
release 1.10: backport the lattice fix for array op type checks (#52773)
1 parent 6eb535d commit cd1d523

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

base/compiler/tfuncs.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,12 +2034,12 @@ function array_type_undefable(@nospecialize(arytype))
20342034
end
20352035
end
20362036

2037-
function array_builtin_common_nothrow(argtypes::Vector{Any}, isarrayref::Bool)
2037+
function array_builtin_common_nothrow(𝕃::AbstractLattice, argtypes::Vector{Any}, isarrayref::Bool)
20382038
first_idx_idx = isarrayref ? 3 : 4
20392039
length(argtypes) first_idx_idx || return false
20402040
boundscheck = argtypes[1]
20412041
arytype = argtypes[2]
2042-
array_builtin_common_typecheck(boundscheck, arytype, argtypes, first_idx_idx) || return false
2042+
array_builtin_common_typecheck(𝕃, boundscheck, arytype, argtypes, first_idx_idx) || return false
20432043
if isarrayref
20442044
# If we could potentially throw undef ref errors, bail out now.
20452045
arytype = widenconst(arytype)
@@ -2056,8 +2056,9 @@ function array_builtin_common_nothrow(argtypes::Vector{Any}, isarrayref::Bool)
20562056
return false
20572057
end
20582058

2059-
@nospecs function array_builtin_common_typecheck(boundscheck, arytype,
2060-
argtypes::Vector{Any}, first_idx_idx::Int)
2059+
@nospecs function array_builtin_common_typecheck(𝕃::AbstractLattice,
2060+
boundscheck, arytype, argtypes::Vector{Any}, first_idx_idx::Int)
2061+
= Core.Compiler.:(𝕃)
20612062
(boundscheck Bool && arytype Array) || return false
20622063
for i = first_idx_idx:length(argtypes)
20632064
argtypes[i] Int || return false
@@ -2080,11 +2081,11 @@ end
20802081
@nospecs function _builtin_nothrow(𝕃::AbstractLattice, f, argtypes::Vector{Any}, rt)
20812082
= Core.Compiler.:(𝕃)
20822083
if f === arrayset
2083-
array_builtin_common_nothrow(argtypes, #=isarrayref=#false) || return false
2084+
array_builtin_common_nothrow(𝕃, argtypes, #=isarrayref=#false) || return false
20842085
# Additionally check element type compatibility
20852086
return arrayset_typecheck(argtypes[2], argtypes[3])
20862087
elseif f === arrayref || f === const_arrayref
2087-
return array_builtin_common_nothrow(argtypes, #=isarrayref=#true)
2088+
return array_builtin_common_nothrow(𝕃, argtypes, #=isarrayref=#true)
20882089
elseif f === Core._expr
20892090
length(argtypes) >= 1 || return false
20902091
return argtypes[1] Symbol

0 commit comments

Comments
 (0)