Skip to content

Scala compiler uses an invalid type java.util.Map#Entry[String, Int] in the compilation error message #24711

@unkarjedy

Description

@unkarjedy

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])

Image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions