Skip to content

Commit 174444d

Browse files
authored
Merge pull request #3345 from dotty-staging/fix-3343
Fix #3343: Make baseType work properly with type lambdas
2 parents 2e864c0 + 678d4b1 commit 174444d

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,13 +1646,11 @@ object SymDenotations {
16461646
case tp @ AppliedType(tycon, args) =>
16471647
val subsym = tycon.typeSymbol
16481648
if (subsym eq symbol) tp
1649-
else subsym.denot match {
1650-
case clsd: ClassDenotation =>
1651-
val tparams = clsd.typeParams
1652-
if (tparams.hasSameLengthAs(args)) baseTypeOf(tycon).subst(tparams, args)
1653-
else NoType
1654-
case _ =>
1649+
else tycon.typeParams match {
1650+
case LambdaParam(_, _) :: _ =>
16551651
baseTypeOf(tp.superType)
1652+
case tparams: List[Symbol @unchecked] =>
1653+
baseTypeOf(tycon).subst(tparams, args)
16561654
}
16571655
case tp: TypeProxy =>
16581656
baseTypeOf(tp.superType)

tests/pos/i3343.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
object Test {
2+
def foo[C[_]](implicit t: C[Char] => Traversable[Char]): C[Char] = ???
3+
4+
val a: List[Char] = foo
5+
}

0 commit comments

Comments
 (0)