Detect loops when a capture expression is reference to itself.
Detect loops when a capture expression is reference to itself.