Skip to content

Commit

Permalink
Fix macroexpand on Julia 1.11 (#3000)
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp authored Aug 15, 2024
1 parent 7354eb8 commit a599a2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/evaluation/MacroAnalysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function resolve_topology(
sn = (session, notebook)

function macroexpand_cell(cell)
try_macroexpand(module_name::Symbol=Symbol("")) = begin
function try_macroexpand(module_name::Symbol=Symbol(""))
success, result = macroexpand_in_workspace(sn, unresolved_topology.codes[cell].parsedcode, cell.cell_id, module_name)
if success
Success(result)
Expand Down
6 changes: 4 additions & 2 deletions src/evaluation/WorkspaceManager.jl
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,10 @@ function macroexpand_in_workspace(session_notebook::SN, macrocall, cell_id, modu
# We have to be careful here, for example a thrown `MethodError()` will contain the called method and arguments.
# which normally would be very useful for debugging, but we can't serialize it!
# So we make sure we only serialize the exception we know about, and string-ify the others.
if (error isa LoadError && error.error isa UndefVarError) || error isa UndefVarError
(false, error)
if error isa UndefVarError
(false, UndefVarError(error.var))
elseif error isa LoadError && error.error isa UndefVarError
(false, UndefVarError(error.error.var))
else
(false, ErrorException(sprint(showerror, error)))
end
Expand Down

0 comments on commit a599a2a

Please sign in to comment.