-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR #16373 introduces a "cannot resolve reference to type" compilation error on ReactiveMongo #18555
Comments
So I am trying to minimize, diagnose the issue. This is error coming from the Scala 3 compiler (I am using Scala 3.3.1 where the issue still persists).
If I am reading/understanding the error (i.e. Im still trying to minimize the issue but no luck so far |
I created a minimal reproduction repo at https://github.com/mdedetrich/cake-pattern-implicit-scala3-compiler-crash if anyone wants to help out, I have the basic structure thats mirroring ReactiveMongo but I am still failing to reproduce the problem @SamTheisens |
I also did some tracking as to what could be the cause of the regressions since Scala 3.2.2, so far I have found the following #16001 but this is a massive stab in the dark, still diagnosing if underlying root cause is implicits or something else |
Okay so one thing I can confirm is that I was on the wrong track wrt implicits, i.e. I replaced the implicit parameters with explicit parameters and Scala 3.3.1 is still failing to compile. I think that this may be due to trait mixin composition or something along those lines, continuing to dig Going through the changes I can see
As hypothetical causes on the presumption that the issue is related to trait composition/types |
@mdedetrich a few days ago I also had an attempt at a minimalist example, trying to mimic the ReactiveMongo as closely as possible, but no luck so far https://github.com/SamTheisens/scala3-16373 I'm wondering if the fact that https://github.com/ReactiveMongo/ReactiveMongo/blob/master/core/src/main/scala-3/api/SerializationPackCompat.scala#L6 is defined in a different project is relevant. Perhaps some relevant type is erased? I'm quite certain that the issue was introduced with #16373, which was merged into 3.3.0-RC1. I've tried other nightly builds of the same RC and they build fine. |
Considering that you managed to get the code on Scala 3.3.1 with SamTheisens/ReactiveMongo@8cac59b#diff-c6447c7894adc9cfe97724d939b60a87a2aca260563123fefb254d6cf6e73097R17-R18 I think that as you said #16373 looks like the culprit |
because pekko requires scala >= 3.3, which can only be used if and when scala/scala3#18555 is addressed branch:
because pekko requires scala >= 3.3, which can only be used if and when scala/scala3#18555 is addressed branch:
* Extract akka/pekko dependencies to project To minimize duplication: - Introduce neutral aliases for Akka actor dependencies - Pull in akka or pekko dependencies based on a build parameter - Publish pekko variants of all modules - Add pekko based permutations to integration test matrix * Scalafix and formatting fixes * Convert to interpolated string * Remove unnecessary import alias * Add ReactiveMongo as prefix to actor modules * Remove unused imports * Exclude scala 3 from pekko build because pekko requires scala >= 3.3, which can only be used if and when scala/scala3#18555 is addressed branch: * Update project/Common.scala * Update Common.scala --------- Co-authored-by: Cédric Chantepie <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
Minimization// tests/pos/i18555.scala
trait GenericCollectionWithCommands {
self: PackSupport =>
def bar(foo: Int = 1): Any = ???
def bar(writer: pack.Writer[Any]): Any = ???
}
trait PackSupport {
val pack: SerializationPack
}
trait SerializationPack {
type Writer[A]
} Details
|
Here
We are trying to compute the signature of (writer: GenericCollectionWithCommands#pack.Writer[Any]): Any MethodType(
List(writer),
List(
AppliedType(
TypeRef(TermRef(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),trait GenericCollectionWithCommands),pack),Writer),
List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object scala),class Any))
)
),
TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object scala),class Any)
) Is this the correct representation of |
It looks like
does not have a type symbol. This cases a problem when we get
|
It used `cls.info` instead of `cls.thisType`, which caused symbols accessible only through the self type of `cls` to be forgotten. Fixes scala#18555
It used `cls.info` instead of `cls.thisType`, which caused symbols accessible only through the self type of `cls` to be forgotten. Fixes #18555
Compiler version
The issue was introduced in Scala version 3.3.0-RC1-bin-20221214-6383025-NIGHTLY in resolving #16373
The is still present in scala 3.3.1.
Minimized code
Unfortunately I have not been able to construct a minimal example. This pull request on the ReactiveMongo library reproduces the problem ReactiveMongo/ReactiveMongo#1251 on compilation.
Output (click arrow to expand)
The text was updated successfully, but these errors were encountered: