Skip to content

Commit 73fe51d

Browse files
author
Roger-luo
committed
fix v0.7 deprecations
1 parent 29c060a commit 73fe51d

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/macro.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,15 @@ macro match(ex, lines)
5151
result = quote
5252
ex = $(esc(ex))
5353
end
54-
body = foldr((clause, body) -> makeclause(clause..., body),
55-
nothing, clauses(lines))
54+
55+
@static if VERSION < v"0.7.0-"
56+
body = foldr((clause, body) -> makeclause(clause..., body),
57+
nothing, clauses(lines))
58+
else
59+
body = foldr((clause, body) -> makeclause(clause..., body),
60+
clauses(lines); init=nothing)
61+
end
62+
5663
push!(result.args, body)
5764
return result
5865
end

src/utils.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,11 @@ end
368368
flatten(ex) = postwalk(flatten1, ex)
369369

370370
function makeif(clauses, els = nothing)
371-
foldr((c, ex)->:($(c[1]) ? $(c[2]) : $ex), els, clauses)
371+
@static if VERSION < v"0.7.0-"
372+
foldr((c, ex)->:($(c[1]) ? $(c[2]) : $ex), els, clauses)
373+
else
374+
foldr((c, ex)->:($(c[1]) ? $(c[2]) : $ex), clauses; init=els)
375+
end
372376
end
373377

374378
unresolve1(x) = x

0 commit comments

Comments
 (0)