[FIR] Properly prohibit access to enum companion in enum entry initialization section

^KT-57456 Fixed
KT-57608
This commit is contained in:
Dmitriy Novozhilov
2023-03-27 19:43:21 +03:00
committed by Space Team
parent cbfa155333
commit e02194b461
11 changed files with 163 additions and 163 deletions
@@ -23,7 +23,7 @@ enum class Planet(val m: Double, internal val r: Double) {
}
};
val g: Double = <!UNINITIALIZED_VARIABLE!>G<!> * m / (r * r)
val g: Double = <!UNINITIALIZED_ENUM_COMPANION!>G<!> * m / (r * r)
abstract fun sayHello()
@@ -98,6 +98,7 @@ object CommonDeclarationCheckers : DeclarationCheckers() {
FirSupertypesChecker,
FirPrimaryConstructorSuperTypeChecker,
FirDynamicSupertypeChecker,
FirEnumCompanionInEnumConstructorCallChecker,
)
override val regularClassCheckers: Set<FirRegularClassChecker>
@@ -166,11 +167,6 @@ object CommonDeclarationCheckers : DeclarationCheckers() {
FirAnonymousInitializerInInterfaceChecker
)
override val enumEntryCheckers: Set<FirEnumEntryChecker>
get() = setOf(
FirEnumCompanionInEnumConstructorCallChecker,
)
override val valueParameterCheckers: Set<FirValueParameterChecker>
get() = setOf()
}
@@ -6,73 +6,94 @@
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.isEnumEntry
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
import org.jetbrains.kotlin.diagnostics.reportOn
import org.jetbrains.kotlin.fir.FirElement
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.checkers.toRegularClassSymbol
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
import org.jetbrains.kotlin.fir.declarations.FirEnumEntry
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
import org.jetbrains.kotlin.fir.declarations.primaryConstructorIfAny
import org.jetbrains.kotlin.fir.expressions.*
import org.jetbrains.kotlin.fir.resolve.dfa.coneType
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.impl.FirPrimaryConstructor
import org.jetbrains.kotlin.fir.expressions.FirExpression
import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier
import org.jetbrains.kotlin.fir.expressions.allReceiverExpressions
import org.jetbrains.kotlin.fir.expressions.toReference
import org.jetbrains.kotlin.fir.references.FirThisReference
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.CFGNodeWithSubgraphs
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.ControlFlowGraph
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.FunctionCallNode
import org.jetbrains.kotlin.fir.resolve.dfa.cfg.QualifiedAccessNode
import org.jetbrains.kotlin.fir.resolve.dfa.controlFlowGraph
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
import org.jetbrains.kotlin.fir.types.coneType
import org.jetbrains.kotlin.fir.types.toRegularClassSymbol
import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
import org.jetbrains.kotlin.utils.addToStdlib.lastIsInstanceOrNull
object FirEnumCompanionInEnumConstructorCallChecker : FirEnumEntryChecker() {
override fun check(declaration: FirEnumEntry, context: CheckerContext, reporter: DiagnosticReporter) {
val enumClass = context.containingDeclarations.lastIsInstanceOrNull<FirRegularClass>() ?: return
if (enumClass.classKind != ClassKind.ENUM_CLASS) return
val companionOfEnumSymbol = enumClass.companionObjectSymbol ?: return
val initializerObject = (declaration.initializer as? FirAnonymousObjectExpression)?.anonymousObject ?: return
val delegatingConstructorCall = initializerObject.primaryConstructorIfAny(context.session)?.resolvedDelegatedConstructorCall ?: return
val visitor = Visitor(context, reporter, companionOfEnumSymbol)
delegatingConstructorCall.argumentList.acceptChildren(visitor)
object FirEnumCompanionInEnumConstructorCallChecker : FirClassChecker() {
override fun check(declaration: FirClass, context: CheckerContext, reporter: DiagnosticReporter) {
val enumClass = when (declaration.classKind) {
ClassKind.ENUM_CLASS -> declaration as FirRegularClass
ClassKind.ENUM_ENTRY -> context.containingDeclarations.lastIsInstanceOrNull()
else -> null
} ?: return
val companionOfEnum = enumClass.companionObjectSymbol ?: return
val graph = declaration.controlFlowGraphReference?.controlFlowGraph ?: return
analyzeGraph(graph, companionOfEnum, context, reporter)
if (declaration.classKind.isEnumEntry) {
val constructor = declaration.declarations.firstIsInstanceOrNull<FirPrimaryConstructor>()
val constructorGraph = constructor?.controlFlowGraphReference?.controlFlowGraph
if (constructorGraph != null) {
analyzeGraph(constructorGraph, companionOfEnum, context, reporter)
}
}
}
private class Visitor(
val context: CheckerContext,
val reporter: DiagnosticReporter,
val companionSymbol: FirRegularClassSymbol
) : FirVisitorVoid() {
override fun visitElement(element: FirElement) {
element.acceptChildren(this)
}
override fun visitFunctionCall(functionCall: FirFunctionCall) {
val needVisitReceiver = checkQualifiedAccess(functionCall)
functionCall.argumentList.acceptChildren(this)
if (needVisitReceiver) {
functionCall.explicitReceiver?.accept(this)
private fun analyzeGraph(
graph: ControlFlowGraph,
companionSymbol: FirRegularClassSymbol,
context: CheckerContext,
reporter: DiagnosticReporter
) {
for (node in graph.nodes) {
if (node is CFGNodeWithSubgraphs) {
for (subGraph in node.subGraphs) {
when (subGraph.kind) {
ControlFlowGraph.Kind.AnonymousFunctionCalledInPlace,
ControlFlowGraph.Kind.PropertyInitializer,
ControlFlowGraph.Kind.ClassInitializer -> analyzeGraph(subGraph, companionSymbol, context, reporter)
ControlFlowGraph.Kind.Class -> {
if (subGraph.declaration is FirAnonymousObject) {
analyzeGraph(subGraph, companionSymbol, context, reporter)
}
}
else -> {}
}
}
}
val qualifiedAccess = when (node) {
is QualifiedAccessNode -> node.fir
is FunctionCallNode -> node.fir
else -> continue
}
val matchingReceiver = qualifiedAccess.allReceiverExpressions
.firstOrNull { it.getClassSymbol(context.session) == companionSymbol }
if (matchingReceiver != null) {
reporter.reportOn(
matchingReceiver.source ?: qualifiedAccess.source,
FirErrors.UNINITIALIZED_ENUM_COMPANION,
companionSymbol,
context
)
}
}
}
override fun visitPropertyAccessExpression(propertyAccessExpression: FirPropertyAccessExpression) {
val needVisitReceiver = checkQualifiedAccess(propertyAccessExpression)
if (needVisitReceiver) {
propertyAccessExpression.explicitReceiver?.accept(this)
private fun FirExpression.getClassSymbol(session: FirSession): FirRegularClassSymbol? {
return when (this) {
is FirResolvedQualifier -> {
this.typeRef.toRegularClassSymbol(session)
}
}
private fun checkQualifiedAccess(expression: FirQualifiedAccessExpression): Boolean {
val companionReceiver = checkReceiver(expression.extensionReceiver)
?: checkReceiver(expression.dispatchReceiver)
?: return true
val source = companionReceiver.source ?: expression.source
reporter.reportOn(source, FirErrors.UNINITIALIZED_ENUM_COMPANION, companionSymbol, context)
return false
}
private fun checkReceiver(receiverExpression: FirExpression): FirExpression? {
if (receiverExpression !is FirResolvedQualifier && receiverExpression !is FirThisReceiverExpression) return null
val receiverSymbol = receiverExpression.typeRef.coneType.toRegularClassSymbol(context.session) ?: return null
return receiverExpression.takeIf { receiverSymbol == companionSymbol }
}
else -> (this.toReference() as? FirThisReference)?.boundSymbol
} as? FirRegularClassSymbol
}
}
@@ -13,11 +13,9 @@ import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.analysis.checkers.classKind
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.checkers.getContainingClassSymbol
import org.jetbrains.kotlin.fir.analysis.checkers.outerClassSymbol
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
import org.jetbrains.kotlin.fir.containingClassForStaticMemberAttr
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.utils.isCompanion
import org.jetbrains.kotlin.fir.declarations.utils.isEnumClass
import org.jetbrains.kotlin.fir.expressions.*
import org.jetbrains.kotlin.fir.references.toResolvedBaseSymbol
@@ -77,16 +75,9 @@ object FirUninitializedEnumChecker : FirQualifiedAccessExpressionChecker() {
if (source.kind is KtFakeSourceElementKind) return
val calleeSymbol = expression.calleeReference.toResolvedBaseSymbol() ?: return
val calleeContainingClassSymbol = calleeSymbol.getContainingClassSymbol(context.session) as? FirRegularClassSymbol ?: return
val enumClassSymbol = calleeSymbol.getContainingClassSymbol(context.session) as? FirRegularClassSymbol ?: return
// We're looking for members/entries/companion object in an enum class or members in companion object of an enum class.
val calleeIsInsideEnum = calleeContainingClassSymbol.isEnumClass
val calleeIsInsideEnumCompanion =
calleeContainingClassSymbol.isCompanion && (calleeContainingClassSymbol.outerClassSymbol(context) as? FirRegularClassSymbol)?.isEnumClass == true
if (!calleeIsInsideEnum && !calleeIsInsideEnumCompanion) return
val enumClassSymbol =
if (calleeIsInsideEnum) calleeContainingClassSymbol
else calleeContainingClassSymbol.outerClassSymbol(context) as? FirRegularClassSymbol ?: return
if (!enumClassSymbol.isEnumClass) return
// An accessed context within the enum class of interest. We should look up until either enum members or enum entries are found,
// not just last containing declaration. For example,
@@ -131,7 +122,9 @@ object FirUninitializedEnumChecker : FirQualifiedAccessExpressionChecker() {
// JVM_1_6 -> ...
// }
// }
val containingDeclarationForAccess = context.containingDeclarations.lastOrNull()
val containingDeclarationForAccess = context.containingDeclarations.lastOrNull {
!(it is FirAnonymousFunction && it.invocationKind != null)
}
if (accessedContext in enumMemberProperties) {
val lazyDelegation = (accessedContext as FirPropertySymbol).lazyDelegation
if (lazyDelegation != null && lazyDelegation == containingDeclarationForAccess) {
@@ -153,24 +146,6 @@ object FirUninitializedEnumChecker : FirQualifiedAccessExpressionChecker() {
return
}
// Members inside the companion object of an enum class
if (calleeContainingClassSymbol == enumClassSymbol.companionObjectSymbol) {
// Uninitialized from the point of view of members or enum entries of that enum class
if (accessedContext in enumMemberProperties || accessedContext in enumEntries) {
if (calleeSymbol is FirPropertySymbol) {
// From KT-11769
// enum class Fruit(...) {
// APPLE(...);
// companion object {
// val common = ...
// }
// val score = ... <!>common<!>
// }
reporter.reportOn(source, FirErrors.UNINITIALIZED_VARIABLE, calleeSymbol, context)
}
}
}
// The enum entries of an enum class
if (calleeSymbol in enumEntries) {
val calleeEnumEntry = calleeSymbol as FirEnumEntrySymbol
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.fir.visitors.TransformData
import org.jetbrains.kotlin.fir.visitors.transformInplace
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.types.ConstantValueKind
import org.jetbrains.kotlin.utils.addIfNotNull
inline val FirAnnotation.unexpandedConeClassLikeType: ConeClassLikeType?
get() = ((annotationTypeRef as? FirResolvedTypeRef)?.type as? ConeClassLikeType)
@@ -169,3 +170,10 @@ fun FirExpression.unwrapSmartcastExpression(): FirExpression =
val FirCallableReferenceAccess.isBound: Boolean
get() = (dispatchReceiver != FirNoReceiverExpression || extensionReceiver != FirNoReceiverExpression) &&
calleeReference.toResolvedCallableSymbol()?.isStatic != true
val FirQualifiedAccessExpression.allReceiverExpressions: List<FirExpression>
get() = buildList {
addIfNotNull(dispatchReceiver)
addIfNotNull(extensionReceiver)
addAll(contextReceiverArguments)
}
@@ -1,7 +1,7 @@
// SKIP_TXT
enum class A(val z: Any) {
Y(<!UNINITIALIZED_ENUM_COMPANION, UNINITIALIZED_VARIABLE!>x<!>);
Y(<!UNINITIALIZED_ENUM_COMPANION!>x<!>);
companion object {
val x = A.Y.ordinal
@@ -9,7 +9,7 @@ enum class A(val z: Any) {
}
enum class B(val z: Any) {
Y(<!UNINITIALIZED_VARIABLE!><!UNINITIALIZED_ENUM_COMPANION!>B<!>.x<!>);
Y(<!UNINITIALIZED_ENUM_COMPANION!>B<!>.x);
companion object {
val x = B.Y.ordinal
@@ -10,22 +10,22 @@ import kotlin.reflect.KProperty
enum class Enum {
A {
val aInside = foo()
val bInside = inPlaceRun { foo() }
val aInside = <!UNINITIALIZED_ENUM_COMPANION!>foo<!>()
val bInside = inPlaceRun { <!UNINITIALIZED_ENUM_COMPANION!>foo<!>() }
val cInside = nonInPlaceRun { foo() }
val dInside by foo()
val eInside by inPlaceDelegate { foo() }
val dInside by <!UNINITIALIZED_ENUM_COMPANION!>foo<!>()
val eInside by inPlaceDelegate { <!UNINITIALIZED_ENUM_COMPANION!>foo<!>() }
val fInside by nonInPlaceDelegate { foo() }
},
B {
init {
val aInit = foo()
val bInit = inPlaceRun { foo() }
val aInit = <!UNINITIALIZED_ENUM_COMPANION!>foo<!>()
val bInit = inPlaceRun { <!UNINITIALIZED_ENUM_COMPANION!>foo<!>() }
val cInit = nonInPlaceRun { foo() }
val dInit by foo()
val eInit by inPlaceDelegate { foo() }
val dInit by <!UNINITIALIZED_ENUM_COMPANION!>foo<!>()
val eInit by inPlaceDelegate { <!UNINITIALIZED_ENUM_COMPANION!>foo<!>() }
val fInit by nonInPlaceDelegate { foo() }
}
},
@@ -65,21 +65,21 @@ enum class Enum {
D {
init {
val someObj = object {
val aInside = foo()
val bInside = inPlaceRun { foo() }
val aInside = <!UNINITIALIZED_ENUM_COMPANION!>foo<!>()
val bInside = inPlaceRun { <!UNINITIALIZED_ENUM_COMPANION!>foo<!>() }
val cInside = nonInPlaceRun { foo() }
val dInside by foo()
val eInside by inPlaceDelegate { foo() }
val dInside by <!UNINITIALIZED_ENUM_COMPANION!>foo<!>()
val eInside by inPlaceDelegate { <!UNINITIALIZED_ENUM_COMPANION!>foo<!>() }
val fInside by nonInPlaceDelegate { foo() }
init {
val aInit = foo()
val bInit = inPlaceRun { foo() }
val aInit = <!UNINITIALIZED_ENUM_COMPANION!>foo<!>()
val bInit = inPlaceRun { <!UNINITIALIZED_ENUM_COMPANION!>foo<!>() }
val cInit = nonInPlaceRun { foo() }
val dInit by foo()
val eInit by inPlaceDelegate { foo() }
val dInit by <!UNINITIALIZED_ENUM_COMPANION!>foo<!>()
val eInit by inPlaceDelegate { <!UNINITIALIZED_ENUM_COMPANION!>foo<!>() }
val fInit by nonInPlaceDelegate { foo() }
}
@@ -97,12 +97,12 @@ enum class Enum {
}
;
val a = foo()
val b = inPlaceRun { foo() }
val a = <!UNINITIALIZED_ENUM_COMPANION!>foo<!>()
val b = inPlaceRun { <!UNINITIALIZED_ENUM_COMPANION!>foo<!>() }
val c = nonInPlaceRun { foo() }
val d by foo()
val e by inPlaceDelegate { foo() }
val d by <!UNINITIALIZED_ENUM_COMPANION!>foo<!>()
val e by inPlaceDelegate { <!UNINITIALIZED_ENUM_COMPANION!>foo<!>() }
val f by nonInPlaceDelegate { foo() }
companion object {
@@ -114,7 +114,7 @@ enum class EnumWithConstructor(val a: String, val b: String, val c: String) {
A(
a = <!UNINITIALIZED_ENUM_COMPANION!>foo<!>(),
b = inPlaceRun { <!UNINITIALIZED_ENUM_COMPANION!>foo<!>() },
c = nonInPlaceRun { <!UNINITIALIZED_ENUM_COMPANION!>foo<!>() }
c = nonInPlaceRun { foo() }
);
companion object {
@@ -10,22 +10,22 @@ import kotlin.reflect.KProperty
enum class Enum {
A {
val aInside = value
val bInside = inPlaceRun { value }
val aInside = <!UNINITIALIZED_ENUM_COMPANION!>value<!>
val bInside = inPlaceRun { <!UNINITIALIZED_ENUM_COMPANION!>value<!> }
val cInside = nonInPlaceRun { value }
val dInside by value
val eInside by inPlaceDelegate { value }
val dInside by <!UNINITIALIZED_ENUM_COMPANION!>value<!>
val eInside by inPlaceDelegate { <!UNINITIALIZED_ENUM_COMPANION!>value<!> }
val fInside by nonInPlaceDelegate { value }
},
B {
init {
val aInit = value
val bInit = inPlaceRun { value }
val aInit = <!UNINITIALIZED_ENUM_COMPANION!>value<!>
val bInit = inPlaceRun { <!UNINITIALIZED_ENUM_COMPANION!>value<!> }
val cInit = nonInPlaceRun { value }
val dInit by value
val eInit by inPlaceDelegate { value }
val dInit by <!UNINITIALIZED_ENUM_COMPANION!>value<!>
val eInit by inPlaceDelegate { <!UNINITIALIZED_ENUM_COMPANION!>value<!> }
val fInit by nonInPlaceDelegate { value }
}
},
@@ -65,21 +65,21 @@ enum class Enum {
D {
init {
val someObj = object {
val aInside = value
val bInside = inPlaceRun { value }
val aInside = <!UNINITIALIZED_ENUM_COMPANION!>value<!>
val bInside = inPlaceRun { <!UNINITIALIZED_ENUM_COMPANION!>value<!> }
val cInside = nonInPlaceRun { value }
val dInside by value
val eInside by inPlaceDelegate { value }
val dInside by <!UNINITIALIZED_ENUM_COMPANION!>value<!>
val eInside by inPlaceDelegate { <!UNINITIALIZED_ENUM_COMPANION!>value<!> }
val fInside by nonInPlaceDelegate { value }
init {
val aInit = value
val bInit = inPlaceRun { value }
val aInit = <!UNINITIALIZED_ENUM_COMPANION!>value<!>
val bInit = inPlaceRun { <!UNINITIALIZED_ENUM_COMPANION!>value<!> }
val cInit = nonInPlaceRun { value }
val dInit by value
val eInit by inPlaceDelegate { value }
val dInit by <!UNINITIALIZED_ENUM_COMPANION!>value<!>
val eInit by inPlaceDelegate { <!UNINITIALIZED_ENUM_COMPANION!>value<!> }
val fInit by nonInPlaceDelegate { value }
}
@@ -97,13 +97,13 @@ enum class Enum {
}
;
val a = <!UNINITIALIZED_VARIABLE!>value<!>
val b = inPlaceRun { <!UNINITIALIZED_VARIABLE!>value<!> }
val c = nonInPlaceRun { <!UNINITIALIZED_VARIABLE!>value<!> }
val a = <!UNINITIALIZED_ENUM_COMPANION!>value<!>
val b = inPlaceRun { <!UNINITIALIZED_ENUM_COMPANION!>value<!> }
val c = nonInPlaceRun { value }
val d by <!UNINITIALIZED_VARIABLE!>value<!>
val e by inPlaceDelegate { <!UNINITIALIZED_VARIABLE!>value<!> }
val f by nonInPlaceDelegate { <!UNINITIALIZED_VARIABLE!>value<!> }
val d by <!UNINITIALIZED_ENUM_COMPANION!>value<!>
val e by inPlaceDelegate { <!UNINITIALIZED_ENUM_COMPANION!>value<!> }
val f by nonInPlaceDelegate { value }
companion object {
val value = "value"
@@ -112,9 +112,9 @@ enum class Enum {
enum class EnumWithConstructor(val a: String, val b: String, val c: String) {
A(
a = <!UNINITIALIZED_ENUM_COMPANION, UNINITIALIZED_VARIABLE!>value<!>,
b = inPlaceRun { <!UNINITIALIZED_ENUM_COMPANION, UNINITIALIZED_VARIABLE!>value<!> },
c = nonInPlaceRun { <!UNINITIALIZED_ENUM_COMPANION!>value<!> }
a = <!UNINITIALIZED_ENUM_COMPANION!>value<!>,
b = inPlaceRun { <!UNINITIALIZED_ENUM_COMPANION!>value<!> },
c = nonInPlaceRun { value }
);
companion object {
@@ -9,7 +9,7 @@ enum class B(val x: Int) {
}
enum class C(val x: Int) {
C1(<!UNINITIALIZED_ENUM_COMPANION, UNINITIALIZED_VARIABLE!>SUM<!>),
C1(<!UNINITIALIZED_ENUM_COMPANION!>SUM<!>),
C2(1);
companion object {
@@ -26,8 +26,8 @@ enum class Fruit(personal: Int) {
val common = 20
}
val score = personal + <!UNINITIALIZED_VARIABLE!>common<!>
val score2 = { personal + <!UNINITIALIZED_VARIABLE!>common<!> }()
val score = personal + <!UNINITIALIZED_ENUM_COMPANION!>common<!>
val score2 = { personal + common }()
}
// Another example from KT-11769
@@ -3,13 +3,13 @@
enum class SomeEnum(val x: Int) {
A(<!UNINITIALIZED_ENUM_COMPANION!>companionFun<!>().length),// UNINITIALIZED_ENUM_COMPANION
B(<!UNINITIALIZED_ENUM_COMPANION, UNINITIALIZED_VARIABLE!>companionProp<!>.length), // UNINITIALIZED_VARIABLE
B(<!UNINITIALIZED_ENUM_COMPANION!>companionProp<!>.length), // UNINITIALIZED_VARIABLE
C(<!UNINITIALIZED_ENUM_COMPANION!>SomeEnum<!>.companionFun().length),
D(<!UNINITIALIZED_VARIABLE!><!UNINITIALIZED_ENUM_COMPANION!>SomeEnum<!>.companionProp<!>.length),
D(<!UNINITIALIZED_ENUM_COMPANION!>SomeEnum<!>.companionProp.length),
E(SomeEnum.<!UNINITIALIZED_ENUM_COMPANION!>Companion<!>.companionFun().length),
F(<!UNINITIALIZED_VARIABLE!>SomeEnum.<!UNINITIALIZED_ENUM_COMPANION!>Companion<!>.companionProp<!>.length); // UNINITIALIZED_VARIABLE
F(SomeEnum.<!UNINITIALIZED_ENUM_COMPANION!>Companion<!>.companionProp.length); // UNINITIALIZED_VARIABLE
companion object {
val companionProp = "someString"
@@ -39,17 +39,17 @@ val OtherEnum.Companion.extensionProp: String
enum class EnumWithLambda(val lambda: () -> Unit) {
M({
<!UNINITIALIZED_ENUM_COMPANION!>companionFun<!>().length
<!UNINITIALIZED_ENUM_COMPANION!>companionProp<!>.length
companionFun().length
companionProp.length
<!UNINITIALIZED_ENUM_COMPANION!>EnumWithLambda<!>.companionFun().length
<!UNINITIALIZED_ENUM_COMPANION!>EnumWithLambda<!>.companionProp.length
EnumWithLambda.companionFun().length
EnumWithLambda.companionProp.length
<!UNINITIALIZED_ENUM_COMPANION!>extensionFun<!>().length
<!UNINITIALIZED_ENUM_COMPANION!>extensionProp<!>.length
extensionFun().length
extensionProp.length
<!UNINITIALIZED_ENUM_COMPANION!>EnumWithLambda<!>.extensionFun().length
<!UNINITIALIZED_ENUM_COMPANION!>EnumWithLambda<!>.extensionProp.length
EnumWithLambda.extensionFun().length
EnumWithLambda.extensionProp.length
});
companion object {
@@ -3,13 +3,13 @@
enum class SomeEnum(val x: Int) {
A(<!UNINITIALIZED_ENUM_COMPANION!>companionFun<!>().length),// UNINITIALIZED_ENUM_COMPANION
B(<!UNINITIALIZED_ENUM_COMPANION, UNINITIALIZED_VARIABLE!>companionProp<!>.length), // UNINITIALIZED_VARIABLE
B(<!UNINITIALIZED_ENUM_COMPANION!>companionProp<!>.length), // UNINITIALIZED_VARIABLE
C(<!UNINITIALIZED_ENUM_COMPANION!>SomeEnum<!>.companionFun().length),
D(<!UNINITIALIZED_VARIABLE!><!UNINITIALIZED_ENUM_COMPANION!>SomeEnum<!>.companionProp<!>.length),
D(<!UNINITIALIZED_ENUM_COMPANION!>SomeEnum<!>.companionProp.length),
E(SomeEnum.<!UNINITIALIZED_ENUM_COMPANION!>Companion<!>.companionFun().length),
F(<!UNINITIALIZED_VARIABLE!>SomeEnum.<!UNINITIALIZED_ENUM_COMPANION!>Companion<!>.companionProp<!>.length); // UNINITIALIZED_VARIABLE
F(SomeEnum.<!UNINITIALIZED_ENUM_COMPANION!>Companion<!>.companionProp.length); // UNINITIALIZED_VARIABLE
companion object {
val companionProp = "someString"
@@ -39,17 +39,17 @@ val OtherEnum.Companion.extensionProp: String
enum class EnumWithLambda(val lambda: () -> Unit) {
M({
<!UNINITIALIZED_ENUM_COMPANION!>companionFun<!>().length
<!UNINITIALIZED_ENUM_COMPANION!>companionProp<!>.length
companionFun().length
companionProp.length
<!UNINITIALIZED_ENUM_COMPANION!>EnumWithLambda<!>.companionFun().length
<!UNINITIALIZED_ENUM_COMPANION!>EnumWithLambda<!>.companionProp.length
EnumWithLambda.companionFun().length
EnumWithLambda.companionProp.length
<!UNINITIALIZED_ENUM_COMPANION!>extensionFun<!>().length
<!UNINITIALIZED_ENUM_COMPANION!>extensionProp<!>.length
extensionFun().length
extensionProp.length
<!UNINITIALIZED_ENUM_COMPANION!>EnumWithLambda<!>.extensionFun().length
<!UNINITIALIZED_ENUM_COMPANION!>EnumWithLambda<!>.extensionProp.length
EnumWithLambda.extensionFun().length
EnumWithLambda.extensionProp.length
});
companion object {