Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "LoweredCodeUtils"
uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b"
version = "3.5.1"
version = "3.5.2"
authors = ["Tim Holy <tim.holy@gmail.com>"]

[deps]
Expand Down
4 changes: 3 additions & 1 deletion src/signatures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ end
# try to normalize `def` to `GlobalRef` representation
function normalize_defsig(@nospecialize(def), mod::Module)
if def isa QuoteNode
def = nameof(def.value)
# A quoted Symbol (e.g. the callee of `:foo(x)`) is already a name; only
# other wrapped values (functions, types, modules) need `nameof`.
def = def.value isa Symbol ? def.value : nameof(def.value)
end
if def isa Symbol
def = GlobalRef(mod, def)
Expand Down
15 changes: 15 additions & 0 deletions test/signatures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -538,4 +538,19 @@ end
LoweredCodeUtils.identify_framemethod_calls(frame) # make sure this does not throw
end

@testset "normalize_defsig with a quoted Symbol callee (issue Revise#914)" begin
# A quoted Symbol is already a name and must not be passed to `nameof`.
@test LoweredCodeUtils.normalize_defsig(QuoteNode(:length), Main) === GlobalRef(Main, :length)

# A method body containing a call to a quoted symbol, e.g. `:length(list)`,
# lowers to a `:call` whose callee is `QuoteNode(:length)`. Walking it must
# not throw.
ex = :(function f_rvs914(list)
m = zeros(3, 3)
m[:, :length(list)]
end)
frame = Frame(Main, ex)
@test LoweredCodeUtils.identify_framemethod_calls(frame) isa Any # must not throw
end

end # module signatures
Loading