Skip to content

Commit 33b73a5

Browse files
committed
use === instead of == to compare Symbols
1 parent 81e869a commit 33b73a5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/rule_definition_tools.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ function _target_rewrite!(expr::Expr, no_rule)
510510
length(expr.args) === 0 && error("Malformed method expression. $expr")
511511
if expr.head === :call || expr.head === :where
512512
expr.args[1] = _target_rewrite!(expr.args[1], no_rule)
513-
elseif expr.head == :(.) && expr.args[1] == :ChainRulesCore
513+
elseif expr.head === :(.) && expr.args[1] === :ChainRulesCore
514514
expr = _target_rewrite!(expr.args[end], no_rule)
515515
else
516516
error("Malformed method expression. $(expr)")
@@ -519,13 +519,13 @@ function _target_rewrite!(expr::Expr, no_rule)
519519
end
520520
_target_rewrite!(qt::QuoteNode, no_rule) = _target_rewrite!(qt.value, no_rule)
521521
function _target_rewrite!(call_target::Symbol, no_rule)
522-
return if call_target == :rrule && no_rule
522+
return if call_target === :rrule && no_rule
523523
:($ChainRulesCore.no_rrule)
524-
elseif call_target == :rrule && !no_rule
524+
elseif call_target === :rrule && !no_rule
525525
:($ChainRulesCore.rrule)
526-
elseif call_target == :frule && no_rule
526+
elseif call_target === :frule && no_rule
527527
:($ChainRulesCore.no_frule)
528-
elseif call_target == :frule && !no_rule
528+
elseif call_target === :frule && !no_rule
529529
:($ChainRulesCore.frule)
530530
else
531531
error("Unexpected opt-out target. Expected frule or rrule, got: $call_target")
@@ -571,8 +571,8 @@ function _isvararg(expr::Expr)
571571
Meta.isexpr(expr, :...) && return true
572572
if Meta.isexpr(expr, :(::))
573573
constraint = last(expr.args)
574-
constraint == :Vararg && return true
575-
Meta.isexpr(constraint, :curly) && first(constraint.args) == :Vararg && return true
574+
constraint === :Vararg && return true
575+
Meta.isexpr(constraint, :curly) && first(constraint.args) === :Vararg && return true
576576
end
577577
return false
578578
end

0 commit comments

Comments
 (0)