[IR] Report error from IR interpreter on field recursive initialization
#KT-59890 #KT-61802 Fixed
This commit is contained in:
+7
-1
@@ -14,7 +14,10 @@ import org.jetbrains.kotlin.ir.interpreter.fqName
|
||||
import org.jetbrains.kotlin.ir.interpreter.isAccessToNotNullableObject
|
||||
import org.jetbrains.kotlin.ir.interpreter.preprocessor.IrInterpreterKCallableNamePreprocessor.Companion.isEnumName
|
||||
import org.jetbrains.kotlin.ir.interpreter.preprocessor.IrInterpreterKCallableNamePreprocessor.Companion.isKCallableNameCall
|
||||
import org.jetbrains.kotlin.ir.types.*
|
||||
import org.jetbrains.kotlin.ir.types.classifierOrNull
|
||||
import org.jetbrains.kotlin.ir.types.isAny
|
||||
import org.jetbrains.kotlin.ir.types.isPrimitiveType
|
||||
import org.jetbrains.kotlin.ir.types.isStringClassType
|
||||
import org.jetbrains.kotlin.ir.util.fileOrNull
|
||||
import org.jetbrains.kotlin.ir.util.parentAsClass
|
||||
import org.jetbrains.kotlin.ir.util.statements
|
||||
@@ -180,6 +183,9 @@ class IrInterpreterCommonChecker : IrInterpreterChecker {
|
||||
(owner.type.isPrimitiveType() || owner.type.isStringClassType())
|
||||
}
|
||||
|
||||
// We allow recursion access, but it will fail during interpretation. This way it is easier to implement error reporting.
|
||||
if (visitedStack.contains(owner)) return true
|
||||
|
||||
return owner.asVisited {
|
||||
when {
|
||||
// TODO fix later; used it here because java boolean resolves very strange,
|
||||
|
||||
Reference in New Issue
Block a user