Closed
Description
minimized code
project/plugins.sbt
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.0")
buid.sbt
scalaVersion := "0.22.0-RC1" // compile successfully with "2.13.1"
libraryDependencies += "org.slf4j" % "slf4j-api" % "1.7.30"
src/main/scala/Main.scala
import org.slf4j.{Logger, LoggerFactory}
object Main {
def main(args: Array[String]): Unit = {
val logger: Logger = LoggerFactory.getLogger("main")
logger.error("{}{}{}", 1, 2, 3) // error here
}
}
Compilation output
[error] -- [E134] Type Mismatch Error: /dotty-example/src/main/scala/Main.scala:6:11
[error] 6 | logger.error("{}{}{}", 1, 2, 3) // error here
[error] | ^^^^^^^^^^^^
[error] |None of the overloaded alternatives of method error in trait Logger with types
[error] | (x$0: org.slf4j.Marker, x$1: String, x$2: Throwable): Unit
[error] | (x$0: org.slf4j.Marker, x$1: String, x$2: Object*): Unit
[error] | (x$0: org.slf4j.Marker, x$1: String, x$2: Any, x$3: Any): Unit
[error] | (x$0: org.slf4j.Marker, x$1: String, x$2: Any): Unit
[error] | (x$0: org.slf4j.Marker, x$1: String): Unit
[error] | (x$0: String, x$1: Throwable): Unit
[error] | (x$0: String, x$1: Object*): Unit
[error] | (x$0: String, x$1: Any, x$2: Any): Unit
[error] | (x$0: String, x$1: Any): Unit
[error] | (x$0: String): Unit
[error] |match arguments (("{}{}{}" : String), (1 : Int), (2 : Int), (3 : Int))
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
expectation
Compile successfully and choose this method in Logger.java:
public void error(String format, Object... arguments);
Note: Change scalaVersion := "2.13.1"
in build.sbt
=> compile successfully