[FIR] FirRenderer: add missing resolvePhaseRenderer usage for anonymous initializer and dangling modifiers

This commit is contained in:
Dmitrii Gridin
2023-09-18 16:31:03 +02:00
committed by Space Team
parent c9df6aff5f
commit c6bb9af823
11 changed files with 24 additions and 20 deletions
@@ -4,14 +4,14 @@ FILE: [ResolvedTo(BODY_RESOLVE)] danglingAnnotationClassLevel.kt
super<R|kotlin/Any|>()
}
@R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
[ResolvedTo(BODY_RESOLVE)] @R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
}
public final [ResolvedTo(BODY_RESOLVE)] class Bar : R|kotlin/Any| {
public [ResolvedTo(BODY_RESOLVE)] constructor(): R|Bar| {
super<R|kotlin/Any|>()
}
@R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
[ResolvedTo(BODY_RESOLVE)] @R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
}
public final [ResolvedTo(BODY_RESOLVE)] class Outer : R|kotlin/Any| {
public [ResolvedTo(BODY_RESOLVE)] constructor(): R|Outer| {
@@ -23,7 +23,7 @@ FILE: [ResolvedTo(BODY_RESOLVE)] danglingAnnotationClassLevel.kt
super<R|kotlin/Any|>()
}
@R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
[ResolvedTo(BODY_RESOLVE)] @R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
}
public final [ResolvedTo(BODY_RESOLVE)] fun foo(): R|kotlin/Unit| {
@@ -32,7 +32,7 @@ FILE: [ResolvedTo(BODY_RESOLVE)] danglingAnnotationClassLevel.kt
super<R|kotlin/Any|>()
}
@R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
[ResolvedTo(BODY_RESOLVE)] @R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
}
}
@@ -8,7 +8,7 @@ FILE: [ResolvedTo(BODY_RESOLVE)] danglingAnnotationClassLevelScript.kts
super<R|kotlin/Any|>()
}
@R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
[ResolvedTo(BODY_RESOLVE)] @R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
}
public final [ResolvedTo(BODY_RESOLVE)] class Bar : R|kotlin/Any| {
@@ -16,7 +16,7 @@ FILE: [ResolvedTo(BODY_RESOLVE)] danglingAnnotationClassLevelScript.kts
super<R|kotlin/Any|>()
}
@R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
[ResolvedTo(BODY_RESOLVE)] @R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
}
public final [ResolvedTo(BODY_RESOLVE)] class Outer : R|kotlin/Any| {
@@ -29,7 +29,7 @@ FILE: [ResolvedTo(BODY_RESOLVE)] danglingAnnotationClassLevelScript.kts
super<R|kotlin/Any|>()
}
@R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
[ResolvedTo(BODY_RESOLVE)] @R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
}
public final [ResolvedTo(BODY_RESOLVE)] fun foo(): R|kotlin/Unit| {
@@ -38,9 +38,10 @@ FILE: [ResolvedTo(BODY_RESOLVE)] danglingAnnotationClassLevelScript.kts
super<R|kotlin/Any|>()
}
@R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
[ResolvedTo(BODY_RESOLVE)] @R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
}
}
}
@@ -1,2 +1,2 @@
FILE: [ResolvedTo(BODY_RESOLVE)] danglingAnnotationTopLevel.kt
@R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
[ResolvedTo(BODY_RESOLVE)] @R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
@@ -4,7 +4,7 @@ FILE: [ResolvedTo(BODY_RESOLVE)] initBlock.kt
super<R|kotlin/Any|>()
}
init {
[ResolvedTo(BODY_RESOLVE)] init {
[ResolvedTo(RAW_FIR)] lval x: R|kotlin/Int| = Int(10)
local final [ResolvedTo(RAW_FIR)] class B : R|kotlin/Any| {
public [ResolvedTo(RAW_FIR)] constructor(): R|<local>/B| {
@@ -8,7 +8,7 @@ FILE: [ResolvedTo(BODY_RESOLVE)] initBlockScript.kts
super<R|kotlin/Any|>()
}
init {
[ResolvedTo(BODY_RESOLVE)] init {
[ResolvedTo(RAW_FIR)] lval x: R|kotlin/Int| = Int(10)
local final [ResolvedTo(RAW_FIR)] class B : R|kotlin/Any| {
public [ResolvedTo(RAW_FIR)] constructor(): R|<local>/B| {
@@ -20,3 +20,4 @@ FILE: [ResolvedTo(BODY_RESOLVE)] initBlockScript.kts
}
}
@@ -7,4 +7,4 @@ FIR element rendered:
FIR FILE:
FILE: [ResolvedTo(IMPORTS)] danglingAnnotation.kt
@R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
[ResolvedTo(BODY_RESOLVE)] @R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
@@ -12,5 +12,5 @@ FILE: [ResolvedTo(IMPORTS)] danglingAnnotationInClass.kt
super<R|kotlin/Any|>()
}
@R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
}
[ResolvedTo(BODY_RESOLVE)] @R|kotlin/Suppress|[Types](names = vararg(String())) @R|kotlin/annotation/MustBeDocumented|[Types]() <DANGLING MODIFIER: Top level declaration expected>
}
@@ -18,7 +18,7 @@ FILE: [ResolvedTo(IMPORTS)] argsFromInit.kts
LAZY_super<R|kotlin/Any|>
}
init {
[ResolvedTo(BODY_RESOLVE)] init {
<Unresolved name: foo>#(<L> = [ResolvedTo(RAW_FIR)] foo@fun <anonymous>(): R|kotlin/Int| <inline=Unknown> {
^ R|<local>/args|.R|SubstitutionOverride<kotlin/Array.size: R|kotlin/Int|>|
}
@@ -3,7 +3,7 @@ FIR element: FirAnonymousInitializerImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
init {
[ResolvedTo(BODY_RESOLVE)] init {
[ResolvedTo(RAW_FIR)] lval i: R|kotlin/Int| = Int(1)
}
@@ -23,8 +23,8 @@ FILE: [ResolvedTo(IMPORTS)] initializerConflict.kt
LAZY_super<R|kotlin/Any|>
}
init {
[ResolvedTo(BODY_RESOLVE)] init {
[ResolvedTo(RAW_FIR)] lval i: R|kotlin/Int| = Int(1)
}
}
}
@@ -3,7 +3,7 @@ FIR element: FirDanglingModifierListImpl
FIR source kind: DanglingModifierList
FIR element rendered:
<DANGLING MODIFIER: Top level declaration expected>
[ResolvedTo(BODY_RESOLVE)] <DANGLING MODIFIER: Top level declaration expected>
FIR FILE:
FILE: [ResolvedTo(IMPORTS)] secondaryConstructor.kt
@@ -17,5 +17,5 @@ FILE: [ResolvedTo(IMPORTS)] secondaryConstructor.kt
public final [ResolvedTo(STATUS)] fun <no name provided>(): R|kotlin/Unit| { LAZY_BLOCK }
<DANGLING MODIFIER: Top level declaration expected>
[ResolvedTo(BODY_RESOLVE)] <DANGLING MODIFIER: Top level declaration expected>
}
@@ -458,11 +458,13 @@ class FirRenderer(
}
override fun visitAnonymousInitializer(anonymousInitializer: FirAnonymousInitializer) {
resolvePhaseRenderer?.render(anonymousInitializer)
print("init")
bodyRenderer?.renderBody(anonymousInitializer.body)
}
override fun visitDanglingModifierList(danglingModifierList: FirDanglingModifierList) {
resolvePhaseRenderer?.render(danglingModifierList)
annotationRenderer?.render(danglingModifierList)
print("<DANGLING MODIFIER: ${danglingModifierList.diagnostic.reason}>")
}