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
@@ -194,8 +194,7 @@ class PsiInlineCodegen(
override fun reorderArgumentsIfNeeded(actualArgsWithDeclIndex: List<ArgumentAndDeclIndex>, valueParameterTypes: List<Type>) = Unit
override fun isInlinedToInlineFunInKotlinRuntime(): Boolean {
val codegen = this.codegen as? ExpressionCodegen ?: return false
val caller = codegen.context.functionDescriptor
val caller = this.codegen.context.functionDescriptor
if (!caller.isInline) return false
val callerPackage = DescriptorUtils.getParentOfType(caller, PackageFragmentDescriptor::class.java) ?: return false
return callerPackage.fqName.asString().startsWith("kotlin.")
@@ -65,8 +65,7 @@ abstract class PrimitiveNumberRangeIntrinsicRangeValue(
return when (comparisonGenerator.comparedType) {
Type.DOUBLE_TYPE, Type.FLOAT_TYPE -> {
val rangeLiteral = getBoundedValue(codegen) as? BoundedValue
?: throw AssertionError("Floating point intrinsic range value should be a range literal")
val rangeLiteral = getBoundedValue(codegen)
InFloatingPointRangeLiteralExpressionGenerator(operatorReference, rangeLiteral, comparisonGenerator, codegen.frameMap)
}
else ->