diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/NewSchemeOfIntegerOperatorResolutionChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/NewSchemeOfIntegerOperatorResolutionChecker.kt index ab64de6805a..6d09e11bdc9 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/NewSchemeOfIntegerOperatorResolutionChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/NewSchemeOfIntegerOperatorResolutionChecker.kt @@ -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) diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/divide.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/divide.kt index 844ea90b6d3..3adade0074a 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/divide.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/divide.kt @@ -8,6 +8,6 @@ annotation class Ann( val l: Long ) -@Ann(1 / 1, 1 / 1, 1 / 1, 1 / 1) class MyClass +@Ann(1 / 1, 1 / 1, 1 / 1, 1 / 1) class MyClass // EXPECTED: @Ann(b = 1.toByte(), i = 1, l = 1.toLong(), s = 1.toShort()) diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/intrincics.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/intrincics.kt index c036d1b8f7e..ffb752c2ee5 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/intrincics.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/intrincics.kt @@ -9,6 +9,6 @@ annotation class Ann(p1: Int, p6: Int ) -@Ann(1 or 1, 1 and 1, 1 xor 1, 1 shl 1, 1 shr 1, 1 ushr 1) class MyClass +@Ann(1 or 1, 1 and 1, 1 xor 1, 1 shl 1, 1 shr 1, 1 ushr 1) class MyClass // EXPECTED: @Ann(p1 = 1, p2 = 1.toShort(), p3 = 0.toByte(), p4 = 2, p5 = 0, p6 = 0) diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/long.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/long.kt index 644f42d2550..9af73154177 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/long.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/long.kt @@ -7,6 +7,6 @@ annotation class Ann( val l3: Long ) -@Ann(1 + 1, java.lang.Long.MAX_VALUE + 1 - 1, java.lang.Long.MAX_VALUE - 1) class MyClass +@Ann(1 + 1, java.lang.Long.MAX_VALUE + 1 - 1, java.lang.Long.MAX_VALUE - 1) class MyClass // EXPECTED: @Ann(l1 = 2.toLong(), l2 = 9223372036854775807.toLong(), l3 = 9223372036854775806.toLong()) diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueByte.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueByte.kt index 8146d177798..9ba847e2018 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueByte.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueByte.kt @@ -11,7 +11,7 @@ annotation class Ann( @Ann( p1 = java.lang.Byte.MAX_VALUE + 1, - p2 = 1 + 1, + p2 = 1 + 1, p3 = java.lang.Byte.MAX_VALUE + 1, p4 = 1.toByte() + 1.toByte(), p5 = 1.toByte() + 1.toByte() diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueInt.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueInt.kt index 2e0a3594e50..272f28969ee 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueInt.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueInt.kt @@ -12,8 +12,8 @@ annotation class Ann( @Ann( p1 = java.lang.Integer.MAX_VALUE + 1, p2 = 1 + 1, - p3 = java.lang.Integer.MAX_VALUE + 1, - p4 = 1.toInt() + 1.toInt(), + p3 = java.lang.Integer.MAX_VALUE + 1, + p4 = 1.toInt() + 1.toInt(), p5 = 1.toInt() + 1.toInt() ) class MyClass diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/miltiply.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/miltiply.kt index 9e041002ad2..894d588eed9 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/miltiply.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/miltiply.kt @@ -8,6 +8,6 @@ annotation class Ann( val l: Long ) -@Ann(1 * 1, 1 * 1, 1 * 1, 1 * 1) class MyClass +@Ann(1 * 1, 1 * 1, 1 * 1, 1 * 1) class MyClass // EXPECTED: @Ann(b = 1.toByte(), i = 1, l = 1.toLong(), s = 1.toShort()) diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/minus.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/minus.kt index f62f29a31cf..c2df3c72afe 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/minus.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/minus.kt @@ -8,6 +8,6 @@ annotation class Ann( val l: Long ) -@Ann(1 - 1, 1 - 1, 1 - 1, 1 - 1) class MyClass +@Ann(1 - 1, 1 - 1, 1 - 1, 1 - 1) class MyClass // EXPECTED: @Ann(b = 0.toByte(), i = 0, l = 0.toLong(), s = 0.toShort()) diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/mod.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/mod.kt index 89b5ff94f01..35d805d2d1c 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/mod.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/mod.kt @@ -8,6 +8,6 @@ annotation class Ann( val l: Long ) -@Ann(1 % 1, 1 % 1, 1 % 1, 1 % 1) class MyClass +@Ann(1 % 1, 1 % 1, 1 % 1, 1 % 1) class MyClass // EXPECTED: @Ann(b = 0.toByte(), i = 0, l = 0.toLong(), s = 0.toShort()) diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/plus.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/plus.kt index 7959b8a8b6f..2a281baec23 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/plus.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/plus.kt @@ -8,6 +8,6 @@ annotation class Ann( val l: Long ) -@Ann(1 + 1, 1 + 1, 1 + 1, 1 + 1) class MyClass +@Ann(1 + 1, 1 + 1, 1 + 1, 1 + 1) class MyClass // EXPECTED: @Ann(b = 2.toByte(), i = 2, l = 2.toLong(), s = 2.toShort()) diff --git a/compiler/testData/diagnostics/tests/evaluate/binaryMinusDepOnExpType.kt b/compiler/testData/diagnostics/tests/evaluate/binaryMinusDepOnExpType.kt index a2643632a5c..12ac32fb30f 100644 --- a/compiler/testData/diagnostics/tests/evaluate/binaryMinusDepOnExpType.kt +++ b/compiler/testData/diagnostics/tests/evaluate/binaryMinusDepOnExpType.kt @@ -8,24 +8,24 @@ fun test() { fooInt(1 - 1) fooInt(1 - 1.toInt()) fooInt(1 - 1.toByte()) - fooInt(1 - 1.toLong()) + fooInt(1 - 1.toLong()) fooInt(1 - 1.toShort()) - fooByte(1 - 1) - fooByte(1 - 1.toInt()) - fooByte(1 - 1.toByte()) - fooByte(1 - 1.toLong()) - fooByte(1 - 1.toShort()) + fooByte(1 - 1) + fooByte(1 - 1.toInt()) + fooByte(1 - 1.toByte()) + fooByte(1 - 1.toLong()) + fooByte(1 - 1.toShort()) - fooLong(1 - 1) - fooLong(1 - 1.toInt()) - fooLong(1 - 1.toByte()) + fooLong(1 - 1) + fooLong(1 - 1.toInt()) + fooLong(1 - 1.toByte()) fooLong(1 - 1.toLong()) - fooLong(1 - 1.toShort()) + fooLong(1 - 1.toShort()) - fooShort(1 - 1) - fooShort(1 - 1.toInt()) - fooShort(1 - 1.toByte()) - fooShort(1 - 1.toLong()) - fooShort(1 - 1.toShort()) + fooShort(1 - 1) + fooShort(1 - 1.toInt()) + fooShort(1 - 1.toByte()) + fooShort(1 - 1.toLong()) + fooShort(1 - 1.toShort()) } diff --git a/compiler/testData/diagnostics/tests/evaluate/binaryMinusIndependentExpType.kt b/compiler/testData/diagnostics/tests/evaluate/binaryMinusIndependentExpType.kt index 29155268069..6fa87294214 100644 --- a/compiler/testData/diagnostics/tests/evaluate/binaryMinusIndependentExpType.kt +++ b/compiler/testData/diagnostics/tests/evaluate/binaryMinusIndependentExpType.kt @@ -1,24 +1,24 @@ val p1: Int = 1 - 1 -val p2: Long = 1 - 1 -val p3: Byte = 1 - 1 -val p4: Short = 1 - 1 +val p2: Long = 1 - 1 +val p3: Byte = 1 - 1 +val p4: Short = 1 - 1 val l1: Long = 1 - 1.toLong() -val l2: Byte = 1 - 1.toLong() -val l3: Int = 1 - 1.toLong() -val l4: Short = 1 - 1.toLong() +val l2: Byte = 1 - 1.toLong() +val l3: Int = 1 - 1.toLong() +val l4: Short = 1 - 1.toLong() -val b1: Byte = 1 - 1.toByte() +val b1: Byte = 1 - 1.toByte() val b2: Int = 1 - 1.toByte() -val b3: Long = 1 - 1.toByte() -val b4: Short = 1 - 1.toByte() +val b3: Long = 1 - 1.toByte() +val b4: Short = 1 - 1.toByte() -val i1: Byte = 1 - 1.toInt() +val i1: Byte = 1 - 1.toInt() val i2: Int = 1 - 1.toInt() -val i3: Long = 1 - 1.toInt() -val i4: Short = 1 - 1.toInt() +val i3: Long = 1 - 1.toInt() +val i4: Short = 1 - 1.toInt() -val s1: Byte = 1 - 1.toShort() +val s1: Byte = 1 - 1.toShort() val s2: Int = 1 - 1.toShort() -val s3: Long = 1 - 1.toShort() -val s4: Short = 1 - 1.toShort() +val s3: Long = 1 - 1.toShort() +val s4: Short = 1 - 1.toShort() diff --git a/compiler/testData/diagnostics/tests/evaluate/divisionByZero.kt b/compiler/testData/diagnostics/tests/evaluate/divisionByZero.kt index ab83e4bba4b..cbf3914065e 100644 --- a/compiler/testData/diagnostics/tests/evaluate/divisionByZero.kt +++ b/compiler/testData/diagnostics/tests/evaluate/divisionByZero.kt @@ -15,7 +15,7 @@ val a10 = 1 / 0.0f val a11 = 1 / 0.0 val a12 = 1L / 0 -val b1: Byte = 1 / 0 +val b1: Byte = 1 / 0 @Ann(1 / 0) val b2 = 1 annotation class Ann(val i : Int) diff --git a/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.kt b/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.kt index a2acf2dbae3..d4c13ae6a0e 100644 --- a/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.kt +++ b/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.kt @@ -29,7 +29,7 @@ const val ui2 = UInt(40 + 2) @AnnoUB(UByte(1), ub0) fun f0() {} -@AnnoUS(UShort(2 + 5), us0) +@AnnoUS(UShort(2 + 5), us0) fun f1() {} @AnnoUI(ui0, ui1, ui2, UInt(100)) diff --git a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperations.kt b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperations.kt index 572093edf45..22f1e5988ea 100644 --- a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperations.kt +++ b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperations.kt @@ -6,22 +6,22 @@ fun fooShort(p: Short) = p fun test() { fooInt(1 + 1) - fooByte(1 + 1) - fooLong(1 + 1) - fooShort(1 + 1) + fooByte(1 + 1) + fooLong(1 + 1) + fooShort(1 + 1) fooInt(1 * 1) - fooByte(1 * 1) - fooLong(1 * 1) - fooShort(1 * 1) + fooByte(1 * 1) + fooLong(1 * 1) + fooShort(1 * 1) fooInt(1 / 1) - fooByte(1 / 1) - fooLong(1 / 1) - fooShort(1 / 1) + fooByte(1 / 1) + fooLong(1 / 1) + fooShort(1 / 1) fooInt(1 % 1) - fooByte(1 % 1) - fooLong(1 % 1) - fooShort(1 % 1) + fooByte(1 % 1) + fooLong(1 % 1) + fooShort(1 % 1) } diff --git a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsCall.kt b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsCall.kt index b22c15ccd75..6adb0fd64e6 100644 --- a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsCall.kt +++ b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsCall.kt @@ -6,22 +6,22 @@ fun fooShort(p: Short) = p fun test() { fooInt(1.plus(1)) - fooByte(1.plus(1)) - fooLong(1.plus(1)) - fooShort(1.plus(1)) + fooByte(1.plus(1)) + fooLong(1.plus(1)) + fooShort(1.plus(1)) fooInt(1.times(1)) - fooByte(1.times(1)) - fooLong(1.times(1)) - fooShort(1.times(1)) + fooByte(1.times(1)) + fooLong(1.times(1)) + fooShort(1.times(1)) fooInt(1.div(1)) - fooByte(1.div(1)) - fooLong(1.div(1)) - fooShort(1.div(1)) + fooByte(1.div(1)) + fooLong(1.div(1)) + fooShort(1.div(1)) fooInt(1.rem(1)) - fooByte(1.rem(1)) - fooLong(1.rem(1)) - fooShort(1.rem(1)) + fooByte(1.rem(1)) + fooLong(1.rem(1)) + fooShort(1.rem(1)) } diff --git a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.kt b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.kt index b2bf9b03a6e..10479156025 100644 --- a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.kt +++ b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.kt @@ -6,22 +6,22 @@ fun fooShort(p: Short) = p fun test() { fooInt(1 plus 1) - fooByte(1 plus 1) - fooLong(1 plus 1) - fooShort(1 plus 1) + fooByte(1 plus 1) + fooLong(1 plus 1) + fooShort(1 plus 1) fooInt(1 times 1) - fooByte(1 times 1) - fooLong(1 times 1) - fooShort(1 times 1) + fooByte(1 times 1) + fooLong(1 times 1) + fooShort(1 times 1) fooInt(1 div 1) - fooByte(1 div 1) - fooLong(1 div 1) - fooShort(1 div 1) + fooByte(1 div 1) + fooLong(1 div 1) + fooShort(1 div 1) fooInt(1 rem 1) - fooByte(1 rem 1) - fooLong(1 rem 1) - fooShort(1 rem 1) + fooByte(1 rem 1) + fooLong(1 rem 1) + fooShort(1 rem 1) } diff --git a/compiler/testData/diagnostics/tests/numbers/kt47729.fir.kt b/compiler/testData/diagnostics/tests/numbers/kt47729.fir.kt index 260e2439cff..93ba4f7974c 100644 --- a/compiler/testData/diagnostics/tests/numbers/kt47729.fir.kt +++ b/compiler/testData/diagnostics/tests/numbers/kt47729.fir.kt @@ -1,4 +1,4 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +ReportChangingIntegerOperatorResolve // ISSUE: Kt-47447, KT-47729 fun takeLong(value : Long) {} diff --git a/compiler/testData/diagnostics/tests/numbers/kt47729.kt b/compiler/testData/diagnostics/tests/numbers/kt47729.kt index 1c1af8f4819..d77f86cf94b 100644 --- a/compiler/testData/diagnostics/tests/numbers/kt47729.kt +++ b/compiler/testData/diagnostics/tests/numbers/kt47729.kt @@ -1,4 +1,4 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +ReportChangingIntegerOperatorResolve // ISSUE: Kt-47447, KT-47729 fun takeLong(value : Long) {} diff --git a/compiler/testData/diagnostics/tests/numbers/kt47729_parenthesis.fir.kt b/compiler/testData/diagnostics/tests/numbers/kt47729_parenthesis.fir.kt index 6fd760f797b..6ec277eafca 100644 --- a/compiler/testData/diagnostics/tests/numbers/kt47729_parenthesis.fir.kt +++ b/compiler/testData/diagnostics/tests/numbers/kt47729_parenthesis.fir.kt @@ -1,4 +1,4 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +ReportChangingIntegerOperatorResolve // ISSUE: Kt-47447, KT-47729 fun takeLong(x: Long) {} diff --git a/compiler/testData/diagnostics/tests/numbers/kt47729_parenthesis.kt b/compiler/testData/diagnostics/tests/numbers/kt47729_parenthesis.kt index e0868364f98..7953e1808e8 100644 --- a/compiler/testData/diagnostics/tests/numbers/kt47729_parenthesis.kt +++ b/compiler/testData/diagnostics/tests/numbers/kt47729_parenthesis.kt @@ -1,4 +1,4 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +ReportChangingIntegerOperatorResolve // ISSUE: Kt-47447, KT-47729 fun takeLong(x: Long) {} diff --git a/compiler/testData/diagnostics/tests/numbers/kt48361_disabled.fir.kt b/compiler/testData/diagnostics/tests/numbers/kt48361_disabled.fir.kt index cd4a8c44a46..90f1ff784be 100644 --- a/compiler/testData/diagnostics/tests/numbers/kt48361_disabled.fir.kt +++ b/compiler/testData/diagnostics/tests/numbers/kt48361_disabled.fir.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +ReportChangingIntegerOperatorResolve fun foo(ttlMillis: Long = 5 * 60 * 1000) {} diff --git a/compiler/testData/diagnostics/tests/numbers/kt48361_disabled.kt b/compiler/testData/diagnostics/tests/numbers/kt48361_disabled.kt index 95e8e7a1318..77ed8f93dab 100644 --- a/compiler/testData/diagnostics/tests/numbers/kt48361_disabled.kt +++ b/compiler/testData/diagnostics/tests/numbers/kt48361_disabled.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +ReportChangingIntegerOperatorResolve fun foo(ttlMillis: Long = 5 * 60 * 1000) {} diff --git a/compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.kt b/compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.kt index 4b80f0ba863..76305f242e7 100644 --- a/compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.kt +++ b/compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.kt @@ -7,62 +7,62 @@ abstract class C { } fun testLongDotCall(c1: C) { - c1.takeT(1.plus(2)) - c1.takeT(1.minus(2)) - c1.takeT(1.times(2)) - c1.takeT(1.div(2)) - c1.takeT(1.rem(2)) + c1.takeT(1.plus(2)) + c1.takeT(1.minus(2)) + c1.takeT(1.times(2)) + c1.takeT(1.div(2)) + c1.takeT(1.rem(2)) c1.takeT(1.inc()) c1.takeT(1.dec()) - c1.takeT(1.unaryPlus()) - c1.takeT(1.unaryMinus()) - c1.takeT(1.shl(2)) - c1.takeT(1.shr(2)) - c1.takeT(1.ushr(2)) - c1.takeT(1.and(2)) - c1.takeT(1.or(2)) - c1.takeT(1.xor(2)) - c1.takeT(1.inv()) + c1.takeT(1.unaryPlus()) + c1.takeT(1.unaryMinus()) + c1.takeT(1.shl(2)) + c1.takeT(1.shr(2)) + c1.takeT(1.ushr(2)) + c1.takeT(1.and(2)) + c1.takeT(1.or(2)) + c1.takeT(1.xor(2)) + c1.takeT(1.inv()) } fun testShortDotCall(c2: C) { - c2.takeT(1.plus(2)) + c2.takeT(1.plus(2)) c2.takeT(1.inc()) c2.takeT(1.dec()) - c2.takeT(1.shr(2)) - c2.takeT(1.inv()) + c2.takeT(1.shr(2)) + c2.takeT(1.inv()) } fun testByteDotCall(c3: C) { - c3.takeT(1.plus(2)) + c3.takeT(1.plus(2)) c3.takeT(1.inc()) c3.takeT(1.dec()) - c3.takeT(1.shr(2)) - c3.takeT(1.inv()) + c3.takeT(1.shr(2)) + c3.takeT(1.inv()) } fun testLongOperatorInfixCall(c4: C) { - c4.takeT(1 + 2) - c4.takeT(1 - 2) - c4.takeT(1 * 2) - c4.takeT(1 / 2) - c4.takeT(1 % 2) + c4.takeT(1 + 2) + c4.takeT(1 - 2) + c4.takeT(1 * 2) + c4.takeT(1 / 2) + c4.takeT(1 % 2) c4.takeT(+1) c4.takeT(-1) - c4.takeT(1 shl 2) - c4.takeT(1 shr 2) - c4.takeT(1 ushr 2) - c4.takeT(1 and 2) - c4.takeT(1 or 2) - c4.takeT(1 xor 2) + c4.takeT(1 shl 2) + c4.takeT(1 shr 2) + c4.takeT(1 ushr 2) + c4.takeT(1 and 2) + c4.takeT(1 or 2) + c4.takeT(1 xor 2) } fun testShortOperatorInfixCall(c5: C) { - c5.takeT(1 + 2) - c5.takeT(1 shr 2) + c5.takeT(1 + 2) + c5.takeT(1 shr 2) } fun testByteOperatorInfixCall(c6: C) { - c6.takeT(1 + 2) - c6.takeT(1 shr 2) + c6.takeT(1 + 2) + c6.takeT(1 shr 2) } diff --git a/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_warning.fir.kt b/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_warning.fir.kt index b49fa39773a..c48e7882c07 100644 --- a/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_warning.fir.kt +++ b/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_warning.fir.kt @@ -1,4 +1,4 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +ReportChangingIntegerOperatorResolve // WITH_STDLIB // ISSUE: KT-38895 diff --git a/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_warning.kt b/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_warning.kt index 286fff0ff56..abab1c413fb 100644 --- a/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_warning.kt +++ b/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_warning.kt @@ -1,4 +1,4 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition +ReportChangingIntegerOperatorResolve // WITH_STDLIB // ISSUE: KT-38895 diff --git a/compiler/testData/diagnostics/tests/operatorRem/numberRemConversions.kt b/compiler/testData/diagnostics/tests/operatorRem/numberRemConversions.kt index 6ea95abe126..468608b6a21 100644 --- a/compiler/testData/diagnostics/tests/operatorRem/numberRemConversions.kt +++ b/compiler/testData/diagnostics/tests/operatorRem/numberRemConversions.kt @@ -7,9 +7,9 @@ fun fooShort(p: Short) = p fun test() { fooInt(1 % 1) - fooByte(1 % 1) - fooLong(1 % 1) - fooShort(1 % 1) + fooByte(1 % 1) + fooLong(1 % 1) + fooShort(1 % 1) } public operator fun Int.rem(other: Int): Int = 0 diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 13abd5d254c..8fa59a5fa94 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -227,7 +227,6 @@ enum class LanguageFeature( DefinitelyNonNullableTypes(KOTLIN_1_7), ProhibitSimplificationOfNonTrivialConstBooleanExpressions(KOTLIN_1_7), SafeCallsAreAlwaysNullable(KOTLIN_1_7), - ApproximateIntegerLiteralTypesInReceiverPosition(KOTLIN_1_7), StopPropagatingDeprecationThroughOverrides(KOTLIN_1_7), AbstractClassMemberNotImplementedWithIntermediateAbstractClass(KOTLIN_1_7, kind = BUG_FIX), @@ -235,6 +234,8 @@ enum class LanguageFeature( SoundSmartcastFromLoopConditionForLoopAssignedVariables(sinceVersion = null, kind = BUG_FIX), // Disabled for indefinite time. See KT-48535 and related discussion OptInOnOverrideForbidden(sinceVersion = null, kind = BUG_FIX), + ApproximateIntegerLiteralTypesInReceiverPosition(sinceVersion = null), + ReportChangingIntegerOperatorResolve(sinceVersion = null), // Experimental features