Skip to content

Commit f02a1b6

Browse files
committed
AppliedTypes returned by baseType shouldn't have type lambdas as constructors
In tests/pos/argDenot-alpakka.min.scala, we want `(([O] =>> Foo[O, S]) @UV)[Int]`.baseType(`Foo`) to return `Foo[Int]` rather than an applied type lambda. This could be achieved by removing the initial if branch from the AppliedType case in baseTypeOf, since the recursive fallback will always work, but it makes sense to keep a special case for performance, so we just explicitly add as a condition to the fast-path that the type constructor of the AppliedType can't be a lambda.
1 parent 3aaf0cd commit f02a1b6

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,19 +2225,13 @@ object SymDenotations {
22252225
case tp @ AppliedType(tycon, args) =>
22262226
def computeApplied = {
22272227
btrCache(tp) = NoPrefix
2228-
extension (tp: Type) def typeSymbol2: Symbol = tp match
2229-
case tp: TypeRef => tp.symbol
2230-
case tp: TypeVar => tp.underlying.typeSymbol2
2231-
case tp: AppliedType => tp.underlying.typeSymbol2
2232-
case _ => NoSymbol
22332228
val baseTp =
2234-
if (tycon.typeSymbol2 eq symbol) tp
2235-
else (tycon.typeParams: @unchecked) match {
2229+
if (tycon.typeSymbol eq symbol) && !tycon.isLambdaSub then tp
2230+
else (tycon.typeParams: @unchecked) match
22362231
case LambdaParam(_, _) :: _ =>
22372232
recur(tp.superType)
22382233
case tparams: List[Symbol @unchecked] =>
22392234
recur(tycon).substApprox(tparams, args)
2240-
}
22412235
record(tp, baseTp)
22422236
baseTp
22432237
}

0 commit comments

Comments
 (0)