[FE 1.0] Disable INTEGER_OPERATOR_RESOLVE_WILL_CHANGE warning by default

Also remove sinceVersion parameter from
  ApproximateIntegerLiteralTypesInReceiverPosition language feature

^KT-48992 Fixed
This commit is contained in:
Dmitriy Novozhilov
2021-09-29 11:50:17 +03:00
committed by TeamCityServer
parent 212c3e8d51
commit 7917e511ed
28 changed files with 133 additions and 127 deletions
@@ -35,7 +35,7 @@ import org.jetbrains.kotlin.types.typeUtil.makeNotNullable
object NewSchemeOfIntegerOperatorResolutionChecker : CallChecker {
override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) {
if (context.languageVersionSettings.supportsFeature(LanguageFeature.ApproximateIntegerLiteralTypesInReceiverPosition)) return
if (!context.languageVersionSettings.needReport()) return
for ((valueParameter, arguments) in resolvedCall.valueArguments) {
val expectedType = if (valueParameter.isVararg) {
valueParameter.varargElementType ?: continue
@@ -52,6 +52,11 @@ object NewSchemeOfIntegerOperatorResolutionChecker : CallChecker {
}
}
private fun LanguageVersionSettings.needReport(): Boolean {
return supportsFeature(LanguageFeature.ReportChangingIntegerOperatorResolve) &&
!supportsFeature(LanguageFeature.ApproximateIntegerLiteralTypesInReceiverPosition)
}
@JvmStatic
fun checkArgument(
expectedType: KotlinType,
@@ -60,7 +65,7 @@ object NewSchemeOfIntegerOperatorResolutionChecker : CallChecker {
trace: BindingTrace,
moduleDescriptor: ModuleDescriptor
) {
if (languageVersionSettings.supportsFeature(LanguageFeature.ApproximateIntegerLiteralTypesInReceiverPosition)) return
if (!languageVersionSettings.needReport()) return
val type = expectedType.lowerIfFlexible()
if (type.isPrimitiveNumberOrNullableType()) {
checkArgumentImpl(type, KtPsiUtil.deparenthesize(argument)!!, trace, moduleDescriptor)