Set receivers for inline class default function stub calls
Default function stubs have dispatch and receiver parameters, but inline class methods are static by design with receivers as ordinary parameters. So, take these parameters and set them as receivers during lowerings. #KT-46230: Fixed
This commit is contained in:
committed by
teamcityserver
parent
31420a934c
commit
ac7538a269
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
// !JVM_DEFAULT_MODE: all-compatibility
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
interface Path {
|
||||
fun dispatch(maxDepth: Int = 42)
|
||||
fun Int.extension(maxDepth: Int = 42)
|
||||
}
|
||||
|
||||
inline class RealPath(val x: Int) : Path {
|
||||
override fun dispatch(maxDepth: Int) = Unit
|
||||
|
||||
fun childrenDispatch(recursively: Boolean): Unit =
|
||||
if (recursively) dispatch() else dispatch()
|
||||
|
||||
override fun Int.extension(maxDepth: Int) = Unit
|
||||
|
||||
fun Int.childrenExtension(recursively: Boolean): Unit =
|
||||
if (recursively) extension() else extension()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
RealPath(1)
|
||||
return "OK"
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
// !JVM_DEFAULT_MODE: all
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
interface Path {
|
||||
fun dispatch(maxDepth: Int = 42)
|
||||
fun Int.extension(maxDepth: Int = 42)
|
||||
}
|
||||
|
||||
inline class RealPath(val x: Int) : Path {
|
||||
override fun dispatch(maxDepth: Int) = Unit
|
||||
|
||||
fun childrenDispatch(recursively: Boolean): Unit =
|
||||
if (recursively) dispatch() else dispatch()
|
||||
|
||||
override fun Int.extension(maxDepth: Int) = Unit
|
||||
|
||||
fun Int.childrenExtension(recursively: Boolean): Unit =
|
||||
if (recursively) extension() else extension()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
RealPath(1)
|
||||
return "OK"
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
// !JVM_DEFAULT_MODE: compatibility
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
interface Path {
|
||||
fun dispatch(maxDepth: Int = 42)
|
||||
fun Int.extension(maxDepth: Int = 42)
|
||||
}
|
||||
|
||||
inline class RealPath(val x: Int) : Path {
|
||||
override fun dispatch(maxDepth: Int) = Unit
|
||||
|
||||
fun childrenDispatch(recursively: Boolean): Unit =
|
||||
if (recursively) dispatch() else dispatch()
|
||||
|
||||
override fun Int.extension(maxDepth: Int) = Unit
|
||||
|
||||
fun Int.childrenExtension(recursively: Boolean): Unit =
|
||||
if (recursively) extension() else extension()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
RealPath(1)
|
||||
return "OK"
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
interface Path {
|
||||
fun dispatch(maxDepth: Int = 42)
|
||||
fun Int.extension(maxDepth: Int = 42)
|
||||
}
|
||||
|
||||
inline class RealPath(val x: Int) : Path {
|
||||
override fun dispatch(maxDepth: Int) = Unit
|
||||
|
||||
fun childrenDispatch(recursively: Boolean): Unit =
|
||||
if (recursively) dispatch() else dispatch()
|
||||
|
||||
override fun Int.extension(maxDepth: Int) = Unit
|
||||
|
||||
fun Int.childrenExtension(recursively: Boolean): Unit =
|
||||
if (recursively) extension() else extension()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
RealPath(1)
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user