[JS FIR] Rework JS_NAME_CLASH diagnostic for constructors

- Fix a false positive JS_NAME_CLASH report on constructors
   from different classes but with the same JsName.
 - Allow the same JsName for class constructors and other top-level
   declarations. This behavior differs from K1, but it is correct
   since there is no real name clash in the generated JS code.

^KT-64867 Fixed
This commit is contained in:
Alexander Korepanov
2024-01-15 15:38:03 +01:00
committed by Space Team
parent 2708c74d9c
commit 5da4d31d37
4 changed files with 17 additions and 6 deletions
@@ -1,4 +1,7 @@
// FIR_IDENTICAL
// FIR_DIFFERENCE
// K1 performs a check for legacy JS BE; however, this is not relevant for IR BE because in the generated JS code,
// there is no name clash between the constructor with JsName and the other top-level declarations with the same JsName.
// Keep K1 as it is, but for K2, implement a more relevant check without the clash.
package foo
class A(val x: String) {