scala / scala3

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

java.lang.AssertionError: assertion failed: TS[753540, 753539, 753538] attempted to take ownership of B which is already owned by committable TS[808807, 753540, 753539, 753538] #20768

Open rleibman opened 2 weeks ago

rleibman commented 2 weeks ago

Reproduction steps

Scala version: I'm able to reproduce it in both 3.4.2 and 3.5.0-RC1 (I was running with 3.5.0-RC1, but went back to 3.4.2 to see if it still happened there. It's a very complicated application, and everything was going fine, on my latest changes, I started getting this error.

To reproduce:

clone https://github.com/rleibman/dmscreen/tree/scalaError cd to the stLib directory and sbt publishLocal cd back to the root directory and sbt compile

Problem

[info]   exception occurred while typechecking /home/rleibman/projects/dmscreen/web/src/main/scala/dmscreen/dnd5e/EncounterPage.scala
[info] 
[info]   An unhandled exception was thrown in the compiler.
[info]   Please file a crash report here:
[info]   https://github.com/scala/scala3/issues/new/choose
[info]   For non-enriched exceptions, compile with -Yno-enrich-error-messages.
[info] 
[info]      while compiling: /home/rleibman/projects/dmscreen/web/src/main/scala/dmscreen/dnd5e/EncounterPage.scala
[info]         during phase: typer
[info]                 mode: Mode(ImplicitsEnabled)
[info]      library version: version 2.13.12
[info]     compiler version: version 3.4.2
[info]             settings: -Werror true -Xmax-inlines 128 -Yretain-trees true -classpath /home/rleibman/projects/dmscreen/web/target/scala-3.4.2/classes:/home/rleibman/projects/dmscreen/common/js/target/scala-3.4.2/classes:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_sjs1_3/3.4.2/scala3-library_sjs1_3-3.4.2.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-js/scalajs-library_2.13/1.16.0/scalajs-library_2.13-1.16.0.jar:/home/rleibman/.ivy2/local/net.leibman/dmscreen-stlib_sjs1_3/0.3.0-SNAPSHOT/jars/dmscreen-stlib_sjs1_3.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/ghostdogpr/caliban-client_sjs1_3/2.7.2/caliban-client_sjs1_3-2.7.2.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/dev/zio/zio_sjs1_3/2.1.4/zio_sjs1_3-2.1.4.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/softwaremill/sttp/client3/core_sjs1_3/3.9.7/core_sjs1_3-3.9.7.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/io/github/cquiroz/scala-java-time_sjs1_3/2.6.0/scala-java-time_sjs1_3-2.6.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/io/github/cquiroz/scala-java-time-tzdb_sjs1_3/2.6.0/scala-java-time-tzdb_sjs1_3-2.6.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-js/scalajs-dom_sjs1_3/2.8.0/scalajs-dom_sjs1_3-2.8.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/olvind/scalablytyped-runtime_sjs1_3/2.4.2/scalablytyped-runtime_sjs1_3-2.4.2.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/japgolly/scalajs-react/core_sjs1_3/2.1.1/core_sjs1_3-2.1.1.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/japgolly/scalajs-react/extra_sjs1_3/2.1.1/extra_sjs1_3-2.1.1.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/scalatags_sjs1_3/0.13.1/scalatags_sjs1_3-0.13.1.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/japgolly/scalacss/core_sjs1_3/1.0.0/core_sjs1_3-1.0.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/japgolly/scalacss/ext-react_sjs1_3/1.0.0/ext-react_sjs1_3-1.0.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/dev/zio/zio-json_sjs1_3/0.7.0/zio-json_sjs1_3-0.7.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/dev/zio/zio-prelude_sjs1_3/1.0.0-RC27/zio-prelude_sjs1_3-1.0.0-RC27.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/org/gnieh/diffson-core_sjs1_3/4.6.0/diffson-core_sjs1_3-4.6.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/io/megl/zio-json-extra_sjs1_3/0.6.2/zio-json-extra_sjs1_3-0.6.2.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/io/megl/zio-json-diffson_sjs1_3/0.6.2/zio-json-diffson_sjs1_3-0.6.2.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/io/kevinlee/just-semver-core_sjs1_3/0.13.0/just-semver-core_sjs1_3-0.13.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/plokhotnyuk/jsoniter-scala/jsoniter-scala-core_sjs1_3/2.30.1/jsoniter-scala-core_sjs1_3-2.30.1.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/plokhotnyuk/jsoniter-scala/jsoniter-scala-macros_sjs1_3/2.30.1/jsoniter-scala-macros_sjs1_3-2.30.1.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.13/scala-library-2.13.13.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-js/scalajs-javalib/1.16.0/scalajs-javalib-1.16.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-js/scalajs-scalalib_2.13/2.13.13%2B1.16.0/scalajs-scalalib_2.13-2.13.13%2B1.16.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/softwaremill/sttp/client3/jsoniter_sjs1_3/3.9.7/jsoniter_sjs1_3-3.9.7.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/plokhotnyuk/jsoniter-scala/jsoniter-scala-core_3/2.30.1/jsoniter-scala-core_3-2.30.1.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-js/scalajs-java-securerandom_sjs1_2.13/1.0.0/scalajs-java-securerandom_sjs1_2.13-1.0.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/dev/zio/zio-internal-macros_sjs1_3/2.1.4/zio-internal-macros_sjs1_3-2.1.4.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/dev/zio/zio-stacktracer_sjs1_3/2.1.4/zio-stacktracer_sjs1_3-2.1.4.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/dev/zio/izumi-reflect_sjs1_3/2.3.8/izumi-reflect_sjs1_3-2.3.8.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-js/scala-js-macrotask-executor_sjs1_3/1.1.1/scala-js-macrotask-executor_sjs1_3-1.1.1.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-js/scalajs-weakreferences_sjs1_2.13/1.0.0/scalajs-weakreferences_sjs1_2.13-1.0.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/softwaremill/sttp/model/core_sjs1_3/1.7.9/core_sjs1_3-1.7.9.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/softwaremill/sttp/shared/core_sjs1_3/1.3.16/core_sjs1_3-1.3.16.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/softwaremill/sttp/shared/ws_sjs1_3/1.3.16/ws_sjs1_3-1.3.16.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/org/portable-scala/portable-scala-reflect_sjs1_2.13/1.1.3/portable-scala-reflect_sjs1_2.13-1.1.3.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/io/github/cquiroz/scala-java-locales_sjs1_3/1.5.4/scala-java-locales_sjs1_3-1.5.4.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/japgolly/scalajs-react/callback_sjs1_3/2.1.1/callback_sjs1_3-2.1.1.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/japgolly/scalajs-react/core-generic_sjs1_3/2.1.1/core-generic_sjs1_3-2.1.1.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/japgolly/scalajs-react/util-fallbacks_sjs1_3/2.1.1/util-fallbacks_sjs1_3-2.1.1.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/japgolly/microlibs/compile-time_sjs1_3/4.0.0/compile-time_sjs1_3-4.0.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/sourcecode_sjs1_3/0.4.0/sourcecode_sjs1_3-0.4.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/geny_sjs1_3/1.1.0/geny_sjs1_3-1.1.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/japgolly/univeq/univeq_sjs1_3/2.0.0/univeq_sjs1_3-2.0.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/dev/zio/zio-streams_sjs1_3/2.1.1/zio-streams_sjs1_3-2.1.1.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-collection-compat_sjs1_3/2.11.0/scala-collection-compat_sjs1_3-2.11.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/softwaremill/magnolia1_3/magnolia_sjs1_3/1.3.0/magnolia_sjs1_3-1.3.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/dev/zio/zio-prelude-macros_sjs1_3/1.0.0-RC27/zio-prelude-macros_sjs1_3-1.0.0-RC27.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-core_sjs1_3/2.10.0/cats-core_sjs1_3-2.10.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/softwaremill/sttp/client3/json-common_sjs1_3/3.9.7/json-common_sjs1_3-3.9.7.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.3/scala3-library_3-3.3.3.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/dev/zio/izumi-reflect-thirdparty-boopickle-shaded_sjs1_3/2.3.8/izumi-reflect-thirdparty-boopickle-shaded_sjs1_3-2.3.8.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/io/github/cquiroz/cldr-api_sjs1_3/4.5.0/cldr-api_sjs1_3-4.5.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/japgolly/scalajs-react/util_sjs1_3/2.1.1/util_sjs1_3-2.1.1.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/japgolly/scalajs-react/facade_sjs1_3/2.1.1/facade_sjs1_3-2.1.1.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/japgolly/microlibs/types_sjs1_3/4.0.0/types_sjs1_3-4.0.0.jar:/home/rleibman/.cache/coursier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-kernel_sjs1_3/2.10.0/cats-kernel_sjs1_3-2.10.0.jar -d /home/rleibman/projects/dmscreen/web/target/scala-3.4.2/classes -deprecation true -encoding utf-8 -feature true -language List(existentials, implicitConversions, higherKinds) -no-indent true -old-syntax true -scalajs true
[error] ## Exception when compiling 42 sources to /home/rleibman/projects/dmscreen/web/target/scala-3.4.2/classes
[error] java.lang.AssertionError: assertion failed: TS[753540, 753539, 753538] attempted to take ownership of B which is already owned by committable TS[808807, 753540, 753539, 753538]
[error] scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
[error] dotty.tools.dotc.core.TyperState.includeVar(TyperState.scala:272)
[error] dotty.tools.dotc.core.TyperState.$anonfun$2$$anonfun$1(TyperState.scala:234)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:333)
[error] dotty.tools.dotc.core.TyperState.$anonfun$2(TyperState.scala:234)
rleibman commented 2 weeks ago

Also, for what it's worth, the error happened when in the diff from the main branch to the scalaError branch.

Gedochao commented 2 weeks ago

We'll need to minimise this. It seems to me there's a lot of extra code in the repo, + a lot of dependencies, SBT plugins, etc. Optimally, we'll need a minimised example with no dependencies.

@rleibman can you help?

rleibman commented 2 weeks ago

Yeah, I know, unfortunately I don't have a lot of time to reproduce a minimal version, at least I know that it happens on that specific branch, so there's only a few files that are affected. I believe it's in one of the scala.js files, for what it's worth. I'm sorry if I can't be more specific and don't have much time to spend on it. I removed most of those changes from my main branch and can keep on working for now. BTW, I understand if this is not enough to go on and you guys can't work on it, though there's always bugs that only show up in "real" code. Based on the error message, is there any ideas about what it could be?