FE: add test reproducing KT-54411

This commit is contained in:
Mikhail Glukhikh
2022-11-23 16:30:46 +01:00
committed by Space Team
parent c32d851585
commit d5c8d9fecc
6 changed files with 79 additions and 0 deletions
@@ -0,0 +1,21 @@
// FIR_IDENTICAL
class AtomicRef<T>(val value: T)
inline fun <F : Segment<F>> AtomicRef<F>.findSegmentAndMoveForward(createNewSegment: (prev: F?) -> F) = null
interface Queue<Q> {
val tail: AtomicRef<OneElementSegment<Q>>
fun enqueue(element: Q) {
// F <: Segment<F> from upper bound
// F <: OneElementSegment<Segment<F>>? from ::createSegment argument. ? is questionable here
// (F?) -> F <: (OneElementSegment<C>?) -> OneElementSegment<C>
tail.<!INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION!>findSegmentAndMoveForward<!>(::createSegment)
}
}
private fun <C> createSegment(prev: OneElementSegment<C>?) = OneElementSegment<C>()
class OneElementSegment<O>() : Segment<OneElementSegment<O>>()
abstract class Segment<S : Segment<S>>
@@ -0,0 +1,34 @@
package
private fun </*0*/ C> createSegment(/*0*/ prev: OneElementSegment<C>?): OneElementSegment<C>
public inline fun </*0*/ F : Segment<F>> AtomicRef<F>.findSegmentAndMoveForward(/*0*/ createNewSegment: (prev: F?) -> F): kotlin.Nothing?
public final class AtomicRef</*0*/ T> {
public constructor AtomicRef</*0*/ T>(/*0*/ value: T)
public final val value: T
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class OneElementSegment</*0*/ O> : Segment<OneElementSegment<O>> {
public constructor OneElementSegment</*0*/ O>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface Queue</*0*/ Q> {
public abstract val tail: AtomicRef<OneElementSegment<Q>>
public open fun enqueue(/*0*/ element: Q): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public abstract class Segment</*0*/ S : Segment<S>> {
public constructor Segment</*0*/ S : Segment<S>>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}