Mangle function names with inline class parameters
Avoid name clashes in cases such as
inline class Login(val login: String)
inline class Password(val password: String)
fun validate(login: Login) { ... }
fun validate(password: Password) { ... }
This commit is contained in:
committed by
Ilya Gorbunov
parent
ff9ba97d66
commit
a56d1d3ce8
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
abstract class GenericBase<T> {
|
||||
abstract fun foo(x: T): T
|
||||
}
|
||||
|
||||
interface IFoo {
|
||||
fun foo(x: String): String
|
||||
}
|
||||
|
||||
inline class Str(val str: String)
|
||||
|
||||
class Derived : GenericBase<Str>(), IFoo {
|
||||
override fun foo(x: Str): Str = x
|
||||
override fun foo(x: String): String = x
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (Derived().foo(Str("OK")).str != "OK") throw AssertionError()
|
||||
if (Derived().foo("OK") != "OK") throw AssertionError()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user