Remove useless casts after fixing subtyping for star projections
This commit is contained in:
+1
-2
@@ -276,8 +276,7 @@ public class JavaNullabilityWarningsChecker : AdditionalTypeChecker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// TODO: Compiler bug
|
doIfNotNull(dataFlowValue, c) {
|
||||||
doIfNotNull(dataFlowValue, c as ResolutionContext<*>) {
|
|
||||||
c.trace.report(Errors.UNNECESSARY_SAFE_CALL.on(c.call.getCallOperationNode().getPsi(), receiverArgument.getType()))
|
c.trace.report(Errors.UNNECESSARY_SAFE_CALL.on(c.call.getCallOperationNode().getPsi(), receiverArgument.getType()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ public class CallCompleter(
|
|||||||
if (valueArgument.isExternal()) return
|
if (valueArgument.isExternal()) return
|
||||||
|
|
||||||
val expression = valueArgument.getArgumentExpression()
|
val expression = valueArgument.getArgumentExpression()
|
||||||
val deparenthesized = ArgumentTypeResolver.getLastElementDeparenthesized(expression, context as ResolutionContext<*>)
|
val deparenthesized = ArgumentTypeResolver.getLastElementDeparenthesized(expression, context)
|
||||||
if (deparenthesized == null) return
|
if (deparenthesized == null) return
|
||||||
|
|
||||||
val recordedType = context.trace[BindingContext.EXPRESSION_TYPE, expression]
|
val recordedType = context.trace[BindingContext.EXPRESSION_TYPE, expression]
|
||||||
@@ -241,20 +241,20 @@ public class CallCompleter(
|
|||||||
// For the cases like 'foo(1)' the type of '1' depends on expected type (it can be Int, Byte, etc.),
|
// For the cases like 'foo(1)' the type of '1' depends on expected type (it can be Int, Byte, etc.),
|
||||||
// so while the expected type is not known, it's IntegerValueType(1), and should be updated when the expected type is known.
|
// so while the expected type is not known, it's IntegerValueType(1), and should be updated when the expected type is known.
|
||||||
if (recordedType != null && !recordedType.getConstructor().isDenotable()) {
|
if (recordedType != null && !recordedType.getConstructor().isDenotable()) {
|
||||||
updatedType = ArgumentTypeResolver.updateResultArgumentTypeIfNotDenotable(context as ResolutionContext<*>, expression)
|
updatedType = ArgumentTypeResolver.updateResultArgumentTypeIfNotDenotable(context, expression)
|
||||||
}
|
}
|
||||||
|
|
||||||
updatedType = updateRecordedTypeForArgument(updatedType, recordedType, expression, context.trace)
|
updatedType = updateRecordedTypeForArgument(updatedType, recordedType, expression, context.trace)
|
||||||
|
|
||||||
// While the expected type is not known, the function literal arguments are not analyzed (to analyze function literal bodies once),
|
// While the expected type is not known, the function literal arguments are not analyzed (to analyze function literal bodies once),
|
||||||
// but they should be analyzed when the expected type is known (during the call completion).
|
// but they should be analyzed when the expected type is known (during the call completion).
|
||||||
if (ArgumentTypeResolver.isFunctionLiteralArgument(expression, context as ResolutionContext<*>)) {
|
if (ArgumentTypeResolver.isFunctionLiteralArgument(expression, context)) {
|
||||||
argumentTypeResolver.getFunctionLiteralTypeInfo(
|
argumentTypeResolver.getFunctionLiteralTypeInfo(
|
||||||
expression, ArgumentTypeResolver.getFunctionLiteralArgument(expression, context as ResolutionContext<*>),
|
expression, ArgumentTypeResolver.getFunctionLiteralArgument(expression, context),
|
||||||
context as CallResolutionContext<*>, RESOLVE_FUNCTION_ARGUMENTS)
|
context, RESOLVE_FUNCTION_ARGUMENTS)
|
||||||
}
|
}
|
||||||
|
|
||||||
DataFlowUtils.checkType(updatedType, deparenthesized, context as ResolutionContext<*>)
|
DataFlowUtils.checkType(updatedType, deparenthesized, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun completeCallForArgument(
|
private fun completeCallForArgument(
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ public class TaskPrioritizer(private val storageManager: StorageManager) {
|
|||||||
) {
|
) {
|
||||||
for (callableDescriptorCollector in c.callableDescriptorCollectors) {
|
for (callableDescriptorCollector in c.callableDescriptorCollectors) {
|
||||||
c.result.addCandidates {
|
c.result.addCandidates {
|
||||||
val variantsForExplicitReceiver = SmartCastUtils.getSmartCastVariants(explicitReceiver, c.context as ResolutionContext<*>) //workaround KT-1969
|
val variantsForExplicitReceiver = SmartCastUtils.getSmartCastVariants(explicitReceiver, c.context)
|
||||||
val members = Lists.newArrayList<ResolutionCandidate<D>>()
|
val members = Lists.newArrayList<ResolutionCandidate<D>>()
|
||||||
for (type in variantsForExplicitReceiver) {
|
for (type in variantsForExplicitReceiver) {
|
||||||
val membersForThisVariant = if (staticMembers) {
|
val membersForThisVariant = if (staticMembers) {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public fun <C: ResolutionContext<C>> Call.hasUnresolvedArguments(context: Resolu
|
|||||||
return arguments.any {
|
return arguments.any {
|
||||||
argument ->
|
argument ->
|
||||||
val expressionType = context.trace.getBindingContext()[BindingContext.EXPRESSION_TYPE, argument]
|
val expressionType = context.trace.getBindingContext()[BindingContext.EXPRESSION_TYPE, argument]
|
||||||
argument != null && !ArgumentTypeResolver.isFunctionLiteralArgument(argument, context as ResolutionContext<*>)
|
argument != null && !ArgumentTypeResolver.isFunctionLiteralArgument(argument, context)
|
||||||
&& (expressionType == null || expressionType.isError())
|
&& (expressionType == null || expressionType.isError())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user