scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

Fix generic signatures to collect type params from all enclosing classes

Open tanishiking opened this issue 1 week ago • 1 comments

Previously, javaSig0 only collected type parameter names from the immediate enclosing class when generating Java generic signatures for methods.

However, this isn't enough with nested classes where outer class type parameters could clash with method-level type parameters.

Now we iterate all enclosing classes to collect their type parameter names, to avoid name conflicts.

Fixes https://github.com/scala/scala3/issues/24619


Also, in 4afe938, I refactored javaSig0 to collect class-level type parameter names in a Map[String, Name]. This allowed us to eliminate the typeParamSigWithName helper method. Does this somewhat align with your suggestion in https://github.com/scala/scala3/pull/24567#discussion_r2578072745 ? @hamzaremmal

tanishiking avatar Dec 02 '25 08:12 tanishiking