From 1b1dd161e279b11cec2093e89e2878eb85b23c3d Mon Sep 17 00:00:00 2001 From: Eugene Flesselle Date: Sun, 8 Sep 2024 00:47:06 +0200 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. --- 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 51e468153d1f..1e040c085019 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -636,7 +636,7 @@ trait ImplicitRunInfo: private def isAnchor(sym: Symbol) = sym.isClass && !isExcluded(sym) || sym.isOpaqueAlias - || sym.is(Deferred) + || sym.is(Deferred, butNot = Param) || sym.info.isMatchAlias private def computeIScope(rootTp: Type): OfTypeImplicits =