@@ -1999,14 +1999,16 @@ function array_type_undefable(@nospecialize(arytype))
1999
1999
end
2000
2000
end
2001
2001
2002
- function array_builtin_common_nothrow (argtypes:: Vector{Any} , first_idx_idx:: Int )
2002
+ function array_builtin_common_nothrow (argtypes:: Vector{Any} , first_idx_idx:: Int , isarrayref :: Bool )
2003
2003
length (argtypes) >= 4 || return false
2004
2004
boundscheck = argtypes[1 ]
2005
2005
arytype = argtypes[2 ]
2006
2006
array_builtin_common_typecheck (boundscheck, arytype, argtypes, first_idx_idx) || return false
2007
- # If we could potentially throw undef ref errors, bail out now.
2008
- arytype = widenconst (arytype)
2009
- array_type_undefable (arytype) && return false
2007
+ if isarrayref
2008
+ # If we could potentially throw undef ref errors, bail out now.
2009
+ arytype = widenconst (arytype)
2010
+ array_type_undefable (arytype) && return false
2011
+ end
2010
2012
# If we have @inbounds (first argument is false), we're allowed to assume
2011
2013
# we don't throw bounds errors.
2012
2014
if isa (boundscheck, Const)
@@ -2042,11 +2044,11 @@ end
2042
2044
@nospecs function _builtin_nothrow (𝕃:: AbstractLattice , f, argtypes:: Vector{Any} , rt)
2043
2045
⊑ = Core. Compiler.:⊑ (𝕃)
2044
2046
if f === arrayset
2045
- array_builtin_common_nothrow (argtypes, 4 ) || return false
2047
+ array_builtin_common_nothrow (argtypes, 4 , #= isarrayref =# false ) || return false
2046
2048
# Additionally check element type compatibility
2047
2049
return arrayset_typecheck (argtypes[2 ], argtypes[3 ])
2048
2050
elseif f === arrayref || f === const_arrayref
2049
- return array_builtin_common_nothrow (argtypes, 3 )
2051
+ return array_builtin_common_nothrow (argtypes, 3 , #= isarrayref =# true )
2050
2052
elseif f === Core. _expr
2051
2053
length (argtypes) >= 1 || return false
2052
2054
return argtypes[1 ] ⊑ Symbol
0 commit comments