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:
Dmitry Petrov
2018-08-15 10:25:49 +03:00
committed by Ilya Gorbunov
parent ff9ba97d66
commit a56d1d3ce8
45 changed files with 1273 additions and 30 deletions
@@ -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"
}