Sema: Associated type inference optimization
This addresses a performance regression from 83cb420ee4.
In the old associated type inference implementation, we used to
fold valid solutions by comparing type witnesses, but this was
not correct as described in the commit message there.
After my fix we started to record more valid solutions from the
same search space, and this caused a performance regression
because we were already doing exponential work.
However in the program in question, each possible choice of witness
for a requirement would introduce the same bindings, so there was
nothing to gain from trying them all.
Since ranking only compares pairs of witnesses for the same
requirement, we can optimize this problem another way: by folding
identical terms in a disjunction, but only if *all* terms are
identical, which avoids the correctness issue in the old search
strategy.
Fixes rdar://problem/123334433.