IR: copy anonymous initializer annotations properly #KT-48687 Fixed
This commit is contained in:
Generated
+6
@@ -515,6 +515,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/declarations/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnClassWithInitializer.kt")
|
||||
public void testAnnotationOnClassWithInitializer() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/annotations/annotationOnClassWithInitializer.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationsInAnnotationArguments.kt")
|
||||
public void testAnnotationsInAnnotationArguments() throws Exception {
|
||||
|
||||
@@ -302,6 +302,7 @@ open class DeepCopyIrTreeWithSymbols(
|
||||
mapDeclarationOrigin(declaration.origin),
|
||||
IrAnonymousInitializerSymbolImpl(declaration.descriptor)
|
||||
).apply {
|
||||
transformAnnotations(declaration)
|
||||
body = declaration.body.transform()
|
||||
}
|
||||
|
||||
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
annotation class SomeAnn : Annotation {
|
||||
constructor() /* primary */
|
||||
|
||||
}
|
||||
|
||||
@SomeAnn
|
||||
class My {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
init {
|
||||
val x: Int = 1
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
FILE fqName:<root> fileName:/annotationOnClassWithInitializer.kt
|
||||
CLASS ANNOTATION_CLASS name:SomeAnn modality:FINAL visibility:public superTypes:[kotlin.Annotation]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.SomeAnn
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.SomeAnn [primary]
|
||||
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 [fake_override,operator] declared in kotlin.Annotation
|
||||
$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 [fake_override] declared in kotlin.Annotation
|
||||
$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 [fake_override] declared in kotlin.Annotation
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:My modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
annotations:
|
||||
SomeAnn
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.My
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.My [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:My modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
ANONYMOUS_INITIALIZER isStatic=false
|
||||
BLOCK_BODY
|
||||
VAR name:x type:kotlin.Int [val]
|
||||
CONST Int type=kotlin.Int value=1
|
||||
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
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
annotation class SomeAnn
|
||||
|
||||
@SomeAnn
|
||||
class My {
|
||||
init {
|
||||
val x = 1
|
||||
}
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
annotation class SomeAnn : Annotation {
|
||||
constructor() /* primary */
|
||||
|
||||
}
|
||||
|
||||
@SomeAnn
|
||||
class My {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
@SomeAnn
|
||||
init {
|
||||
val x: Int = 1
|
||||
}
|
||||
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
FILE fqName:<root> fileName:/annotationOnClassWithInitializer.kt
|
||||
CLASS ANNOTATION_CLASS name:SomeAnn modality:FINAL visibility:public superTypes:[kotlin.Annotation]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.SomeAnn
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.SomeAnn [primary]
|
||||
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 [fake_override,operator] declared in kotlin.Annotation
|
||||
$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 [fake_override] declared in kotlin.Annotation
|
||||
$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 [fake_override] declared in kotlin.Annotation
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:My modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
annotations:
|
||||
SomeAnn
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.My
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.My [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:My modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
ANONYMOUS_INITIALIZER isStatic=false
|
||||
annotations:
|
||||
SomeAnn
|
||||
BLOCK_BODY
|
||||
VAR name:x type:kotlin.Int [val]
|
||||
CONST Int type=kotlin.Int value=1
|
||||
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
|
||||
Generated
+6
@@ -515,6 +515,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/declarations/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnClassWithInitializer.kt")
|
||||
public void testAnnotationOnClassWithInitializer() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/annotations/annotationOnClassWithInitializer.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationsInAnnotationArguments.kt")
|
||||
public void testAnnotationsInAnnotationArguments() throws Exception {
|
||||
|
||||
@@ -407,6 +407,11 @@ public class KlibTextTestCaseGenerated extends AbstractKlibTextTestCase {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/declarations/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotationOnClassWithInitializer.kt")
|
||||
public void testAnnotationOnClassWithInitializer() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/annotations/annotationOnClassWithInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsInAnnotationArguments.kt")
|
||||
public void testAnnotationsInAnnotationArguments() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/annotations/annotationsInAnnotationArguments.kt");
|
||||
|
||||
Reference in New Issue
Block a user