@@ -387,6 +387,13 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
387
387
Array ()
388
388
}
389
389
new api.Structure (strict2lzy(Array (parent)), strict2lzy(decl), strict2lzy(Array ()))
390
+ case tp : RecType =>
391
+ apiType(tp.parent)
392
+ case RecThis (recType) =>
393
+ // `tp` must be present inside `recType`, so calling `apiType` on
394
+ // `recType` would lead to an infinite recursion, we avoid this by
395
+ // computing the representation of `recType` lazily.
396
+ apiLazy(recType)
390
397
case tp : AndOrType =>
391
398
val parents = List (apiType(tp.tp1), apiType(tp.tp2))
392
399
@@ -408,8 +415,6 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
408
415
apiType(tpe)
409
416
case tp : ThisType =>
410
417
apiThis(tp.cls)
411
- case RecThis (binder) =>
412
- apiThis(binder.typeSymbol) // !!! this is almost certainly wrong: binder does not always have a typeSymbol !!!
413
418
case tp : ParamType =>
414
419
// TODO: Distinguishing parameters based on their names alone is not enough,
415
420
// the binder is also needed (at least for type lambdas).
@@ -434,6 +439,13 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
434
439
Constants .emptyType
435
440
}
436
441
442
+ def apiLazy (tp : => Type ): api.Type = {
443
+ // TODO: The sbt api needs a convenient way to make a lazy type.
444
+ // For now, we repurpose Structure for this.
445
+ val apiTp = lzy(Array (apiType(tp)))
446
+ new api.Structure (apiTp, strict2lzy(Array ()), strict2lzy(Array ()))
447
+ }
448
+
437
449
def apiThis (sym : Symbol ): api.Singleton = {
438
450
val pathComponents = sym.ownersIterator.takeWhile(! _.isEffectiveRoot)
439
451
.map(s => new api.Id (s.name.toString))
0 commit comments