Skip to content

Commit 9a6404b

Browse files
authored
Avoid redefining types in sigs mode (#910)
Fixes #903 This is split out from #894.
1 parent 5105f0a commit 9a6404b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Revise"
22
uuid = "295af30f-e4ad-537b-8983-00126c2a3abe"
3-
version = "3.7.3"
3+
version = "3.7.4"
44

55
[deps]
66
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"

src/lowered.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,12 @@ function methods_by_execution!(@nospecialize(recurse), methodinfo, docexprs, fra
452452
end
453453
end
454454
elseif LoweredCodeUtils.get_lhs_rhs(stmt) !== nothing
455-
# If we're here, either isrequired[pc] is true, or the mode forces us to eval assignments
456-
pc = step_expr!(recurse, frame, stmt, true)
455+
if mode === :sigs && stmt.head === :const && (a = stmt.args[1]) isa GlobalRef && @invokelatest(isdefined(mod, a.name))
456+
# avoid redefining types unless we have to
457+
pc = next_or_nothing!(frame)
458+
else
459+
pc = step_expr!(recurse, frame, stmt, true)
460+
end
457461
elseif head === :call
458462
f = @lookup(frame, stmt.args[1])
459463
if isdefined(Core, :_defaultctors) && f === Core._defaultctors && length(stmt.args) == 3

0 commit comments

Comments
 (0)