KT-53846 Pass context receivers to secondary constructors
This commit is contained in:
committed by
Space Team
parent
bd3a28d04d
commit
57ddb9fddf
+6
@@ -17498,6 +17498,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt52373.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53846.kt")
|
||||
public void testKt53846() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt53846.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overload.kt")
|
||||
public void testOverload() throws Exception {
|
||||
|
||||
@@ -1605,6 +1605,7 @@ open class RawFirBuilder(
|
||||
isFromEnumClass = owner.hasModifier(ENUM_KEYWORD)
|
||||
}
|
||||
dispatchReceiverType = owner.obtainDispatchReceiverForConstructor()
|
||||
contextReceivers.addAll(convertContextReceivers(owner.contextReceivers))
|
||||
symbol = FirConstructorSymbol(callableIdForClassConstructor())
|
||||
delegatedConstructor = buildOrLazyDelegatedConstructorCall(
|
||||
isThis = isDelegatedCallToThis(),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// !LANGUAGE: +ContextReceivers
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND_K2: JVM_IR, JS_IR
|
||||
// FIR status: context receivers aren't yet supported
|
||||
// IGNORE_BACKEND_K2: JS_IR
|
||||
// WITH_STDLIB
|
||||
|
||||
class A(val ok: String)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// !LANGUAGE: +ContextReceivers
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
|
||||
fun box(): String {
|
||||
with(Ctx()) {
|
||||
Foo()
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
|
||||
context(Ctx)
|
||||
class Foo private constructor(i: Int) {
|
||||
constructor() : this(1)
|
||||
}
|
||||
|
||||
class Ctx
|
||||
+6
@@ -17498,6 +17498,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt52373.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53846.kt")
|
||||
public void testKt53846() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/kt53846.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overload.kt")
|
||||
public void testOverload() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user