Suppress K2 specific warnings in the codebase
^KT-62472
This commit is contained in:
committed by
Space Team
parent
9e66a7b999
commit
704e2ef5c5
+1
@@ -577,6 +577,7 @@ internal class KtFirCallResolver(
|
|||||||
@Suppress("UNCHECKED_CAST") // safe because of the above check on targetKtSymbol
|
@Suppress("UNCHECKED_CAST") // safe because of the above check on targetKtSymbol
|
||||||
KtSimpleFunctionCall(
|
KtSimpleFunctionCall(
|
||||||
partiallyAppliedSymbol as KtPartiallyAppliedFunctionSymbol<KtFunctionLikeSymbol>,
|
partiallyAppliedSymbol as KtPartiallyAppliedFunctionSymbol<KtFunctionLikeSymbol>,
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
argumentMappingWithoutExtensionReceiver
|
argumentMappingWithoutExtensionReceiver
|
||||||
?.createArgumentMapping(partiallyAppliedSymbol.signature as KtFunctionLikeSignature<*>)
|
?.createArgumentMapping(partiallyAppliedSymbol.signature as KtFunctionLikeSignature<*>)
|
||||||
?: LinkedHashMap(),
|
?: LinkedHashMap(),
|
||||||
|
|||||||
+1
@@ -71,6 +71,7 @@ class KtLightMethodForDecompiledDeclaration(
|
|||||||
override fun findSuperMethodSignaturesIncludingStatic(checkAccess: Boolean): List<MethodSignatureBackedByPsiMethod> =
|
override fun findSuperMethodSignaturesIncludingStatic(checkAccess: Boolean): List<MethodSignatureBackedByPsiMethod> =
|
||||||
PsiSuperMethodImplUtil.findSuperMethodSignaturesIncludingStatic(this, checkAccess)
|
PsiSuperMethodImplUtil.findSuperMethodSignaturesIncludingStatic(this, checkAccess)
|
||||||
|
|
||||||
|
@Suppress("OVERRIDE_DEPRECATION") // K2 warning suppression, TODO: KT-62472
|
||||||
override fun findDeepestSuperMethod() = PsiSuperMethodImplUtil.findDeepestSuperMethod(this)
|
override fun findDeepestSuperMethod() = PsiSuperMethodImplUtil.findDeepestSuperMethod(this)
|
||||||
|
|
||||||
override fun findDeepestSuperMethods(): Array<out PsiMethod> = PsiSuperMethodImplUtil.findDeepestSuperMethods(this)
|
override fun findDeepestSuperMethods(): Array<out PsiMethod> = PsiSuperMethodImplUtil.findDeepestSuperMethods(this)
|
||||||
|
|||||||
+1
@@ -157,6 +157,7 @@ abstract class KtLightMethodImpl protected constructor(
|
|||||||
|
|
||||||
override fun getBody() = null
|
override fun getBody() = null
|
||||||
|
|
||||||
|
@Suppress("OVERRIDE_DEPRECATION") // K2 warning suppression, TODO: KT-62472
|
||||||
abstract override fun findDeepestSuperMethod(): PsiMethod?
|
abstract override fun findDeepestSuperMethod(): PsiMethod?
|
||||||
|
|
||||||
abstract override fun findDeepestSuperMethods(): Array<out PsiMethod>
|
abstract override fun findDeepestSuperMethods(): Array<out PsiMethod>
|
||||||
|
|||||||
+1
@@ -120,6 +120,7 @@ internal class FirTowerDataContextAllElementsCollector : FirResolveContextCollec
|
|||||||
*
|
*
|
||||||
* Otherwise, invokes this function recursively on the parent.
|
* Otherwise, invokes this function recursively on the parent.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("NO_TAIL_CALLS_FOUND", "NON_TAIL_RECURSIVE_CALL") // K2 warning suppression, TODO: KT-62472
|
||||||
private tailrec fun PsiElement.closestParentExpressionWithSameContextOrSelf(): KtExpression? {
|
private tailrec fun PsiElement.closestParentExpressionWithSameContextOrSelf(): KtExpression? {
|
||||||
if (this is KtExpression) {
|
if (this is KtExpression) {
|
||||||
if (
|
if (
|
||||||
|
|||||||
+1
@@ -88,6 +88,7 @@ internal class SymbolLightClassForFacade(
|
|||||||
for (fileSymbol in fileSymbols) {
|
for (fileSymbol in fileSymbols) {
|
||||||
for (callableSymbol in fileSymbol.getFileScope().getCallableSymbols()) {
|
for (callableSymbol in fileSymbol.getFileScope().getCallableSymbols()) {
|
||||||
if (callableSymbol !is KtFunctionSymbol && callableSymbol !is KtKotlinPropertySymbol) continue
|
if (callableSymbol !is KtFunctionSymbol && callableSymbol !is KtKotlinPropertySymbol) continue
|
||||||
|
@Suppress("USELESS_IS_CHECK") // K2 warning suppression, TODO: KT-62472
|
||||||
if (callableSymbol !is KtSymbolWithVisibility) continue
|
if (callableSymbol !is KtSymbolWithVisibility) continue
|
||||||
if ((callableSymbol as? KtAnnotatedSymbol)?.hasInlineOnlyAnnotation() == true) continue
|
if ((callableSymbol as? KtAnnotatedSymbol)?.hasInlineOnlyAnnotation() == true) continue
|
||||||
if (multiFileClass && callableSymbol.toPsiVisibilityForMember() == PsiModifier.PRIVATE) continue
|
if (multiFileClass && callableSymbol.toPsiVisibilityForMember() == PsiModifier.PRIVATE) continue
|
||||||
|
|||||||
+1
@@ -53,6 +53,7 @@ internal abstract class SymbolLightMethodBase(
|
|||||||
override fun findSuperMethodSignaturesIncludingStatic(checkAccess: Boolean): List<MethodSignatureBackedByPsiMethod> =
|
override fun findSuperMethodSignaturesIncludingStatic(checkAccess: Boolean): List<MethodSignatureBackedByPsiMethod> =
|
||||||
PsiSuperMethodImplUtil.findSuperMethodSignaturesIncludingStatic(this, checkAccess)
|
PsiSuperMethodImplUtil.findSuperMethodSignaturesIncludingStatic(this, checkAccess)
|
||||||
|
|
||||||
|
@Suppress("OVERRIDE_DEPRECATION") // K2 warning suppression, TODO: KT-62472
|
||||||
override fun findDeepestSuperMethod() = PsiSuperMethodImplUtil.findDeepestSuperMethod(this)
|
override fun findDeepestSuperMethod() = PsiSuperMethodImplUtil.findDeepestSuperMethod(this)
|
||||||
|
|
||||||
override fun findDeepestSuperMethods(): Array<out PsiMethod> = PsiSuperMethodImplUtil.findDeepestSuperMethods(this)
|
override fun findDeepestSuperMethods(): Array<out PsiMethod> = PsiSuperMethodImplUtil.findDeepestSuperMethods(this)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ open class BuildReporter<B : BuildTime, P : BuildPerformanceMetric>(
|
|||||||
protected open val buildMetricsReporter: BuildMetricsReporter<B, P>,
|
protected open val buildMetricsReporter: BuildMetricsReporter<B, P>,
|
||||||
) : ICReporter by icReporter, BuildMetricsReporter<B, P> by buildMetricsReporter
|
) : ICReporter by icReporter, BuildMetricsReporter<B, P> by buildMetricsReporter
|
||||||
|
|
||||||
|
@Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") // K2 warning suppression, TODO: KT-62472
|
||||||
class RemoteBuildReporter<B : BuildTime, P : BuildPerformanceMetric>(
|
class RemoteBuildReporter<B : BuildTime, P : BuildPerformanceMetric>(
|
||||||
override val icReporter: RemoteICReporter,
|
override val icReporter: RemoteICReporter,
|
||||||
override val buildMetricsReporter: RemoteBuildMetricsReporter<B, P>,
|
override val buildMetricsReporter: RemoteBuildMetricsReporter<B, P>,
|
||||||
@@ -22,5 +23,6 @@ class RemoteBuildReporter<B : BuildTime, P : BuildPerformanceMetric>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") // K2 warning suppression, TODO: KT-62472
|
||||||
object DoNothingBuildReporter :
|
object DoNothingBuildReporter :
|
||||||
BuildReporter<GradleBuildTime, GradleBuildPerformanceMetric>(DoNothingICReporter, DoNothingBuildMetricsReporter)
|
BuildReporter<GradleBuildTime, GradleBuildPerformanceMetric>(DoNothingICReporter, DoNothingBuildMetricsReporter)
|
||||||
|
|||||||
@@ -421,6 +421,7 @@ class MethodInliner(
|
|||||||
|
|
||||||
private fun getNewIndex(`var`: Int): Int {
|
private fun getNewIndex(`var`: Int): Int {
|
||||||
val lambdaInfo = inliningContext.lambdaInfo
|
val lambdaInfo = inliningContext.lambdaInfo
|
||||||
|
@Suppress("USELESS_IS_CHECK") // K2 warning suppression, TODO: KT-62472
|
||||||
if (reorderIrLambdaParameters && lambdaInfo is IrExpressionLambda) {
|
if (reorderIrLambdaParameters && lambdaInfo is IrExpressionLambda) {
|
||||||
val extensionSize = if (lambdaInfo.isExtensionLambda) lambdaInfo.invokeMethod.argumentTypes[0].size else 0
|
val extensionSize = if (lambdaInfo.isExtensionLambda) lambdaInfo.invokeMethod.argumentTypes[0].size else 0
|
||||||
return when {
|
return when {
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ fun classFileContainsMethod(descriptor: FunctionDescriptor, state: GenerationSta
|
|||||||
(descriptor.containingDeclaration as DeserializedClassDescriptor).classId ?: return null
|
(descriptor.containingDeclaration as DeserializedClassDescriptor).classId ?: return null
|
||||||
}
|
}
|
||||||
descriptor.containerSource is JvmPackagePartSource -> {
|
descriptor.containerSource is JvmPackagePartSource -> {
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
(descriptor.containerSource as JvmPackagePartSource).classId
|
(descriptor.containerSource as JvmPackagePartSource).classId
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
|
|||||||
@@ -610,6 +610,7 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
|||||||
|
|
||||||
val isAccessor = property is AccessorForPropertyDescriptor
|
val isAccessor = property is AccessorForPropertyDescriptor
|
||||||
val propertyName = if (isAccessor)
|
val propertyName = if (isAccessor)
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
(property as AccessorForPropertyDescriptor).accessorSuffix
|
(property as AccessorForPropertyDescriptor).accessorSuffix
|
||||||
else
|
else
|
||||||
property.name.asString()
|
property.name.asString()
|
||||||
|
|||||||
+1
@@ -207,6 +207,7 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") // K2 warning suppression, TODO: KT-62472
|
||||||
class LambdaInvocationInfo(
|
class LambdaInvocationInfo(
|
||||||
map: PersistentMap<FirBasedSymbol<*>, EventOccurrencesRange> = persistentMapOf(),
|
map: PersistentMap<FirBasedSymbol<*>, EventOccurrencesRange> = persistentMapOf(),
|
||||||
) : EventOccurrencesRangeInfo<LambdaInvocationInfo, FirBasedSymbol<*>>(map) {
|
) : EventOccurrencesRangeInfo<LambdaInvocationInfo, FirBasedSymbol<*>>(map) {
|
||||||
|
|||||||
+1
@@ -95,6 +95,7 @@ object FirReturnsImpliesAnalyzer : FirControlFlowChecker() {
|
|||||||
val typeContext = context.session.typeContext
|
val typeContext = context.session.typeContext
|
||||||
|
|
||||||
val isReturn = node is JumpNode && node.fir is FirReturnExpression
|
val isReturn = node is JumpNode && node.fir is FirReturnExpression
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
val resultExpression = if (isReturn) (node.fir as FirReturnExpression).result else node.fir
|
val resultExpression = if (isReturn) (node.fir as FirReturnExpression).result else node.fir
|
||||||
|
|
||||||
val expressionType = (resultExpression as? FirExpression)?.resolvedType
|
val expressionType = (resultExpression as? FirExpression)?.resolvedType
|
||||||
|
|||||||
+2
@@ -10,6 +10,7 @@ import kotlinx.collections.immutable.persistentMapOf
|
|||||||
import org.jetbrains.kotlin.contracts.description.EventOccurrencesRange
|
import org.jetbrains.kotlin.contracts.description.EventOccurrencesRange
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||||
|
|
||||||
|
@Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") // K2 warning suppression, TODO: KT-62472
|
||||||
abstract class EventOccurrencesRangeInfo<E : EventOccurrencesRangeInfo<E, K>, K : Any>(
|
abstract class EventOccurrencesRangeInfo<E : EventOccurrencesRangeInfo<E, K>, K : Any>(
|
||||||
map: PersistentMap<K, EventOccurrencesRange> = persistentMapOf()
|
map: PersistentMap<K, EventOccurrencesRange> = persistentMapOf()
|
||||||
) : ControlFlowInfo<E, K, EventOccurrencesRange>(map) {
|
) : ControlFlowInfo<E, K, EventOccurrencesRange>(map) {
|
||||||
@@ -38,6 +39,7 @@ abstract class EventOccurrencesRangeInfo<E : EventOccurrencesRangeInfo<E, K>, K
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") // K2 warning suppression, TODO: KT-62472
|
||||||
class PropertyInitializationInfo(
|
class PropertyInitializationInfo(
|
||||||
map: PersistentMap<FirPropertySymbol, EventOccurrencesRange> = persistentMapOf()
|
map: PersistentMap<FirPropertySymbol, EventOccurrencesRange> = persistentMapOf()
|
||||||
) : EventOccurrencesRangeInfo<PropertyInitializationInfo, FirPropertySymbol>(map) {
|
) : EventOccurrencesRangeInfo<PropertyInitializationInfo, FirPropertySymbol>(map) {
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ fun CheckerContext.findClosestClassOrObject(): FirClass? {
|
|||||||
it is FirRegularClass ||
|
it is FirRegularClass ||
|
||||||
it is FirAnonymousObject
|
it is FirAnonymousObject
|
||||||
) {
|
) {
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
return it as FirClass
|
return it as FirClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.fir.types.*
|
|||||||
object FirAmbiguousAnonymousTypeChecker : FirBasicDeclarationChecker() {
|
object FirAmbiguousAnonymousTypeChecker : FirBasicDeclarationChecker() {
|
||||||
override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||||
if (declaration !is FirFunction && declaration !is FirProperty) return
|
if (declaration !is FirFunction && declaration !is FirProperty) return
|
||||||
|
@Suppress("USELESS_IS_CHECK") // K2 warning suppression, TODO: KT-62472
|
||||||
require(declaration is FirCallableDeclaration)
|
require(declaration is FirCallableDeclaration)
|
||||||
// if source is not null then this type was declared in source
|
// if source is not null then this type was declared in source
|
||||||
// so it can not be inferred to anonymous type
|
// so it can not be inferred to anonymous type
|
||||||
|
|||||||
+1
@@ -122,6 +122,7 @@ object UnusedChecker : AbstractFirPropertyInitializationChecker() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") // K2 warning suppression, TODO: KT-62472
|
||||||
class VariableStatusInfo(
|
class VariableStatusInfo(
|
||||||
map: PersistentMap<FirPropertySymbol, VariableStatus> = persistentMapOf()
|
map: PersistentMap<FirPropertySymbol, VariableStatus> = persistentMapOf()
|
||||||
) : ControlFlowInfo<VariableStatusInfo, FirPropertySymbol, VariableStatus>(map) {
|
) : ControlFlowInfo<VariableStatusInfo, FirPropertySymbol, VariableStatus>(map) {
|
||||||
|
|||||||
+1
@@ -535,6 +535,7 @@ class FirElementSerializer private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (typeParameter in function.typeParameters) {
|
for (typeParameter in function.typeParameters) {
|
||||||
|
@Suppress("USELESS_IS_CHECK") // K2 warning suppression, TODO: KT-62472
|
||||||
if (typeParameter !is FirTypeParameter) continue
|
if (typeParameter !is FirTypeParameter) continue
|
||||||
builder.addTypeParameter(local.typeParameterProto(typeParameter))
|
builder.addTypeParameter(local.typeParameterProto(typeParameter))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ fun FirReference.extractSymbolForCall(): FirBasedSymbol<*>? {
|
|||||||
if (symbol.origin == FirDeclarationOrigin.SubstitutionOverride.CallSite) {
|
if (symbol.origin == FirDeclarationOrigin.SubstitutionOverride.CallSite) {
|
||||||
symbol = symbol.fir.unwrapUseSiteSubstitutionOverrides<FirCallableDeclaration>().symbol
|
symbol = symbol.fir.unwrapUseSiteSubstitutionOverrides<FirCallableDeclaration>().symbol
|
||||||
}
|
}
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
symbol = (symbol as FirCallableSymbol<*>).unwrapCallRepresentative()
|
symbol = (symbol as FirCallableSymbol<*>).unwrapCallRepresentative()
|
||||||
}
|
}
|
||||||
return symbol
|
return symbol
|
||||||
|
|||||||
+1
@@ -136,6 +136,7 @@ class Fir2IrCallableDeclarationsGenerator(val components: Fir2IrComponents) : Fi
|
|||||||
?: if (isLambda) SpecialNames.ANONYMOUS else SpecialNames.NO_NAME_PROVIDED
|
?: if (isLambda) SpecialNames.ANONYMOUS else SpecialNames.NO_NAME_PROVIDED
|
||||||
val visibility = simpleFunction?.visibility ?: Visibilities.Local
|
val visibility = simpleFunction?.visibility ?: Visibilities.Local
|
||||||
val isSuspend =
|
val isSuspend =
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
if (isLambda) ((function as FirAnonymousFunction).typeRef as? FirResolvedTypeRef)?.type?.isSuspendOrKSuspendFunctionType(session) == true
|
if (isLambda) ((function as FirAnonymousFunction).typeRef as? FirResolvedTypeRef)?.type?.isSuspendOrKSuspendFunctionType(session) == true
|
||||||
else function.isSuspend
|
else function.isSuspend
|
||||||
val created = function.convertWithOffsets { startOffset, endOffset ->
|
val created = function.convertWithOffsets { startOffset, endOffset ->
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.ir.util.isFacadeClass
|
|||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||||
|
|
||||||
|
@Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") // K2 warning suppression, TODO: KT-62472
|
||||||
class Fir2IrLazyPropertyAccessor(
|
class Fir2IrLazyPropertyAccessor(
|
||||||
components: Fir2IrComponents,
|
components: Fir2IrComponents,
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.ir.types.IrType
|
|||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||||
|
|
||||||
|
@Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") // K2 warning suppression, TODO: KT-62472
|
||||||
class Fir2IrLazySimpleFunction(
|
class Fir2IrLazySimpleFunction(
|
||||||
components: Fir2IrComponents,
|
components: Fir2IrComponents,
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ fun FirClassSymbol<*>.collectEnumEntries(): Collection<FirEnumEntrySymbol> {
|
|||||||
* sequence of FirTypeAlias'es points to starting
|
* sequence of FirTypeAlias'es points to starting
|
||||||
* with `this`. Or null if something goes wrong or we have anonymous object symbol.
|
* with `this`. Or null if something goes wrong or we have anonymous object symbol.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("NO_TAIL_CALLS_FOUND", "NON_TAIL_RECURSIVE_CALL") // K2 warning suppression, TODO: KT-62472
|
||||||
tailrec fun FirClassLikeSymbol<*>.fullyExpandedClass(useSiteSession: FirSession): FirRegularClassSymbol? {
|
tailrec fun FirClassLikeSymbol<*>.fullyExpandedClass(useSiteSession: FirSession): FirRegularClassSymbol? {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
is FirRegularClassSymbol -> this
|
is FirRegularClassSymbol -> this
|
||||||
|
|||||||
+1
@@ -852,6 +852,7 @@ abstract class AbstractRawFirBuilder<T>(val baseSession: FirSession, val context
|
|||||||
}
|
}
|
||||||
require(operation == FirOperation.ASSIGN)
|
require(operation == FirOperation.ASSIGN)
|
||||||
|
|
||||||
|
@Suppress("SENSELESS_COMPARISON") // K2 warning suppression, TODO: KT-62472
|
||||||
if (this?.elementType == SAFE_ACCESS_EXPRESSION && this != null) {
|
if (this?.elementType == SAFE_ACCESS_EXPRESSION && this != null) {
|
||||||
val safeCallNonAssignment = convert() as? FirSafeCallExpression
|
val safeCallNonAssignment = convert() as? FirSafeCallExpression
|
||||||
if (safeCallNonAssignment != null) {
|
if (safeCallNonAssignment != null) {
|
||||||
|
|||||||
+1
@@ -189,6 +189,7 @@ private fun processConstructors(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
is FirClassSymbol -> {
|
is FirClassSymbol -> {
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
val firClass = matchedSymbol.fir as FirClass
|
val firClass = matchedSymbol.fir as FirClass
|
||||||
when (firClass.classKind) {
|
when (firClass.classKind) {
|
||||||
ClassKind.INTERFACE -> null
|
ClassKind.INTERFACE -> null
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ interface VariableInitReadOnlyControlFlowInfo :
|
|||||||
fun checkDefiniteInitializationInWhen(merge: VariableInitReadOnlyControlFlowInfo): Boolean
|
fun checkDefiniteInitializationInWhen(merge: VariableInitReadOnlyControlFlowInfo): Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") // K2 warning suppression, TODO: KT-62472
|
||||||
class VariableInitControlFlowInfo(map: ImmutableMap<VariableDescriptor, VariableControlFlowState> = ImmutableHashMap.empty()) :
|
class VariableInitControlFlowInfo(map: ImmutableMap<VariableDescriptor, VariableControlFlowState> = ImmutableHashMap.empty()) :
|
||||||
VariableUsageControlFlowInfo<VariableInitControlFlowInfo, VariableControlFlowState>(map),
|
VariableUsageControlFlowInfo<VariableInitControlFlowInfo, VariableControlFlowState>(map),
|
||||||
VariableInitReadOnlyControlFlowInfo {
|
VariableInitReadOnlyControlFlowInfo {
|
||||||
@@ -42,6 +43,7 @@ class VariableInitControlFlowInfo(map: ImmutableMap<VariableDescriptor, Variable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") // K2 warning suppression, TODO: KT-62472
|
||||||
class UsageVariableControlFlowInfo(map: ImmutableMap<VariableDescriptor, VariableUseState> = ImmutableHashMap.empty()) :
|
class UsageVariableControlFlowInfo(map: ImmutableMap<VariableDescriptor, VariableUseState> = ImmutableHashMap.empty()) :
|
||||||
VariableUsageControlFlowInfo<UsageVariableControlFlowInfo, VariableUseState>(map),
|
VariableUsageControlFlowInfo<UsageVariableControlFlowInfo, VariableUseState>(map),
|
||||||
VariableUsageReadOnlyControlInfo {
|
VariableUsageReadOnlyControlInfo {
|
||||||
|
|||||||
+1
@@ -825,6 +825,7 @@ class DiagnosticReporterByTrackingStrategy(
|
|||||||
KtPsiUtil.deparenthesize(it) ?: it
|
KtPsiUtil.deparenthesize(it) ?: it
|
||||||
}
|
}
|
||||||
if (expression != null) {
|
if (expression != null) {
|
||||||
|
@Suppress("USELESS_IS_CHECK") // K2 warning suppression, TODO: KT-62472
|
||||||
if (expression.isNull() && expression is KtConstantExpression) {
|
if (expression.isNull() && expression is KtConstantExpression) {
|
||||||
val factory = when (diagnostic) {
|
val factory = when (diagnostic) {
|
||||||
is ArgumentNullabilityErrorDiagnostic -> NULL_FOR_NONNULL_TYPE
|
is ArgumentNullabilityErrorDiagnostic -> NULL_FOR_NONNULL_TYPE
|
||||||
|
|||||||
+1
@@ -107,6 +107,7 @@ class KotlinToResolvedCallTransformer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
is CompletedCallResolutionResult, is ErrorCallResolutionResult -> {
|
is CompletedCallResolutionResult, is ErrorCallResolutionResult -> {
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
val candidate = (baseResolvedCall as SingleCallResolutionResult).resultCallAtom
|
val candidate = (baseResolvedCall as SingleCallResolutionResult).resultCallAtom
|
||||||
|
|
||||||
val resultSubstitutor =
|
val resultSubstitutor =
|
||||||
|
|||||||
+4
@@ -29,7 +29,9 @@ object ActualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker :
|
|||||||
val (actual, expect) = matchActualWithNonFinalExpect(declaration, descriptor, context) ?: return
|
val (actual, expect) = matchActualWithNonFinalExpect(declaration, descriptor, context) ?: return
|
||||||
|
|
||||||
// The explicit casts won't be necessary when we start compiling kotlin with K2. K1 doesn't build CFG properly
|
// The explicit casts won't be necessary when we start compiling kotlin with K2. K1 doesn't build CFG properly
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
declaration as KtClassLikeDeclaration
|
declaration as KtClassLikeDeclaration
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
descriptor as ClassifierDescriptorWithTypeParameters
|
descriptor as ClassifierDescriptorWithTypeParameters
|
||||||
|
|
||||||
checkSupertypes(expect, actual, context, declaration, descriptor)
|
checkSupertypes(expect, actual, context, declaration, descriptor)
|
||||||
@@ -105,7 +107,9 @@ internal fun matchActualWithNonFinalExpect(
|
|||||||
// Common supertype of KtTypeAlias and KtClassOrObject is KtClassLikeDeclaration.
|
// Common supertype of KtTypeAlias and KtClassOrObject is KtClassLikeDeclaration.
|
||||||
// Common supertype of TypeAliasDescriptor and ClassDescriptor is ClassifierDescriptorWithTypeParameters.
|
// Common supertype of TypeAliasDescriptor and ClassDescriptor is ClassifierDescriptorWithTypeParameters.
|
||||||
// The explicit casts won't be necessary when we start compiling kotlin with K2.
|
// The explicit casts won't be necessary when we start compiling kotlin with K2.
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
declaration as KtClassLikeDeclaration
|
declaration as KtClassLikeDeclaration
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
descriptor as ClassifierDescriptorWithTypeParameters
|
descriptor as ClassifierDescriptorWithTypeParameters
|
||||||
|
|
||||||
if (!descriptor.isActual) return null
|
if (!descriptor.isActual) return null
|
||||||
|
|||||||
+2
@@ -27,7 +27,9 @@ object ExpectActualClassifiersAreInBetaChecker : DeclarationChecker {
|
|||||||
// Common supertype of KtTypeAlias and KtClassOrObject is KtClassLikeDeclaration.
|
// Common supertype of KtTypeAlias and KtClassOrObject is KtClassLikeDeclaration.
|
||||||
// Common supertype of TypeAliasDescriptor and ClassDescriptor is ClassifierDescriptorWithTypeParameters.
|
// Common supertype of TypeAliasDescriptor and ClassDescriptor is ClassifierDescriptorWithTypeParameters.
|
||||||
// The explicit casts won't be necessary when we start compiling kotlin with K2.
|
// The explicit casts won't be necessary when we start compiling kotlin with K2.
|
||||||
|
@Suppress("USELESS_IS_CHECK") // K2 warning suppression, TODO: KT-62472
|
||||||
check(declaration is KtClassLikeDeclaration)
|
check(declaration is KtClassLikeDeclaration)
|
||||||
|
@Suppress("USELESS_IS_CHECK") // K2 warning suppression, TODO: KT-62472
|
||||||
check(descriptor is ClassifierDescriptorWithTypeParameters)
|
check(descriptor is ClassifierDescriptorWithTypeParameters)
|
||||||
|
|
||||||
if (descriptor.isExpect || descriptor.isActual) {
|
if (descriptor.isExpect || descriptor.isActual) {
|
||||||
|
|||||||
+1
@@ -73,6 +73,7 @@ abstract class InventNamesForLocalClasses(
|
|||||||
val isLocal = parent is IrFile && declaration.isAnonymousObject
|
val isLocal = parent is IrFile && declaration.isAnonymousObject
|
||||||
if (!isLocal) return processClass(declaration, data)
|
if (!isLocal) return processClass(declaration, data)
|
||||||
|
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
val enclosingName = (parent as IrFile).name.removeSuffix(".kt").plus("Kt").capitalizeAsciiOnly()
|
val enclosingName = (parent as IrFile).name.removeSuffix(".kt").plus("Kt").capitalizeAsciiOnly()
|
||||||
processClass(declaration, data.copy(enclosingName = enclosingName, isLocal = true))
|
processClass(declaration, data.copy(enclosingName = enclosingName, isLocal = true))
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -105,6 +105,7 @@ abstract class UsefulDeclarationProcessor(
|
|||||||
addReachabilityInfoIfNeeded(from, this, description, isContagiousOverridableDeclaration)
|
addReachabilityInfoIfNeeded(from, this, description, isContagiousOverridableDeclaration)
|
||||||
|
|
||||||
if (isContagiousOverridableDeclaration) {
|
if (isContagiousOverridableDeclaration) {
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
contagiousReachableDeclarations.add(this as IrOverridableDeclaration<*>)
|
contagiousReachableDeclarations.add(this as IrOverridableDeclaration<*>)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
@@ -52,6 +52,7 @@ open class KotlinSourceFileMap<out T>(files: Map<KotlinLibraryFile, Map<KotlinSo
|
|||||||
operator fun get(libFile: KotlinLibraryFile, sourceFile: KotlinSourceFile): T? = get(libFile)?.get(sourceFile)
|
operator fun get(libFile: KotlinLibraryFile, sourceFile: KotlinSourceFile): T? = get(libFile)?.get(sourceFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") // K2 warning suppression, TODO: KT-62472
|
||||||
class KotlinSourceFileMutableMap<T>(
|
class KotlinSourceFileMutableMap<T>(
|
||||||
private val files: MutableMap<KotlinLibraryFile, MutableMap<KotlinSourceFile, T>> = hashMapOf()
|
private val files: MutableMap<KotlinLibraryFile, MutableMap<KotlinSourceFile, T>> = hashMapOf()
|
||||||
) : KotlinSourceFileMap<T>(files) {
|
) : KotlinSourceFileMap<T>(files) {
|
||||||
|
|||||||
+1
@@ -262,6 +262,7 @@ private class AddContinuationLowering(context: JvmBackendContext) : SuspendLower
|
|||||||
var cursor = irFunction.parentAsClass.parent
|
var cursor = irFunction.parentAsClass.parent
|
||||||
while (cursor is IrClass) {
|
while (cursor is IrClass) {
|
||||||
if (cursor == param.parent) return true
|
if (cursor == param.parent) return true
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
cursor = (cursor as IrClass).parent
|
cursor = (cursor as IrClass).parent
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -350,6 +350,7 @@ val IrDeclaration.parentAsClass: IrClass
|
|||||||
fun IrElement.getPackageFragment(): IrPackageFragment? =
|
fun IrElement.getPackageFragment(): IrPackageFragment? =
|
||||||
this as? IrPackageFragment ?: (this as? IrDeclaration)?.getPackageFragment()
|
this as? IrPackageFragment ?: (this as? IrDeclaration)?.getPackageFragment()
|
||||||
|
|
||||||
|
@Suppress("NO_TAIL_CALLS_FOUND", "NON_TAIL_RECURSIVE_CALL") // K2 warning suppression, TODO: KT-62472
|
||||||
tailrec fun IrDeclaration.getPackageFragment(): IrPackageFragment {
|
tailrec fun IrDeclaration.getPackageFragment(): IrPackageFragment {
|
||||||
val parent = this.parent
|
val parent = this.parent
|
||||||
return parent as? IrPackageFragment
|
return parent as? IrPackageFragment
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ abstract class KtExpressionImpl(node: ASTNode) : KtElementImpl(node), KtExpressi
|
|||||||
if (newElement is KtExpression) {
|
if (newElement is KtExpression) {
|
||||||
when (parent) {
|
when (parent) {
|
||||||
is KtExpression, is KtValueArgument -> {
|
is KtExpression, is KtValueArgument -> {
|
||||||
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
if (KtPsiUtil.areParenthesesNecessary(newElement, expression, parent as KtElement)) {
|
if (KtPsiUtil.areParenthesesNecessary(newElement, expression, parent as KtElement)) {
|
||||||
val factory = KtPsiFactory(expression.project)
|
val factory = KtPsiFactory(expression.project)
|
||||||
return rawReplaceHandler(factory.createExpressionByPattern("($0)", newElement, reformat = reformat))
|
return rawReplaceHandler(factory.createExpressionByPattern("($0)", newElement, reformat = reformat))
|
||||||
|
|||||||
@@ -22,8 +22,10 @@ import org.jetbrains.kotlin.name.Name
|
|||||||
|
|
||||||
open class KtExpressionWithLabel(node: ASTNode) : KtExpressionImpl(node) {
|
open class KtExpressionWithLabel(node: ASTNode) : KtExpressionImpl(node) {
|
||||||
|
|
||||||
fun getTargetLabel(): KtSimpleNameExpression? =
|
fun getTargetLabel(): KtSimpleNameExpression? {
|
||||||
labelQualifier?.findChildByType(KtNodeTypes.LABEL) as? KtSimpleNameExpression
|
@Suppress("USELESS_CAST") // K2 warning suppression, TODO: KT-62472
|
||||||
|
return labelQualifier?.findChildByType(KtNodeTypes.LABEL) as? KtSimpleNameExpression
|
||||||
|
}
|
||||||
|
|
||||||
val labelQualifier: KtContainerNode?
|
val labelQualifier: KtContainerNode?
|
||||||
get() = findChildByType(KtNodeTypes.LABEL_QUALIFIER)
|
get() = findChildByType(KtNodeTypes.LABEL_QUALIFIER)
|
||||||
|
|||||||
@@ -707,6 +707,7 @@ fun getTrailingCommaByElementsList(elementList: PsiElement?): PsiElement? {
|
|||||||
val KtNameReferenceExpression.isUnderscoreInBackticks
|
val KtNameReferenceExpression.isUnderscoreInBackticks
|
||||||
get() = getReferencedName() == "`_`"
|
get() = getReferencedName() == "`_`"
|
||||||
|
|
||||||
|
@Suppress("NO_TAIL_CALLS_FOUND", "NON_TAIL_RECURSIVE_CALL") // K2 warning suppression, TODO: KT-62472
|
||||||
tailrec fun KtTypeElement.unwrapNullability(): KtTypeElement? {
|
tailrec fun KtTypeElement.unwrapNullability(): KtTypeElement? {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
is KtNullableType -> this.innerType?.unwrapNullability()
|
is KtNullableType -> this.innerType?.unwrapNullability()
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ inline fun <reified T : PsiElement> PsiElement.getParentOfTypeAndBranches(
|
|||||||
return getParentOfType<T>(strict)?.getIfChildIsInBranches(this, branches)
|
return getParentOfType<T>(strict)?.getIfChildIsInBranches(this, branches)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("NO_TAIL_CALLS_FOUND", "NON_TAIL_RECURSIVE_CALL") // K2 warning suppression, TODO: KT-62472
|
||||||
tailrec fun PsiElement.getOutermostParentContainedIn(container: PsiElement): PsiElement? {
|
tailrec fun PsiElement.getOutermostParentContainedIn(container: PsiElement): PsiElement? {
|
||||||
val parent = parent
|
val parent = parent
|
||||||
return if (parent == container) this else parent?.getOutermostParentContainedIn(container)
|
return if (parent == container) this else parent?.getOutermostParentContainedIn(container)
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ fun DeclarationDescriptor.containingPackage(): FqName? {
|
|||||||
if (container == null || container is PackageFragmentDescriptor) break
|
if (container == null || container is PackageFragmentDescriptor) break
|
||||||
container = container.containingDeclaration
|
container = container.containingDeclaration
|
||||||
}
|
}
|
||||||
|
@Suppress("USELESS_IS_CHECK") // K2 warning suppression, TODO: KT-62472
|
||||||
require(container is PackageFragmentDescriptor?)
|
require(container is PackageFragmentDescriptor?)
|
||||||
return container?.fqName
|
return container?.fqName
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ object DescriptorEquivalenceForOverrides {
|
|||||||
return a.index == b.index // We ignore type parameter names
|
return a.index == b.index // We ignore type parameter names
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("NO_TAIL_CALLS_FOUND", "NON_TAIL_RECURSIVE_CALL") // K2 warning suppression, TODO: KT-62472
|
||||||
private tailrec fun CallableDescriptor.singleSource(): SourceElement? {
|
private tailrec fun CallableDescriptor.singleSource(): SourceElement? {
|
||||||
if (this !is CallableMemberDescriptor || kind != CallableMemberDescriptor.Kind.FAKE_OVERRIDE) return source
|
if (this !is CallableMemberDescriptor || kind != CallableMemberDescriptor.Kind.FAKE_OVERRIDE) return source
|
||||||
|
|
||||||
|
|||||||
+1
@@ -346,5 +346,6 @@ internal fun getTopLevelPropertyDeclarationName(scope: KotlinScope, property: Pr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to use the provided name. If failed, mangle it with underscore and try again:
|
// Try to use the provided name. If failed, mangle it with underscore and try again:
|
||||||
|
@Suppress("NO_TAIL_CALLS_FOUND", "NON_TAIL_RECURSIVE_CALL") // K2 warning suppression, TODO: KT-62472
|
||||||
private tailrec fun getTopLevelPropertyDeclarationName(scope: KotlinScope, receiver: String?, name: String): String =
|
private tailrec fun getTopLevelPropertyDeclarationName(scope: KotlinScope, receiver: String?, name: String): String =
|
||||||
scope.declareProperty(receiver, name) ?: getTopLevelPropertyDeclarationName(scope, receiver, name + "_")
|
scope.declareProperty(receiver, name) ?: getTopLevelPropertyDeclarationName(scope, receiver, name + "_")
|
||||||
+1
@@ -232,6 +232,7 @@ internal fun ObjCExportMapper.getBaseProperties(descriptor: PropertyDescriptor):
|
|||||||
.distinct()
|
.distinct()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("NO_TAIL_CALLS_FOUND", "NON_TAIL_RECURSIVE_CALL") // K2 warning suppression, TODO: KT-62472
|
||||||
internal tailrec fun KotlinType.getErasedTypeClass(): ClassDescriptor =
|
internal tailrec fun KotlinType.getErasedTypeClass(): ClassDescriptor =
|
||||||
TypeUtils.getClassDescriptor(this) ?: this.constructor.supertypes.first().getErasedTypeClass()
|
TypeUtils.getClassDescriptor(this) ?: this.constructor.supertypes.first().getErasedTypeClass()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user