@@ -174,9 +174,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
174
174
175
175
val name = if (sym.is(ModuleClass )) sym.fullName.sourceModuleName else sym.fullName
176
176
177
- val tparams = sym.typeParams.map(tparam => apiTypeParameter(
178
- tparam.name.toString, tparam.variance,
179
- tparam.info.bounds.lo, tparam.info.bounds.lo))
177
+ val tparams = sym.typeParams.map(apiTypeParameter)
180
178
181
179
val structure = apiClassStructure(sym)
182
180
@@ -364,6 +362,10 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
364
362
val apiTycon = simpleType(tycon)
365
363
val apiArgs = args.map(processArg)
366
364
new api.Parameterized (apiTycon, apiArgs.toArray)
365
+ case TypeLambda (tparams, res) =>
366
+ val apiTparams = tparams.map(apiTypeParameter)
367
+ val apiRes = apiType(res)
368
+ new api.Polymorphic (apiRes, apiTparams.toArray)
367
369
case rt : RefinedType =>
368
370
val name = rt.refinedName.toString
369
371
val parent = apiType(rt.parent)
@@ -409,12 +411,13 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
409
411
case RecThis (binder) =>
410
412
apiThis(binder.typeSymbol) // !!! this is almost certainly wrong: binder does not always have a typeSymbol !!!
411
413
case tp : ParamType =>
414
+ // TODO: Distinguishing parameters based on their names alone is not enough,
415
+ // the binder is also needed (at least for type lambdas).
412
416
new api.ParameterRef (tp.paramName.toString)
413
417
case tp : LazyRef =>
414
418
apiType(tp.ref)
415
419
case tp : TypeVar =>
416
420
apiType(tp.underlying)
417
- // !!! missing cases: TypeLambda, HKApply
418
421
case _ => {
419
422
ctx.warning(i " sbt-api: Unhandled type ${tp.getClass} : $tp" )
420
423
Constants .emptyType
@@ -437,6 +440,10 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
437
440
new api.Singleton (new api.Path (pathComponents.toArray.reverse ++ Array (Constants .thisPath)))
438
441
}
439
442
443
+ def apiTypeParameter (tparam : TypeParamInfo ): api.TypeParameter =
444
+ apiTypeParameter(tparam.paramName.toString, tparam.paramVariance,
445
+ tparam.paramBounds.lo, tparam.paramBounds.hi)
446
+
440
447
def apiTypeParameter (name : String , variance : Int , lo : Type , hi : Type ): api.TypeParameter =
441
448
new api.TypeParameter (name, Array (), Array (), apiVariance(variance),
442
449
apiType(lo), apiType(hi))
0 commit comments