Skip to content

Commit 9d5332b

Browse files
committed
look for iterate relative to calling module in inference
1 parent 163b019 commit 9d5332b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

base/compiler/abstractinterpretation.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,11 @@ end
420420

421421
# simulate iteration protocol on container type up to fixpoint
422422
function abstract_iteration(@nospecialize(itertype), vtypes::VarTable, sv::InferenceState)
423-
if !isdefined(Main, :Base) || !isdefined(Main.Base, :iterate) || !isconst(Main.Base, :iterate)
423+
tm = _topmod(sv)
424+
if !isdefined(tm, :iterate) || !isconst(tm, :iterate)
424425
return Any[Vararg{Any}]
425426
end
426-
iteratef = getfield(Main.Base, :iterate)
427+
iteratef = getfield(tm, :iterate)
427428
stateordonet = abstract_call(iteratef, (), Any[Const(iteratef), itertype], vtypes, sv)
428429
# Return Bottom if this is not an iterator.
429430
# WARNING: Changes to the iteration protocol must be reflected here,

0 commit comments

Comments
 (0)