@@ -65,7 +65,7 @@ object TypeApplications {
65
65
val cls = prefix.typeSymbol
66
66
val variances = cls.typeParams.map(_.variance)
67
67
val argBounds = prefix.argInfos.map(_.bounds)
68
- Some ((variances, argBounds, app.refinedInfo))
68
+ Some ((variances, argBounds, app.refinedInfo.argInfo ))
69
69
case _ =>
70
70
None
71
71
}
@@ -91,14 +91,22 @@ object TypeApplications {
91
91
92
92
def unapply (tp : Type )(implicit ctx : Context ): Option [TypeRef ] = {
93
93
def argsAreForwarders (args : List [Type ], n : Int ): Boolean = args match {
94
- case TypeRef (RefinedThis (rt), sel) :: args1 =>
95
- rt.eq(tp) && sel == tpnme.hkArg(n) && argsAreForwarders(args1, n - 1 )
96
- case nil =>
94
+ case Nil =>
97
95
n == 0
96
+ case TypeRef (RefinedThis (rt), sel) :: args1 =>
97
+ rt.eq(tp) && sel == tpnme.hkArg(n - 1 ) && argsAreForwarders(args1, n - 1 )
98
+ case _ =>
99
+ false
98
100
}
99
101
tp match {
100
102
case TypeLambda (_, argBounds, AppliedType (fn : TypeRef , args))
101
- if argsAreForwarders(args, tp.typeParams.length - 1 ) => Some (fn)
103
+ if argsAreForwarders(args, tp.typeParams.length) => Some (fn)
104
+ // case TypeLambda(_, argBounds, AppliedType(fn: TypeRef, args)) =>
105
+ // println(i"eta expansion failed because args $args are not forwarders for ${tp.toString}")
106
+ // None
107
+ // case TypeLambda(_, argBounds, _) =>
108
+ // println(i"eta expansion failed because body is not applied type")
109
+ // None
102
110
case _ => None
103
111
}
104
112
}
0 commit comments