[FIR] Add regression tests for number of issues fixed in K2
List of issues: KT-4113, KT-6822, KT-7389, KT-17817, KT-20223 KT-21463, KT-24503, KT-24737, KT-24779, KT-24901 KT-27261, KT-28668, KT-30497, KT-30756, KT-36958 KT-37365, KT-37490, KT-38288, KT-41038, KT-41721 KT-42136, KT-42169, KT-42449, KT-42715, KT-43553 KT-43603, KT-43846, KT-43936, KT-46288, KT-46301 KT-47373, KT-47484, KT-47490, KT-47495, KT-47750 KT-47815, KT-47870, KT-48975, KT-49024, KT-49045 KT-50134, KT-50160, KT-50550, KT-51045, KT-51143 KT-51796, KT-52262, KT-52424, KT-52860, KT-52934 KT-53086, KT-53494, KT-53671, KT-53752, KT-53819 KT-54478, KT-54518, KT-54931, KT-54990, KT-55138 KT-55379, KT-55555, KT-56243
This commit is contained in:
committed by
Space Team
parent
8ae5213155
commit
aef9b129d2
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
FILE: ifInBuildMap.kt
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|kotlin/collections/buildMap|<R|kotlin/String|, R|kotlin/String|>(<L> = buildMap@fun R|kotlin/collections/MutableMap<kotlin/String, kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
when () {
|
||||
Boolean(true) -> {
|
||||
R|kotlin/io/println|(String(test))
|
||||
}
|
||||
else -> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableMap.put: R|Stub (chain inference): TypeVariable(V)?|>|(String(foo), String(bar))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-51143
|
||||
|
||||
fun main() {
|
||||
buildMap {
|
||||
if (true) {
|
||||
println("test")
|
||||
} else {
|
||||
put("foo", "bar")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
FILE: javaCollector.kt
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
R|kotlin/collections/listOf|<R|kotlin/String|>(String()).R|SubstitutionOverride<kotlin/collections/List.stream: R|@EnhancedNullability java/util/stream/Stream<@EnhancedNullability kotlin/String>|>|().R|SubstitutionOverride<java/util/stream/Stream.collect: R|ft<R & Any, R?>|>|<R|ft<kotlin/collections/MutableMap<@EnhancedNullability kotlin/String!, kotlin/Int!>, kotlin/collections/Map<@EnhancedNullability kotlin/String!, kotlin/Int!>?>|, R|ft<CapturedType(*), CapturedType(*)?>|>(Q|java/util/stream/Collectors|.R|java/util/stream/Collectors.groupingBy|<R|@EnhancedNullability kotlin/String!|, R|@EnhancedNullability kotlin/String!|, R|ft<CapturedType(*), CapturedType(*)?>|, R|kotlin/Int!|>(groupingBy@fun <anonymous>(it: R|@EnhancedNullability kotlin/String!|): R|@EnhancedNullability kotlin/String!| <inline=NoInline> {
|
||||
^ R|<local>/it|
|
||||
}
|
||||
, Q|java/util/stream/Collectors|.R|java/util/stream/Collectors.collectingAndThen|<R|kotlin/String!|, R|ft<CapturedType(*), CapturedType(*)?>|, R|kotlin/Long!|, R|kotlin/Int!|>(Q|java/util/stream/Collectors|.R|java/util/stream/Collectors.counting|<R|kotlin/String|>(), Q|kotlin/Long|::R|kotlin/Long.toInt|)))
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// ISSUE: KT-50134
|
||||
// WITH_STDLIB
|
||||
// FULL_JDK
|
||||
|
||||
import java.util.stream.Collectors
|
||||
|
||||
fun foo(){
|
||||
listOf("").stream().collect(
|
||||
Collectors.groupingBy(
|
||||
{ it },
|
||||
Collectors.collectingAndThen(
|
||||
Collectors.counting<String>(),
|
||||
Long::toInt
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
FILE: kt53494.kt
|
||||
public open class C<out T> : R|kotlin/Any| {
|
||||
public constructor<out T>(): R|C<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final data class Wrapped<out T> : R|C<T>| {
|
||||
public constructor<out T>(value: R|T|): R|Wrapped<T>| {
|
||||
super<R|C<T>|>()
|
||||
}
|
||||
|
||||
public final val value: R|T| = R|<local>/value|
|
||||
public get(): R|T|
|
||||
|
||||
public final operator fun component1(): R|T|
|
||||
|
||||
public final fun copy(value: R|T| = this@R|/Wrapped|.R|/Wrapped.value|): R|Wrapped<T>|
|
||||
|
||||
}
|
||||
public final object Default : R|C<kotlin/Nothing>| {
|
||||
private constructor(): R|Default| {
|
||||
super<R|C<kotlin/Nothing>|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final inline fun <reified T> test_1(t: R|T?|): R|C<T>| {
|
||||
when () {
|
||||
!=(R|<local>/t|, Null(null)) -> {
|
||||
^test_1 R|/Wrapped.Wrapped|<R|T? & Any|>(R|<local>/t|)
|
||||
}
|
||||
}
|
||||
|
||||
^test_1 when () {
|
||||
(R|<local>/t| is R|T|) -> {
|
||||
R|/Wrapped.Wrapped|<R|it(kotlin/Nothing? & T)|>(R|<local>/t|)
|
||||
}
|
||||
else -> {
|
||||
Q|Default|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final inline fun <reified T> test_2(t: R|T?|): R|C<T>| {
|
||||
^test_2 when () {
|
||||
!=(R|<local>/t|, Null(null)) -> {
|
||||
R|/Wrapped.Wrapped|<R|T? & Any|>(R|<local>/t|)
|
||||
}
|
||||
(R|<local>/t| is R|T|) -> {
|
||||
R|/Wrapped.Wrapped|<R|it(kotlin/Nothing? & T)|>(R|<local>/t|)
|
||||
}
|
||||
else -> {
|
||||
Q|Default|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// ISSUE: KT-53494
|
||||
|
||||
open class C<out T>
|
||||
data class Wrapped<out T>(val value: T) : C<T>()
|
||||
object Default : C<Nothing>()
|
||||
|
||||
inline fun <reified T> test_1(t: T?): C<T> {
|
||||
if (t != null) return Wrapped(t)
|
||||
return if (t is T) Wrapped(t) else Default
|
||||
}
|
||||
|
||||
inline fun <reified T> test_2(t: T?): C<T> {
|
||||
return if (t != null) Wrapped(t) else if (t is T) Wrapped(t) else Default
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
FILE: kt54990.kt
|
||||
public final class A<T1, T2 : R|B<T1, kotlin/Double>|> : R|kotlin/Any| {
|
||||
public constructor<T1, T2 : R|B<T1, kotlin/Double>|>(): R|A<T1, T2>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class B<T1, T2> : R|kotlin/Any| {
|
||||
public constructor<T1, T2>(): R|B<T1, T2>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class C<L> : R|kotlin/Any| {
|
||||
public constructor<L>(x: R|A<out L, out B<L, kotlin/Double>>|): R|C<L>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val x: R|A<out L, out B<L, kotlin/Double>>| = R|<local>/x|
|
||||
public get(): R|A<out L, out B<L, kotlin/Double>>|
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval x: R|A<out kotlin/Any, out B<kotlin/Any, kotlin/Double>>| = R|/A.A|<R|kotlin/Any|, R|B<kotlin/Any, kotlin/Double>|>()
|
||||
R|/C.C|<R|kotlin/Any|>(R|<local>/x|)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// ISSUE: KT-54990
|
||||
|
||||
class A<T1, T2: B<T1, Double>>
|
||||
class B<T1, T2>
|
||||
class C<L>(val x: A<out L, out B<L, Double>>)
|
||||
|
||||
fun test() {
|
||||
val x: A<out Any, out B<Any, Double>> = A()
|
||||
C<Any>(x)
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
FILE: kt55555.kt
|
||||
private abstract interface Foo : R|kotlin/Any| {
|
||||
}
|
||||
private final class Bar<T : R|Foo|, L : R|kotlin/collections/List<T>|> : R|kotlin/Any| {
|
||||
public constructor<T : R|Foo|, L : R|kotlin/collections/List<T>|>(): R|Bar<T, L>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
private final fun <T : R|Foo|> bar(t: R|T|): R|Bar<T, *>| {
|
||||
^bar Null(null)!!
|
||||
}
|
||||
private final fun <T : R|Foo|> foo(t: R|T|): R|T| {
|
||||
lval map: R|Bar<T, *>| = when () {
|
||||
(R|<local>/t| is R|Bar<*, *>|) -> {
|
||||
(R|<local>/t| as R|Bar<T, *>|)
|
||||
}
|
||||
else -> {
|
||||
R|/bar|<R|T|>(R|<local>/t|)
|
||||
}
|
||||
}
|
||||
|
||||
^foo R|<local>/t|
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// ISSUE: KT-55555
|
||||
|
||||
private interface Foo
|
||||
|
||||
private class Bar<T : Foo, L : List<T>>
|
||||
|
||||
private fun <T : Foo> bar(t: T): Bar<T, *> = null!!
|
||||
|
||||
private fun <T : Foo> foo(t: T): T {
|
||||
val map =
|
||||
if (t is Bar<*, *>) t <!UNCHECKED_CAST!>as Bar<T, *><!>
|
||||
else bar(t)
|
||||
return t
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
FILE: recursiveSelfTypes.kt
|
||||
public abstract class Child<R : R|Recursive<R>|> : R|Parent<ChildParameter<*>, R>| {
|
||||
public constructor<R : R|Recursive<R>|>(): R|Child<R>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun getParent(): R|Child<R>| {
|
||||
^getParent (this@R|/Child|.R|SubstitutionOverride</Child.self: R|Parent<ChildParameter<*>, R>|>|() as R|Child<R>|)
|
||||
}
|
||||
|
||||
}
|
||||
public abstract interface Parent<P : R|Parameter|, R : R|Recursive<R>|> : R|kotlin/Any| {
|
||||
public abstract fun self(): R|Parent<P, R>|
|
||||
|
||||
}
|
||||
public abstract interface Parameter : R|kotlin/Any| {
|
||||
}
|
||||
public final class ChildParameter<R : R|Recursive<R>|> : R|Parameter| {
|
||||
public constructor<R : R|Recursive<R>|>(): R|ChildParameter<R>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public abstract interface Recursive<R : R|Recursive<R>|> : R|kotlin/Any| {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// ISSUE: KT-52860
|
||||
|
||||
abstract class Child<R : Recursive<R>> : Parent<ChildParameter<*>, R> {
|
||||
fun getParent(): Child<R> = self() as Child<R>
|
||||
}
|
||||
|
||||
interface Parent<P : Parameter, R : Recursive<R>> {
|
||||
fun self(): Parent<P, R>
|
||||
}
|
||||
|
||||
interface Parameter
|
||||
|
||||
class ChildParameter<R : Recursive<R>> : Parameter
|
||||
|
||||
interface Recursive<R : Recursive<R>>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
FILE: main.kt
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
lval a: R|ft<Java<*, kotlin/String!>, Java<*, kotlin/String!>?>| = Q|Java|.R|/Java.factory|<R|kotlin/String!|>(String())
|
||||
lval b: R|ft<Java<*, kotlin/String!>, Java<*, kotlin/String!>?>| = R|<local>/a|.R|SubstitutionOverride</Java.produceSelf: R|ft<CapturedType(*) & Any, CapturedType(*)?>|>|()
|
||||
R|<local>/b|.R|SubstitutionOverride</Java.consumeElement: R|kotlin/Unit|>|(String(testing))
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// ISSUE: KT-48975
|
||||
|
||||
// FILE: Java.java
|
||||
public class Java<SELF extends Java<SELF, ELEMENT>, ELEMENT> {
|
||||
public static <E> Java<?, E> factory(E actual) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public SELF produceSelf() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void consumeElement(ELEMENT values) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main() {
|
||||
val a = Java.factory("")
|
||||
val b = a.produceSelf()
|
||||
b.consumeElement("testing")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user