K2: add reproducer for KT-54275

This commit is contained in:
Mikhail Glukhikh
2022-10-07 11:18:41 +02:00
committed by Space Team
parent 7f6bd2ab1e
commit d491eba629
5 changed files with 66 additions and 0 deletions
@@ -0,0 +1,31 @@
FILE: exceptionInRepeatedAnnotation.kt
public final typealias EventHandler<E> = R|(@R|kotlin/ParameterName|(name = String(e)) E) -> kotlin/Unit|
public final class EventListener<E : R|Event|> : R|kotlin/Any| {
public constructor<E : R|Event|>(): R|EventListener<E>| {
super<R|kotlin/Any|>()
}
public final companion object Companion : R|kotlin/Any| {
private constructor(): R|EventListener.Companion| {
super<R|kotlin/Any|>()
}
public final inline operator fun <reified E : R|Event|> invoke(noinline callback: R|EventHandler<E>|): R|EventListener<E>| {
^invoke R|kotlin/TODO|()
}
}
}
public final inline fun <reified E : R|Event|> R|EventHandler<E>|.withPriority(): R|EventListener<@R|kotlin/ParameterName|(name = String(e)) E>| {
^withPriority Q|EventListener|.R|/EventListener.Companion.invoke|<R|@R|kotlin/ParameterName|(name = String(e)) E|>(this@R|/withPriority|)
}
public final inline fun <reified E : R|Event|> R|EventHandler<E>|.withDefaultPriority(): R|EventListener<@R|kotlin/ParameterName|(name = String(e)) @R|kotlin/ParameterName|(name = String(e)) E>| {
^withDefaultPriority this@R|/withDefaultPriority|.R|/withPriority|<R|@R|kotlin/ParameterName|(name = String(e)) E|>()
}
public abstract class Event : R|kotlin/Any| {
public constructor(): R|Event| {
super<R|kotlin/Any|>()
}
}
@@ -0,0 +1,17 @@
typealias EventHandler<E> = (e: E) -> Unit
class EventListener<E: Event>() {
companion object {
inline operator fun <reified E: Event> invoke(
noinline callback: EventHandler<E>,
): EventListener<E> = TODO()
}
}
inline fun <reified E: Event> EventHandler<E>.withPriority() = EventListener(this)
inline fun <reified E: Event> EventHandler<E>.withDefaultPriority() = withPriority()
abstract class Event