Skip to content

Commit a599a2a

Browse files
authored
Fix macroexpand on Julia 1.11 (#3000)
1 parent 7354eb8 commit a599a2a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/evaluation/MacroAnalysis.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function resolve_topology(
8484
sn = (session, notebook)
8585

8686
function macroexpand_cell(cell)
87-
try_macroexpand(module_name::Symbol=Symbol("")) = begin
87+
function try_macroexpand(module_name::Symbol=Symbol(""))
8888
success, result = macroexpand_in_workspace(sn, unresolved_topology.codes[cell].parsedcode, cell.cell_id, module_name)
8989
if success
9090
Success(result)

src/evaluation/WorkspaceManager.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,10 @@ function macroexpand_in_workspace(session_notebook::SN, macrocall, cell_id, modu
523523
# We have to be careful here, for example a thrown `MethodError()` will contain the called method and arguments.
524524
# which normally would be very useful for debugging, but we can't serialize it!
525525
# So we make sure we only serialize the exception we know about, and string-ify the others.
526-
if (error isa LoadError && error.error isa UndefVarError) || error isa UndefVarError
527-
(false, error)
526+
if error isa UndefVarError
527+
(false, UndefVarError(error.var))
528+
elseif error isa LoadError && error.error isa UndefVarError
529+
(false, UndefVarError(error.error.var))
528530
else
529531
(false, ErrorException(sprint(showerror, error)))
530532
end

0 commit comments

Comments
 (0)