-
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
Regression in rescala-lang/rescala #18160
Comments
Related issue (same bisect result) #17233 |
8d65f19 fixed a basic problem in type computations. Looking at it again, I cannot find anything wrong with it. It does affect type inference, but maybe the failing projects have to be fixed instead. One would have to minimize to see whether anything can reasonably be done here. |
Reproduction involves multi-stage compilation, the problem is present when compiling tests (different compilation unit), but not when compilng main sources // repro.scala
object core {
final class CreationTicket[State[_]]
}
trait ReadAs[S[_], +A] { type State[V] = S[V] }
trait EventCompatBundle {
bundle: Operators =>
trait EventCompat[+T] extends ReadAs[State, Option[T]] {
selfType: Event[T] =>
final inline def map[B](inline expression: T => B)(implicit ticket: CreationTicket): Event[B] = ???
}
}
trait EventBundle extends EventCompatBundle { self: Operators =>
trait Event[+T] extends EventCompat[T]:
final override type State[V] = self.State[V]
}
trait Operators extends EventBundle {
type State[_]
type CreationTicket = core.CreationTicket[State]
}
trait RescalaInterface extends Operators // repro.test.scala
class SynchronizedReevaluation
class SynchronizedReevaluationApi[Api <: RescalaInterface](val api: Api){
import api._
def SynchronizedReevaluation[A](evt: Event[A])(implicit
turnSource: CreationTicket
): (SynchronizedReevaluation, Event[A]) = {
val sync = new SynchronizedReevaluation
(sync, evt.map(identity)(turnSource))
}
} Can be reproduced using scala-cli using |
The issue might be related to dependant types. The Compilation error: [error] ./main.test.scala:9:30
[error] Found: (turnSource : SynchronizedReevaluationApi.this.api.CreationTicket)
[error] Required: EventCompatBundle.this.CreationTicket
[error] (sync, evt.map(identity)(turnSource))
[error] ^^^^^^^^^^
Error compiling project (test, Scala 3.3.1-RC3, JVM) |
Thanks for the minimization! I tried with
The failing comparison is
Indeed, I don't see how the compiler could prove that this comparison is true. Previously, the compiler sometimes mispredicted when the prefix had to be updated and used a cached prefix instead. This could hide errors like the one detected here. |
infoDependsOnPrefix now also considers non-final term members. Before 8d65f19 it only considered abstract types. Constructors were classified as non-final, which caused regression. We now exclude constructors specifically. Maybe we should instead classify them as effectively final. Fixes scala#18160
infoDependsOnPrefix now also considers non-final term members. Before 8d65f19 it only considered abstract types. Constructors were classified as non-final, which caused regressions. We now exclude constructors specifically in a separate clause in infoDependsOnPrefix. Maybe we should instead classify them as effectively final. Fixes #18160
Regression found in Open Community Build for rescala-lang/rescala and vigoo/prox
Compiler version
Since 3.3.1-RC1-bin-20230216 Nightly
Bisect points to 8d65f19
Project-wise bisect logs: https://github.com/VirtusLab/community-build3/actions/runs/5475858690/jobs/9973280267
Similar issue with the same bisection result where found in other projects:
Minimized code
Not yet minimized, bisected on whole project, multiple compilation errors including typer and implicit resoultion errors
Link to failing project: https://github.com/rescala-lang/REScala
Output (click arrow to expand)
Expectation
Probably should compile
The text was updated successfully, but these errors were encountered: