Skip to content

Commit 6ed6857

Browse files
committed
Make typeParams more defensive
The problematic case is something like { z => CC { type hk$0 = z.hk$0; type(param) hk$0 } Here $hk0 becomes a type parameter through CC and the type lambda. It's true that such types are eliminated later on. But we want to avoid mispredictions at all points.
1 parent 6fac433 commit 6ed6857

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/dotty/tools/dotc/core/TypeApplications.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,9 @@ class TypeApplications(val self: Type) extends AnyVal {
364364
val sym = self.parent.classSymbol
365365
if (sym.isLambdaTraitOBS) return sym.typeParams
366366
}
367-
val precedingParams = self.parent.typeParams
367+
val precedingParams = self.parent.typeParams.filterNot(_.memberName == self.refinedName)
368368
if (Config.newHK && self.isTypeParam) precedingParams :+ self
369-
else precedingParams.filterNot(_.memberName == self.refinedName)
369+
else precedingParams
370370
case self: RecType =>
371371
self.parent.typeParams
372372
case self: SingletonType =>

0 commit comments

Comments
 (0)