Removed useless as casts from compiler code

It allows compiling code with K2 and enabled `-Werror`
This commit is contained in:
Ivan Kochurkin
2023-10-20 13:44:09 +02:00
committed by Space Team
parent d50c6f1b6d
commit 1827df82c4
40 changed files with 77 additions and 117 deletions
@@ -15,7 +15,6 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall
import org.jetbrains.kotlin.resolve.calls.tower.NewResolvedCallImpl
import org.jetbrains.kotlin.resolve.calls.tower.SimplePSIKotlinCallArgument
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValueWithSmartCastInfo
import org.jetbrains.kotlin.types.FlexibleType
import org.jetbrains.kotlin.types.TypeUtils
@@ -32,7 +31,7 @@ object NullableVarargArgumentCallChecker : CallChecker {
if (!arg.isSpread || arg !is SimplePSIKotlinCallArgument) continue
val spreadElement = arg.valueArgument.getSpreadElement() ?: continue
val receiver = (arg.receiver as? ReceiverValueWithSmartCastInfo) ?: continue
val receiver = arg.receiver
val type = if (receiver.stableType.constructor is TypeVariableTypeConstructor) {
context.trace.bindingContext[EXPRESSION_TYPE_INFO, arg.valueArgument.getArgumentExpression()]?.type
@@ -5,7 +5,6 @@
package org.jetbrains.kotlin.resolve.checkers
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.*
@@ -89,7 +88,7 @@ object ValueClassDeclarationChecker : DeclarationChecker {
}
var baseParametersOk = true
val baseParameterTypes = (descriptor as? ClassDescriptor)?.defaultType?.substitutedUnderlyingTypes() ?: emptyList()
val baseParameterTypes = descriptor.defaultType.substitutedUnderlyingTypes()
for ((baseParameter, baseParameterType) in primaryConstructor.valueParameters zip baseParameterTypes) {
if (!isParameterAcceptableForInlineClass(baseParameter)) {