-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Missing dependency results in compiler crash #16368
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
Comments
Single file minimization using scala-cli (but still requiring external dependencies): //> using scala "3.2.1"
//> using lib "com.typesafe.akka::akka-http:10.5.0-M1"
// //> using lib "com.typesafe.akka::akka-stream:2.7.0"
val x = akka.http.scaladsl.model.HttpEntity Uncommenting the second dependency makes the code compile |
There was another instance of this problem observed in #16439 by @pmeheut. //> using scala "3.2.1"
//> using lib "dev.zio::zio-config:2.0.4"
//> using lib "dev.zio::zio-config-magnolia:2.0.4"
//> using lib "dev.zio::zio-config-typesafe:2.0.4"
//> using lib "com.softwaremill.sttp.client3::zio:3.8.3"
import zio.config.typesafe.*
import zio.config.magnolia.*
import zio.config.*, ConfigDescriptor.*, ConfigSource.*
object Foo {
case class Config(url: String)
def configDescription(args: Array[String]): ConfigDescriptor[Config] = {
val commandLineArgs = ConfigSource.fromCommandLineArgs(args.toList, keyDelimiter = Some('.'))
(descriptor[Config] from commandLineArgs)
}
} |
I finally managed to run this without a wrapper using just the compiler. Here is what I get for the akka example in this case. "com.typesafe.akka::akka-http:10.5.0-M1" is on the classpath but "com.typesafe.akka::akka-stream:2.7.0" is not:
The first two lines are debug output to System.err. The text after "Bad symbolic reference" is a regular error message that's printed, but a position is missing. The error message is output at phase erasure. I can't explain the different behavior when running under sbt or cli. |
@odersky how do you run that exactly? Are you sure you also put the transitive dependencies of Using scala 3.2.1 and given that val x = akka.http.scaladsl.model.HttpEntity I run scalac -cp $(cs fetch --classpath com.typesafe.akka:akka-http_3:10.5.0-M1) i16368.scala |
Thanks for the tip. I ran it without the transitive dependencies. I can also reproduce it now. |
Fixes #16368 (?) It would be good if somebody else would follow up here. I have just identified and avoided the immediate source of the crash, but I don't know what else could go wrong. In any case it's probably just a matter of surviving non-existing types.
Compiler version
3.2.1
Minimized code
Minimal reproduction in this repo.
sbt compile
results in compiler crash with just a single line in main (Java 17 on MacOS)Uncommenting the
akka-stream
dependency inbuild.sbt
prevents the crash.Note: adding
akka-stream
dep is required because it is just a Provided dep inakka-http
Output (click arrow to expand)
Click me
The text was updated successfully, but these errors were encountered: