Skip to content

Treat a quoted Symbol callee as a name in normalize_defsig#149

Merged
timholy merged 1 commit into
masterfrom
teh/rvs914
Jun 1, 2026
Merged

Treat a quoted Symbol callee as a name in normalize_defsig#149
timholy merged 1 commit into
masterfrom
teh/rvs914

Conversation

@timholy
Copy link
Copy Markdown
Member

@timholy timholy commented Jun 1, 2026

In buggy user code,

function f(list)
    m = zeros(3, 3)
    m[:, :length(list)]
end

the intended call length(list) is a Symbol instead of a function. This caused normalize_defsig to throw, and led to a Revise bug, timholy/Revise.jl#914. A bare Symbol has no nameof method, so walking the body threw MethodError: no method matching nameof(::Symbol) and aborted includet.

A quoted Symbol is already a name, so use it directly and reserve nameof for QuoteNodes wrapping functions, types, or modules. With this, such code loads and instead fails at call time with the clear runtime error the user expects. This is the same behavior exhibited as if the code had been included rather than includeted, and this is the contract that includet should uphold.

Fixes timholy/Revise.jl#914.

In buggy user code,

function f(list)
    m = zeros(3, 3)
    m[:, :length(list)]
end

the intended call `length(list)` is a Symbol instead of a function. This
caused `normalize_defsig` to throw, and led to a Revise bug,
timholy/Revise.jl#914. A bare Symbol has no `nameof` method, so walking
the body threw `MethodError: no method matching nameof(::Symbol)` and
aborted `includet`.

A quoted Symbol is already a name, so use it directly and reserve
`nameof` for QuoteNodes wrapping functions, types, or modules. With
this, such code loads and instead fails at call time with the clear
runtime error the user expects. This is the same behavior exhibited as
if the code had been `include`d rather than `includet`ed, and this is
the contract that `includet` should uphold.

Fixes timholy/Revise.jl#914.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@timholy
Copy link
Copy Markdown
Member Author

timholy commented Jun 1, 2026

Nightly failure is independent (present already on master), so it should not block this change.

@timholy timholy merged commit 0f08d86 into master Jun 1, 2026
8 of 9 checks passed
@timholy timholy deleted the teh/rvs914 branch June 1, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MethodError: no method matching nameof(::Symbol)

1 participant