Skip to content

Commit 41a716b

Browse files
committed
Improve robustness of computing type parameters in completers
We need to take DerivedTypeTrees into account when computing the type parameters of a type completer.
1 parent d326f68 commit 41a716b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,10 +795,16 @@ class Namer { typer: Typer =>
795795
nestedCtx = localContext(sym).setNewScope
796796
myTypeParams = {
797797
implicit val ctx = nestedCtx
798-
val tparams = original.rhs match {
799-
case LambdaTypeTree(tparams, _) => tparams
798+
def typeParamTrees(tdef: Tree): List[TypeDef] = tdef match {
799+
case TypeDef(_, original) =>
800+
original match {
801+
case LambdaTypeTree(tparams, _) => tparams
802+
case original: DerivedFromParamTree => typeParamTrees(original.watched)
803+
case _ => Nil
804+
}
800805
case _ => Nil
801806
}
807+
val tparams = typeParamTrees(original)
802808
completeParams(tparams)
803809
tparams.map(symbolOfTree(_).asType)
804810
}

0 commit comments

Comments
 (0)