scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.81k stars 1.05k forks source link

3.3.0-RC4 -Wunused:all compiler exception #17309

Closed ornicar closed 1 year ago

ornicar commented 1 year ago

When compiling lila with:

we get the following exception:

java.lang.AssertionError: NoDenotation.owner while running checkUnusedPostInlining on lila/modules/tree/src/main/Eval.scala
[info] exception occurred while compiling lila/modules/tree/src/main/Eval.scala, lila/modules/tree/src/main/package.scala, lila/modules/tree/src/main/tree.scala
java.lang.AssertionError: NoDenotation.owner while compiling lila/modules/tree/src/main/Eval.scala, lila/modules/tree/src/main/package.scala, lila/modules/tree/src/main/tree.scala
[error] ## Exception when compiling 3 sources to lila/modules/tree/target/scala-3.3.0-RC4/classes
[error] java.lang.AssertionError: NoDenotation.owner

Here's the full compiler output.

It works if we remove the -Wunused:all flag from the build settings, or if we downgrade scala to 3.3.0-RC3.

How to reproduce:

git clone https://github.com/lichess-org/lila.git --branch scala-3.3.0-RC4
cd lila
sbt compile
ornicar commented 1 year ago

It can also be reproduced with lila-ws, a much smaller project.

git clone https://github.com/lichess-org/lila-ws.git --branch Wunused-all
cd lila-ws
sbt compile
WojciechMazur commented 1 year ago
Also present in 3 Open CB projects: Project Version Build URL Notes
cchantep/acolyte 1.2.6 Open CB logs Contains other compilation errors (scaladoc)
reactivemongo/reactivemongo-bson 1.1.0-RC9 Open CB logs
reactivemongo/reactivemongo-play-json 1.1.0-play29-RC9 Open CB logs
KacperFKorban commented 1 year ago

The common factor is reactivemongo-bson-api. Partial minimization with just reactivemongo-bson-api as dependency:

//> using scala "3.3.0-RC4-bin-SNAPSHOT"
//> using options "-Wunused:all"
//> using lib "org.reactivemongo::reactivemongo-bson-api:1.1.0-RC9"

import reactivemongo.api.bson.*

case class Eval()

given BSONDocumentHandler[Eval] = Macros.handler
Kordyjan commented 1 year ago

We have identified the symbol that is missing a denotation, and this is definitely some weird bug. It shouldn't cause further problems but still, we need to investigate it.

The investigation will take place under #17346. In the meantime, #17316 fixed the symptoms.