Open atoomic opened 5 years ago
ref $foo eq "ARRAY" is replaced as is_arrayref($foo) but when using the equality check in the reverse way "ARRAY" eq ref $foo, then nothing is replaced
ref $foo eq "ARRAY"
is_arrayref($foo)
"ARRAY" eq ref $foo
proof in image
> perl -Ilib -MRef::Util::Rewriter -E 'say Ref::Util::Rewriter::rewrite_string( q[ "ARRAY" eq ref $foo ] ); ' "ARRAY" eq ref $foo > perl -Ilib -MRef::Util::Rewriter -E 'say Ref::Util::Rewriter::rewrite_string( q[ ref $foo eq "ARRAY" ] ); ' is_arrayref($foo)
I guess we could do a look-behind if we can't look forward for anything valuable.
I'm not that interested in writing this support right now. I'd rather the code gets cleaned up first.
ref $foo eq "ARRAY"
is replaced asis_arrayref($foo)
but when using the equality check in the reverse way"ARRAY" eq ref $foo
, then nothing is replacedproof in image