FIR2IR: generate annotations on fake override parameters #KT-53208 Fixed

This commit is contained in:
Mikhail Glukhikh
2022-07-18 16:57:56 +02:00
committed by Space
parent 5445f4043a
commit 3ae75a5094
14 changed files with 373 additions and 1 deletions
@@ -556,12 +556,12 @@ class Fir2IrDeclarationStorage(
containerSource = simpleFunction?.containerSource,
).apply {
metadata = FirMetadataSource.Function(function)
convertAnnotationsForNonDeclaredMembers(function, origin)
enterScope(this)
bindAndDeclareParameters(
function, irParent,
thisReceiverOwner, isStatic = simpleFunction?.isStatic == true
)
convertAnnotationsForNonDeclaredMembers(function, origin)
leaveScope(this)
}
}
@@ -1595,6 +1595,11 @@ class Fir2IrDeclarationStorage(
|| origin == IrDeclarationOrigin.FAKE_OVERRIDE
) {
annotationGenerator.generate(this, firAnnotationContainer)
if (this is IrFunction && firAnnotationContainer is FirSimpleFunction) {
valueParameters.zip(firAnnotationContainer.valueParameters).forEach { (irParameter, firParameter) ->
annotationGenerator.generate(irParameter, firParameter, isInConstructor = false)
}
}
}
}
@@ -17817,6 +17817,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt");
}
@Test
@TestMetadata("findAnnotationOnDefaultMethodParameter.kt")
public void testFindAnnotationOnDefaultMethodParameter() throws Exception {
runTest("compiler/testData/codegen/box/fir/findAnnotationOnDefaultMethodParameter.kt");
}
@Test
@TestMetadata("Fir2IrClassifierStorage.kt")
public void testFir2IrClassifierStorage() throws Exception {
@@ -2632,6 +2632,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
runTest("compiler/testData/ir/irText/firProblems/recursiveCapturedTypeInPropertyReference.kt");
}
@Test
@TestMetadata("reflectFindAnnotationOnDefaultMethodParameter.kt")
public void testReflectFindAnnotationOnDefaultMethodParameter() throws Exception {
runTest("compiler/testData/ir/irText/firProblems/reflectFindAnnotationOnDefaultMethodParameter.kt");
}
@Test
@TestMetadata("reflectGetOnNullableTypeAlias.kt")
public void testReflectGetOnNullableTypeAlias() throws Exception {
@@ -2632,6 +2632,12 @@ public class LightTreeFir2IrTextTestGenerated extends AbstractLightTreeFir2IrTex
runTest("compiler/testData/ir/irText/firProblems/recursiveCapturedTypeInPropertyReference.kt");
}
@Test
@TestMetadata("reflectFindAnnotationOnDefaultMethodParameter.kt")
public void testReflectFindAnnotationOnDefaultMethodParameter() throws Exception {
runTest("compiler/testData/ir/irText/firProblems/reflectFindAnnotationOnDefaultMethodParameter.kt");
}
@Test
@TestMetadata("reflectGetOnNullableTypeAlias.kt")
public void testReflectGetOnNullableTypeAlias() throws Exception {