scala/scala — pull request #1571 by paulp (2012-11-04 21:14:24+00:00)
Title: Save existential regression fix from the graveyard.

Retronym's commit message appended. Following another idea
from his idea-wealthy pull request #1074, I only perform the
widen.narrow incantation if there are existentials present
in the widened type.

The result is that compiling the entirety of quick, that
code path is hit only 143 times. All the other calls hit
.narrow directly as before. It looks like the definition
of negligible in the diff of -Ystatistics when compiling
src/library/scala/collection:

< #symbols : 306315
---
> #symbols : 306320
12c13
< #unique types : 293859
---
> #unique types : 293865

I'm assuming based on the 2/1000ths of a percent increase
in symbol and type creation that wall clock is manageable,
but I didn't measure it.

---

SI-5330, SI-6014 deal with existential self-type

This has been broken since https://github.com/scala/scala/commit/b7b81ca2#L0L567.
The existential rash is treated in a similar manner as in fc24db4c.

Conceptually, the fix would be `def selfTypeSkolemized =
widen.skolemizeExistential.narrow`, but simply widening before
narrowing achieves the same thing. Since we're in existential voodoo
territory, let's go for the minimal fix: replacing `this.narrow` by
`widen.narrow`.