[NI] Prefer between two complex variables one with proper lower bounds

This reverts commit d4d35bb766.
This commit is contained in:
Mikhail Zarechenskiy
2020-03-24 01:56:10 +03:00
parent a4c7619c89
commit ec4d9d2f1f
12 changed files with 135 additions and 3 deletions
@@ -0,0 +1,16 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface Out<out T>
interface In<in T>
interface Recursive<T : In<T>>
interface Specialized : In<Specialized>
class Parent : Specialized
fun <T : In<T>> foo(o: Out<T>): Recursive<T>? = null
fun test(o: Out<Parent>) {
foo(o) ?: return
}
@@ -0,0 +1,35 @@
package
public fun </*0*/ T : In<T>> foo(/*0*/ o: Out<T>): Recursive<T>?
public fun test(/*0*/ o: Out<Parent>): kotlin.Unit
public interface In</*0*/ in 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 interface Out</*0*/ out 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 Parent : Specialized {
public constructor Parent()
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 Recursive</*0*/ T : In<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 interface Specialized : In<Specialized> {
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
}
@@ -0,0 +1,20 @@
// FIR_IDENTICAL
// FULL_JDK
import java.time.LocalDate
data class DailyTime(val date: LocalDate)
fun <T : Comparable<T>> Sequence<T>.range(): ClosedRange<T>? {
val iter = iterator()
return when {
iter.hasNext() -> iter.next().let { it..it }
else -> null
}
}
fun test(dailyTimes: List<DailyTime>): List<DailyTime> {
val dateRange = dailyTimes.asSequence().map { it.date }.range() ?: return emptyList()
println(dateRange.start)
return dailyTimes
}
@@ -0,0 +1,14 @@
package
public fun test(/*0*/ dailyTimes: kotlin.collections.List<DailyTime>): kotlin.collections.List<DailyTime>
public fun </*0*/ T : kotlin.Comparable<T>> kotlin.sequences.Sequence<T>.range(): kotlin.ranges.ClosedRange<T>?
public final data class DailyTime {
public constructor DailyTime(/*0*/ date: java.time.LocalDate)
public final val date: java.time.LocalDate
public final operator /*synthesized*/ fun component1(): java.time.LocalDate
public final /*synthesized*/ fun copy(/*0*/ date: java.time.LocalDate = ...): DailyTime
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}