Skip to content

Commit fad4d4d

Browse files
authored
Merge pull request #149 from aviatesk/followup37573
more follow up for JuliaLang/julia#37573
2 parents 7723a86 + 9999985 commit fad4d4d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/match/macro.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ macro capture(ex, pat)
6969
pat = subtb(subor(pat))
7070
quote
7171
$([:($(esc(b)) = nothing) for b in bs]...)
72-
env = trymatch($(Expr(:quote, pat)), $(esc(ex)))
72+
env = trymatch($(esc(Expr(:quote, pat))), $(esc(ex)))
7373
if env == nothing
7474
false
7575
else
76-
$([:($(esc(b)) = get(env, $(Expr(:quote, b)), nothing)) for b in bs]...)
76+
$([:($(esc(b)) = get(env, $(esc(Expr(:quote, b))), nothing)) for b in bs]...)
7777
true
7878
end
7979
end

test/match.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,11 @@ let
8888
@capture(ex, @foo(a_,b_))
8989
@test (a, b) == (:a, :b)
9090
end
91+
92+
# https://github.com/FluxML/MacroTools.jl/pull/149
93+
let
94+
ex = :(sin(a, b))
95+
f = :sin
96+
@capture(ex, $f(args__))
97+
@test args == [:a, :b]
98+
end

0 commit comments

Comments
 (0)