Eliminate a set of warnings, mostly nullability ones
This commit is contained in:
committed by
Mikhail Glukhikh
parent
82fc221470
commit
3623f581b8
-2
@@ -63,10 +63,8 @@ class GenericReplCompilingEvaluator(val compiler: ReplCompiler,
|
||||
is ReplEvalResult.ValueResult,
|
||||
is ReplEvalResult.UnitResult ->
|
||||
result
|
||||
else -> throw IllegalStateException("Unknown evaluator result type $compiled")
|
||||
}
|
||||
}
|
||||
else -> throw IllegalStateException("Unknown compiler result type $compiled")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -325,7 +325,7 @@ object KotlinCompilerClient {
|
||||
if (err != null) {
|
||||
reportingTargets.report(DaemonReportCategory.INFO,
|
||||
(if (attempts >= DAEMON_CONNECT_CYCLE_ATTEMPTS || !autostart) "no more retries on: " else "retrying($attempts) on: ")
|
||||
+ err?.toString())
|
||||
+ err.toString())
|
||||
}
|
||||
|
||||
if (attempts++ > DAEMON_CONNECT_CYCLE_ATTEMPTS || !autostart) {
|
||||
|
||||
+1
-2
@@ -51,8 +51,7 @@ class ExternalFunChecker : SimpleDeclarationChecker {
|
||||
if (DescriptorUtils.isInterface(descriptor.containingDeclaration)) {
|
||||
diagnosticHolder.report(ErrorsJvm.EXTERNAL_DECLARATION_IN_INTERFACE.on(declaration))
|
||||
}
|
||||
else if (descriptor is CallableMemberDescriptor &&
|
||||
descriptor.modality == Modality.ABSTRACT) {
|
||||
else if (descriptor.modality == Modality.ABSTRACT) {
|
||||
if (declaration is KtPropertyAccessor) {
|
||||
diagnosticHolder.report(ErrorsJvm.EXTERNAL_DECLARATION_CANNOT_BE_ABSTRACT.on(declaration.property))
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ abstract class KtCodeFragment(
|
||||
}
|
||||
|
||||
fun getContextContainingFile(): KtFile? {
|
||||
return (getOriginalContext() as? KtElement)?.containingKtFile
|
||||
return getOriginalContext()?.containingKtFile
|
||||
}
|
||||
|
||||
fun getOriginalContext(): KtElement? {
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ class KtEnumEntrySuperclassReferenceExpression :
|
||||
get() = calcReferencedElement()!!
|
||||
|
||||
private fun calcReferencedElement(): KtClass? {
|
||||
val owner = this.getStrictParentOfType<KtEnumEntry>() as? KtEnumEntry
|
||||
val owner = this.getStrictParentOfType<KtEnumEntry>()
|
||||
return owner?.parent?.parent as? KtClass
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ object ConstModifierChecker : SimpleDeclarationChecker {
|
||||
return Errors.CONST_VAL_WITH_DELEGATE.on(declaration.delegate!!).nonApplicable()
|
||||
}
|
||||
|
||||
if (descriptor is PropertyDescriptor && !descriptor.getter!!.isDefault) {
|
||||
if (!descriptor.getter!!.isDefault) {
|
||||
return Errors.CONST_VAL_WITH_GETTER.on(declaration.getter!!).nonApplicable()
|
||||
}
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ object LabelResolver {
|
||||
|
||||
if (parent is KtValueArgument) {
|
||||
// f ({}) or f(p = {}) or f (fun () {})
|
||||
// NB: parent of KtElement is really nullable!!!
|
||||
val argList = parent.parent ?: return null
|
||||
val call = argList.parent
|
||||
if (call is KtCallExpression) {
|
||||
|
||||
-1
@@ -272,7 +272,6 @@ class IncrementalJvmCompilerRunner(
|
||||
// there is no point in updating annotation file since all files will be compiled anyway
|
||||
kaptAnnotationsFileUpdater = null
|
||||
}
|
||||
else -> throw IllegalStateException("Unknown CompilationMode ${compilationMode::class.java}")
|
||||
}
|
||||
|
||||
val currentBuildInfo = BuildInfo(startTS = System.currentTimeMillis())
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ private fun Scope.createTemporaryVariable(symbol: IrVariableSymbol, initializer:
|
||||
}
|
||||
|
||||
private fun getDefaultParameterExpressionBody(irFunction: IrFunction, valueParameter: ValueParameterDescriptor):IrExpressionBody {
|
||||
return irFunction.getDefault(valueParameter) as? IrExpressionBody ?: TODO("FIXME!!!")
|
||||
return irFunction.getDefault(valueParameter) ?: TODO("FIXME!!!")
|
||||
}
|
||||
|
||||
private fun maskParameterDescriptor(function: IrFunction, number: Int) =
|
||||
|
||||
+2
-3
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.codegen.AsmUtil.comparisonOperandType
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil.isPrimitive
|
||||
import org.jetbrains.kotlin.codegen.OwnerKind
|
||||
import org.jetbrains.kotlin.codegen.StackValue
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrCall
|
||||
import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
@@ -68,10 +67,10 @@ class IrCompareTo : IntrinsicMethod() {
|
||||
val rightType = argTypes[1]
|
||||
val parameterType = comparisonOperandType(leftType, rightType)
|
||||
|
||||
val newSignature = context.state.typeMapper.mapSignatureSkipGeneric(compareCall.descriptor as FunctionDescriptor, OwnerKind.IMPLEMENTATION)
|
||||
val newSignature = context.state.typeMapper.mapSignatureSkipGeneric(compareCall.descriptor, OwnerKind.IMPLEMENTATION)
|
||||
return object : IrIntrinsicFunction(compareCall, newSignature, context, listOf(parameterType, parameterType)) {
|
||||
override fun invoke(v: InstructionAdapter, codegen: ExpressionCodegen, data: BlockInfo): StackValue {
|
||||
val isPrimitiveIntrinsic = codegen.intrinsics.intrinsics.getIntrinsic(compareCall.descriptor as FunctionDescriptor) != null
|
||||
val isPrimitiveIntrinsic = codegen.intrinsics.intrinsics.getIntrinsic(compareCall.descriptor) != null
|
||||
val operationType: Type
|
||||
val leftValue: StackValue
|
||||
val rightValue: StackValue
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ class ContextAnnotator(val state: GenerationState) : ClassLowerWithContext() {
|
||||
|
||||
override fun lowerBefore(irClass: IrClass, data: IrClassContext) {
|
||||
val descriptor = irClass.descriptor
|
||||
val newContext: CodegenContext<*> = if (descriptor is FileClassDescriptor || descriptor !is ClassDescriptor) {
|
||||
val newContext: CodegenContext<*> = if (descriptor is FileClassDescriptor) {
|
||||
StubCodegenContext(descriptor, data.parent?.codegenContext, data)
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -59,6 +59,6 @@ class IrFieldImpl(
|
||||
}
|
||||
|
||||
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
|
||||
initializer = initializer?.transform(transformer, data) as? IrExpressionBody
|
||||
initializer = initializer?.transform(transformer, data)
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -114,7 +114,7 @@ class KtLightMethodImpl private constructor(
|
||||
if (calculatingReturnType.get() == true) {
|
||||
return KotlinJavaPsiFacade.getInstance(project).emptyModifierList
|
||||
}
|
||||
return super.getModifierList()!!
|
||||
return super.getModifierList()
|
||||
}
|
||||
|
||||
override fun getParameterList() = paramsList
|
||||
@@ -235,7 +235,7 @@ fun KtLightMethod.isTraitFakeOverride(): Boolean {
|
||||
}
|
||||
|
||||
val parentOfMethodOrigin = PsiTreeUtil.getParentOfType(methodOrigin, KtClassOrObject::class.java)
|
||||
val thisClassDeclaration = (this.containingClass as KtLightClass).kotlinOrigin
|
||||
val thisClassDeclaration = this.containingClass.kotlinOrigin
|
||||
|
||||
// Method was generated from declaration in some other trait
|
||||
return (parentOfMethodOrigin != null && thisClassDeclaration !== parentOfMethodOrigin && KtPsiUtil.isTrait(parentOfMethodOrigin))
|
||||
|
||||
@@ -670,7 +670,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
|
||||
fun testDaemonReplLocalEvalNoParams() {
|
||||
withDaemon { daemon ->
|
||||
val repl = KotlinRemoteReplCompilerClient(daemon!!, null, CompileService.TargetPlatform.JVM,
|
||||
val repl = KotlinRemoteReplCompilerClient(daemon, null, CompileService.TargetPlatform.JVM,
|
||||
emptyArray(),
|
||||
TestMessageCollector(),
|
||||
classpathFromClassloader(),
|
||||
@@ -685,7 +685,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
|
||||
fun testDaemonReplLocalEvalStandardTemplate() {
|
||||
withDaemon { daemon ->
|
||||
val repl = KotlinRemoteReplCompilerClient(daemon!!, null, CompileService.TargetPlatform.JVM, emptyArray(),
|
||||
val repl = KotlinRemoteReplCompilerClient(daemon, null, CompileService.TargetPlatform.JVM, emptyArray(),
|
||||
TestMessageCollector(),
|
||||
classpathFromClassloader(),
|
||||
"kotlin.script.templates.standard.ScriptTemplateWithArgs")
|
||||
|
||||
Reference in New Issue
Block a user