Skip to content

Commit

Permalink
Fix info of ASF nested class
Browse files Browse the repository at this point in the history
Class M1#F asSeenFrom M2 has type parameters with info of the original
owner/prefix (M1).  So running asSeenFrom against that info fixes the
eta-expanded lambda.
  • Loading branch information
dwijnand committed Oct 4, 2023
1 parent de4ad2b commit 3b99291
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 6 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Namer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1175,8 +1175,12 @@ class Namer { typer: Typer =>
if mbr.isType then
val forwarderName = checkNoConflict(alias.toTypeName, isPrivate = false, span)
var target = pathType.select(sym)
if target.typeParams.nonEmpty then
target = target.EtaExpand(target.typeParams)
val tparams = target.typeParamSymbols
if tparams.nonEmpty then
target = HKTypeLambda(tparams.map(_.paramName))(
tl => tparams.map(p =>
HKTypeLambda.toPInfo(tl.integrate(tparams, p.info.asSeenFrom(pathType, sym.owner)))),
tl => tl.integrate(tparams, target.appliedTo(tparams.map(_.paramRef))))
newSymbol(
cls, forwarderName,
Exported | Final,
Expand Down
9 changes: 9 additions & 0 deletions tests/pos/i18569.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
trait M1:
trait A
trait F[T <: A]

object M2 extends M1

trait Test:
export M2.*
def y: F[A]

0 comments on commit 3b99291

Please sign in to comment.