@@ -92,7 +92,6 @@ trait TypesSupport:
92
92
def noSupported (name : String ): SSignature =
93
93
println(s " WARN: Unsupported type: $name: ${tp.show}" )
94
94
plain(s " Unsupported[ $name] " ).l
95
-
96
95
tp match
97
96
case OrType (left, right) => inner(left) ++ keyword(" | " ).l ++ inner(right)
98
97
case AndType (left, right) => inner(left) ++ keyword(" & " ).l ++ inner(right)
@@ -117,7 +116,6 @@ trait TypesSupport:
117
116
++ keyword(" =>> " ).l
118
117
++ inner(resType)
119
118
120
-
121
119
case r : Refinement => { // (parent, name, info)
122
120
def getRefinementInformation (t : TypeRepr ): List [TypeRepr ] = t match {
123
121
case r : Refinement => getRefinementInformation(r.parent) :+ r
@@ -163,13 +161,25 @@ trait TypesSupport:
163
161
plain(" [" ).l ++ paramBounds ++ plain(" ]" ).l ++ keyword(" => " ).l ++ paramList ++ keyword(" => " ).l ++ resType
164
162
case other => noSupported(s " Not supported type in refinement $info" )
165
163
}
164
+
165
+ def parseDependentFunctionType (info : TypeRepr ): SSignature = info match {
166
+ case m : MethodType =>
167
+ val paramList = getParamList(m)
168
+ paramList ++ keyword(" => " ).l ++ inner(m.resType)
169
+ case other => noSupported(" Dependent function type without MethodType refinement" )
170
+ }
171
+
166
172
val refinementInfo = getRefinementInformation(r)
167
173
val refinedType = refinementInfo.head
168
174
val refinedElems = refinementInfo.tail.collect{ case r : Refinement => r }.toList
169
175
val prefix = if refinedType.typeSymbol != defn.ObjectClass then inner(refinedType) ++ plain(" " ).l else Nil
170
176
if (refinedType.typeSymbol.fullName == " scala.PolyFunction" && refinedElems.size == 1 ) {
171
177
parsePolyFunction(refinedElems.head.info)
172
- } else {
178
+ }
179
+ else if (r.isDependentFunctionType) {
180
+ parseDependentFunctionType(r.info)
181
+ }
182
+ else {
173
183
prefix ++ plain(" { " ).l ++ refinedElems.flatMap(e => parseRefinedElem(e.name, e.info)) ++ plain(" }" ).l
174
184
}
175
185
}
@@ -274,7 +284,7 @@ trait TypesSupport:
274
284
275
285
case ParamRef (TypeLambda (names, _, _), i) => tpe(names.apply(i)).l
276
286
277
- case ParamRef (m : MethodType , i) => tpe(m.paramNames(i)).l
287
+ case ParamRef (m : MethodType , i) => tpe(m.paramNames(i)).l ++ plain( " .type " ).l
278
288
279
289
case RecursiveType (tp) => inner(tp)
280
290
0 commit comments