Minor: reformat
This commit is contained in:
+5
-5
@@ -89,11 +89,11 @@ class DataFlowValueFactoryImpl constructor(private val languageVersionSettings:
|
|||||||
KotlinBuiltIns.isNullableNothing(type) ->
|
KotlinBuiltIns.isNullableNothing(type) ->
|
||||||
DataFlowValue.nullValue(containingDeclarationOrModule.builtIns) // 'null' is the only inhabitant of 'Nothing?'
|
DataFlowValue.nullValue(containingDeclarationOrModule.builtIns) // 'null' is the only inhabitant of 'Nothing?'
|
||||||
|
|
||||||
// In most cases type of `E!!`-expression is strictly not nullable and we could get proper Nullability
|
// In most cases type of `E!!`-expression is strictly not nullable and we could get proper Nullability
|
||||||
// by calling `getImmanentNullability` (as it happens below).
|
// by calling `getImmanentNullability` (as it happens below).
|
||||||
//
|
//
|
||||||
// But there are some problem with types built on type parameters, e.g.
|
// But there are some problem with types built on type parameters, e.g.
|
||||||
// fun <T : Any?> foo(x: T) = x!!.hashCode() // there no way in type system to denote that `x!!` is not nullable
|
// fun <T : Any?> foo(x: T) = x!!.hashCode() // there no way in type system to denote that `x!!` is not nullable
|
||||||
ExpressionTypingUtils.isExclExclExpression(KtPsiUtil.deparenthesize(expression)) ->
|
ExpressionTypingUtils.isExclExclExpression(KtPsiUtil.deparenthesize(expression)) ->
|
||||||
DataFlowValue(IdentifierInfo.Expression(expression), type, Nullability.NOT_NULL)
|
DataFlowValue(IdentifierInfo.Expression(expression), type, Nullability.NOT_NULL)
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -33,7 +33,6 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitReceiver
|
|||||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
||||||
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver
|
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.types.KotlinTypeRefinerImpl
|
|
||||||
import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner
|
import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner
|
||||||
|
|
||||||
interface IdentifierInfo {
|
interface IdentifierInfo {
|
||||||
@@ -150,8 +149,10 @@ internal fun getIdForStableIdentifier(
|
|||||||
is KtQualifiedExpression -> {
|
is KtQualifiedExpression -> {
|
||||||
val receiverExpression = expression.receiverExpression
|
val receiverExpression = expression.receiverExpression
|
||||||
val selectorExpression = expression.selectorExpression
|
val selectorExpression = expression.selectorExpression
|
||||||
val receiverInfo = getIdForStableIdentifier(receiverExpression, bindingContext, containingDeclarationOrModule, languageVersionSettings)
|
val receiverInfo =
|
||||||
val selectorInfo = getIdForStableIdentifier(selectorExpression, bindingContext, containingDeclarationOrModule, languageVersionSettings)
|
getIdForStableIdentifier(receiverExpression, bindingContext, containingDeclarationOrModule, languageVersionSettings)
|
||||||
|
val selectorInfo =
|
||||||
|
getIdForStableIdentifier(selectorExpression, bindingContext, containingDeclarationOrModule, languageVersionSettings)
|
||||||
|
|
||||||
qualified(
|
qualified(
|
||||||
receiverInfo, bindingContext.getType(receiverExpression),
|
receiverInfo, bindingContext.getType(receiverExpression),
|
||||||
@@ -267,7 +268,7 @@ private fun getIdForImplicitReceiver(receiverValue: ReceiverValue?, expression:
|
|||||||
private fun getIdForThisReceiver(descriptorOfThisReceiver: DeclarationDescriptor?) = when (descriptorOfThisReceiver) {
|
private fun getIdForThisReceiver(descriptorOfThisReceiver: DeclarationDescriptor?) = when (descriptorOfThisReceiver) {
|
||||||
is CallableDescriptor -> {
|
is CallableDescriptor -> {
|
||||||
val receiverParameter = descriptorOfThisReceiver.extensionReceiverParameter
|
val receiverParameter = descriptorOfThisReceiver.extensionReceiverParameter
|
||||||
?: error("'This' refers to the callable member without a receiver parameter: $descriptorOfThisReceiver")
|
?: error("'This' refers to the callable member without a receiver parameter: $descriptorOfThisReceiver")
|
||||||
IdentifierInfo.Receiver(receiverParameter.value)
|
IdentifierInfo.Receiver(receiverParameter.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user