Skip to content

Commit

Permalink
string patterns compiled to == : fix #68, #62
Browse files Browse the repository at this point in the history
  • Loading branch information
thautwarm committed Aug 21, 2019
1 parent 333d06d commit d7a4e2e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Pervasives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ function mk_pat_by(f)
end
end

const strict_eq_types = @static VERSION < v"1.1.0" ? Union{Int, Nothing} : Union{Int, String, Nothing}
const strict_eq_types = Union{Int, Nothing}

def_pattern(Pervasives,
predicate = x -> x isa strict_eq_types,
rewrite = mk_pat_by(===)
)

def_pattern(Pervasives,
predicate = x -> x isa Union{Number, AbstractString, AbstractChar, AbstractFloat, QuoteNode},
predicate = x -> x isa Union{Number, AbstractString, AbstractChar, QuoteNode},
rewrite = (tag, case, mod) ->
let f = isimmutable(case) ? mk_pat_by(===) : mk_pat_by(==)
let f = isimmutable(case) ? mk_pat_by(===) : mk_pat_by(isequal)
f(tag, case, mod)
end
)
Expand Down

0 comments on commit d7a4e2e

Please sign in to comment.