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 c27d2d972fd..297302d2acb 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 @@ -13326,6 +13326,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @Test + @TestMetadata("changingResolveIfDontUseBuilderInference.kt") + public void testChangingResolveIfDontUseBuilderInference() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/changingResolveIfDontUseBuilderInference.kt"); + } + @Test @TestMetadata("kt47744.kt") public void testKt47744() 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 0f7855d9263..6b5627f961d 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 @@ -13326,6 +13326,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @Test + @TestMetadata("changingResolveIfDontUseBuilderInference.kt") + public void testChangingResolveIfDontUseBuilderInference() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/changingResolveIfDontUseBuilderInference.kt"); + } + @Test @TestMetadata("kt47744.kt") public void testKt47744() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index abac5ddebdf..6a4e1b455fe 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -18019,6 +18019,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/inference/builderInference/capturedTypes.kt"); } + @Test + @TestMetadata("changingResolveIfDontUseBuilderInferenceDisabledFeature.kt") + public void testChangingResolveIfDontUseBuilderInferenceDisabledFeature() throws Exception { + runTest("compiler/testData/codegen/box/inference/builderInference/changingResolveIfDontUseBuilderInferenceDisabledFeature.kt"); + } + @Test @TestMetadata("commonSuperType.kt") public void testCommonSuperType() throws Exception { @@ -18055,6 +18061,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/inference/builderInference/constraintsBetweenTwoStubVariables.kt"); } + @Test + @TestMetadata("cstBasedOnTwoBuilderInferenceLambda.kt") + public void testCstBasedOnTwoBuilderInferenceLambda() throws Exception { + runTest("compiler/testData/codegen/box/inference/builderInference/cstBasedOnTwoBuilderInferenceLambda.kt"); + } + @Test @TestMetadata("inferFromExpectedType.kt") public void testInferFromExpectedType() throws Exception { @@ -18139,18 +18151,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferences.kt"); } - @Test - @TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt") - public void testSpecialCallsWithCallableReferencesDontCareTypeInBlockExpression() throws Exception { - runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt"); - } - - @Test - @TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt") - public void testSpecialCallsWithCallableReferencesDontCareTypeInBlockExression() throws Exception { - runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt"); - } - @Test @TestMetadata("specialCallsWithCallableReferencesDontRewriteAtSlice.kt") public void testSpecialCallsWithCallableReferencesDontRewriteAtSlice() throws Exception { @@ -18228,6 +18228,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT public void testWithExpectedType() throws Exception { runTest("compiler/testData/codegen/box/inference/builderInference/withExpectedType.kt"); } + + @Test + @TestMetadata("withoutAnnotation.kt") + public void testWithoutAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/inference/builderInference/withoutAnnotation.kt"); + } + + @Test + @TestMetadata("withoutAnnotationDisabledFeature.kt") + public void testWithoutAnnotationDisabledFeature() throws Exception { + runTest("compiler/testData/codegen/box/inference/builderInference/withoutAnnotationDisabledFeature.kt"); + } } } diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintSystemCompletionContext.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintSystemCompletionContext.kt index 0445128706e..32073b002a5 100644 --- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintSystemCompletionContext.kt +++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintSystemCompletionContext.kt @@ -25,6 +25,7 @@ interface ConstraintSystemCompletionContext : VariableFixationFinder.Context, Re fun canBeProper(type: KotlinTypeMarker): Boolean fun containsOnlyFixedOrPostponedVariables(type: KotlinTypeMarker): Boolean + fun containsOnlyFixedVariables(type: KotlinTypeMarker): Boolean // mutable operations fun addError(error: ConstraintSystemError) diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt index 28bc250f0ff..0e8f196b330 100644 --- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt +++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/model/NewConstraintSystemImpl.kt @@ -482,6 +482,14 @@ class NewConstraintSystemImpl( } } + override fun containsOnlyFixedVariables(type: KotlinTypeMarker): Boolean { + checkState(State.BUILDING, State.COMPLETION) + return !type.contains { + val typeConstructor = it.typeConstructor() + storage.notFixedTypeVariables.containsKey(typeConstructor) + } + } + // PostponedArgumentsAnalyzer.Context override fun buildCurrentSubstitutor(): TypeSubstitutorMarker { checkState(State.BUILDING, State.COMPLETION, State.TRANSACTION) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ResolutionParts.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ResolutionParts.kt index ef84bb63520..14a502a9043 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ResolutionParts.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ResolutionParts.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.resolve.calls.components import org.jetbrains.kotlin.builtins.UnsignedTypes import org.jetbrains.kotlin.builtins.getReceiverTypeFromFunctionType +import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor import org.jetbrains.kotlin.resolve.calls.components.TypeArgumentsToParametersMapper.TypeArgumentsMapping.NoExplicitArguments @@ -274,11 +275,15 @@ internal object PostponedVariablesInitializerResolutionPart : ResolutionPart() { for ((argument, parameter) in resolvedCall.argumentToCandidateParameter) { if (!callComponents.statelessCallbacks.isBuilderInferenceCall(argument, parameter)) continue val receiverType = parameter.type.getReceiverTypeFromFunctionType() ?: continue + val dontUseBuilderInferenceIfPossible = + callComponents.languageVersionSettings.supportsFeature(LanguageFeature.UseBuilderInferenceOnlyIfNeeded) if (argument is LambdaKotlinCallArgument && !argument.hasBuilderInferenceAnnotation) { argument.hasBuilderInferenceAnnotation = true } + if (dontUseBuilderInferenceIfPossible) continue + for (freshVariable in resolvedCall.freshVariablesSubstitutor.freshVariables) { if (resolvedCall.typeArgumentMappingByOriginal.getTypeArgument(freshVariable.originalTypeParameter) is SimpleTypeArgument) continue diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/KotlinConstraintSystemCompleter.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/KotlinConstraintSystemCompleter.kt index f2ab0c5f26c..59ac07cbdb7 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/KotlinConstraintSystemCompleter.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/KotlinConstraintSystemCompleter.kt @@ -5,6 +5,8 @@ package org.jetbrains.kotlin.resolve.calls.inference.components +import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.resolve.calls.components.transformToResolvedLambda import org.jetbrains.kotlin.resolve.calls.inference.model.* import org.jetbrains.kotlin.resolve.calls.model.* @@ -21,6 +23,7 @@ class KotlinConstraintSystemCompleter( private val resultTypeResolver: ResultTypeResolver, val variableFixationFinder: VariableFixationFinder, private val postponedArgumentInputTypesResolver: PostponedArgumentInputTypesResolver, + private val languageVersionSettings: LanguageVersionSettings ) { fun runCompletion( c: ConstraintSystemCompletionContext, @@ -137,14 +140,19 @@ class KotlinConstraintSystemCompleter( if (fixNextReadyVariable(completionMode, topLevelAtoms, topLevelType, collectVariablesFromContext, postponedArguments)) continue - // Stage 7: report "not enough information" for uninferred type variables + // Stage 7: try to complete call with the builder inference if there are uninferred type variables + val areThereAppearedProperConstraintsForSomeVariable = + tryToCompleteWithBuilderInference(completionMode, topLevelType, postponedArguments, analyze) + + if (areThereAppearedProperConstraintsForSomeVariable) + continue + + // Stage 8: report "not enough information" for uninferred type variables reportNotEnoughTypeInformation( completionMode, topLevelAtoms, topLevelType, collectVariablesFromContext, postponedArguments, diagnosticsHolder ) - if (wasFixedSomeVariable) - continue - // Stage 7: force analysis of remaining not analyzed postponed arguments and rerun stages if there are + // Stage 9: force analysis of remaining not analyzed postponed arguments and rerun stages if there are if (completionMode == ConstraintSystemCompletionMode.FULL) { if (analyzeRemainingNotAnalyzedPostponedArgument(postponedArguments, analyze)) continue @@ -154,6 +162,47 @@ class KotlinConstraintSystemCompleter( } } + private fun ConstraintSystemCompletionContext.tryToCompleteWithBuilderInference( + completionMode: ConstraintSystemCompletionMode, + topLevelType: UnwrappedType, + postponedArguments: List, + analyze: (PostponedResolvedAtom) -> Unit + ): Boolean { + if (completionMode == ConstraintSystemCompletionMode.PARTIAL) return false + + val useBuilderInferenceOnlyIfNeeded = languageVersionSettings.supportsFeature(LanguageFeature.UseBuilderInferenceOnlyIfNeeded) + + // If we use the builder inference anyway (if the annotation is presented), then we are already analysed builder inference lambdas + if (!useBuilderInferenceOnlyIfNeeded) return false + + val lambdaArguments = postponedArguments.filterIsInstance().takeIf { it.isNotEmpty() } ?: return false + + return lambdaArguments.any { argument -> + if (!argument.atom.hasBuilderInferenceAnnotation) + return@any false + + val notFixedInputTypeVariables = argument.inputTypes + .map { it.extractTypeVariables() }.flatten().filter { it !in fixedTypeVariables } + + if (notFixedInputTypeVariables.isEmpty()) return@any false + + for (variable in notFixedInputTypeVariables) { + getBuilder().markPostponedVariable(notFixedTypeVariables.getValue(variable).typeVariable) + } + + analyze(argument) + + val variableForFixation = variableFixationFinder.findFirstVariableForFixation( + this, notFixedInputTypeVariables, postponedArguments, completionMode, topLevelType + ) + + // continue completion (rerun stages) only if ready for fixation variables with proper constraints have appeared + // (after analysing a lambda with the builder inference) + // otherwise we report "not enough type information" error + return variableForFixation?.hasProperConstraint == true + } + } + private fun transformToAtomWithNewFunctionalExpectedType( c: ConstraintSystemCompletionContext, argument: PostponedAtomWithRevisableExpectedType, @@ -179,10 +228,15 @@ class KotlinConstraintSystemCompleter( postponedArguments: List, analyze: (PostponedResolvedAtom) -> Unit ): Boolean { - val argumentWithFixedOrPostponedInputTypes = findPostponedArgumentWithFixedOrPostponedInputTypes(postponedArguments) + val useBuilderInferenceOnlyIfNeeded = languageVersionSettings.supportsFeature(LanguageFeature.UseBuilderInferenceOnlyIfNeeded) + val argumentToAnalyze = if (useBuilderInferenceOnlyIfNeeded) { + findPostponedArgumentWithFixedInputTypes(postponedArguments) + } else { + findPostponedArgumentWithFixedOrPostponedInputTypes(postponedArguments) + } - if (argumentWithFixedOrPostponedInputTypes != null) { - analyze(argumentWithFixedOrPostponedInputTypes) + if (argumentToAnalyze != null) { + analyze(argumentToAnalyze) return true } @@ -252,8 +306,12 @@ class KotlinConstraintSystemCompleter( private fun findPostponedArgumentWithRevisableExpectedType(postponedArguments: List) = postponedArguments.firstOrNull { argument -> argument is PostponedAtomWithRevisableExpectedType } - private fun ConstraintSystemCompletionContext.findPostponedArgumentWithFixedOrPostponedInputTypes(postponedArguments: List) = - postponedArguments.firstOrNull { argument -> argument.inputTypes.all { containsOnlyFixedOrPostponedVariables(it) } } + private fun ConstraintSystemCompletionContext.findPostponedArgumentWithFixedOrPostponedInputTypes( + postponedArguments: List + ) = postponedArguments.firstOrNull { argument -> argument.inputTypes.all { containsOnlyFixedOrPostponedVariables(it) } } + + private fun ConstraintSystemCompletionContext.findPostponedArgumentWithFixedInputTypes(postponedArguments: List) = + postponedArguments.firstOrNull { argument -> argument.inputTypes.all { containsOnlyFixedVariables(it) } } private fun fixVariable( c: ConstraintSystemCompletionContext, diff --git a/compiler/testData/codegen/box/inference/builderInference/changingResolveIfDontUseBuilderInferenceDisabledFeature.kt b/compiler/testData/codegen/box/inference/builderInference/changingResolveIfDontUseBuilderInferenceDisabledFeature.kt new file mode 100644 index 00000000000..cd13a448705 --- /dev/null +++ b/compiler/testData/codegen/box/inference/builderInference/changingResolveIfDontUseBuilderInferenceDisabledFeature.kt @@ -0,0 +1,21 @@ +// WITH_RUNTIME +// DONT_TARGET_EXACT_BACKEND: WASM +// !LANGUAGE: -UseBuilderInferenceOnlyIfNeeded + +import kotlin.experimental.ExperimentalTypeInference + +@OptIn(ExperimentalTypeInference::class) +fun buildMap(@BuilderInference builderAction: MutableMap.() -> Unit): Map = mapOf() + +fun foo(): MutableMap = mutableMapOf() + +fun MutableMap.swap(x: MutableMap) {} + +@OptIn(ExperimentalStdlibApi::class) +fun box(): String { + val x: Map = buildMap { + put("", "") + swap(foo()) + } // `Map` if we use builder inference, `Map` if we don't + return "OK" +} diff --git a/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferences.kt b/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferences.kt index 2774f8b99f4..ca0247c11b2 100644 --- a/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferences.kt +++ b/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferences.kt @@ -28,20 +28,6 @@ fun poll01(): Flow { } } -fun poll1(flag: Boolean): Flow { - return flow { - val inv = if (flag) { ::bar2 } else { ::foo2 } - inv() - } -} - -fun poll11(flag: Boolean): Flow { - return flow { - val inv = if (flag) { ::bar2 } else { ::foo2 } - inv() - } -} - fun poll21(flag: Boolean): Flow { return flow { @@ -57,20 +43,6 @@ fun poll31(flag: Boolean): Flow { } } -fun poll41(): Flow { - return flow { - val inv = try { ::bar2 } finally { ::foo2 } - inv() - } -} - -fun poll51(): Flow { - return flow { - val inv = try { ::bar2 } catch (e: Exception) { ::foo2 } finally { ::foo2 } - inv() - } -} - fun poll61(): Flow { return flow { val inv = ::bar2 @@ -101,12 +73,8 @@ fun poll91(): Flow { fun box(): String { poll01() - poll1(true) - poll11(true) poll21(true) poll31(true) - poll41() - poll51() poll61() poll71() poll81() diff --git a/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt b/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt deleted file mode 100644 index db17e668315..00000000000 --- a/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt +++ /dev/null @@ -1,55 +0,0 @@ -// WITH_RUNTIME -// DONT_TARGET_EXACT_BACKEND: WASM - -import kotlin.experimental.ExperimentalTypeInference - -fun FlowCollector.bar(): K = null as K -fun FlowCollector.foo(): K = null as K - -fun bar2(): Int = 1 -fun foo2(): Float = 1f - -fun materialize() = null as T - -interface FlowCollector {} - -@Suppress("EXPERIMENTAL_API_USAGE_ERROR") -fun flow(@BuilderInference block: suspend FlowCollector.() -> Unit) = Flow(block) - -class Flow(private val block: suspend FlowCollector.() -> Unit) - -fun poll1(flag: Boolean): Flow { - return flow { - val inv = if (flag) { ::bar2 } else { ::foo2 } - inv() - } -} - -fun poll11(flag: Boolean): Flow { - return flow { - val inv = if (flag) { ::bar2 } else { ::foo2 } - inv() - } -} - -fun poll41(): Flow { - return flow { - val inv = try { ::bar2 } finally { ::foo2 } - inv() - } -} - -fun poll51(): Flow { - return flow { - val inv = try { ::bar2 } catch (e: Exception) { ::foo2 } finally { ::foo2 } - inv() - } -} - -fun box(): String { - poll1(true) - poll11(true) - poll41() - poll51() - return "OK" -} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt b/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt deleted file mode 100644 index 68a0a2df6ea..00000000000 --- a/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt +++ /dev/null @@ -1,174 +0,0 @@ -// !LANGUAGE: +UnrestrictedBuilderInference -// WITH_RUNTIME -// SKIP_TXT -// DONT_TARGET_EXACT_BACKEND: WASM -// IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: JVM - -import kotlin.experimental.ExperimentalTypeInference - -fun FlowCollector.bar(): K = null as K -fun FlowCollector.foo(): K = null as K - -fun K.bar3(): K = null as K -fun K.foo3(): K = null as K - -fun bar2(): Int = 1 -fun foo2(): Float = 1f - -val bar4: Int - get() = 1 - -var foo4: Float - get() = 1f - set(value) {} - -val FlowCollector.bar5: K get() = null as K -val FlowCollector.foo5: K get() = null as K - -class Foo6 - -class Foo7 -fun foo7() = null as Foo7 - -interface FlowCollector {} - -@OptIn(ExperimentalTypeInference::class) -fun flow(@BuilderInference block: suspend FlowCollector.() -> Unit) = Flow(block) - -class Flow(private val block: suspend FlowCollector.() -> Unit) - -//fun poll1(flag: Boolean): Flow { -// return flow { -// val inv = if (flag) { ::bar2 } else { ::foo2 } -// inv() -// } -//} -// -//fun poll11(flag: Boolean): Flow { -// return flow { -// val inv = if (flag) { ::bar2 } else { ::foo2 } -// inv() -// } -//} - -fun poll12(flag: Boolean): Flow { - return flow { - val inv = if (flag) { ::bar3 } else { ::foo3 } - inv() - } -} - -//fun poll13(flag: Boolean): Flow { -// return flow { -// val inv = if (flag) { ::bar2 } else { ::foo3 } -// inv() -// } -//} -// -//fun poll14(flag: Boolean): Flow { -// return flow { -// val inv = if (flag) { ::bar4 } else { ::foo4 } -// inv() -// } -//} -// -//fun poll15(flag: Boolean): Flow { -// return flow { -// val inv = if (flag) { ::bar5 } else { ::foo5 } -// inv() -// } -//} -// -//fun poll16(flag: Boolean): Flow { -// return flow { -// val inv = if (flag) { ::Foo6 } else { ::Foo6 } -// inv() -// } -//} -// -//fun poll4(): Flow { -// return flow { -// val inv = try { ::bar } finally { ::foo } -// inv() -// } -//} -// -//fun poll41(): Flow { -// return flow { -// val inv = try { ::bar2 } finally { ::foo2 } -// inv() -// } -//} -// -//fun poll42(): Flow { -// return flow { -// val inv = try { ::bar3 } finally { ::foo3 } -// inv() -// } -//} -// -//fun poll43(): Flow { -// return flow { -// val inv = try { ::bar4 } finally { ::foo4 } -// inv() -// } -//} -// -//fun poll44(): Flow { -// return flow { -// val inv = try { ::bar5 } finally { ::foo5 } -// inv() -// } -//} -// -//fun poll45(): Flow { -// return flow { -// val inv = try { ::Foo6 } finally { ::Foo6 } -// inv() -// } -//} -// -//fun poll5(): Flow { -// return flow { -// val inv = try { ::bar } catch (e: Exception) { ::foo } finally { ::foo } -// inv() -// } -//} -// -//fun poll51(): Flow { -// return flow { -// val inv = try { ::bar2 } catch (e: Exception) { ::foo2 } finally { ::foo2 } -// inv() -// } -//} -// -//fun poll52(): Flow { -// return flow { -// val inv = try { ::bar3 } catch (e: Exception) { ::foo3 } finally { ::foo3 } -// inv() -// } -//} -// -//fun poll53(): Flow { -// return flow { -// val inv = try { ::bar4 } catch (e: Exception) { ::foo4 } finally { ::foo4 } -// inv() -// } -//} -// -//fun poll54(): Flow { -// return flow { -// val inv = try { ::bar5 } catch (e: Exception) { ::foo5 } finally { ::foo5 } -// inv() -// } -//} -// -//fun poll55(): Flow { -// return flow { -// val inv = try { ::Foo6 } catch (e: Exception) { ::Foo6 } finally { ::Foo6 } -// inv() -// } -//} - -fun box() = "OK" \ No newline at end of file diff --git a/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesErrorType.kt b/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesErrorType.kt index 2774f8b99f4..ca0247c11b2 100644 --- a/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesErrorType.kt +++ b/compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesErrorType.kt @@ -28,20 +28,6 @@ fun poll01(): Flow { } } -fun poll1(flag: Boolean): Flow { - return flow { - val inv = if (flag) { ::bar2 } else { ::foo2 } - inv() - } -} - -fun poll11(flag: Boolean): Flow { - return flow { - val inv = if (flag) { ::bar2 } else { ::foo2 } - inv() - } -} - fun poll21(flag: Boolean): Flow { return flow { @@ -57,20 +43,6 @@ fun poll31(flag: Boolean): Flow { } } -fun poll41(): Flow { - return flow { - val inv = try { ::bar2 } finally { ::foo2 } - inv() - } -} - -fun poll51(): Flow { - return flow { - val inv = try { ::bar2 } catch (e: Exception) { ::foo2 } finally { ::foo2 } - inv() - } -} - fun poll61(): Flow { return flow { val inv = ::bar2 @@ -101,12 +73,8 @@ fun poll91(): Flow { fun box(): String { poll01() - poll1(true) - poll11(true) poll21(true) poll31(true) - poll41() - poll51() poll61() poll71() poll81() diff --git a/compiler/testData/codegen/box/inference/builderInference/withExpectedType.kt b/compiler/testData/codegen/box/inference/builderInference/withExpectedType.kt index 7138a4d6011..7a00e6e98d5 100644 --- a/compiler/testData/codegen/box/inference/builderInference/withExpectedType.kt +++ b/compiler/testData/codegen/box/inference/builderInference/withExpectedType.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +UnrestrictedBuilderInference +// !LANGUAGE: +UnrestrictedBuilderInference -UseBuilderInferenceOnlyIfNeeded // WITH_RUNTIME // !DIAGNOSTICS: -EXPERIMENTAL_API_USAGE_ERROR -CAST_NEVER_SUCCEEDS // IGNORE_BACKEND_FIR: JVM_IR diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/changingResolveIfDontUseBuilderInference.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/changingResolveIfDontUseBuilderInference.fir.kt new file mode 100644 index 00000000000..a01998420b6 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/builderInference/changingResolveIfDontUseBuilderInference.fir.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME +// !DIAGNOSTICS: -EXPERIMENTAL_IS_NOT_ENABLED -DEPRECATION -EXPERIMENTAL_API_USAGE_ERROR +// DONT_TARGET_EXACT_BACKEND: WASM + +import kotlin.experimental.ExperimentalTypeInference + +@OptIn(ExperimentalTypeInference::class) +fun buildMap(@BuilderInference builderAction: MutableMap.() -> Unit): Map = mapOf() + +fun foo(): MutableMap = mutableMapOf() + +fun MutableMap.swap(x: MutableMap) {} + +@UseExperimental(ExperimentalTypeInference::class) +fun build7(@BuilderInference builderAction: MutableMap.() -> MutableMap) = mutableMapOf() + +fun id(x: K): K = x + +@OptIn(ExperimentalStdlibApi::class) +fun main() { + val x: Map = buildMap { + put("", "") + swap(foo()) + } // `Map` if we use builder inference, `Map` if we don't + + val y: MutableMap = build7 { + id(run { this }) + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/changingResolveIfDontUseBuilderInference.kt b/compiler/testData/diagnostics/tests/inference/builderInference/changingResolveIfDontUseBuilderInference.kt new file mode 100644 index 00000000000..7100dbb1620 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/builderInference/changingResolveIfDontUseBuilderInference.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME +// !DIAGNOSTICS: -EXPERIMENTAL_IS_NOT_ENABLED -DEPRECATION -EXPERIMENTAL_API_USAGE_ERROR +// DONT_TARGET_EXACT_BACKEND: WASM + +import kotlin.experimental.ExperimentalTypeInference + +@OptIn(ExperimentalTypeInference::class) +fun buildMap(@BuilderInference builderAction: MutableMap.() -> Unit): Map = mapOf() + +fun foo(): MutableMap = mutableMapOf() + +fun MutableMap.swap(x: MutableMap) {} + +@UseExperimental(ExperimentalTypeInference::class) +fun build7(@BuilderInference builderAction: MutableMap.() -> MutableMap) = mutableMapOf() + +fun id(x: K): K = x + +@OptIn(ExperimentalStdlibApi::class) +fun main() { + val x: Map = buildMap { + put("", "") + swap(foo()) + } // `Map` if we use builder inference, `Map` if we don't + + val y: MutableMap = build7 { + id(run { this }) + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/changingResolveIfDontUseBuilderInference.txt b/compiler/testData/diagnostics/tests/inference/builderInference/changingResolveIfDontUseBuilderInference.txt new file mode 100644 index 00000000000..5556b61d1d8 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/builderInference/changingResolveIfDontUseBuilderInference.txt @@ -0,0 +1,8 @@ +package + +@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun build7(/*0*/ @kotlin.BuilderInference builderAction: kotlin.collections.MutableMap.() -> kotlin.collections.MutableMap): kotlin.collections.MutableMap +@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun buildMap(/*0*/ @kotlin.BuilderInference builderAction: kotlin.collections.MutableMap.() -> kotlin.Unit): kotlin.collections.Map +public fun foo(): kotlin.collections.MutableMap +public fun id(/*0*/ x: K): K +@kotlin.OptIn(markerClass = {kotlin.ExperimentalStdlibApi::class}) public fun main(): kotlin.Unit +public fun kotlin.collections.MutableMap.swap(/*0*/ x: kotlin.collections.MutableMap): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/skipedUnresolvedInBuilderInferenceWithStubReceiverType.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/skipedUnresolvedInBuilderInferenceWithStubReceiverType.fir.kt deleted file mode 100644 index aa94bcbed9f..00000000000 --- a/compiler/testData/diagnostics/tests/inference/builderInference/skipedUnresolvedInBuilderInferenceWithStubReceiverType.fir.kt +++ /dev/null @@ -1,15 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -EXPERIMENTAL_IS_NOT_ENABLED -// WITH_RUNTIME - -import kotlin.experimental.ExperimentalTypeInference - -@OptIn(ExperimentalTypeInference::class) -fun foo(x: T, @BuilderInference builder: T.() -> Unit): Unit = TODO() - -class Bar - -fun test() { - foo(1) { - dsgfsdg - } -} diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/skipedUnresolvedInBuilderInferenceWithStubReceiverType.kt b/compiler/testData/diagnostics/tests/inference/builderInference/skipedUnresolvedInBuilderInferenceWithStubReceiverType.kt index 2e82448e11f..1a3f156b4c6 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/skipedUnresolvedInBuilderInferenceWithStubReceiverType.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/skipedUnresolvedInBuilderInferenceWithStubReceiverType.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -EXPERIMENTAL_IS_NOT_ENABLED // WITH_RUNTIME @@ -10,6 +11,6 @@ class Bar fun test() { foo(1) { - dsgfsdg + dsgfsdg } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.kt index d7ef40e03a8..3d9dfa5b90e 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.kt @@ -87,57 +87,57 @@ fun poll06(): Flow { fun poll1(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar2 } else { ::foo2 } - inv() + val inv = if (flag) { ::bar2 } else { ::foo2 } + inv() } } fun poll11(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar2 } else { ::foo2 } - inv() + val inv = if (flag) { ::bar2 } else { ::foo2 } + inv() } } fun poll12(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar3 } else { ::foo3 } - inv() + val inv = if (flag) { ::bar3 } else { ::foo3 } + inv() } } fun poll13(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar2 } else { ::foo3 } - inv() + val inv = if (flag) { ::bar2 } else { ::foo3 } + inv() } } fun poll14(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar4 } else { ::foo4 } - inv() + val inv = if (flag) { ::bar4 } else { ::foo4 } + inv() } } fun poll15(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar5 } else { ::foo5 } - inv() + val inv = if (flag) { ::bar5 } else { ::foo5 } + inv() } } fun poll16(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::Foo6 } else { ::Foo6 } - inv() + val inv = if (flag) { ::Foo6 } else { ::Foo6 } + inv() } } fun poll17(flag: Boolean): Flow { return flow { - val inv = if (flag) { foo7() } else { ::Foo7 } - inv + val inv = if (flag) { foo7() } else { ::Foo7 } + inv } } @@ -241,99 +241,99 @@ fun poll36(flag: Boolean): Flow { fun poll4(): Flow { return flow { - val inv = try { ::bar } finally { ::foo } - inv() + val inv = try { ::bar } finally { ::foo } + inv() } } fun poll41(): Flow { return flow { - val inv = try { ::bar2 } finally { ::foo2 } - inv() + val inv = try { ::bar2 } finally { ::foo2 } + inv() } } fun poll42(): Flow { return flow { - val inv = try { ::bar3 } finally { ::foo3 } - inv() + val inv = try { ::bar3 } finally { ::foo3 } + inv() } } fun poll43(): Flow { return flow { - val inv = try { ::bar4 } finally { ::foo4 } - inv() + val inv = try { ::bar4 } finally { ::foo4 } + inv() } } fun poll44(): Flow { return flow { - val inv = try { ::bar5 } finally { ::foo5 } - inv() + val inv = try { ::bar5 } finally { ::foo5 } + inv() } } fun poll45(): Flow { return flow { - val inv = try { ::Foo6 } finally { ::Foo6 } - inv() + val inv = try { ::Foo6 } finally { ::Foo6 } + inv() } } fun poll46(): Flow { return flow { - val inv = try { foo7() } finally { ::Foo7 } + val inv = try { foo7() } finally { ::Foo7 } inv } } fun poll5(): Flow { return flow { - val inv = try { ::bar } catch (e: Exception) { ::foo } finally { ::foo } - inv() + val inv = try { ::bar } catch (e: Exception) { ::foo } finally { ::foo } + inv() } } fun poll51(): Flow { return flow { - val inv = try { ::bar2 } catch (e: Exception) { ::foo2 } finally { ::foo2 } - inv() + val inv = try { ::bar2 } catch (e: Exception) { ::foo2 } finally { ::foo2 } + inv() } } fun poll52(): Flow { return flow { - val inv = try { ::bar3 } catch (e: Exception) { ::foo3 } finally { ::foo3 } - inv() + val inv = try { ::bar3 } catch (e: Exception) { ::foo3 } finally { ::foo3 } + inv() } } fun poll53(): Flow { return flow { - val inv = try { ::bar4 } catch (e: Exception) { ::foo4 } finally { ::foo4 } - inv() + val inv = try { ::bar4 } catch (e: Exception) { ::foo4 } finally { ::foo4 } + inv() } } fun poll54(): Flow { return flow { - val inv = try { ::bar5 } catch (e: Exception) { ::foo5 } finally { ::foo5 } - inv() + val inv = try { ::bar5 } catch (e: Exception) { ::foo5 } finally { ::foo5 } + inv() } } fun poll55(): Flow { return flow { - val inv = try { ::Foo6 } catch (e: Exception) { ::Foo6 } finally { ::Foo6 } - inv() + val inv = try { ::Foo6 } catch (e: Exception) { ::Foo6 } finally { ::Foo6 } + inv() } } fun poll56(): Flow { return flow { - val inv = try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() } - inv + val inv = try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() } + inv } } @@ -430,7 +430,7 @@ fun poll75(): Flow { fun poll76(): Flow { return flow { - val inv = ::Foo7!! + val inv = ::Foo7!! inv } } @@ -445,7 +445,7 @@ fun poll8(): Flow { fun poll81(): Flow { return flow { val inv = ::bar2 in setOf(::foo2) - inv() + inv() } } @@ -479,14 +479,14 @@ fun poll85(): Flow { fun poll86(): Flow { return flow { - val inv = ::Foo7 in setOf(::Foo7) + val inv = ::Foo7 in setOf(::Foo7) inv } } fun poll87(): Flow { return flow { - val inv = ::Foo7 in setOf(foo7()) + val inv = ::Foo7 in setOf(foo7()) inv } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt index a75eb326d5f..53d2ec2b5bf 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt @@ -36,154 +36,154 @@ class Flow(private val block: suspend FlowCollector.() -> Unit) fun poll1(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar2 } else { ::foo2 } - inv() + val inv = if (flag) { ::bar2 } else { ::foo2 } + inv() } } fun poll11(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar2 } else { ::foo2 } - inv() + val inv = if (flag) { ::bar2 } else { ::foo2 } + inv() } } fun poll12(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar3 } else { ::foo3 } - inv() + val inv = if (flag) { ::bar3 } else { ::foo3 } + inv() } } fun poll13(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar2 } else { ::foo3 } - inv() + val inv = if (flag) { ::bar2 } else { ::foo3 } + inv() } } fun poll14(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar4 } else { ::foo4 } - inv() + val inv = if (flag) { ::bar4 } else { ::foo4 } + inv() } } fun poll15(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar5 } else { ::foo5 } - inv() + val inv = if (flag) { ::bar5 } else { ::foo5 } + inv() } } fun poll16(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::Foo6 } else { ::Foo6 } - inv() + val inv = if (flag) { ::Foo6 } else { ::Foo6 } + inv() } } fun poll17(flag: Boolean): Flow { return flow { - val inv = if (flag) { foo7() } else { ::Foo7 } - inv + val inv = if (flag) { foo7() } else { ::Foo7 } + inv } } fun poll4(): Flow { return flow { - val inv = try { ::bar } finally { ::foo } - inv() + val inv = try { ::bar } finally { ::foo } + inv() } } fun poll41(): Flow { return flow { - val inv = try { ::bar2 } finally { ::foo2 } - inv() + val inv = try { ::bar2 } finally { ::foo2 } + inv() } } fun poll42(): Flow { return flow { - val inv = try { ::bar3 } finally { ::foo3 } - inv() + val inv = try { ::bar3 } finally { ::foo3 } + inv() } } fun poll43(): Flow { return flow { - val inv = try { ::bar4 } finally { ::foo4 } - inv() + val inv = try { ::bar4 } finally { ::foo4 } + inv() } } fun poll44(): Flow { return flow { - val inv = try { ::bar5 } finally { ::foo5 } - inv() + val inv = try { ::bar5 } finally { ::foo5 } + inv() } } fun poll45(): Flow { return flow { - val inv = try { ::Foo6 } finally { ::Foo6 } - inv() + val inv = try { ::Foo6 } finally { ::Foo6 } + inv() } } fun poll46(): Flow { return flow { - val inv = try { foo7() } finally { ::Foo7 } + val inv = try { foo7() } finally { ::Foo7 } inv } } fun poll5(): Flow { return flow { - val inv = try { ::bar } catch (e: Exception) { ::foo } finally { ::foo } - inv() + val inv = try { ::bar } catch (e: Exception) { ::foo } finally { ::foo } + inv() } } fun poll51(): Flow { return flow { - val inv = try { ::bar2 } catch (e: Exception) { ::foo2 } finally { ::foo2 } - inv() + val inv = try { ::bar2 } catch (e: Exception) { ::foo2 } finally { ::foo2 } + inv() } } fun poll52(): Flow { return flow { - val inv = try { ::bar3 } catch (e: Exception) { ::foo3 } finally { ::foo3 } - inv() + val inv = try { ::bar3 } catch (e: Exception) { ::foo3 } finally { ::foo3 } + inv() } } fun poll53(): Flow { return flow { - val inv = try { ::bar4 } catch (e: Exception) { ::foo4 } finally { ::foo4 } - inv() + val inv = try { ::bar4 } catch (e: Exception) { ::foo4 } finally { ::foo4 } + inv() } } fun poll54(): Flow { return flow { - val inv = try { ::bar5 } catch (e: Exception) { ::foo5 } finally { ::foo5 } - inv() + val inv = try { ::bar5 } catch (e: Exception) { ::foo5 } finally { ::foo5 } + inv() } } fun poll55(): Flow { return flow { - val inv = try { ::Foo6 } catch (e: Exception) { ::Foo6 } finally { ::Foo6 } - inv() + val inv = try { ::Foo6 } catch (e: Exception) { ::Foo6 } finally { ::Foo6 } + inv() } } fun poll56(): Flow { return flow { - val inv = try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() } - inv + val inv = try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() } + inv } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesDontRewriteAtSlice.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesDontRewriteAtSlice.kt index 28feea9c513..98f8544e077 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesDontRewriteAtSlice.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesDontRewriteAtSlice.kt @@ -58,7 +58,7 @@ fun poll75(): Flow { fun poll81(): Flow { return flow { val inv = ::bar2 in setOf(::foo2) - inv() + inv() } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesErrorType.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesErrorType.kt index e357ec6494c..101938fea78 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesErrorType.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesErrorType.kt @@ -79,7 +79,7 @@ fun poll75(): Flow { fun poll76(): Flow { return flow { - val inv = ::Foo7!! + val inv = ::Foo7!! inv } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesErrorTypeUnrestricted.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesErrorTypeUnrestricted.kt index 03b6309b73c..036795a1e19 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesErrorTypeUnrestricted.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesErrorTypeUnrestricted.kt @@ -80,7 +80,7 @@ fun poll75(): Flow { fun poll76(): Flow { return flow { - val inv = ::Foo7!! + val inv = ::Foo7!! inv } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt index c08b0f6aa49..6d4430288e2 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesNonStrictOnlyInputTypes.kt @@ -23,7 +23,7 @@ class Flow(private val block: suspend FlowCollector.() -> Unit) fun poll81(): Flow { return flow { val inv = ::bar2 in setOf(::foo2) - inv() + inv() } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.fir.kt index d1c86237184..7905ecbb7e1 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.fir.kt @@ -2,6 +2,7 @@ // WITH_RUNTIME // SKIP_TXT // !DIAGNOSTICS: -CAST_NEVER_SUCCEEDS -UNCHECKED_CAST -UNUSED_PARAMETER -UNUSED_VARIABLE -EXPERIMENTAL_API_USAGE_ERROR -UNUSED_EXPRESSION +// KT-47797 import kotlin.experimental.ExperimentalTypeInference diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.kt index dc587d67616..a91240205ef 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.kt @@ -2,6 +2,7 @@ // WITH_RUNTIME // SKIP_TXT // !DIAGNOSTICS: -CAST_NEVER_SUCCEEDS -UNCHECKED_CAST -UNUSED_PARAMETER -UNUSED_VARIABLE -EXPERIMENTAL_API_USAGE_ERROR -UNUSED_EXPRESSION +// KT-47797 import kotlin.experimental.ExperimentalTypeInference @@ -88,57 +89,57 @@ fun poll06(): Flow { fun poll1(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar2 } else { ::foo2 } - inv() + val inv = if (flag) { ::bar2 } else { ::foo2 } + inv() } } fun poll11(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar2 } else { ::foo2 } - inv() + val inv = if (flag) { ::bar2 } else { ::foo2 } + inv() } } fun poll12(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar3 } else { ::foo3 } - inv() + val inv = if (flag) { ::bar3 } else { ::foo3 } + inv() } } fun poll13(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar2 } else { ::foo3 } - inv() + val inv = if (flag) { ::bar2 } else { ::foo3 } + inv() } } fun poll14(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar4 } else { ::foo4 } - inv() + val inv = if (flag) { ::bar4 } else { ::foo4 } + inv() } } fun poll15(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::bar5 } else { ::foo5 } - inv() + val inv = if (flag) { ::bar5 } else { ::foo5 } + inv() } } fun poll16(flag: Boolean): Flow { return flow { - val inv = if (flag) { ::Foo6 } else { ::Foo6 } - inv() + val inv = if (flag) { ::Foo6 } else { ::Foo6 } + inv() } } fun poll17(flag: Boolean): Flow { return flow { - val inv = if (flag) { foo7() } else { ::Foo7 } - inv + val inv = if (flag) { foo7() } else { ::Foo7 } + inv } } @@ -242,99 +243,99 @@ fun poll36(flag: Boolean): Flow { fun poll4(): Flow { return flow { - val inv = try { ::bar } finally { ::foo } - inv() + val inv = try { ::bar } finally { ::foo } + inv() } } fun poll41(): Flow { return flow { - val inv = try { ::bar2 } finally { ::foo2 } - inv() + val inv = try { ::bar2 } finally { ::foo2 } + inv() } } fun poll42(): Flow { return flow { - val inv = try { ::bar3 } finally { ::foo3 } - inv() + val inv = try { ::bar3 } finally { ::foo3 } + inv() } } fun poll43(): Flow { return flow { - val inv = try { ::bar4 } finally { ::foo4 } - inv() + val inv = try { ::bar4 } finally { ::foo4 } + inv() } } fun poll44(): Flow { return flow { - val inv = try { ::bar5 } finally { ::foo5 } - inv() + val inv = try { ::bar5 } finally { ::foo5 } + inv() } } fun poll45(): Flow { return flow { - val inv = try { ::Foo6 } finally { ::Foo6 } - inv() + val inv = try { ::Foo6 } finally { ::Foo6 } + inv() } } fun poll46(): Flow { return flow { - val inv = try { foo7() } finally { ::Foo7 } + val inv = try { foo7() } finally { ::Foo7 } inv } } fun poll5(): Flow { return flow { - val inv = try { ::bar } catch (e: Exception) { ::foo } finally { ::foo } - inv() + val inv = try { ::bar } catch (e: Exception) { ::foo } finally { ::foo } + inv() } } fun poll51(): Flow { return flow { - val inv = try { ::bar2 } catch (e: Exception) { ::foo2 } finally { ::foo2 } - inv() + val inv = try { ::bar2 } catch (e: Exception) { ::foo2 } finally { ::foo2 } + inv() } } fun poll52(): Flow { return flow { - val inv = try { ::bar3 } catch (e: Exception) { ::foo3 } finally { ::foo3 } - inv() + val inv = try { ::bar3 } catch (e: Exception) { ::foo3 } finally { ::foo3 } + inv() } } fun poll53(): Flow { return flow { - val inv = try { ::bar4 } catch (e: Exception) { ::foo4 } finally { ::foo4 } - inv() + val inv = try { ::bar4 } catch (e: Exception) { ::foo4 } finally { ::foo4 } + inv() } } fun poll54(): Flow { return flow { - val inv = try { ::bar5 } catch (e: Exception) { ::foo5 } finally { ::foo5 } - inv() + val inv = try { ::bar5 } catch (e: Exception) { ::foo5 } finally { ::foo5 } + inv() } } fun poll55(): Flow { return flow { - val inv = try { ::Foo6 } catch (e: Exception) { ::Foo6 } finally { ::Foo6 } - inv() + val inv = try { ::Foo6 } catch (e: Exception) { ::Foo6 } finally { ::Foo6 } + inv() } } fun poll56(): Flow { return flow { - val inv = try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() } - inv + val inv = try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() } + inv } } @@ -431,7 +432,7 @@ fun poll75(): Flow { fun poll76(): Flow { return flow { - val inv = ::Foo7!! + val inv = ::Foo7!! inv } } @@ -446,7 +447,7 @@ fun poll8(): Flow { fun poll81(): Flow { return flow { val inv = ::bar2 in setOf(::foo2) - inv() + inv() } } @@ -480,14 +481,14 @@ fun poll85(): Flow { fun poll86(): Flow { return flow { - val inv = ::Foo7 in setOf(::Foo7) + val inv = ::Foo7 in setOf(::Foo7) inv } } fun poll87(): Flow { return flow { - val inv = ::Foo7 in setOf(foo7()) + val inv = ::Foo7 in setOf(foo7()) inv } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithLambdas.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithLambdas.kt index e8f405c2b08..1efc4fd16a2 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithLambdas.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithLambdas.kt @@ -148,7 +148,7 @@ fun poll73(): Flow { fun poll8(): Flow { return flow { val inv = {1} in setOf({1f}) - inv() + inv() } } @@ -176,7 +176,7 @@ fun poll83(): Flow { fun poll84(): Flow { return flow { val inv = {{1}} in setOf({{1f}}) - inv() + inv() } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.kt index 9b41d17072a..dcef946ba99 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.kt @@ -52,11 +52,11 @@ fun test(a: String?) { } val ret4 = build4(1) { emit(1) - get()?.equals("") + get()?.equals("") val x = get() - x?.equals("") + x?.equals("") x ?: 1 - x!! + x!! "" } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt index 3b72d9c46ab..bd2a96831bd 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWithErrors.kt @@ -18,6 +18,6 @@ val test1 = generate { yield(A) } -val test2: Int = generate { +val test2: Int = generate { yield(A()) -} +} 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 e7e05fd5a38..7780befc12b 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 @@ -13332,6 +13332,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @Test + @TestMetadata("changingResolveIfDontUseBuilderInference.kt") + public void testChangingResolveIfDontUseBuilderInference() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/changingResolveIfDontUseBuilderInference.kt"); + } + @Test @TestMetadata("kt47744.kt") public void testKt47744() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index ba29f95f935..35b2b728678 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -17881,6 +17881,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/inference/builderInference/capturedTypes.kt"); } + @Test + @TestMetadata("changingResolveIfDontUseBuilderInferenceDisabledFeature.kt") + public void testChangingResolveIfDontUseBuilderInferenceDisabledFeature() throws Exception { + runTest("compiler/testData/codegen/box/inference/builderInference/changingResolveIfDontUseBuilderInferenceDisabledFeature.kt"); + } + @Test @TestMetadata("commonSuperType.kt") public void testCommonSuperType() throws Exception { @@ -17995,18 +18001,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferences.kt"); } - @Test - @TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt") - public void testSpecialCallsWithCallableReferencesDontCareTypeInBlockExpression() throws Exception { - runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt"); - } - - @Test - @TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt") - public void testSpecialCallsWithCallableReferencesDontCareTypeInBlockExression() throws Exception { - runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt"); - } - @Test @TestMetadata("specialCallsWithCallableReferencesDontRewriteAtSlice.kt") public void testSpecialCallsWithCallableReferencesDontRewriteAtSlice() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index a5d25216ae4..22c8a81baa9 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -18019,6 +18019,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/inference/builderInference/capturedTypes.kt"); } + @Test + @TestMetadata("changingResolveIfDontUseBuilderInferenceDisabledFeature.kt") + public void testChangingResolveIfDontUseBuilderInferenceDisabledFeature() throws Exception { + runTest("compiler/testData/codegen/box/inference/builderInference/changingResolveIfDontUseBuilderInferenceDisabledFeature.kt"); + } + @Test @TestMetadata("commonSuperType.kt") public void testCommonSuperType() throws Exception { @@ -18139,18 +18145,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferences.kt"); } - @Test - @TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt") - public void testSpecialCallsWithCallableReferencesDontCareTypeInBlockExpression() throws Exception { - runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt"); - } - - @Test - @TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt") - public void testSpecialCallsWithCallableReferencesDontCareTypeInBlockExression() throws Exception { - runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt"); - } - @Test @TestMetadata("specialCallsWithCallableReferencesDontRewriteAtSlice.kt") public void testSpecialCallsWithCallableReferencesDontRewriteAtSlice() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index a3a66597797..2a4de17e8e5 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -14787,11 +14787,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class BuilderInference extends AbstractLightAnalysisModeTest { - @TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt") - public void ignoreSpecialCallsWithCallableReferencesDontCareTypeInBlockExression() throws Exception { - runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt"); - } - private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } @@ -14820,6 +14815,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/inference/builderInference/capturedTypes.kt"); } + @TestMetadata("changingResolveIfDontUseBuilderInferenceDisabledFeature.kt") + public void testChangingResolveIfDontUseBuilderInferenceDisabledFeature() throws Exception { + runTest("compiler/testData/codegen/box/inference/builderInference/changingResolveIfDontUseBuilderInferenceDisabledFeature.kt"); + } + @TestMetadata("commonSuperType.kt") public void testCommonSuperType() throws Exception { runTest("compiler/testData/codegen/box/inference/builderInference/commonSuperType.kt"); @@ -14915,11 +14915,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferences.kt"); } - @TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt") - public void testSpecialCallsWithCallableReferencesDontCareTypeInBlockExpression() throws Exception { - runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt"); - } - @TestMetadata("specialCallsWithCallableReferencesDontRewriteAtSlice.kt") public void testSpecialCallsWithCallableReferencesDontRewriteAtSlice() throws Exception { runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontRewriteAtSlice.kt"); diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 2fa92b3618c..2c35e07cbb0 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -220,6 +220,7 @@ enum class LanguageFeature( OptInContagiousSignatures(KOTLIN_1_6, kind = BUG_FIX), RepeatableAnnotations(KOTLIN_1_6), RepeatableAnnotationContainerConstraints(KOTLIN_1_6, kind = BUG_FIX), + UseBuilderInferenceOnlyIfNeeded(KOTLIN_1_6), // 1.7 diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index 66166e37bb3..14605a34861 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -13326,6 +13326,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @Test + @TestMetadata("changingResolveIfDontUseBuilderInference.kt") + public void testChangingResolveIfDontUseBuilderInference() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/changingResolveIfDontUseBuilderInference.kt"); + } + @Test @TestMetadata("kt47744.kt") public void testKt47744() throws Exception { @@ -13398,6 +13404,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithLambdas.kt"); } + @Test + @TestMetadata("withoutAnnotationDisabledFeature.kt") + public void testWithoutAnnotationDisabledFeature() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/builderInference/withoutAnnotationDisabledFeature.kt"); + } + @Nested @TestMetadata("compiler/testData/diagnostics/tests/inference/builderInference/constraints") @TestDataPath("$PROJECT_ROOT") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 2449f640663..53644c3816f 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -12934,6 +12934,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/inference/builderInference/capturedTypes.kt"); } + @TestMetadata("changingResolveIfDontUseBuilderInferenceDisabledFeature.kt") + public void testChangingResolveIfDontUseBuilderInferenceDisabledFeature() throws Exception { + runTest("compiler/testData/codegen/box/inference/builderInference/changingResolveIfDontUseBuilderInferenceDisabledFeature.kt"); + } + @TestMetadata("constraintsBetweenTwoStubVariables.kt") public void testConstraintsBetweenTwoStubVariables() throws Exception { runTest("compiler/testData/codegen/box/inference/builderInference/constraintsBetweenTwoStubVariables.kt"); @@ -12999,16 +13004,6 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferences.kt"); } - @TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt") - public void testSpecialCallsWithCallableReferencesDontCareTypeInBlockExpression() throws Exception { - runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt"); - } - - @TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt") - public void testSpecialCallsWithCallableReferencesDontCareTypeInBlockExression() throws Exception { - runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt"); - } - @TestMetadata("specialCallsWithCallableReferencesDontRewriteAtSlice.kt") public void testSpecialCallsWithCallableReferencesDontRewriteAtSlice() throws Exception { runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontRewriteAtSlice.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 907c60e0b4f..9cae988420d 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -12340,6 +12340,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inference/builderInference/capturedTypes.kt"); } + @TestMetadata("changingResolveIfDontUseBuilderInferenceDisabledFeature.kt") + public void testChangingResolveIfDontUseBuilderInferenceDisabledFeature() throws Exception { + runTest("compiler/testData/codegen/box/inference/builderInference/changingResolveIfDontUseBuilderInferenceDisabledFeature.kt"); + } + @TestMetadata("constraintsBetweenTwoStubVariables.kt") public void testConstraintsBetweenTwoStubVariables() throws Exception { runTest("compiler/testData/codegen/box/inference/builderInference/constraintsBetweenTwoStubVariables.kt"); @@ -12405,16 +12410,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferences.kt"); } - @TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt") - public void testSpecialCallsWithCallableReferencesDontCareTypeInBlockExpression() throws Exception { - runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt"); - } - - @TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt") - public void testSpecialCallsWithCallableReferencesDontCareTypeInBlockExression() throws Exception { - runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt"); - } - @TestMetadata("specialCallsWithCallableReferencesDontRewriteAtSlice.kt") public void testSpecialCallsWithCallableReferencesDontRewriteAtSlice() throws Exception { runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontRewriteAtSlice.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 53e091ca227..d87f835237c 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -12405,6 +12405,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inference/builderInference/capturedTypes.kt"); } + @TestMetadata("changingResolveIfDontUseBuilderInferenceDisabledFeature.kt") + public void testChangingResolveIfDontUseBuilderInferenceDisabledFeature() throws Exception { + runTest("compiler/testData/codegen/box/inference/builderInference/changingResolveIfDontUseBuilderInferenceDisabledFeature.kt"); + } + @TestMetadata("constraintsBetweenTwoStubVariables.kt") public void testConstraintsBetweenTwoStubVariables() throws Exception { runTest("compiler/testData/codegen/box/inference/builderInference/constraintsBetweenTwoStubVariables.kt"); @@ -12470,16 +12475,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferences.kt"); } - @TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt") - public void testSpecialCallsWithCallableReferencesDontCareTypeInBlockExpression() throws Exception { - runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExpression.kt"); - } - - @TestMetadata("specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt") - public void testSpecialCallsWithCallableReferencesDontCareTypeInBlockExression() throws Exception { - runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.kt"); - } - @TestMetadata("specialCallsWithCallableReferencesDontRewriteAtSlice.kt") public void testSpecialCallsWithCallableReferencesDontRewriteAtSlice() throws Exception { runTest("compiler/testData/codegen/box/inference/builderInference/specialCallsWithCallableReferencesDontRewriteAtSlice.kt");