[Analysis API] fix IndexOutOfRangeException
Previously, the `KtFirUsualClassType.qualifiers` was empty for the local classes The reason was a RawFirBuilder setting up a containingClassForLocalAttr to the outer non-local class for the local class. It should be a null instead, see the localClassType.kt as an example ^KT-55510 fixed
This commit is contained in:
+5
-1
@@ -60,8 +60,10 @@ import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||
import org.jetbrains.kotlin.fir.types.impl.FirQualifierPartImpl
|
||||
import org.jetbrains.kotlin.fir.types.impl.FirTypeArgumentListImpl
|
||||
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.lexer.KtTokens.*
|
||||
import org.jetbrains.kotlin.name.*
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.runUnless
|
||||
|
||||
@@ -648,7 +650,9 @@ class DeclarationsConverter(
|
||||
}
|
||||
}
|
||||
}.also {
|
||||
it.initContainingClassForLocalAttr()
|
||||
if (classNode.getParent()?.elementType == KtStubElementTypes.CLASS_BODY) {
|
||||
it.initContainingClassForLocalAttr()
|
||||
}
|
||||
fillDanglingConstraintsTo(firTypeParameters, typeConstraints, it)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1332,7 +1332,9 @@ open class RawFirBuilder(
|
||||
}
|
||||
}
|
||||
}.also {
|
||||
it.initContainingClassForLocalAttr()
|
||||
if (classOrObject.parent is KtClassBody) {
|
||||
it.initContainingClassForLocalAttr()
|
||||
}
|
||||
classOrObject.fillDanglingConstraintsTo(it)
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -27,7 +27,7 @@ FILE: danglingAnnotationsClassLevel.kt
|
||||
}
|
||||
|
||||
public? final? fun withLocal(): R|kotlin/Unit| {
|
||||
local final? [ContainingClassKey=Outer] class Local : R|kotlin/Any| {
|
||||
local final? class Local : R|kotlin/Any| {
|
||||
public? [ContainingClassKey=Local] constructor(): R|Outer.Local| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ FILE: enums3.kt
|
||||
}
|
||||
|
||||
init {
|
||||
local final? [ContainingClassKey=C] enum class Planet : R|kotlin/Enum<C.Planet>| {
|
||||
local final? enum class Planet : R|kotlin/Enum<C.Planet>| {
|
||||
private [ContainingClassKey=Planet] constructor([CorrespondingProperty=<local>/m] m: Double, [CorrespondingProperty=<local>/r] r: Double): R|C.Planet| {
|
||||
super<R|kotlin/Enum<C.Planet>|>()
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -5,7 +5,7 @@ FILE: initBlockWithDeclarations.kt
|
||||
}
|
||||
|
||||
init {
|
||||
local final? [ContainingClassKey=X] class classInInit : R|kotlin/Any| {
|
||||
local final? class classInInit : R|kotlin/Any| {
|
||||
public? [ContainingClassKey=classInInit] constructor(): R|X.classInInit| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
@@ -27,7 +27,7 @@ FILE: initBlockWithDeclarations.kt
|
||||
}
|
||||
|
||||
init {
|
||||
local final? [ContainingClassKey=<no name provided>] class classInInit : R|kotlin/Any| {
|
||||
local final? class classInInit : R|kotlin/Any| {
|
||||
public? [ContainingClassKey=classInInit] constructor(): R|<no name provided>.classInInit| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user