Open jgogstad opened 8 months ago
We should try to define the spire implicits and types in the example file to avoid the dependency.
@jgogstad could you compile it with the latest nightly build? That version should show more information on the assertion failure.
sure, code: https://github.com/jgogstad/spire-scalac-crash/tree/nightly
output
❯ sbt compile
[info] welcome to sbt 1.9.7 (Azul Systems, Inc. Java 11.0.10)
[info] loading project definition from /Users/josteingogstad/source-code/github.com/jgogstad/spire-scalac-crash/project
[info] loading settings for project spire-scalac-crash from build.sbt ...
[info] set current project to hello-world (in build file:/Users/josteingogstad/source-code/github.com/jgogstad/spire-scalac-crash/)
[info] Executing in batch mode. For better performance use sbt's shell
[info] compiling 2 Scala sources to /Users/josteingogstad/source-code/github.com/jgogstad/spire-scalac-crash/target/scala-3.4.0-RC1-bin-20231219-eae8831-NIGHTLY/classes ...
[error] -- [E172] Type Error: /Users/josteingogstad/source-code/github.com/jgogstad/spire-scalac-crash/src/main/scala/SpireExtensions.scala:5:47
[error] 5 | def coerce: Long = implicitly[IntegralOps[A]].coerce(a)
[error] | ^
[error] |No given instance of type spire.math.IntegralOps[A] was found for parameter e of method implicitly in object Predef
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 8 s, completed Dec 21, 2023, 12:30:51 PM
At least the crash is fixed. It is hard to know if this is an expected error from this snipped of code alone. We will need a minimization.
We should also check if the crash fix will be in 3.3.2. If not, we should backport it.
Similar issue got reported in Chimney, but without a working reproduction. I also assumed it is a compiler bug, since I feel it's unlikely that 2 libraries have the same bug at the same time.
I'm experiencing the same issue
I just got the same error in a project using FS2 and cats-effect.
Compiler version
3.3.1
Minimized code
Small project for reproducing: https://github.com/jgogstad/spire-scalac-crash,
There is a chance that Spire is a culprit here, however, there are no traces of Spire in the compiler stacktraces, hence filing the issue here. See repo linked above for contained test case.
Output (click arrow to expand)