[K/JS] Calculate generated function names based on signatures of argument types (instead of fqNames) ^KT-49077 Fixed

This commit is contained in:
Artem Kobzar
2023-07-11 13:14:45 +00:00
committed by Space Team
parent e94a0b8483
commit fdda394a77
12 changed files with 192 additions and 26 deletions
@@ -0,0 +1,47 @@
// EXPECTED_REACHABLE_NODES: 1281
package foo
private class Foo{
data class Id(val uuid: Int)
}
private class Bar{
data class Id(val uuid: Int)
}
private class E1 {
enum class Id { A }
}
private class E2 {
enum class Id { A }
}
private class O1 {
object Id
}
private class O2 {
object Id
}
private class Service{
operator fun get(id: Foo.Id) = "Foo getter"
operator fun get(id: Bar.Id) = "Bar getter"
operator fun get(id: E1.Id) = "E1 getter"
operator fun get(id: E2.Id) = "E2 getter"
operator fun get(id: O1.Id) = "O1 getter"
operator fun get(id: O2.Id) = "O2 getter"
}
fun box(): String {
var service = Service()
if (service[Bar.Id(12)] != "Bar getter") return "Fail with Bar overload"
if (service[Foo.Id(6)] != "Foo getter") return "Fail with Foo overload"
if (service[E1.Id.A] != "E1 getter") return "Fail with E1 overload"
if (service[E2.Id.A] != "E2 getter") return "Fail with E2 overload"
if (service[O1.Id] != "O1 getter") return "Fail with O1 overload"
if (service[O2.Id] != "O2 getter") return "Fail with O2 overload"
return "OK"
}
@@ -0,0 +1,47 @@
// EXPECTED_REACHABLE_NODES: 1281
package foo
class Foo{
data class Id(val uuid: Int)
}
class Bar{
data class Id(val uuid: Int)
}
class E1 {
enum class Id { A }
}
class E2 {
enum class Id { A }
}
class O1 {
object Id
}
class O2 {
object Id
}
class Service{
operator fun get(id: Foo.Id) = "Foo getter"
operator fun get(id: Bar.Id) = "Bar getter"
operator fun get(id: E1.Id) = "E1 getter"
operator fun get(id: E2.Id) = "E2 getter"
operator fun get(id: O1.Id) = "O1 getter"
operator fun get(id: O2.Id) = "O2 getter"
}
fun box(): String {
var service = Service()
if (service[Bar.Id(12)] != "Bar getter") return "Fail with /**/Bar overload"
if (service[Foo.Id(6)] != "Foo getter") return "Fail with Foo overload"
if (service[E1.Id.A] != "E1 getter") return "Fail with E1 overload"
if (service[E2.Id.A] != "E2 getter") return "Fail with E2 overload"
if (service[O1.Id] != "O1 getter") return "Fail with O1 overload"
if (service[O2.Id] != "O2 getter") return "Fail with O2 overload"
return "OK"
}