shadow: fix and expand comment, simplify implementation

The previous shadow implementation was technically correct but performed redundant checks. The comment was also not clearly describing the behavior of the function. The comment has been rewritten in terms of the general concept of shadowing on patterns, as well as a more concrete description given the data structures in use today.