diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index 90bf9b4ce0f..a4006e9c0e2 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -22285,15 +22285,9 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag } @Test - @TestMetadata("kt48361_disabled.kt") - public void testKt48361_disabled() throws Exception { - runTest("compiler/testData/diagnostics/tests/numbers/kt48361_disabled.kt"); - } - - @Test - @TestMetadata("kt48361_enabled.kt") - public void testKt48361_enabled() throws Exception { - runTest("compiler/testData/diagnostics/tests/numbers/kt48361_enabled.kt"); + @TestMetadata("kt48361.kt") + public void testKt48361() throws Exception { + runTest("compiler/testData/diagnostics/tests/numbers/kt48361.kt"); } @Test @@ -22302,12 +22296,6 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.kt"); } - @Test - @TestMetadata("newLiteralOperatorsResolution_newResolve.kt") - public void testNewLiteralOperatorsResolution_newResolve() throws Exception { - runTest("compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_newResolve.kt"); - } - @Test @TestMetadata("newLiteralOperatorsResolution_warning.kt") public void testNewLiteralOperatorsResolution_warning() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index b7e47a78fcf..9b93fdde65a 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -22291,15 +22291,9 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti } @Test - @TestMetadata("kt48361_disabled.kt") - public void testKt48361_disabled() throws Exception { - runTest("compiler/testData/diagnostics/tests/numbers/kt48361_disabled.kt"); - } - - @Test - @TestMetadata("kt48361_enabled.kt") - public void testKt48361_enabled() throws Exception { - runTest("compiler/testData/diagnostics/tests/numbers/kt48361_enabled.kt"); + @TestMetadata("kt48361.kt") + public void testKt48361() throws Exception { + runTest("compiler/testData/diagnostics/tests/numbers/kt48361.kt"); } @Test @@ -22308,12 +22302,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.kt"); } - @Test - @TestMetadata("newLiteralOperatorsResolution_newResolve.kt") - public void testNewLiteralOperatorsResolution_newResolve() throws Exception { - runTest("compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_newResolve.kt"); - } - @Test @TestMetadata("newLiteralOperatorsResolution_warning.kt") public void testNewLiteralOperatorsResolution_warning() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java index d1b2424f182..0418441e188 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java @@ -22285,15 +22285,9 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac } @Test - @TestMetadata("kt48361_disabled.kt") - public void testKt48361_disabled() throws Exception { - runTest("compiler/testData/diagnostics/tests/numbers/kt48361_disabled.kt"); - } - - @Test - @TestMetadata("kt48361_enabled.kt") - public void testKt48361_enabled() throws Exception { - runTest("compiler/testData/diagnostics/tests/numbers/kt48361_enabled.kt"); + @TestMetadata("kt48361.kt") + public void testKt48361() throws Exception { + runTest("compiler/testData/diagnostics/tests/numbers/kt48361.kt"); } @Test @@ -22302,12 +22296,6 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.kt"); } - @Test - @TestMetadata("newLiteralOperatorsResolution_newResolve.kt") - public void testNewLiteralOperatorsResolution_newResolve() throws Exception { - runTest("compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_newResolve.kt"); - } - @Test @TestMetadata("newLiteralOperatorsResolution_warning.kt") public void testNewLiteralOperatorsResolution_warning() throws Exception { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/VariableTypeAndInitializerResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/VariableTypeAndInitializerResolver.kt index 062dad686c4..8495a3ac64f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/VariableTypeAndInitializerResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/VariableTypeAndInitializerResolver.kt @@ -131,7 +131,6 @@ class VariableTypeAndInitializerResolver( NewSchemeOfIntegerOperatorResolutionChecker.checkArgument( variableType, initializer, - languageVersionSettings, trace, constantExpressionEvaluator.module ) 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 492822ed2a2..8b5833f8e36 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 @@ -6,11 +6,8 @@ package org.jetbrains.kotlin.resolve.calls.checkers import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.config.LanguageFeature -import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor -import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.name.FqName @@ -33,7 +30,6 @@ import org.jetbrains.kotlin.types.typeUtil.* object NewSchemeOfIntegerOperatorResolutionChecker : CallChecker { override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) { - if (context.languageVersionSettings.supportsFeature(LanguageFeature.ApproximateIntegerLiteralTypesInReceiverPosition)) return for ((valueParameter, arguments) in resolvedCall.valueArguments) { val expectedType = if (valueParameter.isVararg) { valueParameter.varargElementType ?: continue @@ -54,11 +50,9 @@ object NewSchemeOfIntegerOperatorResolutionChecker : CallChecker { fun checkArgument( expectedType: KotlinType, argument: KtExpression, - languageVersionSettings: LanguageVersionSettings, trace: BindingTrace, moduleDescriptor: ModuleDescriptor ) { - if (languageVersionSettings.supportsFeature(LanguageFeature.ApproximateIntegerLiteralTypesInReceiverPosition)) return val type = expectedType.lowerIfFlexible() if (type.isPrimitiveNumberOrNullableType()) { checkArgumentImpl(type, KtPsiUtil.deparenthesize(argument)!!, trace, moduleDescriptor) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt index 31ac3ff50f6..19ed9c1e6f5 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt @@ -14,7 +14,6 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.builtins.UnsignedTypes import org.jetbrains.kotlin.config.LanguageFeature -import org.jetbrains.kotlin.config.LanguageFeature.ApproximateIntegerLiteralTypesInReceiverPosition import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptorImpl @@ -286,10 +285,9 @@ class ConstantExpressionEvaluator( fun evaluateExpression( expression: KtExpression, trace: BindingTrace, - expectedType: KotlinType? = TypeUtils.NO_EXPECTED_TYPE, - isIndependentContext: Boolean = false + expectedType: KotlinType? = TypeUtils.NO_EXPECTED_TYPE ): CompileTimeConstant<*>? { - val visitor = ConstantExpressionEvaluatorVisitor(this, trace, isIndependentContext) + val visitor = ConstantExpressionEvaluatorVisitor(this, trace) val constant = visitor.evaluate(expression, expectedType) ?: return null checkExperimentalityOfConstantLiteral(expression, constant, expectedType, trace) @@ -389,13 +387,10 @@ private val DIVISION_OPERATION_NAMES = private class ConstantExpressionEvaluatorVisitor( private val constantExpressionEvaluator: ConstantExpressionEvaluator, - private val trace: BindingTrace, - private val isIndependentContext: Boolean + private val trace: BindingTrace ) : KtVisitor?, KotlinType>() { private val languageVersionSettings = constantExpressionEvaluator.languageVersionSettings private val builtIns = constantExpressionEvaluator.module.builtIns - private val defaultValueForDontCreateIntegerLiteralType = - languageVersionSettings.supportsFeature(ApproximateIntegerLiteralTypesInReceiverPosition) private val inlineConstTracker = if (constantExpressionEvaluator.inlineConstTracker is InlineConstTracker.DoNothing) null @@ -530,8 +525,7 @@ private class ConstantExpressionEvaluatorVisitor( isUnsignedLongNumberLiteral = isUnsignedLong, usesVariableAsConstant = false, usesNonConstValAsConstant = false, - isConvertableConstVal = false, - dontCreateILT = defaultValueForDontCreateIntegerLiteralType && isIndependentContext + isConvertableConstVal = false ) ) } @@ -581,8 +575,7 @@ private class ConstantExpressionEvaluatorVisitor( canBeUsedInAnnotation = canBeUsedInAnnotation, usesVariableAsConstant = usesVariableAsConstant, usesNonConstValAsConstant = usesNonConstantVariableAsConstant, - isConvertableConstVal = false, - dontCreateILT = false + isConvertableConstVal = false ) ) else null @@ -646,8 +639,7 @@ private class ConstantExpressionEvaluatorVisitor( isUnsignedLongNumberLiteral = false, usesVariableAsConstant = leftConstant.usesVariableAsConstant || rightConstant.usesVariableAsConstant, usesNonConstValAsConstant = leftConstant.usesNonConstValAsConstant || rightConstant.usesNonConstValAsConstant, - isConvertableConstVal = false, - dontCreateILT = false + isConvertableConstVal = false ) ) } else { @@ -666,8 +658,7 @@ private class ConstantExpressionEvaluatorVisitor( private fun evaluateCall( callExpression: KtExpression, receiverExpression: KtExpression, - expectedType: KotlinType?, - isUnaryPlusMinus: Boolean = false + expectedType: KotlinType? ): CompileTimeConstant<*>? { val resolvedCall = callExpression.getResolvedCall(trace.bindingContext) ?: return null if (!KotlinBuiltIns.isUnderKotlinPackage(resolvedCall.resultingDescriptor)) return null @@ -689,12 +680,9 @@ private class ConstantExpressionEvaluatorVisitor( val usesNonConstValAsConstant = usesNonConstValAsConstant(argumentForReceiver.expression) val isNumberConversionMethod = resultingDescriptorName in OperatorConventions.NUMBER_CONVERSIONS val isCharCode = argumentForReceiver.ctcType == CHAR && resultingDescriptorName == StandardNames.CHAR_CODE - val dontCreateILT = defaultValueForDontCreateIntegerLiteralType && - !isUnaryPlusMinus && - !hasIntegerLiteralType(receiverExpression) return createConstant( result, - expectedType.takeUnless { dontCreateILT }, + expectedType, CompileTimeConstant.Parameters( canBeUsedInAnnotation, !isNumberConversionMethod && !isCharCode && isArgumentPure, @@ -702,8 +690,7 @@ private class ConstantExpressionEvaluatorVisitor( isUnsignedLongNumberLiteral = false, usesVariableAsConstant, usesNonConstValAsConstant, - isConvertableConstVal = false, - dontCreateILT = dontCreateILT + isConvertableConstVal = false ) ) } else if (argumentsEntrySet.size == 1) { @@ -738,7 +725,6 @@ private class ConstantExpressionEvaluatorVisitor( usesVariableAsConstant(argumentForReceiver.expression) || usesVariableAsConstant(argumentForParameter.expression) val usesNonConstValAsConstant = usesNonConstValAsConstant(argumentForReceiver.expression) || usesNonConstValAsConstant(argumentForParameter.expression) - val dontCreateILT = defaultValueForDontCreateIntegerLiteralType && !hasIntegerLiteralType(receiverExpression) val parameters = CompileTimeConstant.Parameters( canBeUsedInAnnotation, areArgumentsPure, @@ -746,8 +732,7 @@ private class ConstantExpressionEvaluatorVisitor( isUnsignedLongNumberLiteral = false, usesVariableAsConstant, usesNonConstValAsConstant, - isConvertableConstVal = false, - dontCreateILT = dontCreateILT + isConvertableConstVal = false ) return when (resultingDescriptorName) { OperatorNameConventions.COMPARE_TO -> createCompileTimeConstantForCompareTo(result, callExpression)?.wrap(parameters) @@ -755,7 +740,7 @@ private class ConstantExpressionEvaluatorVisitor( else -> { createConstant( result, - expectedType.takeUnless { dontCreateILT }, + expectedType, parameters ) } @@ -777,9 +762,6 @@ private class ConstantExpressionEvaluatorVisitor( private fun isPureConstant(expression: KtExpression) = ConstantExpressionEvaluator.getConstant(expression, trace.bindingContext)?.isPure ?: false - private fun hasIntegerLiteralType(expression: KtExpression): Boolean = - ConstantExpressionEvaluator.getConstant(expression, trace.bindingContext)?.hasIntegerLiteralType ?: false - private fun evaluateUnaryAndCheck(receiver: OperationArgument, name: String, callExpression: KtExpression): Any? { return evaluateUnaryAndCheck(name, receiver.ctcType, receiver.value) { trace.report(Errors.INTEGER_OVERFLOW.on(callExpression.getStrictParentOfType() ?: callExpression)) @@ -803,12 +785,10 @@ private class ConstantExpressionEvaluatorVisitor( override fun visitUnaryExpression(expression: KtUnaryExpression, expectedType: KotlinType?): CompileTimeConstant<*>? { val leftExpression = expression.baseExpression ?: return null - val tokenType = expression.operationToken return evaluateCall( expression.operationReference, leftExpression, - expectedType, - isUnaryPlusMinus = tokenType == KtTokens.PLUS || tokenType == KtTokens.MINUS + expectedType ) } @@ -847,8 +827,7 @@ private class ConstantExpressionEvaluatorVisitor( isUnsignedLongNumberLiteral = false, usesVariableAsConstant = true, usesNonConstValAsConstant = !callableDescriptor.isConst, - isConvertableConstVal = isConvertableConstVal, - dontCreateILT = true + isConvertableConstVal = isConvertableConstVal ) ) } @@ -1108,9 +1087,7 @@ private class ConstantExpressionEvaluatorVisitor( } if (TypeUtils.noExpectedType(expectedType) || expectedType.isError) { - return if (parameters.dontCreateILT) { - value.createSimpleIntCompileTimeConst(parameters) - } else createIntegerValueTypeConstant( + return createIntegerValueTypeConstant( value, constantExpressionEvaluator.module, parameters, @@ -1159,8 +1136,7 @@ private class ConstantExpressionEvaluatorVisitor( isUnsignedLong: Boolean = false, usesVariableAsConstant: Boolean = false, usesNonConstValAsConstant: Boolean = false, - isConvertableConstVal: Boolean = false, - dontCreateILT: Boolean = false + isConvertableConstVal: Boolean = false ): TypedCompileTimeConstant = wrap( CompileTimeConstant.Parameters( @@ -1170,8 +1146,7 @@ private class ConstantExpressionEvaluatorVisitor( isUnsignedLong, usesVariableAsConstant, usesNonConstValAsConstant, - isConvertableConstVal, - dontCreateILT + isConvertableConstVal ) ) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java index f34a508899f..3cd124d362f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java @@ -181,7 +181,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { checkNull(expression, context, typeInfo.getType()); components.constantExpressionEvaluator.evaluateExpression( - expression, context.trace, context.expectedType, evaluateIntegerConstantInIndependentMode(context) + expression, context.trace, context.expectedType ); return components.dataFlowAnalyzer.checkType(typeInfo, expression, context); // TODO : Extensions to this } @@ -217,7 +217,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { } CompileTimeConstant compileTimeConstant = components.constantExpressionEvaluator.evaluateExpression( - expression, context.trace, context.expectedType, evaluateIntegerConstantInIndependentMode(context) + expression, context.trace, context.expectedType ); if (compileTimeConstant instanceof UnsignedErrorValueTypeConstant) { @@ -830,7 +830,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { } CompileTimeConstant value = components.constantExpressionEvaluator.evaluateExpression( - expression, contextWithExpectedType.trace, contextWithExpectedType.expectedType, evaluateIntegerConstantInIndependentMode(context) + expression, contextWithExpectedType.trace, contextWithExpectedType.expectedType ); if (value != null) { return components.dataFlowAnalyzer.createCompileTimeConstantTypeInfo(value, expression, contextWithExpectedType); @@ -1126,7 +1126,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { result = TypeInfoFactoryKt.noTypeInfo(context); } CompileTimeConstant value = components.constantExpressionEvaluator.evaluateExpression( - expression, contextWithExpectedType.trace, contextWithExpectedType.expectedType, evaluateIntegerConstantInIndependentMode(context) + expression, contextWithExpectedType.trace, contextWithExpectedType.expectedType ); if (value != null) { return components.dataFlowAnalyzer.createCompileTimeConstantTypeInfo(value, expression, contextWithExpectedType); @@ -1602,7 +1602,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { for (KtStringTemplateEntry entry : expression.getEntries()) { entry.accept(visitor); } - components.constantExpressionEvaluator.evaluateExpression(expression, context.trace, contextWithExpectedType.expectedType, evaluateIntegerConstantInIndependentMode(context)); + components.constantExpressionEvaluator.evaluateExpression(expression, context.trace, contextWithExpectedType.expectedType); return components.dataFlowAnalyzer.checkType(visitor.typeInfo.replaceType(components.builtIns.getStringType()), expression, contextWithExpectedType); @@ -1805,8 +1805,4 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { return BindingContextUtils.getRecordedTypeInfo(expression, context.trace.getBindingContext()); } } - - private boolean evaluateIntegerConstantInIndependentMode(ExpressionTypingContext context) { - return context.contextDependency == INDEPENDENT && context.languageVersionSettings.supportsFeature(LanguageFeature.ApproximateIntegerLiteralTypesInReceiverPosition); - } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingVisitorForStatements.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingVisitorForStatements.java index b3f81527910..1231802c9dd 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingVisitorForStatements.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingVisitorForStatements.java @@ -474,7 +474,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito DataFlowValue rightValue = components.dataFlowValueFactory.createDataFlowValue(right, rightType, context); // We cannot say here anything new about rightValue except it has the same value as leftValue resultInfo = resultInfo.replaceDataFlowInfo(dataFlowInfo.assign(leftValue, rightValue, components.languageVersionSettings)); - NewSchemeOfIntegerOperatorResolutionChecker.checkArgument(expectedType, right, context.languageVersionSettings, context.trace, components.moduleDescriptor); + NewSchemeOfIntegerOperatorResolutionChecker.checkArgument(expectedType, right, context.trace, components.moduleDescriptor); } } else { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ValueParameterResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ValueParameterResolver.kt index d88c02385b5..c4068583e3d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ValueParameterResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ValueParameterResolver.kt @@ -75,7 +75,6 @@ class ValueParameterResolver( NewSchemeOfIntegerOperatorResolutionChecker.checkArgument( type, defaultValue, - context.languageVersionSettings, context.trace, constantExpressionEvaluator.module ) diff --git a/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.args b/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.args index 81c45ff75f0..909d29ca6be 100644 --- a/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.args +++ b/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.args @@ -1,4 +1,4 @@ $TESTDATA_DIR$/overridingXx.kt -d $TEMP_DIR$ --XXLanguage\:+ApproximateIntegerLiteralTypesInReceiverPosition \ No newline at end of file +-XXLanguage\:+RangeUntilOperator diff --git a/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.env b/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.env index ea13a2dc606..c21fea6d3d1 100644 --- a/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.env +++ b/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.env @@ -1 +1 @@ --XXLanguage:-ApproximateIntegerLiteralTypesInReceiverPosition \ No newline at end of file +-XXLanguage:-RangeUntilOperator diff --git a/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.kt b/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.kt index 798b83f32e7..302433fef59 100644 --- a/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.kt +++ b/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.kt @@ -1,3 +1,7 @@ -fun foo(ttlMillis: Long = 5 * 60 * 1000) {} - -const val cacheSize: Long = 4096 * 4 +fun test(): Int { + var res = 0 + for (x in 100 ..< 1) { + res += x + } + return res +} diff --git a/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.out b/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.out index 4028521bde0..6d3b7543925 100644 --- a/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.out +++ b/compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.out @@ -1,13 +1,16 @@ warning: ATTENTION! This build uses unsafe internal compiler arguments: --XXLanguage:-ApproximateIntegerLiteralTypesInReceiverPosition +-XXLanguage:-RangeUntilOperator This mode is not recommended for production use, as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! -compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.kt:1:9: warning: parameter 'ttlMillis' is never used -fun foo(ttlMillis: Long = 5 * 60 * 1000) {} - ^ -OK +compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.kt:3:19: error: this declaration needs opt-in. Its usage must be marked with '@kotlin.ExperimentalStdlibApi' or '@OptIn(kotlin.ExperimentalStdlibApi::class)' + for (x in 100 ..< 1) { + ^ +compiler/testData/cli/jvm/readingConfigFromEnvironment/overridingXx.kt:3:19: error: the feature "range until operator" is disabled + for (x in 100 ..< 1) { + ^ +COMPILATION_ERROR diff --git a/compiler/testData/codegen/box/binaryOp/boxingOfLiteralReceiverWithIntegerValueType.kt b/compiler/testData/codegen/box/binaryOp/boxingOfLiteralReceiverWithIntegerValueType.kt index 5dd3430b5db..f1098711361 100644 --- a/compiler/testData/codegen/box/binaryOp/boxingOfLiteralReceiverWithIntegerValueType.kt +++ b/compiler/testData/codegen/box/binaryOp/boxingOfLiteralReceiverWithIntegerValueType.kt @@ -1,7 +1,6 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // TARGET_BACKEND: JVM // IGNORE_BACKEND_K2: JVM_IR, JS_IR -// FIR status: don't support legacy feature +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design // WITH_STDLIB // This test exists only to check that we don't accidentally break the buggy behavior of the old JVM backend in JVM IR (KT-42321). // Feel free to remove it as soon as there's no language version where such code is allowed (KT-38895). diff --git a/compiler/testData/codegen/box/binaryOp/call.kt b/compiler/testData/codegen/box/binaryOp/call.kt index b8162f9bca8..303345c5e13 100644 --- a/compiler/testData/codegen/box/binaryOp/call.kt +++ b/compiler/testData/codegen/box/binaryOp/call.kt @@ -1,6 +1,5 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: JVM_IR, JS_IR -// FIR status: don't support legacy feature; for reasons this test is ignored, go to KT-46419 +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design fun box(): String { val a1: Byte = 1.plus(1) diff --git a/compiler/testData/codegen/box/binaryOp/callNullable.kt b/compiler/testData/codegen/box/binaryOp/callNullable.kt index 93c0e53209b..cac77ee9041 100644 --- a/compiler/testData/codegen/box/binaryOp/callNullable.kt +++ b/compiler/testData/codegen/box/binaryOp/callNullable.kt @@ -1,6 +1,5 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: JVM_IR, JS_IR -// FIR status: don't support legacy feature; for reasons this test is ignored, go to KT-46419 +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design fun box(): String { val a1: Byte? = 1.plus(1) diff --git a/compiler/testData/codegen/box/binaryOp/intrinsic.kt b/compiler/testData/codegen/box/binaryOp/intrinsic.kt index 876755ee490..d5e2aa565ce 100644 --- a/compiler/testData/codegen/box/binaryOp/intrinsic.kt +++ b/compiler/testData/codegen/box/binaryOp/intrinsic.kt @@ -1,6 +1,5 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: JVM_IR, JS_IR -// FIR status: don't support legacy feature; for reasons this test is ignored, go to KT-46419 +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design fun box(): String { val a1: Byte = 1 + 1 diff --git a/compiler/testData/codegen/box/binaryOp/intrinsicNullable.kt b/compiler/testData/codegen/box/binaryOp/intrinsicNullable.kt index b8c9ddadd34..a1650d7fc29 100644 --- a/compiler/testData/codegen/box/binaryOp/intrinsicNullable.kt +++ b/compiler/testData/codegen/box/binaryOp/intrinsicNullable.kt @@ -1,6 +1,5 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: JVM_IR, JS_IR -// FIR status: don't support legacy feature; for reasons this test is ignored, go to KT-46419 +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design fun box(): String { val a1: Byte? = 1 + 1 diff --git a/compiler/testData/codegen/box/binaryOp/overflowLong.kt b/compiler/testData/codegen/box/binaryOp/overflowLong.kt index c09a9be37bc..d0c8d82ae1e 100644 --- a/compiler/testData/codegen/box/binaryOp/overflowLong.kt +++ b/compiler/testData/codegen/box/binaryOp/overflowLong.kt @@ -1,5 +1,3 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition - fun box(): String { val a: Long = 2147483647 + 1 if (a != -2147483648L) return "fail: in this case we should add to ints and than cast the result to long - overflow expected" diff --git a/compiler/testData/codegen/box/evaluate/divide.kt b/compiler/testData/codegen/box/evaluate/divide.kt index 98bdb1ed0f2..225560b11a3 100644 --- a/compiler/testData/codegen/box/evaluate/divide.kt +++ b/compiler/testData/codegen/box/evaluate/divide.kt @@ -1,5 +1,5 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_FIR_DIAGNOSTICS +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design // TARGET_BACKEND: JVM // WITH_STDLIB diff --git a/compiler/testData/codegen/box/evaluate/floorDiv.kt b/compiler/testData/codegen/box/evaluate/floorDiv.kt index 44079c584b8..2b2cdc84560 100644 --- a/compiler/testData/codegen/box/evaluate/floorDiv.kt +++ b/compiler/testData/codegen/box/evaluate/floorDiv.kt @@ -1,5 +1,5 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_FIR_DIAGNOSTICS +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design // TARGET_BACKEND: JVM // WITH_STDLIB diff --git a/compiler/testData/codegen/box/evaluate/intrinsics.kt b/compiler/testData/codegen/box/evaluate/intrinsics.kt index 32ee8cd883f..349285421f4 100644 --- a/compiler/testData/codegen/box/evaluate/intrinsics.kt +++ b/compiler/testData/codegen/box/evaluate/intrinsics.kt @@ -1,6 +1,5 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: JVM_IR, JS_IR -// FIR status: don't support legacy feature +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design // TARGET_BACKEND: JVM // WITH_STDLIB diff --git a/compiler/testData/codegen/box/evaluate/maxValueByte.kt b/compiler/testData/codegen/box/evaluate/maxValueByte.kt index c3c81bc2de8..8249fa87f6d 100644 --- a/compiler/testData/codegen/box/evaluate/maxValueByte.kt +++ b/compiler/testData/codegen/box/evaluate/maxValueByte.kt @@ -1,5 +1,5 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_FIR_DIAGNOSTICS +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design // TARGET_BACKEND: JVM // WITH_STDLIB diff --git a/compiler/testData/codegen/box/evaluate/maxValueInt.kt b/compiler/testData/codegen/box/evaluate/maxValueInt.kt index 39ba46839ea..a1d0acc8f6e 100644 --- a/compiler/testData/codegen/box/evaluate/maxValueInt.kt +++ b/compiler/testData/codegen/box/evaluate/maxValueInt.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // TARGET_BACKEND: JVM // WITH_STDLIB diff --git a/compiler/testData/codegen/box/evaluate/minus.kt b/compiler/testData/codegen/box/evaluate/minus.kt index 10896c7b9d6..26a6ff1bae0 100644 --- a/compiler/testData/codegen/box/evaluate/minus.kt +++ b/compiler/testData/codegen/box/evaluate/minus.kt @@ -1,5 +1,5 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: JVM_IR, JS_IR +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design // TARGET_BACKEND: JVM // WITH_STDLIB diff --git a/compiler/testData/codegen/box/evaluate/mod.kt b/compiler/testData/codegen/box/evaluate/mod.kt index c0ebc6380c3..c7fdfb071d8 100644 --- a/compiler/testData/codegen/box/evaluate/mod.kt +++ b/compiler/testData/codegen/box/evaluate/mod.kt @@ -1,5 +1,5 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_FIR_DIAGNOSTICS +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design // TARGET_BACKEND: JVM // WITH_STDLIB diff --git a/compiler/testData/codegen/box/evaluate/multiply.kt b/compiler/testData/codegen/box/evaluate/multiply.kt index 1089e6e1003..075117e586b 100644 --- a/compiler/testData/codegen/box/evaluate/multiply.kt +++ b/compiler/testData/codegen/box/evaluate/multiply.kt @@ -1,5 +1,5 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: JVM_IR, JS_IR +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design // TARGET_BACKEND: JVM // WITH_STDLIB diff --git a/compiler/testData/codegen/box/evaluate/parenthesized.kt b/compiler/testData/codegen/box/evaluate/parenthesized.kt index b293c2befea..8dd7d61cde2 100644 --- a/compiler/testData/codegen/box/evaluate/parenthesized.kt +++ b/compiler/testData/codegen/box/evaluate/parenthesized.kt @@ -1,5 +1,5 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: JVM_IR, JS_IR +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design // TARGET_BACKEND: JVM // WITH_STDLIB diff --git a/compiler/testData/codegen/box/evaluate/plus.kt b/compiler/testData/codegen/box/evaluate/plus.kt index 3babb10de4c..d3af25a4313 100644 --- a/compiler/testData/codegen/box/evaluate/plus.kt +++ b/compiler/testData/codegen/box/evaluate/plus.kt @@ -1,5 +1,5 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: JVM_IR, JS_IR +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design // TARGET_BACKEND: JVM // WITH_STDLIB diff --git a/compiler/testData/codegen/box/evaluate/rem.kt b/compiler/testData/codegen/box/evaluate/rem.kt index aa36b3e375d..580a691e37f 100644 --- a/compiler/testData/codegen/box/evaluate/rem.kt +++ b/compiler/testData/codegen/box/evaluate/rem.kt @@ -1,5 +1,5 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: JVM_IR, JS_IR +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design // TARGET_BACKEND: JVM // WITH_STDLIB diff --git a/compiler/testData/codegen/box/fullJdk/kt46540.kt b/compiler/testData/codegen/box/fullJdk/kt46540.kt index 83681a1d1a0..a2ec57631f8 100644 --- a/compiler/testData/codegen/box/fullJdk/kt46540.kt +++ b/compiler/testData/codegen/box/fullJdk/kt46540.kt @@ -1,7 +1,6 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // TARGET_BACKEND: JVM // IGNORE_BACKEND_K2: JVM_IR, JS_IR -// FIR status: don't support legacy feature; for reasons this test is ignored, go to KT-46419 +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design // SKIP_JDK6 // FULL_JDK diff --git a/compiler/testData/codegen/box/unaryOp/call.kt b/compiler/testData/codegen/box/unaryOp/call.kt index 6cfe42d183c..e05ff6f700a 100644 --- a/compiler/testData/codegen/box/unaryOp/call.kt +++ b/compiler/testData/codegen/box/unaryOp/call.kt @@ -1,6 +1,5 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: JVM_IR, JS_IR -// FIR status: don't support legacy feature; for reasons this test is ignored, go to KT-46419 +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design fun box(): String { val a1: Byte = 1.unaryMinus() diff --git a/compiler/testData/codegen/box/unaryOp/callNullable.kt b/compiler/testData/codegen/box/unaryOp/callNullable.kt index 72839c78711..53e04ef0a02 100644 --- a/compiler/testData/codegen/box/unaryOp/callNullable.kt +++ b/compiler/testData/codegen/box/unaryOp/callNullable.kt @@ -1,6 +1,5 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: JVM_IR, JS_IR -// FIR status: don't support legacy feature; for reasons this test is ignored, go to KT-46419 +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design fun box(): String { val a1: Byte? = 1.unaryMinus() diff --git a/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt b/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt index af6f5f856d1..7a71b4532be 100644 --- a/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt +++ b/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // WITH_REFLECT // TARGET_BACKEND: JVM @@ -65,4 +64,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedType.kt b/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedType.kt index 3eb4952fb33..01977816070 100644 --- a/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedType.kt +++ b/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedType.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // WITH_REFLECT // TARGET_BACKEND: JVM @@ -62,4 +61,4 @@ fun box(): String { } return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/bytecodeText/constants/byte.kt b/compiler/testData/codegen/bytecodeText/constants/byte.kt index 705b2e29396..1f0255b4815 100644 --- a/compiler/testData/codegen/bytecodeText/constants/byte.kt +++ b/compiler/testData/codegen/bytecodeText/constants/byte.kt @@ -1,6 +1,5 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: JVM_IR -// For reasons this test is ignored, go to KT-46419 +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design val a: Byte = 1 + 10 diff --git a/compiler/testData/codegen/bytecodeText/constants/short.kt b/compiler/testData/codegen/bytecodeText/constants/short.kt index d14189253ec..7a38176f847 100644 --- a/compiler/testData/codegen/bytecodeText/constants/short.kt +++ b/compiler/testData/codegen/bytecodeText/constants/short.kt @@ -1,6 +1,5 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: JVM_IR -// For reasons this test is ignored, go to KT-46419 +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design val a: Short = 1 + 255 diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/divide.fir.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/divide.fir.kt index 50eb8d27a22..39bac679222 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/divide.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/divide.fir.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/divide.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/divide.kt index 11bd9d7e6f5..9a1be48c120 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/divide.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/divide.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/intrincics.fir.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/intrincics.fir.kt index 6299b512c7c..db00775cff2 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/intrincics.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/intrincics.fir.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann(p1: Int, diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/intrincics.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/intrincics.kt index c036d1b8f7e..421f45ad246 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/intrincics.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/intrincics.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann(p1: Int, diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/long.fir.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/long.fir.kt index 79d4facad40..52ed559f206 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/long.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/long.fir.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/long.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/long.kt index 9af73154177..77a08892af0 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/long.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/long.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueByte.fir.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueByte.fir.kt index 818194630a5..5bffb467f24 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueByte.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueByte.fir.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueByte.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueByte.kt index 8146d177798..82c4055767d 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueByte.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueByte.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueInt.fir.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueInt.fir.kt index a84efe598fb..e75681b68f5 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueInt.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueInt.fir.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueInt.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueInt.kt index 272f28969ee..8260cf979a8 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueInt.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/maxValueInt.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/miltiply.fir.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/miltiply.fir.kt index b9f9308e6b1..66ea11443b2 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/miltiply.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/miltiply.fir.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/miltiply.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/miltiply.kt index b0927efc7e8..be4432a74f2 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/miltiply.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/miltiply.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/minus.fir.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/minus.fir.kt index a04d78ed0c5..c3ae55fd0ff 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/minus.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/minus.fir.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/minus.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/minus.kt index 02b1ceff496..a2f33576a6e 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/minus.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/minus.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/mod.fir.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/mod.fir.kt index e5560ffb577..69317a9b269 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/mod.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/mod.fir.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/mod.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/mod.kt index abe756cac99..3e558d1ab57 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/mod.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/mod.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/plus.fir.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/plus.fir.kt index 550a3822111..0063fcebfef 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/plus.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/plus.fir.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/plus.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/plus.kt index a7f76b6801c..c3e397e80eb 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/plus.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/plus.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition package test annotation class Ann( diff --git a/compiler/testData/diagnostics/tests/evaluate/binaryMinusDepOnExpType.fir.kt b/compiler/testData/diagnostics/tests/evaluate/binaryMinusDepOnExpType.fir.kt index e6545c73e44..132e132e924 100644 --- a/compiler/testData/diagnostics/tests/evaluate/binaryMinusDepOnExpType.fir.kt +++ b/compiler/testData/diagnostics/tests/evaluate/binaryMinusDepOnExpType.fir.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition fun fooInt(p: Int) = p fun fooLong(p: Long) = p fun fooByte(p: Byte) = p diff --git a/compiler/testData/diagnostics/tests/evaluate/binaryMinusDepOnExpType.kt b/compiler/testData/diagnostics/tests/evaluate/binaryMinusDepOnExpType.kt index 62403c8160b..2a3646ababe 100644 --- a/compiler/testData/diagnostics/tests/evaluate/binaryMinusDepOnExpType.kt +++ b/compiler/testData/diagnostics/tests/evaluate/binaryMinusDepOnExpType.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition fun fooInt(p: Int) = p fun fooLong(p: Long) = p fun fooByte(p: Byte) = p diff --git a/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.fir.kt b/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.fir.kt index 585f25a5318..4812a2c3de8 100644 --- a/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.fir.kt +++ b/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.fir.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses -ApproximateIntegerLiteralTypesInReceiverPosition +// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses // SKIP_JAVAC // ALLOW_KOTLIN_PACKAGE diff --git a/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.kt b/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.kt index a2acf2dbae3..93512ea1dc3 100644 --- a/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.kt +++ b/compiler/testData/diagnostics/tests/evaluate/inlineClasses/constructorOfUnsignedType.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses -ApproximateIntegerLiteralTypesInReceiverPosition +// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses // SKIP_JAVAC // ALLOW_KOTLIN_PACKAGE diff --git a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperations.fir.kt b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperations.fir.kt index b9505ce3840..22d88eb549a 100644 --- a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperations.fir.kt +++ b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperations.fir.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition fun fooInt(p: Int) = p fun fooLong(p: Long) = p fun fooByte(p: Byte) = p diff --git a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperations.kt b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperations.kt index dc230fa136a..5480816f8c8 100644 --- a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperations.kt +++ b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperations.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition fun fooInt(p: Int) = p fun fooLong(p: Long) = p fun fooByte(p: Byte) = p diff --git a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsCall.fir.kt b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsCall.fir.kt index cd9c1813f3d..37ee4227d49 100644 --- a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsCall.fir.kt +++ b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsCall.fir.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition fun fooInt(p: Int) = p fun fooLong(p: Long) = p fun fooByte(p: Byte) = p diff --git a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsCall.kt b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsCall.kt index 45f43d4a08a..186f2f7321b 100644 --- a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsCall.kt +++ b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsCall.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition fun fooInt(p: Int) = p fun fooLong(p: Long) = p fun fooByte(p: Byte) = p diff --git a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.fir.kt b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.fir.kt index a8d60b15873..0f4b5caceb1 100644 --- a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.fir.kt +++ b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.fir.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition fun fooInt(p: Int) = p fun fooLong(p: Long) = p fun fooByte(p: Byte) = p diff --git a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.kt b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.kt index ed1d6e1e8e4..b2ac6c42114 100644 --- a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.kt +++ b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition fun fooInt(p: Int) = p fun fooLong(p: Long) = p fun fooByte(p: Byte) = p diff --git a/compiler/testData/diagnostics/tests/evaluate/parentesized.fir.kt b/compiler/testData/diagnostics/tests/evaluate/parentesized.fir.kt index 9229e78f278..3d872367ba6 100644 --- a/compiler/testData/diagnostics/tests/evaluate/parentesized.fir.kt +++ b/compiler/testData/diagnostics/tests/evaluate/parentesized.fir.kt @@ -1,4 +1,3 @@ -// LANGUAGE: +ApproximateIntegerLiteralTypesInReceiverPosition val p1: Byte = (1 + 2) * 2 val p2: Short = (1 + 2) * 2 val p3: Int = (1 + 2) * 2 diff --git a/compiler/testData/diagnostics/tests/evaluate/parentesized.kt b/compiler/testData/diagnostics/tests/evaluate/parentesized.kt index f533ba18019..8685080bf03 100644 --- a/compiler/testData/diagnostics/tests/evaluate/parentesized.kt +++ b/compiler/testData/diagnostics/tests/evaluate/parentesized.kt @@ -1,11 +1,10 @@ -// LANGUAGE: +ApproximateIntegerLiteralTypesInReceiverPosition -val p1: Byte = (1 + 2) * 2 -val p2: Short = (1 + 2) * 2 +val p1: Byte = (1 + 2) * 2 +val p2: Short = (1 + 2) * 2 val p3: Int = (1 + 2) * 2 -val p4: Long = (1 + 2) * 2 +val p4: Long = (1 + 2) * 2 -val b1: Byte = (1.toByte() + 2) * 2 -val b2: Short = (1.toShort() + 2) * 2 +val b1: Byte = (1.toByte() + 2) * 2 +val b2: Short = (1.toShort() + 2) * 2 val b3: Int = (1.toInt() + 2) * 2 val b4: Long = (1.toLong() + 2) * 2 diff --git a/compiler/testData/diagnostics/tests/evaluate/parentesized.txt b/compiler/testData/diagnostics/tests/evaluate/parentesized.txt index 8748b6d2aa3..134010e38f9 100644 --- a/compiler/testData/diagnostics/tests/evaluate/parentesized.txt +++ b/compiler/testData/diagnostics/tests/evaluate/parentesized.txt @@ -6,8 +6,8 @@ public val b3: kotlin.Int = 6 public val b4: kotlin.Long = 6.toLong() public val i1: kotlin.Int = 6 public val i2: kotlin.Int = 6 -public val p1: kotlin.Byte = 6 -public val p2: kotlin.Short = 6 +public val p1: kotlin.Byte = 6.toByte() +public val p2: kotlin.Short = 6.toShort() public val p3: kotlin.Int = 6 -public val p4: kotlin.Long = 6 +public val p4: kotlin.Long = 6.toLong() diff --git a/compiler/testData/diagnostics/tests/numbers/kt47447.kt b/compiler/testData/diagnostics/tests/numbers/kt47447.kt index 7f423fc03c2..19fcb032b3a 100644 --- a/compiler/testData/diagnostics/tests/numbers/kt47447.kt +++ b/compiler/testData/diagnostics/tests/numbers/kt47447.kt @@ -1,5 +1,4 @@ // FIR_IDENTICAL -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // ISSUE: KT-47447 // FULL_JDK diff --git a/compiler/testData/diagnostics/tests/numbers/kt47729.kt b/compiler/testData/diagnostics/tests/numbers/kt47729.kt index 2ec025df9e6..80fd4cad113 100644 --- a/compiler/testData/diagnostics/tests/numbers/kt47729.kt +++ b/compiler/testData/diagnostics/tests/numbers/kt47729.kt @@ -1,5 +1,4 @@ // FIR_IDENTICAL -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // ISSUE: Kt-47447, KT-47729 fun takeLong(value : Long) {} diff --git a/compiler/testData/diagnostics/tests/numbers/kt47729_parenthesis.kt b/compiler/testData/diagnostics/tests/numbers/kt47729_parenthesis.kt index 0ee887ff059..ecb6063484e 100644 --- a/compiler/testData/diagnostics/tests/numbers/kt47729_parenthesis.kt +++ b/compiler/testData/diagnostics/tests/numbers/kt47729_parenthesis.kt @@ -1,5 +1,4 @@ // FIR_IDENTICAL -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // ISSUE: Kt-47447, KT-47729 fun takeLong(x: Long) {} diff --git a/compiler/testData/diagnostics/tests/numbers/kt48361_disabled.kt b/compiler/testData/diagnostics/tests/numbers/kt48361.kt similarity index 60% rename from compiler/testData/diagnostics/tests/numbers/kt48361_disabled.kt rename to compiler/testData/diagnostics/tests/numbers/kt48361.kt index f335d3e2790..1f63bf330bd 100644 --- a/compiler/testData/diagnostics/tests/numbers/kt48361_disabled.kt +++ b/compiler/testData/diagnostics/tests/numbers/kt48361.kt @@ -1,5 +1,4 @@ // FIR_IDENTICAL -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition fun foo(ttlMillis: Long = 5 * 60 * 1000) {} diff --git a/compiler/testData/diagnostics/tests/numbers/kt48361_disabled.txt b/compiler/testData/diagnostics/tests/numbers/kt48361.txt similarity index 100% rename from compiler/testData/diagnostics/tests/numbers/kt48361_disabled.txt rename to compiler/testData/diagnostics/tests/numbers/kt48361.txt diff --git a/compiler/testData/diagnostics/tests/numbers/kt48361_enabled.fir.kt b/compiler/testData/diagnostics/tests/numbers/kt48361_enabled.fir.kt deleted file mode 100644 index af14b49ce39..00000000000 --- a/compiler/testData/diagnostics/tests/numbers/kt48361_enabled.fir.kt +++ /dev/null @@ -1,6 +0,0 @@ -// LANGUAGE: +ApproximateIntegerLiteralTypesInReceiverPosition - -fun foo(ttlMillis: Long = 5 * 60 * 1000) {} - -const val cacheSize: Long = 4096 * 4 - diff --git a/compiler/testData/diagnostics/tests/numbers/kt48361_enabled.kt b/compiler/testData/diagnostics/tests/numbers/kt48361_enabled.kt deleted file mode 100644 index a29cd7d8e1c..00000000000 --- a/compiler/testData/diagnostics/tests/numbers/kt48361_enabled.kt +++ /dev/null @@ -1,6 +0,0 @@ -// LANGUAGE: +ApproximateIntegerLiteralTypesInReceiverPosition - -fun foo(ttlMillis: Long = 5 * 60 * 1000) {} - -const val cacheSize: Long = 4096 * 4 - diff --git a/compiler/testData/diagnostics/tests/numbers/kt48361_enabled.txt b/compiler/testData/diagnostics/tests/numbers/kt48361_enabled.txt deleted file mode 100644 index 9cf7a8a24cf..00000000000 --- a/compiler/testData/diagnostics/tests/numbers/kt48361_enabled.txt +++ /dev/null @@ -1,4 +0,0 @@ -package - -public const val cacheSize: kotlin.Long = 16384 -public fun foo(/*0*/ ttlMillis: kotlin.Long = ...): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.fir.kt b/compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.fir.kt index 2c47902bb54..72f61c38047 100644 --- a/compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.fir.kt +++ b/compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.fir.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // This test exists only to check that we don't accidentally break the buggy behavior of the old JVM backend in JVM IR (KT-42321). // Feel free to remove it as soon as there's no language version where such code is allowed (KT-38895). diff --git a/compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.kt b/compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.kt index 677695477fe..0ec2ea4b02f 100644 --- a/compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.kt +++ b/compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // This test exists only to check that we don't accidentally break the buggy behavior of the old JVM backend in JVM IR (KT-42321). // Feel free to remove it as soon as there's no language version where such code is allowed (KT-38895). diff --git a/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_newResolve.fir.kt b/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_newResolve.fir.kt deleted file mode 100644 index e93e2602263..00000000000 --- a/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_newResolve.fir.kt +++ /dev/null @@ -1,116 +0,0 @@ -// LANGUAGE: +ApproximateIntegerLiteralTypesInReceiverPosition -// WITH_STDLIB -// ISSUE: KT-38895 - -fun takeByte(b: Byte) {} -fun takeInt(b: Int) {} -fun takeLong(b: Long) {} - -fun testByteBinaryOperators() { - takeByte(2 + 1) - takeByte(2 - 1) - takeByte(2 * 1) - takeByte(2 / 1) - takeByte(2 % 1) - - takeByte(2.plus(1)) - takeByte(2.minus(1)) - takeByte(2.times(1)) - takeByte(2.div(1)) - takeByte(2.rem(1)) - takeByte(2 shl 1) - takeByte(2 shr 1) - takeByte(2 ushr 1) - - takeByte(2 and 1) - takeByte(2 or 1) - takeByte(2 xor 1) -} - -fun testByteUnaryOperators() { - // No mismatch - takeByte(+1) - takeByte(-1) - - // Mismatch - takeByte(2.unaryPlus()) - takeByte(2.unaryMinus()) - takeByte(2.inv()) - takeByte(1.inc()) - takeByte(1.dec()) -} - -fun testLongBinaryOperators() { - takeLong(2 + 1) - takeLong(2 - 1) - takeLong(2 * 1) - takeLong(2 / 1) - takeLong(2 % 1) - - takeLong(2.plus(1)) - takeLong(2.minus(1)) - takeLong(2.times(1)) - takeLong(2.div(1)) - takeLong(2.rem(1)) - takeLong(2 shl 1) - takeLong(2 shr 1) - takeLong(2 ushr 1) - - takeLong(2 and 1) - takeLong(2 or 1) - takeLong(2 xor 1) - - // positive - takeLong(2 * 100000000000) -} - -fun testLongUnaryOperators() { - // No mismatch - takeLong(+1) - takeLong(-1) - - // Mismatch - takeLong(2.unaryPlus()) - takeLong(2.unaryMinus()) - takeLong(2.inv()) - takeLong(1.inc()) - takeLong(1.dec()) -} - -fun testIntBinaryOperators() { - takeInt(2 + 1) - takeInt(2 - 1) - takeInt(2 * 1) - takeInt(2 / 1) - takeInt(2 % 1) - - takeInt(2.plus(1)) - takeInt(2.minus(1)) - takeInt(2.times(1)) - takeInt(2.div(1)) - takeInt(2.rem(1)) - takeInt(2 shl 1) - takeInt(2 shr 1) - takeInt(2 ushr 1) - - takeInt(2 and 1) - takeInt(2 or 1) - takeInt(2 xor 1) -} - -fun testIntUnaryOperators() { - takeInt(+1) - takeInt(-1) - - takeInt(2.unaryPlus()) - takeInt(2.unaryMinus()) - takeInt(2.inv()) - takeInt(1.inc()) - takeInt(1.dec()) -} - -fun testNoOperators() { - takeByte(1) - takeInt(1) - takeLong(1) -} diff --git a/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_newResolve.kt b/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_newResolve.kt deleted file mode 100644 index 436e0fd0740..00000000000 --- a/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_newResolve.kt +++ /dev/null @@ -1,116 +0,0 @@ -// LANGUAGE: +ApproximateIntegerLiteralTypesInReceiverPosition -// WITH_STDLIB -// ISSUE: KT-38895 - -fun takeByte(b: Byte) {} -fun takeInt(b: Int) {} -fun takeLong(b: Long) {} - -fun testByteBinaryOperators() { - takeByte(2 + 1) - takeByte(2 - 1) - takeByte(2 * 1) - takeByte(2 / 1) - takeByte(2 % 1) - - takeByte(2.plus(1)) - takeByte(2.minus(1)) - takeByte(2.times(1)) - takeByte(2.div(1)) - takeByte(2.rem(1)) - takeByte(2 shl 1) - takeByte(2 shr 1) - takeByte(2 ushr 1) - - takeByte(2 and 1) - takeByte(2 or 1) - takeByte(2 xor 1) -} - -fun testByteUnaryOperators() { - // No mismatch - takeByte(+1) - takeByte(-1) - - // Mismatch - takeByte(2.unaryPlus()) - takeByte(2.unaryMinus()) - takeByte(2.inv()) - takeByte(1.inc()) - takeByte(1.dec()) -} - -fun testLongBinaryOperators() { - takeLong(2 + 1) - takeLong(2 - 1) - takeLong(2 * 1) - takeLong(2 / 1) - takeLong(2 % 1) - - takeLong(2.plus(1)) - takeLong(2.minus(1)) - takeLong(2.times(1)) - takeLong(2.div(1)) - takeLong(2.rem(1)) - takeLong(2 shl 1) - takeLong(2 shr 1) - takeLong(2 ushr 1) - - takeLong(2 and 1) - takeLong(2 or 1) - takeLong(2 xor 1) - - // positive - takeLong(2 * 100000000000) -} - -fun testLongUnaryOperators() { - // No mismatch - takeLong(+1) - takeLong(-1) - - // Mismatch - takeLong(2.unaryPlus()) - takeLong(2.unaryMinus()) - takeLong(2.inv()) - takeLong(1.inc()) - takeLong(1.dec()) -} - -fun testIntBinaryOperators() { - takeInt(2 + 1) - takeInt(2 - 1) - takeInt(2 * 1) - takeInt(2 / 1) - takeInt(2 % 1) - - takeInt(2.plus(1)) - takeInt(2.minus(1)) - takeInt(2.times(1)) - takeInt(2.div(1)) - takeInt(2.rem(1)) - takeInt(2 shl 1) - takeInt(2 shr 1) - takeInt(2 ushr 1) - - takeInt(2 and 1) - takeInt(2 or 1) - takeInt(2 xor 1) -} - -fun testIntUnaryOperators() { - takeInt(+1) - takeInt(-1) - - takeInt(2.unaryPlus()) - takeInt(2.unaryMinus()) - takeInt(2.inv()) - takeInt(1.inc()) - takeInt(1.dec()) -} - -fun testNoOperators() { - takeByte(1) - takeInt(1) - takeLong(1) -} diff --git a/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_newResolve.txt b/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_newResolve.txt deleted file mode 100644 index 40c7f607706..00000000000 --- a/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_newResolve.txt +++ /dev/null @@ -1,12 +0,0 @@ -package - -public fun takeByte(/*0*/ b: kotlin.Byte): kotlin.Unit -public fun takeInt(/*0*/ b: kotlin.Int): kotlin.Unit -public fun takeLong(/*0*/ b: kotlin.Long): kotlin.Unit -public fun testByteBinaryOperators(): kotlin.Unit -public fun testByteUnaryOperators(): kotlin.Unit -public fun testIntBinaryOperators(): kotlin.Unit -public fun testIntUnaryOperators(): kotlin.Unit -public fun testLongBinaryOperators(): kotlin.Unit -public fun testLongUnaryOperators(): kotlin.Unit -public fun testNoOperators(): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_warning.fir.kt b/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_warning.fir.kt index 2c8aeda5d04..9b08554750b 100644 --- a/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_warning.fir.kt +++ b/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_warning.fir.kt @@ -1,4 +1,3 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // 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 ec39fa20a7e..9811219ef98 100644 --- a/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_warning.kt +++ b/compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_warning.kt @@ -1,4 +1,3 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // WITH_STDLIB // ISSUE: KT-38895 diff --git a/compiler/testData/ir/irText/expressions/kt42321.kt b/compiler/testData/ir/irText/expressions/kt42321.kt index 7a97279da4e..1ab9f0b6d6e 100644 --- a/compiler/testData/ir/irText/expressions/kt42321.kt +++ b/compiler/testData/ir/irText/expressions/kt42321.kt @@ -1,5 +1,5 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: JVM_IR +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design // SKIP_KT_DUMP // This test exists only to check that we don't accidentally break the buggy behavior of the old JVM backend in JVM IR (KT-42321). // Feel free to remove it as soon as there's no language version where such code is allowed (KT-38895). diff --git a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt index 48723ca063f..8dfa688275e 100644 --- a/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt +++ b/compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt @@ -1,6 +1,5 @@ -// LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // IGNORE_BACKEND_K2: ANY -// For reasons this test is ignored, go to KT-46419 +// FIR status: KT-46419, ILT conversions to Byte and Short are not supported by design val test1: Long = 42 val test2: Short = 42 diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index d633015cccd..007f2957866 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -22291,15 +22291,9 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { } @Test - @TestMetadata("kt48361_disabled.kt") - public void testKt48361_disabled() throws Exception { - runTest("compiler/testData/diagnostics/tests/numbers/kt48361_disabled.kt"); - } - - @Test - @TestMetadata("kt48361_enabled.kt") - public void testKt48361_enabled() throws Exception { - runTest("compiler/testData/diagnostics/tests/numbers/kt48361_enabled.kt"); + @TestMetadata("kt48361.kt") + public void testKt48361() throws Exception { + runTest("compiler/testData/diagnostics/tests/numbers/kt48361.kt"); } @Test @@ -22308,12 +22302,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/numbers/literalReceiverWithIntegerValueType.kt"); } - @Test - @TestMetadata("newLiteralOperatorsResolution_newResolve.kt") - public void testNewLiteralOperatorsResolution_newResolve() throws Exception { - runTest("compiler/testData/diagnostics/tests/numbers/newLiteralOperatorsResolution_newResolve.kt"); - } - @Test @TestMetadata("newLiteralOperatorsResolution_warning.kt") public void testNewLiteralOperatorsResolution_warning() throws Exception { diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt index 453391501cf..56912a9ee7f 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt @@ -128,12 +128,6 @@ abstract class AbstractDiagnosticTest : AbstractKotlinCompilerTest() { } // ----------------------- constant evaluation tests ----------------------- - forTestsMatching("compiler/testData/diagnostics/tests/constantEvaluator/*") { - defaultDirectives { - LANGUAGE with "-ApproximateIntegerLiteralTypesInReceiverPosition" - } - } - forTestsMatching("compiler/testData/diagnostics/tests/constantEvaluator/constant/*") { defaultDirectives { CHECK_COMPILE_TIME_VALUES with ConstantValuesHandler.Mode.Constant diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 2077762e900..301130e5530 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -287,9 +287,6 @@ enum class LanguageFeature( // Disabled for indefinite time. See KT-53751 IgnoreNullabilityForErasedValueParameters(sinceVersion = null, kind = BUG_FIX), - // Disabled for indefinite time. See KT-48535 and related discussion - ApproximateIntegerLiteralTypesInReceiverPosition(sinceVersion = null), - // Disabled for indefinite time. Disables restrictions of builder inference without annotation // Note: In 1.7.0, builder inference without annotation was introduced. // However, later we encountered various situations when it works incorrectly, and decided to forbid them. diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/CompileTimeConstant.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/CompileTimeConstant.kt index e29d2292c7c..538e6cbc67d 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/CompileTimeConstant.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/CompileTimeConstant.kt @@ -28,7 +28,7 @@ interface CompileTimeConstant { val isError: Boolean get() = false - val parameters: CompileTimeConstant.Parameters + val parameters: Parameters val moduleDescriptor: ModuleDescriptor @@ -58,8 +58,7 @@ interface CompileTimeConstant { val usesVariableAsConstant: Boolean, val usesNonConstValAsConstant: Boolean, // `isConvertableConstVal` means that this is `const val` that has `ImplicitIntegerCoercion` annotation - val isConvertableConstVal: Boolean, - val dontCreateILT: Boolean + val isConvertableConstVal: Boolean ) override fun equals(other: Any?): Boolean @@ -150,8 +149,7 @@ class IntegerValueTypeConstant( isUnsignedLongNumberLiteral = parameters.isUnsignedLongNumberLiteral, usesVariableAsConstant = parameters.usesVariableAsConstant, usesNonConstValAsConstant = parameters.usesNonConstValAsConstant, - isConvertableConstVal = parameters.isConvertableConstVal, - dontCreateILT = false + isConvertableConstVal = parameters.isConvertableConstVal ) return IntegerValueTypeConstant(value, module, newParameters, newInferenceEnabled, convertedFromSigned = true) @@ -165,8 +163,7 @@ class IntegerValueTypeConstant( isUnsignedLongNumberLiteral = parameters.isUnsignedLongNumberLiteral, usesVariableAsConstant = parameters.usesVariableAsConstant, usesNonConstValAsConstant = parameters.usesNonConstValAsConstant, - isConvertableConstVal = parameters.isConvertableConstVal, - dontCreateILT = false + isConvertableConstVal = parameters.isConvertableConstVal ) return IntegerValueTypeConstant(value, module, newParameters, newInferenceEnabled, convertedFromSigned = true) diff --git a/js/js.translator/testData/box/expression/cast/implicitCastToLong.kt b/js/js.translator/testData/box/expression/cast/implicitCastToLong.kt index 12b49ede575..c9896d95e60 100644 --- a/js/js.translator/testData/box/expression/cast/implicitCastToLong.kt +++ b/js/js.translator/testData/box/expression/cast/implicitCastToLong.kt @@ -1,4 +1,3 @@ -// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition // EXPECTED_REACHABLE_NODES: 1375 package foo @@ -14,4 +13,4 @@ fun box(): String { return "OK" } -fun id(x: Long) = x \ No newline at end of file +fun id(x: Long) = x