Skip to content

Conversation

@EugeneFlesselle
Copy link
Contributor

@EugeneFlesselle EugeneFlesselle commented Sep 7, 2024

This reverts commit 9d88c80.
Closes #21521

The ClassTypeParamCreationFlags include both TypeParam and Deferred.
In effect, a class type parameter was considered an anchor for implicit search, by sym.is(Deferred) as a sufficient condition.

For a failing example, one can try asserting:

|| 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:

if (flags.is(TypeParam)) flags1 |= owner.typeParamCreationFlags

This reverts commit 9d88c80. Closes scala#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.
@som-snytt
Copy link
Contributor

Without knowing anything about it, removing Deferred from the flag set doesn't break anything:

 val ClassTypeParamCreationFlags: FlagSet = - TypeParam | Deferred | Private | Local + TypeParam | /*Deferred |*/ Private | Local 

Not sure what the minimum test is for the new issue.

@EugeneFlesselle
Copy link
Contributor Author

EugeneFlesselle commented Sep 8, 2024

Without knowing anything about it, removing Deferred from the flag set doesn't break anything:

Indeed, I'm not sure about it myself either, but we may want to drop the Deferred flag from there.
Still, this is not the only source of such a composition of flags, the assertion in isAnchor continues failing after having updated the ClassTypeParamCreationFlags.

@EugeneFlesselle EugeneFlesselle merged commit eb42a4d into scala:main Sep 14, 2024
@EugeneFlesselle EugeneFlesselle deleted the fix-i21521 branch September 14, 2024 10:27
WojciechMazur added a commit that referenced this pull request Dec 4, 2024
…" to LTS (#22127) Backports #21566 to the 3.3.5. PR submitted by the release tooling. [skip ci]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants