[SLC] avoid return type check for implicit types
we should avoid value class check in implicit return types to avoid extra resolve ^KT-56046 ^KT-55788
This commit is contained in:
committed by
Space Team
parent
e1c2ca1bbf
commit
e1c8b3d674
-14
@@ -18,10 +18,6 @@ import com.intellij.psi.scope.PsiScopeProcessor
|
||||
import com.intellij.psi.util.CachedValueProvider
|
||||
import com.intellij.psi.util.PsiUtil
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtCallableSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtFunctionLikeSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.receiverType
|
||||
import org.jetbrains.kotlin.analysis.project.structure.KtModule
|
||||
import org.jetbrains.kotlin.analysis.providers.createProjectWideOutOfBlockModificationTracker
|
||||
import org.jetbrains.kotlin.analysis.utils.errors.buildErrorWithAttachment
|
||||
@@ -195,14 +191,4 @@ abstract class SymbolLightClassBase protected constructor(val ktModule: KtModule
|
||||
visitor.visitElement(this)
|
||||
}
|
||||
}
|
||||
|
||||
context(KtAnalysisSession)
|
||||
protected fun KtCallableSymbol.hasTypeForValueClassInSignature(ignoreReturnType: Boolean = false): Boolean {
|
||||
if (!ignoreReturnType && returnType.typeForValueClass) return true
|
||||
if (receiverType?.typeForValueClass == true) return true
|
||||
if (this is KtFunctionLikeSymbol) {
|
||||
return valueParameters.any { it.returnType.typeForValueClass }
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
+17
-1
@@ -287,7 +287,8 @@ internal fun SymbolLightClassBase.createPropertyAccessors(
|
||||
if (declaration.getter?.hasBody != true && declaration.setter?.hasBody != true && declaration.visibility.isPrivateOrPrivateToThis()) return
|
||||
|
||||
if (declaration.hasJvmFieldAnnotation()) return
|
||||
val propertyTypeIsValueClass = declaration.returnType.typeForValueClass
|
||||
val propertyTypeIsValueClass = declaration.hasTypeForValueClassInSignature()
|
||||
|
||||
/*
|
||||
* For top-level properties with value class in return type compiler mangles only setter
|
||||
*
|
||||
@@ -621,6 +622,21 @@ internal fun SymbolLightClassBase.addPropertyBackingFields(
|
||||
propertyGroups[false]?.forEach(::addPropertyBackingField)
|
||||
}
|
||||
|
||||
context(KtAnalysisSession)
|
||||
internal fun KtCallableSymbol.hasTypeForValueClassInSignature(ignoreReturnType: Boolean = false): Boolean {
|
||||
if (!ignoreReturnType) {
|
||||
val psiDeclaration = sourcePsiSafe<KtCallableDeclaration>()
|
||||
if (psiDeclaration?.typeReference != null && returnType.typeForValueClass) return true
|
||||
}
|
||||
|
||||
if (receiverType?.typeForValueClass == true) return true
|
||||
if (this is KtFunctionLikeSymbol) {
|
||||
return valueParameters.any { it.returnType.typeForValueClass }
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
context(KtAnalysisSession)
|
||||
internal val KtType.typeForValueClass: Boolean
|
||||
get() {
|
||||
|
||||
Reference in New Issue
Block a user