From 91e973ca0bf905ca650ced58871e050d68a05a2a Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Tue, 3 Dec 2024 22:40:12 +0100 Subject: [PATCH] Revert "Drop redundant `butNot = Param` clause in isAnchor" This reverts commit 9d88c800ba518b184bb5f63259a782532d1abf96. Closes #21521 The `ClassTypeParamCreationFlags` include both `TypeParam` and `Deferred`. In effect, a class type parameter was incorrectly considered as an anchor. For a failing example, one can try asserting: ```scala || sym.is(Deferred).ensuring(_ == sym.is(Deferred, butNot = Param)) ``` in `ImplicitRunInfo#isAnchor` and a test with `summon[Ordering[Int]]`. In that example, at least, the flags happen to be set by `Scala2Unpickler#readDisambiguatedSymbol` src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala:562. [Cherry-picked 1b1dd161e279b11cec2093e89e2878eb85b23c3d][modified] --- compiler/src/dotty/tools/dotc/typer/Implicits.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index bdc3a46fb571..3329055fd5d1 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -597,7 +597,7 @@ trait ImplicitRunInfo: private def isAnchor(sym: Symbol) = sym.isClass && !isExcluded(sym) || sym.isOpaqueAlias - || sym.is(Deferred) + || sym.is(Deferred, butNot = Param) || sym.info.isInstanceOf[MatchAlias] private def computeIScope(rootTp: Type): OfTypeImplicits =