scala/scala — pull request #3979 by b-studios (2014-09-14 21:08:30+00:00)
Title: SI-8575 Prevent AbstractMethodError caused by type alias

For some reason, erasure will not create the bridge method for consume in the situation below.

~~~scala
type F = A with B
type X = E[F with C]
def consume(x: X): Unit
~~~

When the method consume is defined in a subclass but called in the super class (using the generated bridge) an AbstractMethodError is triggered.

This appears to be only the case if `X` is aliased to an applied type constructor with the argument being a compound type as above.

Since manually deliasing `F` to `A with B` does work, the solution appears to be to dealias components of compound types. However, dealiasing must not be performed on `AnyRef`, which would result in Object and thus break tests.

This might change the binary interface of the generated code to a theoretically equivalent one. But who knows whether this is equivalent enough.

Review by @adriaanm and @dragos