Minor. Move declaration closer to usages and optimize imports
This commit is contained in:
@@ -444,7 +444,6 @@ public class CandidateResolver(
|
||||
val candidateDescriptor = candidateCall.getCandidateDescriptor()
|
||||
if (TypeUtils.dependsOnTypeParameters(receiverParameter.getType(), candidateDescriptor.getTypeParameters())) return SUCCESS
|
||||
|
||||
val safeAccess = isExplicitReceiver && !implicitInvokeCheck && candidateCall.getCall().isExplicitSafeCall()
|
||||
val isSubtypeBySmartCastIgnoringNullability = smartCastManager.isSubTypeBySmartCastIgnoringNullability(
|
||||
receiverArgument, receiverParameter.getType(), this)
|
||||
|
||||
@@ -455,6 +454,7 @@ public class CandidateResolver(
|
||||
|
||||
// Here we know that receiver is OK ignoring nullability and check that nullability is OK too
|
||||
// Doing it simply as full subtyping check (receiverValueType <: receiverParameterType)
|
||||
val safeAccess = isExplicitReceiver && !implicitInvokeCheck && candidateCall.getCall().isExplicitSafeCall()
|
||||
val expectedReceiverParameterType = if (safeAccess) TypeUtils.makeNullable(receiverParameter.type) else receiverParameter.type
|
||||
val smartCastNeeded = !ArgumentTypeResolver.isSubtypeOfForArgumentType(receiverArgument.type, expectedReceiverParameterType)
|
||||
var reportUnsafeCall = false
|
||||
|
||||
@@ -198,7 +198,7 @@ public class DataFlowAnalyzer {
|
||||
ConstantValue<?> constantValue = constantExpressionEvaluator.evaluateToConstantValue(expression, c.trace, c.expectedType);
|
||||
boolean error = new CompileTimeConstantChecker(c.trace, builtIns, true)
|
||||
.checkConstantExpressionType(constantValue, (KtConstantExpression) expression, c.expectedType);
|
||||
if (hasError != null) hasError.set(error);
|
||||
hasError.set(error);
|
||||
return expressionType;
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ public class DataFlowAnalyzer {
|
||||
if (castResult != null) return castResult.getResultType();
|
||||
|
||||
c.trace.report(TYPE_MISMATCH.on(expression, c.expectedType, expressionType));
|
||||
if (hasError != null) hasError.set(true);
|
||||
hasError.set(true);
|
||||
return expressionType;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.types
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
|
||||
|
||||
Reference in New Issue
Block a user