From 3dd5a267b8d63545a45c77c32dcbb0dd29038a06 Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Thu, 6 Sep 2018 14:04:39 +0300 Subject: [PATCH] Refine scope of signed to unsigned conversions Depend on a module of function declaration, not function call --- .../src/org/jetbrains/kotlin/resolve/calls/CallCompleter.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallCompleter.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallCompleter.kt index bbb26989ec5..6d409ce9e17 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallCompleter.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallCompleter.kt @@ -323,9 +323,6 @@ class CallCompleter( val constant = context.trace[BindingContext.COMPILE_TIME_VALUE, deparenthesized] val convertedConst = constant is IntegerValueTypeConstant && constant.convertedFromSigned - if (convertedConst && !moduleDescriptor.hasImplicitIntegerCoercionCapability()) { - context.trace.report(Errors.SIGNED_CONSTANT_CONVERTED_TO_UNSIGNED.on(deparenthesized)) - } if (results != null && results.isSingleResult) { val resolvedCall = results.resultingCall @@ -354,6 +351,8 @@ class CallCompleter( ) } } + } else if (convertedConst) { + context.trace.report(Errors.SIGNED_CONSTANT_CONVERTED_TO_UNSIGNED.on(deparenthesized)) } updatedType = updateRecordedTypeForArgument(updatedType, recordedType, expression, context.statementFilter, context.trace)