scala/scala — pull request #3981 by retronym (2014-09-15 05:49:01+00:00)
Title: SI-8575 Fix subtyping transitivity with aliases, compound types

Thanks to @b-studios and @Blaisorblade for investigation into this
bug.

`RefinedType#normalize` is responsible for flattening nested
compound types to a flat representation.

Types are normalized during `=:=` in search of a successful
result.

This means that `((A with B) with C) =:= (A with B with C)`.

However, if we introduce a type alias for `A with B` on the LHS,
the attempt at flattening is thwarted.

This commit dealiases parents of refined types during normalization.

Two tests are included. The first demonstrates a symptom of this
problem: failure to install a bridge method resulted in a linkage
error.

The second test uses the reflection API to directly show transitivity
of subtyping now holds.

Targetting at 2.12, as bug fixes in subtyping usually can be shown
to lead to binary incompatibilities between code using the old and
new compilers.