@@ -26,6 +26,7 @@ import ProtoTypes._
2626import ErrorReporting ._
2727import reporting .diagnostic .Message
2828import Inferencing .fullyDefinedType
29+ import TypeApplications .EtaExpansion
2930import Trees ._
3031import transform .SymUtils ._
3132import transform .TypeUtils ._
@@ -817,12 +818,23 @@ trait Implicits { self: Typer =>
817818
818819 /** The mirror type
819820 *
820- * <parent> { MirroredMonoType = <monoType; MirroredLabel = <label> }
821+ * <parent> {
822+ * MirroredMonoType = <monoType>
823+ * MirroredTypeConstrictor = <tycon>
824+ * MirroredLabel = <label> }
821825 */
822- private def mirrorCore (parent : Type , monoType : Type , label : Name )(implicit ctx : Context ) =
826+ private def mirrorCore (parent : Type , monoType : Type , label : Name )(implicit ctx : Context ) = {
827+ val mirroredType = monoType match {
828+ case monoType @ AppliedType (tycon, targs) if targs.forall(_.isInstanceOf [TypeBounds ]) =>
829+ EtaExpansion (tycon)
830+ case _ =>
831+ monoType
832+ }
823833 parent
824834 .refinedWith(tpnme.MirroredMonoType , TypeAlias (monoType))
835+ .refinedWith(tpnme.MirroredTypeConstructor , TypeAlias (mirroredType))
825836 .refinedWith(tpnme.MirroredLabel , TypeAlias (ConstantType (Constant (label.toString))))
837+ }
826838
827839 /** A path referencing the companion of class type `clsType` */
828840 private def companionPath (clsType : Type , span : Span )(implicit ctx : Context ) = {
0 commit comments