PSI2IR: don't generate annotations on init block (related to KT-48687)
This commit is contained in:
+3
@@ -39,6 +39,9 @@ class AnnotationGenerator(context: GeneratorContext) : IrElementVisitorVoid {
|
||||
// front-end (incorrectly) copies annotations from corresponding interface members.
|
||||
if (declaration is IrProperty && declaration.origin == IrDeclarationOrigin.DELEGATED_MEMBER) return
|
||||
|
||||
// Don't generate annotations for anonymous initializers
|
||||
if (declaration is IrAnonymousInitializer) return
|
||||
|
||||
// Delegate field is mapped to a new property descriptor with annotations of the original property delegate
|
||||
// (see IrPropertyDelegateDescriptorImpl), but annotations on backing fields should be processed manually here
|
||||
val annotatedDescriptor =
|
||||
|
||||
Vendored
-18
@@ -1,18 +0,0 @@
|
||||
annotation class SomeAnn : Annotation {
|
||||
constructor() /* primary */
|
||||
|
||||
}
|
||||
|
||||
@SomeAnn
|
||||
class My {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
init {
|
||||
val x: Int = 1
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
-42
@@ -1,42 +0,0 @@
|
||||
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
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
annotation class SomeAnn
|
||||
|
||||
@SomeAnn
|
||||
|
||||
Vendored
-1
@@ -11,7 +11,6 @@ class My {
|
||||
|
||||
}
|
||||
|
||||
@SomeAnn
|
||||
init {
|
||||
val x: Int = 1
|
||||
}
|
||||
|
||||
-2
@@ -24,8 +24,6 @@ FILE fqName:<root> fileName:/annotationOnClassWithInitializer.kt
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user