Skip to content

Commit

Permalink
better error for esc outside of macro expansion (#55797)
Browse files Browse the repository at this point in the history
fixes #55788

---------

Co-authored-by: Jeff Bezanson <[email protected]>
  • Loading branch information
simeonschaub and JeffBezanson authored Sep 21, 2024
1 parent bce8f04 commit 911e025
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -5001,6 +5001,10 @@ f(x) = yt(x)
((≔ ⩴ ≕ :=)
(error (string "unsupported assignment operator \"" (deparse (car e)) "\"")))

;; bare :escape
((escape)
(error (string "\"esc(...)\" used outside of macro expansion")))

((error)
(error (cadr e)))
(else
Expand Down
2 changes: 2 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3985,3 +3985,5 @@ begin
end
end
@test f45494() === (0,)

@test_throws "\"esc(...)\" used outside of macro expansion" eval(esc(:(const x=1)))

0 comments on commit 911e025

Please sign in to comment.