Skip to content

Commit

Permalink
Revert "Drop redundant butNot = Param clause in isAnchor"
Browse files Browse the repository at this point in the history
This reverts commit 9d88c80.
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 1b1dd16][modified]
  • Loading branch information
WojciechMazur committed Dec 3, 2024
1 parent b33eb4f commit 91e973c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 91e973c

Please sign in to comment.