@@ -286,19 +286,12 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(fun
286286 state. rettype = Any
287287 end
288288 # if from_interprocedural added any pclimitations to the set inherited from the arguments,
289- # some of those may be part of our cycles, so those can be deleted now
290- # TODO : and those might need to be deleted later too if the cycle grows to include them?
291289 if isa (sv, InferenceState)
292290 # TODO (#48913) implement a proper recursion handling for irinterp:
293- # This works just because currently the `:terminate` condition guarantees that
294- # irinterp doesn't fail into unresolved cycles, but it's not a good solution.
291+ # This works most of the time just because currently the `:terminate` condition often guarantees that
292+ # irinterp doesn't fail into unresolved cycles, but it is not a good (or working) solution.
295293 # We should revisit this once we have a better story for handling cycles in irinterp.
296- if ! isempty (sv. pclimitations) # remove self, if present
297- delete! (sv. pclimitations, sv)
298- for caller in callers_in_cycle (sv)
299- delete! (sv. pclimitations, caller)
300- end
301- end
294+ delete! (sv. pclimitations, sv) # remove self, if present
302295 end
303296 else
304297 # there is unanalyzed candidate, widen type and effects to the top
@@ -775,7 +768,7 @@ function edge_matches_sv(interp::AbstractInterpreter, frame::AbsIntState,
775768 # check in the cycle list first
776769 # all items in here are considered mutual parents of all others
777770 if ! any (p:: AbsIntState -> matches_sv (p, sv), callers_in_cycle (frame))
778- let parent = frame_parent (frame)
771+ let parent = cycle_parent (frame)
779772 parent === nothing && return false
780773 (is_cached (parent) || frame_parent (parent) != = nothing ) || return false
781774 matches_sv (parent, sv) || return false
@@ -1379,6 +1372,7 @@ function const_prop_call(interp::AbstractInterpreter,
13791372 inf_result. result = concrete_eval_result. rt
13801373 inf_result. ipo_effects = concrete_eval_result. effects
13811374 end
1375+ typ = inf_result. result
13821376 return const_prop_result (inf_result)
13831377end
13841378
@@ -2381,7 +2375,7 @@ function abstract_throw_methoderror(interp::AbstractInterpreter, argtypes::Vecto
23812375 return Future (CallMeta (Union{}, exct, EFFECTS_THROWS, NoCallInfo ()))
23822376end
23832377
2384- const generic_getglobal_effects = Effects (EFFECTS_THROWS, consistent= ALWAYS_FALSE, inaccessiblememonly= ALWAYS_FALSE)
2378+ const generic_getglobal_effects = Effects (EFFECTS_THROWS, effect_free = ALWAYS_FALSE, consistent= ALWAYS_FALSE, inaccessiblememonly= ALWAYS_FALSE) #= effect_free for depwarn =#
23852379const generic_getglobal_exct = Union{ArgumentError, TypeError, ConcurrencyViolationError, UndefVarError}
23862380function abstract_eval_getglobal (interp:: AbstractInterpreter , sv:: AbsIntState , saw_latestworld:: Bool , @nospecialize (M), @nospecialize (s))
23872381 ⊑ = partialorder (typeinf_lattice (interp))
@@ -3509,32 +3503,36 @@ end
35093503
35103504function abstract_eval_partition_load (interp:: AbstractInterpreter , partition:: Core.BindingPartition )
35113505 kind = binding_kind (partition)
3506+ isdepwarn = (partition. kind & BINDING_FLAG_DEPWARN) != 0
3507+ local_getglobal_effects = Effects (generic_getglobal_effects, effect_free= isdepwarn ? ALWAYS_FALSE : ALWAYS_TRUE)
35123508 if is_some_guard (kind) || kind == BINDING_KIND_UNDEF_CONST
35133509 if InferenceParams (interp). assume_bindings_static
35143510 return RTEffects (Union{}, UndefVarError, EFFECTS_THROWS)
35153511 else
35163512 # We do not currently assume an invalidation for guard -> defined transitions
35173513 # return RTEffects(Union{}, UndefVarError, EFFECTS_THROWS)
3518- return RTEffects (Any, UndefVarError, generic_getglobal_effects )
3514+ return RTEffects (Any, UndefVarError, local_getglobal_effects )
35193515 end
35203516 end
35213517
35223518 if is_defined_const_binding (kind)
35233519 if kind == BINDING_KIND_BACKDATED_CONST
35243520 # Infer this as guard. We do not want a later const definition to retroactively improve
35253521 # inference results in an earlier world.
3526- return RTEffects (Any, UndefVarError, generic_getglobal_effects )
3522+ return RTEffects (Any, UndefVarError, local_getglobal_effects )
35273523 end
35283524 rt = Const (partition_restriction (partition))
3529- return RTEffects (rt, Union{}, Effects (EFFECTS_TOTAL, inaccessiblememonly= is_mutation_free_argtype (rt) ? ALWAYS_TRUE : ALWAYS_FALSE))
3525+ return RTEffects (rt, Union{}, Effects (EFFECTS_TOTAL,
3526+ inaccessiblememonly= is_mutation_free_argtype (rt) ? ALWAYS_TRUE : ALWAYS_FALSE,
3527+ effect_free= isdepwarn ? ALWAYS_FALSE : ALWAYS_TRUE))
35303528 end
35313529
35323530 if kind == BINDING_KIND_DECLARED
35333531 rt = Any
35343532 else
35353533 rt = partition_restriction (partition)
35363534 end
3537- return RTEffects (rt, UndefVarError, generic_getglobal_effects )
3535+ return RTEffects (rt, UndefVarError, local_getglobal_effects )
35383536end
35393537
35403538function abstract_eval_globalref (interp:: AbstractInterpreter , g:: GlobalRef , saw_latestworld:: Bool , sv:: AbsIntState )
0 commit comments