K2: reproduce KT-58008
This commit is contained in:
committed by
Space Team
parent
27b103e2ca
commit
4172ce1018
+12
@@ -18549,6 +18549,18 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
runTest("compiler/testData/codegen/box/fir/toLong.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||
public void testTypeParameterInNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/TypeParameterInNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterInNestedClass2.kt")
|
||||
public void testTypeParameterInNestedClass2() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/TypeParameterInNestedClass2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unqualifiedEnum.kt")
|
||||
public void testUnqualifiedEnum() throws Exception {
|
||||
|
||||
+12
@@ -18549,6 +18549,18 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
runTest("compiler/testData/codegen/box/fir/toLong.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||
public void testTypeParameterInNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/TypeParameterInNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterInNestedClass2.kt")
|
||||
public void testTypeParameterInNestedClass2() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/TypeParameterInNestedClass2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unqualifiedEnum.kt")
|
||||
public void testUnqualifiedEnum() throws Exception {
|
||||
|
||||
+6
@@ -2840,6 +2840,12 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI
|
||||
runTest("compiler/testData/ir/irText/firProblems/typeParameterFromJavaClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||
public void testTypeParameterInNestedClass() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/TypeParameterInNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeVariableAfterBuildMap.kt")
|
||||
public void testTypeVariableAfterBuildMap() throws Exception {
|
||||
|
||||
compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java
Generated
+6
@@ -2840,6 +2840,12 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/firProblems/typeParameterFromJavaClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||
public void testTypeParameterInNestedClass() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/TypeParameterInNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeVariableAfterBuildMap.kt")
|
||||
public void testTypeVariableAfterBuildMap() throws Exception {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// WITH_STDLIB
|
||||
// WITH_COROUTINES
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND_K2: JVM_IR
|
||||
// ISSUE: KT-58008
|
||||
|
||||
import kotlin.coroutines.*
|
||||
|
||||
fun <T> runBlocking(c: suspend () -> T): T {
|
||||
var res: T? = null
|
||||
c.startCoroutine(Continuation(EmptyCoroutineContext) {
|
||||
res = it.getOrThrow()
|
||||
})
|
||||
return res!!
|
||||
}
|
||||
|
||||
object Retry {
|
||||
class Builder<B>(
|
||||
private val action: suspend () -> B,
|
||||
) {
|
||||
fun foo() = runBlocking {
|
||||
action.invoke()
|
||||
}
|
||||
}
|
||||
|
||||
fun <W> withExponentialBackoff(action: () -> W): Builder<W> {
|
||||
return Builder(action)
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Retry.withExponentialBackoff { "OK" }.foo()
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// WITH_STDLIB
|
||||
// WITH_COROUTINES
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND_K2: JVM_IR
|
||||
// ISSUE: KT-58008
|
||||
|
||||
import kotlin.coroutines.*
|
||||
|
||||
fun <T> runBlocking(c: suspend () -> T): T {
|
||||
var res: T? = null
|
||||
c.startCoroutine(Continuation(EmptyCoroutineContext) {
|
||||
res = it.getOrThrow()
|
||||
})
|
||||
return res!!
|
||||
}
|
||||
|
||||
class Owner<C>(val c: C) {
|
||||
class Builder<B>(
|
||||
private val action: suspend () -> B,
|
||||
) {
|
||||
fun foo() = runBlocking {
|
||||
action.invoke()
|
||||
}
|
||||
}
|
||||
|
||||
fun <W> withExponentialBackoff(action: () -> W): Builder<W> {
|
||||
return Builder(action)
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Owner("").withExponentialBackoff { "OK" }.foo()
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
FILE fqName:<root> fileName:/TypeParameterInNestedClass.kt
|
||||
CLASS OBJECT name:Retry modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Retry
|
||||
CONSTRUCTOR visibility:private <> () returnType:<root>.Retry [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Retry modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
CLASS CLASS name:Builder modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Retry.Builder<B of <root>.Retry.Builder>
|
||||
TYPE_PARAMETER name:B index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
CONSTRUCTOR visibility:public <> (action:kotlin.coroutines.SuspendFunction0<B of <root>.Retry.Builder>) returnType:<root>.Retry.Builder<B of <root>.Retry.Builder> [primary]
|
||||
VALUE_PARAMETER name:action index:0 type:kotlin.coroutines.SuspendFunction0<B of <root>.Retry.Builder>
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Builder modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:action visibility:private modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.coroutines.SuspendFunction0<B of <root>.Retry.Builder> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'action: kotlin.coroutines.SuspendFunction0<B of <root>.Retry.Builder> declared in <root>.Retry.Builder.<init>' type=kotlin.coroutines.SuspendFunction0<B of <root>.Retry.Builder> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-action> visibility:private modality:FINAL <> ($this:<root>.Retry.Builder<B of <root>.Retry.Builder>) returnType:kotlin.coroutines.SuspendFunction0<B of <root>.Retry.Builder>
|
||||
correspondingProperty: PROPERTY name:action visibility:private modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Retry.Builder<B of <root>.Retry.Builder>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='private final fun <get-action> (): kotlin.coroutines.SuspendFunction0<B of <root>.Retry.Builder> declared in <root>.Retry.Builder'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.coroutines.SuspendFunction0<B of <root>.Retry.Builder> visibility:private [final]' type=kotlin.coroutines.SuspendFunction0<B of <root>.Retry.Builder> origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Retry.Builder<B of <root>.Retry.Builder> declared in <root>.Retry.Builder.<get-action>' type=<root>.Retry.Builder<B of <root>.Retry.Builder> origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:withExponentialBackoff visibility:public modality:FINAL <W> ($this:<root>.Retry, action:kotlin.Function0<W of <root>.Retry.withExponentialBackoff>) returnType:<root>.Retry.Builder<W of <root>.Retry.withExponentialBackoff>
|
||||
TYPE_PARAMETER name:W index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Retry
|
||||
VALUE_PARAMETER name:action index:0 type:kotlin.Function0<W of <root>.Retry.withExponentialBackoff>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun withExponentialBackoff <W> (action: kotlin.Function0<W of <root>.Retry.withExponentialBackoff>): <root>.Retry.Builder<W of <root>.Retry.withExponentialBackoff> declared in <root>.Retry'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (action: kotlin.coroutines.SuspendFunction0<B of <root>.Retry.Builder>) [primary] declared in <root>.Retry.Builder' type=<root>.Retry.Builder<W of <root>.Retry.withExponentialBackoff> origin=null
|
||||
<class: B>: W of <root>.Retry.withExponentialBackoff
|
||||
action: BLOCK type=kotlin.coroutines.SuspendFunction0<W of <root>.Retry.withExponentialBackoff> origin=SUSPEND_CONVERSION
|
||||
FUN ADAPTER_FOR_SUSPEND_CONVERSION name:suspendConversion0 visibility:local modality:FINAL <> ($receiver:kotlin.Function0<W of <root>.Retry.withExponentialBackoff>) returnType:W of <root>.Retry.withExponentialBackoff [suspend]
|
||||
$receiver: VALUE_PARAMETER ADAPTER_PARAMETER_FOR_SUSPEND_CONVERSION name:callee type:kotlin.Function0<W of <root>.Retry.withExponentialBackoff>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun suspendConversion0 (): W of <root>.Retry.withExponentialBackoff [suspend] declared in <root>.Retry.withExponentialBackoff'
|
||||
CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=W of <root>.Retry.withExponentialBackoff origin=null
|
||||
$this: GET_VAR 'callee: kotlin.Function0<W of <root>.Retry.withExponentialBackoff> declared in <root>.Retry.withExponentialBackoff.suspendConversion0' type=kotlin.Function0<W of <root>.Retry.withExponentialBackoff> origin=null
|
||||
FUNCTION_REFERENCE 'local final fun suspendConversion0 (): W of <root>.Retry.withExponentialBackoff [suspend] declared in <root>.Retry.withExponentialBackoff' type=kotlin.coroutines.SuspendFunction0<W of <root>.Retry.withExponentialBackoff> origin=SUSPEND_CONVERSION reflectionTarget=null
|
||||
$receiver: GET_VAR 'action: kotlin.Function0<W of <root>.Retry.withExponentialBackoff> declared in <root>.Retry.withExponentialBackoff' type=kotlin.Function0<W of <root>.Retry.withExponentialBackoff> origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
@@ -0,0 +1,11 @@
|
||||
// ISSUE: KT-58008
|
||||
|
||||
object Retry {
|
||||
class Builder<B>(
|
||||
private val action: suspend () -> B,
|
||||
)
|
||||
|
||||
fun <W> withExponentialBackoff(action: () -> W): Builder<W> {
|
||||
return Builder(action)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
object Retry {
|
||||
private constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
class Builder<B : Any?> {
|
||||
constructor(action: SuspendFunction0<B>) /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
private val action: SuspendFunction0<B>
|
||||
field = action
|
||||
private get
|
||||
|
||||
}
|
||||
|
||||
fun <W : Any?> withExponentialBackoff(action: Function0<W>): Builder<W> {
|
||||
return Builder<W>(action = { // BLOCK
|
||||
local suspend fun Function0<W>.suspendConversion0(): W {
|
||||
return callee.invoke()
|
||||
}
|
||||
|
||||
action::suspendConversion0
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
+12
@@ -18549,6 +18549,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/fir/toLong.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||
public void testTypeParameterInNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/TypeParameterInNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterInNestedClass2.kt")
|
||||
public void testTypeParameterInNestedClass2() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/TypeParameterInNestedClass2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unqualifiedEnum.kt")
|
||||
public void testUnqualifiedEnum() throws Exception {
|
||||
|
||||
+12
@@ -18549,6 +18549,18 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
runTest("compiler/testData/codegen/box/fir/toLong.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||
public void testTypeParameterInNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/TypeParameterInNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterInNestedClass2.kt")
|
||||
public void testTypeParameterInNestedClass2() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/TypeParameterInNestedClass2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unqualifiedEnum.kt")
|
||||
public void testUnqualifiedEnum() throws Exception {
|
||||
|
||||
+6
@@ -2840,6 +2840,12 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest
|
||||
runTest("compiler/testData/ir/irText/firProblems/typeParameterFromJavaClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||
public void testTypeParameterInNestedClass() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/TypeParameterInNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeVariableAfterBuildMap.kt")
|
||||
public void testTypeVariableAfterBuildMap() throws Exception {
|
||||
|
||||
+5
@@ -2010,6 +2010,11 @@ public class KlibIrTextTestCaseGenerated extends AbstractKlibIrTextTestCase {
|
||||
runTest("compiler/testData/ir/irText/firProblems/TypeParameterBounds.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||
public void testTypeParameterInNestedClass() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/TypeParameterInNestedClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeVariableAfterBuildMap.kt")
|
||||
public void testTypeVariableAfterBuildMap() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.kt");
|
||||
|
||||
Generated
+6
@@ -2306,6 +2306,12 @@ public class FirLightTreeJsIrTextTestGenerated extends AbstractFirLightTreeJsIrT
|
||||
runTest("compiler/testData/ir/irText/firProblems/TypeParameterBounds.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||
public void testTypeParameterInNestedClass() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/TypeParameterInNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeVariableAfterBuildMap.kt")
|
||||
public void testTypeVariableAfterBuildMap() throws Exception {
|
||||
|
||||
+6
@@ -2306,6 +2306,12 @@ public class FirPsiJsIrTextTestGenerated extends AbstractFirPsiJsIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/firProblems/TypeParameterBounds.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||
public void testTypeParameterInNestedClass() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/TypeParameterInNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeVariableAfterBuildMap.kt")
|
||||
public void testTypeVariableAfterBuildMap() throws Exception {
|
||||
|
||||
+6
@@ -2306,6 +2306,12 @@ public class ClassicJsIrTextTestGenerated extends AbstractClassicJsIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/firProblems/TypeParameterBounds.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterInNestedClass.kt")
|
||||
public void testTypeParameterInNestedClass() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/TypeParameterInNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeVariableAfterBuildMap.kt")
|
||||
public void testTypeVariableAfterBuildMap() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user