FIR2IR: correct IR origin for substitution overrides
#KT-44054 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
34dbbdce07
commit
aaa3f2e2c1
+1
-1
@@ -1155,7 +1155,7 @@ class Fir2IrDeclarationStorage(
|
|||||||
parentOrigin: IrDeclarationOrigin,
|
parentOrigin: IrDeclarationOrigin,
|
||||||
irParent: IrDeclarationParent?
|
irParent: IrDeclarationParent?
|
||||||
): IrDeclarationOrigin {
|
): IrDeclarationOrigin {
|
||||||
return if (irParent.isSourceClass() && symbol.fir.isIntersectionOverride)
|
return if (irParent.isSourceClass() && (symbol.fir.isIntersectionOverride || symbol.fir.isSubstitutionOverride))
|
||||||
IrDeclarationOrigin.FAKE_OVERRIDE
|
IrDeclarationOrigin.FAKE_OVERRIDE
|
||||||
else
|
else
|
||||||
parentOrigin
|
parentOrigin
|
||||||
|
|||||||
Generated
+5
@@ -19869,6 +19869,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("substitutionFunctionFromSuper.kt")
|
||||||
|
public void testSubstitutionFunctionFromSuper() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/objects/substitutionFunctionFromSuper.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("thisInConstructor.kt")
|
@TestMetadata("thisInConstructor.kt")
|
||||||
public void testThisInConstructor() throws Exception {
|
public void testThisInConstructor() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// KT-44054
|
||||||
|
|
||||||
|
enum class Enum {
|
||||||
|
Entry1,
|
||||||
|
Entry2
|
||||||
|
}
|
||||||
|
|
||||||
|
class Outer {
|
||||||
|
fun fooCaller(): Enum = obj.foo()
|
||||||
|
|
||||||
|
private abstract inner class Inner<T>(val default: T) {
|
||||||
|
fun foo(): T {
|
||||||
|
return default
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val obj = object : Inner<Enum>(Enum.Entry1) {
|
||||||
|
fun bar(): Enum {
|
||||||
|
return default
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val o = Outer()
|
||||||
|
if (o.fooCaller() != Enum.Entry1) return "Fail"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+5
@@ -19869,6 +19869,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("substitutionFunctionFromSuper.kt")
|
||||||
|
public void testSubstitutionFunctionFromSuper() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/objects/substitutionFunctionFromSuper.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("thisInConstructor.kt")
|
@TestMetadata("thisInConstructor.kt")
|
||||||
public void testThisInConstructor() throws Exception {
|
public void testThisInConstructor() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
||||||
|
|||||||
+5
@@ -19869,6 +19869,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("substitutionFunctionFromSuper.kt")
|
||||||
|
public void testSubstitutionFunctionFromSuper() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/objects/substitutionFunctionFromSuper.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("thisInConstructor.kt")
|
@TestMetadata("thisInConstructor.kt")
|
||||||
public void testThisInConstructor() throws Exception {
|
public void testThisInConstructor() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
||||||
|
|||||||
+5
@@ -19869,6 +19869,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("substitutionFunctionFromSuper.kt")
|
||||||
|
public void testSubstitutionFunctionFromSuper() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/objects/substitutionFunctionFromSuper.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("thisInConstructor.kt")
|
@TestMetadata("thisInConstructor.kt")
|
||||||
public void testThisInConstructor() throws Exception {
|
public void testThisInConstructor() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -15924,6 +15924,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("substitutionFunctionFromSuper.kt")
|
||||||
|
public void testSubstitutionFunctionFromSuper() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/objects/substitutionFunctionFromSuper.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("thisInConstructor.kt")
|
@TestMetadata("thisInConstructor.kt")
|
||||||
public void testThisInConstructor() throws Exception {
|
public void testThisInConstructor() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
||||||
|
|||||||
Generated
+5
@@ -15924,6 +15924,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("substitutionFunctionFromSuper.kt")
|
||||||
|
public void testSubstitutionFunctionFromSuper() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/objects/substitutionFunctionFromSuper.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("thisInConstructor.kt")
|
@TestMetadata("thisInConstructor.kt")
|
||||||
public void testThisInConstructor() throws Exception {
|
public void testThisInConstructor() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
||||||
|
|||||||
Generated
+5
@@ -15989,6 +15989,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("substitutionFunctionFromSuper.kt")
|
||||||
|
public void testSubstitutionFunctionFromSuper() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/objects/substitutionFunctionFromSuper.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("thisInConstructor.kt")
|
@TestMetadata("thisInConstructor.kt")
|
||||||
public void testThisInConstructor() throws Exception {
|
public void testThisInConstructor() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -9965,6 +9965,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
|||||||
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
runTest("compiler/testData/codegen/box/objects/simpleObject.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("substitutionFunctionFromSuper.kt")
|
||||||
|
public void testSubstitutionFunctionFromSuper() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/objects/substitutionFunctionFromSuper.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("thisInConstructor.kt")
|
@TestMetadata("thisInConstructor.kt")
|
||||||
public void testThisInConstructor() throws Exception {
|
public void testThisInConstructor() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user