[SLC] prefer sourcePsiSafe to psiSafe
We should use only source declarations as anchors as it is a predictable contract ^KT-64772
This commit is contained in:
committed by
Space Team
parent
b8306c8242
commit
042042768f
+1
-1
@@ -268,7 +268,7 @@ internal open class SymbolLightClassForClassOrObject : SymbolLightClassForNamedC
|
|||||||
classOrObjectSymbol.getStaticDeclaredMemberScope().getCallableSymbols()
|
classOrObjectSymbol.getStaticDeclaredMemberScope().getCallableSymbols()
|
||||||
.filterIsInstance<KtEnumEntrySymbol>()
|
.filterIsInstance<KtEnumEntrySymbol>()
|
||||||
.mapNotNullTo(result) {
|
.mapNotNullTo(result) {
|
||||||
val enumEntry = it.psiSafe<KtEnumEntry>()
|
val enumEntry = it.sourcePsiSafe<KtEnumEntry>()
|
||||||
val name = enumEntry?.name ?: return@mapNotNullTo null
|
val name = enumEntry?.name ?: return@mapNotNullTo null
|
||||||
SymbolLightFieldForEnumEntry(
|
SymbolLightFieldForEnumEntry(
|
||||||
enumEntry = enumEntry,
|
enumEntry = enumEntry,
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -544,7 +544,7 @@ internal fun KtSymbolWithMembers.createInnerClasses(
|
|||||||
// we can't prohibit creating light classes with null names either since they can contain members
|
// we can't prohibit creating light classes with null names either since they can contain members
|
||||||
|
|
||||||
getStaticDeclaredMemberScope().getClassifierSymbols().filterIsInstance<KtNamedClassOrObjectSymbol>().mapTo(result) {
|
getStaticDeclaredMemberScope().getClassifierSymbols().filterIsInstance<KtNamedClassOrObjectSymbol>().mapTo(result) {
|
||||||
val classOrObjectDeclaration = it.psiSafe<KtClassOrObject>()
|
val classOrObjectDeclaration = it.sourcePsiSafe<KtClassOrObject>()
|
||||||
if (classOrObjectDeclaration != null) {
|
if (classOrObjectDeclaration != null) {
|
||||||
createLightClassNoCache(classOrObjectDeclaration, containingClass.ktModule)
|
createLightClassNoCache(classOrObjectDeclaration, containingClass.ktModule)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+2
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -16,7 +16,6 @@ import com.intellij.psi.search.SearchScope
|
|||||||
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
|
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
|
||||||
import org.jetbrains.kotlin.analysis.api.symbols.KtTypeParameterSymbol
|
import org.jetbrains.kotlin.analysis.api.symbols.KtTypeParameterSymbol
|
||||||
import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer
|
import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer
|
||||||
import org.jetbrains.kotlin.analysis.api.symbols.psiSafe
|
|
||||||
import org.jetbrains.kotlin.analysis.api.symbols.sourcePsiSafe
|
import org.jetbrains.kotlin.analysis.api.symbols.sourcePsiSafe
|
||||||
import org.jetbrains.kotlin.analysis.api.types.KtErrorType
|
import org.jetbrains.kotlin.analysis.api.types.KtErrorType
|
||||||
import org.jetbrains.kotlin.analysis.api.types.KtNonErrorClassType
|
import org.jetbrains.kotlin.analysis.api.types.KtNonErrorClassType
|
||||||
@@ -52,7 +51,7 @@ internal class SymbolLightTypeParameter private constructor(
|
|||||||
index = index,
|
index = index,
|
||||||
typeParameterSymbolPointer = with(ktAnalysisSession) { typeParameterSymbol.createPointer() },
|
typeParameterSymbolPointer = with(ktAnalysisSession) { typeParameterSymbol.createPointer() },
|
||||||
typeParameterDeclaration = typeParameterSymbol.sourcePsiSafe(),
|
typeParameterDeclaration = typeParameterSymbol.sourcePsiSafe(),
|
||||||
kotlinOrigin = typeParameterSymbol.psiSafe(),
|
kotlinOrigin = typeParameterSymbol.sourcePsiSafe(),
|
||||||
)
|
)
|
||||||
|
|
||||||
private val ktModule: KtModule get() = parent.ktModule
|
private val ktModule: KtModule get() = parent.ktModule
|
||||||
|
|||||||
Reference in New Issue
Block a user