Skip to content

Commit 414daeb

Browse files
authored
Update a comment in PatternTypeConstrainer
1 parent bf4f126 commit 414daeb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ trait PatternTypeConstrainer { self: TypeComparer =>
255255
tyconS.typeParams.lazyZip(argsS).lazyZip(argsP).forall { (param, argS, argP) =>
256256
val variance = param.paramVarianceSign
257257
if variance == 0 || assumeInvariantRefinement ||
258-
// heal the type if it's a (pattern-bound) type variable, provided we didn't upcast the pattern type:
258+
// As a special case, when pattern and scrutinee types have the same type constructor,
259+
// we infer better bounds for pattern-bound abstract types.
259260
argP.typeSymbol.isPatternBound && patternTp.classSymbol == scrutineeTp.classSymbol
260261
then
261262
val TypeBounds(loS, hiS) = argS.bounds

0 commit comments

Comments
 (0)