Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve inferrability of isor #166

Merged
merged 2 commits into from
Aug 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/match/union.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ function match_inner(pat::OrBind, ex, env)
env′ == nothing ? match(pat.pat2, ex, env) : merge!(env, env′)
end

isor(ex) = isexpr(ex, :call) && ex.args[1] in (:or_, :|)
function isor(ex)
if isexpr(ex, :call)
arg1 = ex.args[1]
return arg1 isa Symbol && arg1 in (:or_, :|) # to improve inferrability, see #166
end
return false
end

function ornew(ex)
isor(ex) || return ex
Expand Down