Eliminate a set of warnings, mostly nullability ones
This commit is contained in:
committed by
Mikhail Glukhikh
parent
82fc221470
commit
3623f581b8
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user