cue/errors: avoid simple duplication when gathering errors
The (benchmark) test case added caused immense duplication of errors
(over 43 million). The cause is unclear, but it's suspected a bug in
comprehensions. The solution here is to detect, in errors.Append, that
the two errors are the same, and if so, avoid creating a list of both.
Fixes #3307
Signed-off-by: Matthew Sackman <matthew@cue.works>
Change-Id: I1cb3baf00888072c5a4811f9acc95fac9ed49d4b
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1199401
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>