diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt index 328e9a1dd17..f1c631f0132 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CandidateResolver.kt @@ -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 diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DataFlowAnalyzer.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DataFlowAnalyzer.java index b5de274bbb9..9f416c970c5 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DataFlowAnalyzer.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DataFlowAnalyzer.java @@ -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; } diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitution.kt b/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitution.kt index 0b7a81596b3..5807ff50fc2 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitution.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitution.kt @@ -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