-
Notifications
You must be signed in to change notification settings - Fork 21
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
Inox does not compile on Scala 3.3.1 + #210
Comments
Hey! |
|
Oh thanks, I was not in the loop on that! My bad for not checking the open PRs. I mostly wanted to leave this here so I have a documented source so I don't forget about the details. I will keep passively looking into it while I'm working on Inox. |
NP! Okay, sounds good! Thanks :) |
Okay I have a (shady) fix for this. In private val aliased: targetProgram.type = targetProgram (the access permissions don't matter, checked) Which is obviously useless, but it works. It is likely an issue with how the compiler checks these accesses. I'll try to minimize and look into dotty sometime later. It's a band-aid fix but would allow us to update if we want to. I've tested it on 3.3.3. What do you think @samuelchassot ? Exact diff: ---
diff --git a/src/main/scala/inox/solvers/z3/NativeZ3Optimizer.scala b/src/main/scala/inox/solvers/z3/NativeZ3Optimizer.scala
index 187295e94..110ccfb1a 100644
--- a/src/main/scala/inox/solvers/z3/NativeZ3Optimizer.scala
+++ b/src/main/scala/inox/solvers/z3/NativeZ3Optimizer.scala
@@ -16,9 +16,11 @@ trait NativeZ3Optimizer extends Z3Unrolling with AbstractUnrollingOptimizer { s
override val name = "native-z3-opt"
- override protected val underlying = NativeZ3Solver.synchronized(new Underlying(targetProgram, context)(using targetSemantics))
+ val aliased: targetProgram.type = targetProgram
- private class Underlying(override val program: targetProgram.type,
+ override protected val underlying = NativeZ3Solver.synchronized(new Underlying(aliased, context)(using targetSemantics))
+
+ private class Underlying(override val program: aliased.type,
override val context: Context)
(using override val semantics: targetSemantics.type)
extends AbstractOptimizer with Z3Native { |
Inox is currently on Scala 3.3.0, and fails to compile on 3.3.1 or higher. I noticed this while updated my build to update dependencies generally.
The following error is raised:
The error seems to be due to a pattern that was disallowed in Scala 3.3.1 (scala/scala3#16908) as in the following minimal example:
A
val
overrides adef
in a parent trait, and there is an ambiguous access through a subclass. I don't get why leaving out thesuper.
causes it to work.In any case, despite the error message, a simple search shows that the Inox code base has no instance of
def targetProgram
orsuper.targetProgram
, so it's not obvious where this is coming from. I do not see any other clearsuper
calls accessingval
s either. It would need some more investigation.This also seems to only happen for that single instance (and commenting it out leads to a successful compile) suggesting that the error is isolated, and not a more global pattern problem.
If anyone else has ideas about what is causing this, it would be helpful to hear them.
The text was updated successfully, but these errors were encountered: