scala3
scala3 copied to clipboard
Scala compiler uses an invalid type `java.util.Map#Entry[String, Int]` in the compilation error message
Scala 3.7.4 Compile this code (it's expected to fail with compilation errors)
@main def main(): Unit = {
// GOOD: the type mismatch error has correct type (java.util.Map.Entry[String, Int])
val entry1: Int = (??? : java.util.Map.Entry[String, Int])
// BAD: the type mismatch error has incorrect type (java.util.Map#Entry[String, Int])
val entry2: Int = java.util.Map.entry("key", 1)
}
Notice that the second error uses an invalid type java.util.Map#Entry[String, Int] (It should be java.util.Map.Entry[String, Int])
If you try to use the one with # you will get another compilation error.
Originally found by the IntelliJ Scala Plugin Decompiler text-to-text tests
- https://youtrack.jetbrains.com/issue/SCL-21078/Text-to-text-tests-for-Scala-libraries
- https://youtrack.jetbrains.com/issue/SCL-24753/TASTy-java.util.MapEntry