Bug introduced in 11.0, persisting through 14.1.
Background info
I enocountered this problem when exploring
Pattern match about Times default value
But this turns out to be a different issue i.e. the behavior of code sample in the link is consistent in version 8 and version 14. So I decide to post this as a separate question.
Consider this example:
Replace[x y, c_. (a : (x y)) :> aaa]
In version 8.0.4, the output is aaa
, which looks reasonable for me:
But it's not the case in version 14.1:
I don't have access to version 9 to 13 at the moment so cannot do further test.
My question is:
x y
in Version "12.0.0 for Mac OS X x86 (64-bit) (April 7, 2019)". Note that this only seems to be a problem for multiplication: BothReplace[x + y, c_. (a : (x + y)) :> aaa]
andReplace[f[x, y], c_. (a : f[x, y]) :> aaa]
yieldaaa
, so I wonder if this is doing some multiplication simplification first or something like that. $\endgroup$MatchQ[x y, c_. (a : (x y))]
andMatchQ[x + y, c_. (a : (x + y))]
yieldFalse
andTrue
, respectively. UsingTrace
doesn't help. $\endgroup$