-from-tasty compilation crashes on code that compiles normal way
Compiler version
3.4.2
Minimized code
3 files
ops.scala:
package demo.util
trait Ops:
final implicit class Ops[A](private val self: A):
def tap(): Unit = ()
package.scala:
package demo
package object util extends Ops
impl.scala:
package demo.debug
import demo.util._
class Impl:
"".tap()
Standard compilation (scalac *.scala) succeeds producing the following output:
demo
├── debug
│ ├── Impl.class
│ └── Impl.tasty
└── util
├── Ops$Ops.class
├── Ops.class
├── Ops.tasty
├── package$.class
├── package.class
└── package.tasty
-from-tasty compilation (scalac -from-tasty demo/*/*.tasty) fails with:
exception occurred while readTasty class file demo.debug.Impl
An unhandled exception was thrown in the compiler.
Please file a crash report here:
https://github.com/scala/scala3/issues/new/choose
For non-enriched exceptions, compile with -Yno-enrich-error-messages.
while compiling: class file demo.debug.Impl
during phase: readTasty
mode: Mode(ImplicitsEnabled,ReadPositions)
library version: version 2.13.12
compiler version: version 3.4.2
settings: -classpath :. -from-tasty true
cannot resolve reference to type demo.util.package.type.Ops
the classfile defining the type might be missing from the classpath
Note
changing implicit class name to something else (e.g. Ops2) makes the crash go away
Btw this comes from trying to debug https://github.com/scala/scala3/issues/20031
This does not crash on main and in 3.5.0-RC1 (so no additional backports needed), but is broken on 3.3.3
The bisect pointed out to https://github.com/scala/scala3/commit/c47138c4b8238ce49f255edfc5ff6147518a0a3b, cherry-picking it to the current LTS branch fixes the issue, but seems to introduce regression in 2 other tests. We would need to test it again to check if the fix can be backported into the LTS line