FIR: distinguish anonymous object as enum entry when scoping
so that `this` reference with the enum entry name as label can be resolved
This commit is contained in:
committed by
Mikhail Glukhikh
parent
52631b7abd
commit
c744dfba9c
+5
-1
@@ -400,7 +400,11 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
|
|||||||
this.type = type
|
this.type = type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var result = withScopesForClass(null, anonymousObject, type) {
|
val labelName =
|
||||||
|
if (anonymousObject.classKind == ClassKind.ENUM_ENTRY) {
|
||||||
|
anonymousObject.getPrimaryConstructorIfAny()?.symbol?.callableId?.className?.shortName()
|
||||||
|
} else null
|
||||||
|
var result = withScopesForClass(labelName, anonymousObject, type) {
|
||||||
transformDeclarationContent(anonymousObject, data).single as FirAnonymousObject
|
transformDeclarationContent(anonymousObject, data).single as FirAnonymousObject
|
||||||
}
|
}
|
||||||
if (!implicitTypeOnly && result.controlFlowGraphReference == FirEmptyControlFlowGraphReference) {
|
if (!implicitTypeOnly && result.controlFlowGraphReference == FirEmptyControlFlowGraphReference) {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
enum class A {
|
enum class A {
|
||||||
X {
|
X {
|
||||||
val x = "OK"
|
val x = "OK"
|
||||||
|
|||||||
Reference in New Issue
Block a user