Skip to content

defining empty function with escaped name in macro does not work #38386

@mhinsch

Description

@mhinsch

When I try to define an empty generic function from within a macro using an escaped name I get a 'malformed expression' error. Doing exactly the same thing but with a function with an empty argument list works.

julia> macro Bla()
       fname = :myfun
       :(function $(esc(fname)) end)
       end
@Bla (macro with 1 method)

julia> @Bla
ERROR: syntax: malformed expression
Stacktrace:
 [1] top-level scope at REPL[8]:1

julia> macro Bla()
       fname = :myfun
       :(function $(esc(fname))() end)
       end
@Bla (macro with 1 method)

julia> @Bla
myfun (generic function with 1 method)

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviormacros@macros

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions