Minor. Add tests
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
// WITH_STDLIB
|
||||
// WORKS_WHEN_VALUE_CLASS
|
||||
// LANGUAGE: +ValueClasses, +GenericInlineClassParameter
|
||||
|
||||
// !JVM_DEFAULT_MODE: all-compatibility
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
interface Path {
|
||||
fun dispatch(s: String = "K") = "dispatch$s"
|
||||
fun Int.extension(s: String = "K") = "${this}extension$s"
|
||||
}
|
||||
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class RealPath<T: Int>(val x: T) : Path
|
||||
|
||||
fun box(): String {
|
||||
val rp = RealPath(1)
|
||||
val res = "${rp.dispatch()};${rp.dispatch("KK")};" +
|
||||
with(rp) {
|
||||
"${1.extension()};${2.extension("KK")}"
|
||||
}
|
||||
if (res != "dispatchK;dispatchKK;1extensionK;2extensionKK") return res
|
||||
return "OK"
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// WITH_STDLIB
|
||||
// WORKS_WHEN_VALUE_CLASS
|
||||
// LANGUAGE: +ValueClasses, +GenericInlineClassParameter
|
||||
|
||||
// !JVM_DEFAULT_MODE: all
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
interface Path {
|
||||
fun dispatch(s: String = "K") = "dispatch$s"
|
||||
fun Int.extension(s: String = "K") = "${this}extension$s"
|
||||
}
|
||||
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class RealPath<T: Int>(val x: T) : Path
|
||||
|
||||
fun box(): String {
|
||||
val rp = RealPath(1)
|
||||
val res = "${rp.dispatch()};${rp.dispatch("KK")};" +
|
||||
with(rp) {
|
||||
"${1.extension()};${2.extension("KK")}"
|
||||
}
|
||||
if (res != "dispatchK;dispatchKK;1extensionK;2extensionKK") return res
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// WITH_STDLIB
|
||||
// WORKS_WHEN_VALUE_CLASS
|
||||
// LANGUAGE: +ValueClasses, +GenericInlineClassParameter
|
||||
|
||||
// !JVM_DEFAULT_MODE: compatibility
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
interface Path {
|
||||
fun dispatch(s: String = "K") = "dispatch$s"
|
||||
fun Int.extension(s: String = "K") = "${this}extension$s"
|
||||
}
|
||||
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class RealPath<T: Int>(val x: T) : Path
|
||||
|
||||
fun box(): String {
|
||||
val rp = RealPath(1)
|
||||
val res = "${rp.dispatch()};${rp.dispatch("KK")};" +
|
||||
with(rp) {
|
||||
"${1.extension()};${2.extension("KK")}"
|
||||
}
|
||||
if (res != "dispatchK;dispatchKK;1extensionK;2extensionKK") return res
|
||||
return "OK"
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// WITH_STDLIB
|
||||
// WORKS_WHEN_VALUE_CLASS
|
||||
// LANGUAGE: +ValueClasses, +GenericInlineClassParameter
|
||||
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
interface Path {
|
||||
fun dispatch(s: String = "K") = "dispatch$s"
|
||||
fun Int.extension(s: String = "K") = "${this}extension$s"
|
||||
}
|
||||
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class RealPath<T: Int>(val x: T) : Path
|
||||
|
||||
fun box(): String {
|
||||
val rp = RealPath(1)
|
||||
val res = "${rp.dispatch()};${rp.dispatch("KK")};" +
|
||||
with(rp) {
|
||||
"${1.extension()};${2.extension("KK")}"
|
||||
}
|
||||
if (res != "dispatchK;dispatchKK;1extensionK;2extensionKK") return res
|
||||
return "OK"
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// WITH_STDLIB
|
||||
// WORKS_WHEN_VALUE_CLASS
|
||||
// LANGUAGE: +ValueClasses, +GenericInlineClassParameter
|
||||
|
||||
// !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)
|
||||
}
|
||||
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class RealPath<T: Int>(val x: T) : 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"
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// WITH_STDLIB
|
||||
// WORKS_WHEN_VALUE_CLASS
|
||||
// LANGUAGE: +ValueClasses, +GenericInlineClassParameter
|
||||
|
||||
// !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)
|
||||
}
|
||||
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class RealPath<T: Int>(val x: T) : 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"
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// WITH_STDLIB
|
||||
// WORKS_WHEN_VALUE_CLASS
|
||||
// LANGUAGE: +ValueClasses, +GenericInlineClassParameter
|
||||
|
||||
// !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)
|
||||
}
|
||||
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class RealPath<T: Int>(val x: T) : 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"
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// WITH_STDLIB
|
||||
// WORKS_WHEN_VALUE_CLASS
|
||||
// LANGUAGE: +ValueClasses, +GenericInlineClassParameter
|
||||
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
interface Path {
|
||||
fun dispatch(maxDepth: Int = 42)
|
||||
fun Int.extension(maxDepth: Int = 42)
|
||||
}
|
||||
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class RealPath<T: Int>(val x: T) : 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