From 51551998c7aba5e96b39b146f995894e367852cb Mon Sep 17 00:00:00 2001 From: Victor Petukhov Date: Tue, 24 May 2022 16:00:46 +0200 Subject: [PATCH] Revert "[FE 1.0] Take care callable reference candidates with recursive candidate return type" This reverts commit d04beaa8bb49c99ceb993f3f7b32169c393b39f4. --- ...CompilerTestFE10TestdataTestGenerated.java | 6 -- ...irOldFrontendDiagnosticsTestGenerated.java | 6 -- ...DiagnosticsWithLightTreeTestGenerated.java | 6 -- .../FirBlackBoxCodegenTestGenerated.java | 6 -- .../DiagnosticReporterByTrackingStrategy.kt | 8 --- .../calls/tower/NewResolutionOldInference.kt | 2 +- ...enteringLazyValueComputationException.java | 3 +- .../CallableReferenceArgumentResolver.kt | 3 - .../calls/components/KotlinCallCompleter.kt | 2 +- .../CallableReferencesCandidateFactory.kt | 55 +++---------------- .../calls/model/KotlinCallDiagnostics.kt | 10 +--- .../calls/model/SimpleCandidateFactory.kt | 3 +- .../resolve/calls/tower/ImplicitScopeTower.kt | 1 - .../resolve/calls/tower/TowerResolver.kt | 3 +- .../calls/util/ErrorCandidateReason.kt | 8 --- .../codegen/box/callableReference/kt51844.kt | 15 ----- .../diagnostics/tests/delegation/kt49477.kt | 2 +- .../tests/delegation/kt49477Error.kt | 2 +- .../tests/inference/kt51844.fir.kt | 11 ---- .../diagnostics/tests/inference/kt51844.kt | 11 ---- .../diagnostics/tests/inference/kt51844.txt | 11 ---- .../tests/platformTypes/kt50877.fir.kt | 31 +++++++++++ .../tests/platformTypes/kt50877.kt | 1 - .../test/runners/DiagnosticTestGenerated.java | 6 -- .../codegen/BlackBoxCodegenTestGenerated.java | 6 -- .../IrBlackBoxCodegenTestGenerated.java | 6 -- .../LightAnalysisModeTestGenerated.java | 5 -- .../LazyWrappedTypeComputationException.kt | 8 --- .../js/test/JsCodegenBoxTestGenerated.java | 6 -- .../test/ir/IrJsCodegenBoxTestGenerated.java | 6 -- .../IrCodegenBoxWasmTestGenerated.java | 5 -- .../NativeCodegenBoxTestGenerated.java | 6 -- 32 files changed, 48 insertions(+), 212 deletions(-) delete mode 100644 compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/util/ErrorCandidateReason.kt delete mode 100644 compiler/testData/codegen/box/callableReference/kt51844.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/kt51844.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/kt51844.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/kt51844.txt create mode 100644 compiler/testData/diagnostics/tests/platformTypes/kt50877.fir.kt delete mode 100644 core/descriptors/src/org/jetbrains/kotlin/types/error/LazyWrappedTypeComputationException.kt 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 859c4566e81..30c80f45168 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 @@ -13910,12 +13910,6 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/inference/kt49961.kt"); } - @Test - @TestMetadata("kt51844.kt") - public void testKt51844() throws Exception { - runTest("compiler/testData/diagnostics/tests/inference/kt51844.kt"); - } - @Test @TestMetadata("kt6175.kt") public void testKt6175() 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 fdecbc497c5..2080834f42f 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 @@ -13910,12 +13910,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/inference/kt49961.kt"); } - @Test - @TestMetadata("kt51844.kt") - public void testKt51844() throws Exception { - runTest("compiler/testData/diagnostics/tests/inference/kt51844.kt"); - } - @Test @TestMetadata("kt6175.kt") public void testKt6175() 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 54f535b8fd9..9f5f4cc12a9 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 @@ -13910,12 +13910,6 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/inference/kt49961.kt"); } - @Test - @TestMetadata("kt51844.kt") - public void testKt51844() throws Exception { - runTest("compiler/testData/diagnostics/tests/inference/kt51844.kt"); - } - @Test @TestMetadata("kt6175.kt") public void testKt6175() 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 403cc958715..7b132431cf8 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 @@ -3129,12 +3129,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/callableReference/kt50172.kt"); } - @Test - @TestMetadata("kt51844.kt") - public void testKt51844() throws Exception { - runTest("compiler/testData/codegen/box/callableReference/kt51844.kt"); - } - @Test @TestMetadata("nested.kt") public void testNested() throws Exception { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt index 219ee1b736a..9583fb36bed 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt @@ -195,14 +195,6 @@ class DiagnosticReporterByTrackingStrategy( SmartCastDiagnostic::class.java -> reportSmartCast(diagnostic as SmartCastDiagnostic) UnstableSmartCastDiagnosticError::class.java, UnstableSmartCastResolutionError::class.java -> reportUnstableSmartCast(diagnostic as UnstableSmartCast) - TypeCheckerHasRanIntoRecursion::class.java -> { - diagnostic as TypeCheckerHasRanIntoRecursion - val argumentExpression = - diagnostic.onArgument?.psiCallArgument?.valueArgument?.getArgumentExpression() - if (argumentExpression != null) { - trace.report(TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM.errorFactory.on(argumentExpression)) - } - } VisibilityErrorOnArgument::class.java -> { diagnostic as VisibilityErrorOnArgument val invisibleMember = diagnostic.invisibleMember diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt index 0a9ae26a170..70c3c272766 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt @@ -502,7 +502,7 @@ class NewResolutionOldInference( extensionReceiverCandidates: List ): MyCandidate = error("${this::class.simpleName} doesn't support candidates with multiple extension receiver candidates") - override fun createErrorCandidate(reason: ErrorCandidateReason): MyCandidate { + override fun createErrorCandidate(): MyCandidate { throw IllegalStateException("Not supported creating error candidate for the old type inference candidate factory") } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/util/ReenteringLazyValueComputationException.java b/compiler/frontend/src/org/jetbrains/kotlin/util/ReenteringLazyValueComputationException.java index ed607710a45..5be947c2021 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/util/ReenteringLazyValueComputationException.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/util/ReenteringLazyValueComputationException.java @@ -19,9 +19,8 @@ package org.jetbrains.kotlin.util; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import org.jetbrains.annotations.NotNull; -import org.jetbrains.kotlin.types.error.LazyWrappedTypeComputationException; -public class ReenteringLazyValueComputationException extends LazyWrappedTypeComputationException { +public class ReenteringLazyValueComputationException extends RuntimeException { public ReenteringLazyValueComputationException() { } diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/CallableReferenceArgumentResolver.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/CallableReferenceArgumentResolver.kt index e0ce2e4fd2c..891a7e912cd 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/CallableReferenceArgumentResolver.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/CallableReferenceArgumentResolver.kt @@ -8,11 +8,9 @@ package org.jetbrains.kotlin.resolve.calls.components import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilder import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstitutor import org.jetbrains.kotlin.resolve.calls.model.* -import org.jetbrains.kotlin.resolve.calls.tower.RecursiveCallableReferenceType import org.jetbrains.kotlin.resolve.calls.tower.VisibilityError import org.jetbrains.kotlin.resolve.calls.tower.VisibilityErrorOnArgument import org.jetbrains.kotlin.resolve.calls.tower.isInapplicable -import org.jetbrains.kotlin.resolve.calls.model.TypeCheckerHasRanIntoRecursion class CallableReferenceArgumentResolver(val callableReferenceOverloadConflictResolver: CallableReferenceOverloadConflictResolver) { fun processCallableReferenceArgument( @@ -48,7 +46,6 @@ class CallableReferenceArgumentResolver(val callableReferenceOverloadConflictRes val transformedDiagnostic = when (it) { is CompatibilityWarning -> CompatibilityWarningOnArgument(argument, it.candidate) is VisibilityError -> VisibilityErrorOnArgument(argument, it.invisibleMember) - is RecursiveCallableReferenceType -> TypeCheckerHasRanIntoRecursion(argument) else -> it } diagnosticsHolder.addDiagnostic(transformedDiagnostic) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt index 2e1175ea291..139e7d82a74 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt @@ -273,7 +273,7 @@ class KotlinCallCompleter( constraintSystem.errors.forEach(diagnosticsHolder::addError) if (returnType is ErrorType && returnType.kind == ErrorTypeKind.RECURSIVE_TYPE) { - diagnosticsHolder.addDiagnostic(TypeCheckerHasRanIntoRecursion()) + diagnosticsHolder.addDiagnostic(TypeCheckerHasRanIntoRecursion) } } diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/CallableReferencesCandidateFactory.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/CallableReferencesCandidateFactory.kt index 733a2e5343e..ba69a1ef2b7 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/CallableReferencesCandidateFactory.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/CallableReferencesCandidateFactory.kt @@ -18,15 +18,15 @@ import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintStorage import org.jetbrains.kotlin.resolve.calls.inference.model.TypeVariableTypeConstructor import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind import org.jetbrains.kotlin.resolve.calls.tower.* -import org.jetbrains.kotlin.resolve.calls.util.ErrorCandidateReason import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns import org.jetbrains.kotlin.resolve.descriptorUtil.isCompanionObject import org.jetbrains.kotlin.resolve.scopes.receivers.DetailedReceiver import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValueWithSmartCastInfo import org.jetbrains.kotlin.types.* -import org.jetbrains.kotlin.types.error.* +import org.jetbrains.kotlin.types.error.ErrorScopeKind import org.jetbrains.kotlin.types.error.ErrorUtils +import org.jetbrains.kotlin.types.error.ErrorTypeKind import org.jetbrains.kotlin.types.expressions.CoercionStrategy import org.jetbrains.kotlin.types.typeUtil.isUnit import org.jetbrains.kotlin.utils.SmartList @@ -43,7 +43,7 @@ class CallableReferencesCandidateFactory( private val CallableReceiver.asReceiverValueForVisibilityChecks: ReceiverValue get() = receiver.receiverValue - override fun createErrorCandidate(reason: ErrorCandidateReason): CallableReferenceResolutionCandidate { + override fun createErrorCandidate(): CallableReferenceResolutionCandidate { val errorScope = ErrorUtils.createErrorScope(ErrorScopeKind.SCOPE_FOR_ERROR_RESOLUTION_CANDIDATE, kotlinCall.toString()) val errorDescriptor = errorScope.getContributedFunctions(kotlinCall.rhsName, scopeTower.location).first() @@ -56,36 +56,21 @@ class CallableReferencesCandidateFactory( buildTypeWithConversions = kotlinCall is CallableReferenceKotlinCallArgument ) - val candidate = CallableReferenceResolutionCandidate( + return CallableReferenceResolutionCandidate( errorDescriptor, dispatchReceiver = null, extensionReceiver = null, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER, reflectionCandidateType, callableReferenceAdaptation, kotlinCall, expectedType, callComponents, scopeTower, resolutionCallbacks, baseSystem ) - - when (reason) { - ErrorCandidateReason.TYPE_COMPUTATION_RECURSION -> candidate.addDiagnostic(RecursiveCallableReferenceType) - ErrorCandidateReason.OTHER -> {} - } - - return candidate } - private fun KotlinType.isErrorRecursiveType(): Boolean { - val unwrapped = if (this is WrappedType && isComputed()) unwrap() else this - return unwrapped is ErrorType && unwrapped.kind == ErrorTypeKind.RECURSIVE_TYPE - } - - private fun createCandidateInternal( + override fun createCandidate( towerCandidate: CandidateWithBoundDispatchReceiver, explicitReceiverKind: ExplicitReceiverKind, extensionReceiver: ReceiverValueWithSmartCastInfo? ): CallableReferenceResolutionCandidate { - val dispatchCallableReceiver = towerCandidate.dispatchReceiver?.let { - toCallableReceiver(it, explicitReceiverKind == ExplicitReceiverKind.DISPATCH_RECEIVER) - } - val extensionCallableReceiver = extensionReceiver?.let { - toCallableReceiver(it, explicitReceiverKind == ExplicitReceiverKind.EXTENSION_RECEIVER) - } + val dispatchCallableReceiver = + towerCandidate.dispatchReceiver?.let { toCallableReceiver(it, explicitReceiverKind == ExplicitReceiverKind.DISPATCH_RECEIVER) } + val extensionCallableReceiver = extensionReceiver?.let { toCallableReceiver(it, explicitReceiverKind == ExplicitReceiverKind.EXTENSION_RECEIVER) } val candidateDescriptor = towerCandidate.descriptor val diagnostics = SmartList() @@ -137,30 +122,6 @@ class CallableReferencesCandidateFactory( return createCallableReferenceCallCandidate(diagnostics) } - override fun createCandidate( - towerCandidate: CandidateWithBoundDispatchReceiver, - explicitReceiverKind: ExplicitReceiverKind, - extensionReceiver: ReceiverValueWithSmartCastInfo? - ): CallableReferenceResolutionCandidate = - createRecursionTolerantCandidate(towerCandidate, explicitReceiverKind, extensionReceiver) { - createErrorCandidate(ErrorCandidateReason.TYPE_COMPUTATION_RECURSION) - } - - private fun createRecursionTolerantCandidate( - towerCandidate: CandidateWithBoundDispatchReceiver, - explicitReceiverKind: ExplicitReceiverKind, - extensionReceiver: ReceiverValueWithSmartCastInfo?, - onRecursion: () -> CallableReferenceResolutionCandidate, - ): CallableReferenceResolutionCandidate = - try { - val resolutionCandidate = createCandidateInternal(towerCandidate, explicitReceiverKind, extensionReceiver) - val returnType = resolutionCandidate.candidate.returnType - - if (returnType == null || !returnType.isErrorRecursiveType()) resolutionCandidate else onRecursion() - } catch (e: LazyWrappedTypeComputationException) { - onRecursion() - } - /** * The function is called only inside [NoExplicitReceiverScopeTowerProcessor] with [TowerData.BothTowerLevelAndContextReceiversGroup]. * This case involves only [SimpleCandidateFactory]. diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallDiagnostics.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallDiagnostics.kt index 5ae0e11488a..38f93dfaa47 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallDiagnostics.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallDiagnostics.kt @@ -116,14 +116,8 @@ class WrongCountOfTypeArguments( override fun report(reporter: DiagnosticReporter) = reporter.onTypeArguments(this) } -class TypeCheckerHasRanIntoRecursion(val onArgument: KotlinCallArgument? = null) : KotlinCallDiagnostic(INAPPLICABLE) { - override fun report(reporter: DiagnosticReporter) { - return if (onArgument != null) { - reporter.onCallArgument(onArgument, this) - } else { - reporter.onCall(this) - } - } +object TypeCheckerHasRanIntoRecursion : KotlinCallDiagnostic(INAPPLICABLE) { + override fun report(reporter: DiagnosticReporter) = reporter.onCall(this) } // Callable reference resolution diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/SimpleCandidateFactory.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/SimpleCandidateFactory.kt index 1d962252f42..aa18c5858cf 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/SimpleCandidateFactory.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/SimpleCandidateFactory.kt @@ -15,7 +15,6 @@ import org.jetbrains.kotlin.resolve.calls.inference.addSubsystemFromArgument import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintStorage import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind import org.jetbrains.kotlin.resolve.calls.tower.* -import org.jetbrains.kotlin.resolve.calls.util.ErrorCandidateReason import org.jetbrains.kotlin.resolve.descriptorUtil.hasDynamicExtensionAnnotation import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValueWithSmartCastInfo import org.jetbrains.kotlin.types.error.ErrorUtils @@ -164,7 +163,7 @@ class SimpleCandidateFactory( return candidate } - override fun createErrorCandidate(reason: ErrorCandidateReason): SimpleResolutionCandidate { + override fun createErrorCandidate(): SimpleResolutionCandidate { val errorScope = ErrorUtils.createErrorScope(ErrorScopeKind.SCOPE_FOR_ERROR_RESOLUTION_CANDIDATE, kotlinCall.toString()) val errorDescriptor = if (kotlinCall.callKind == KotlinCallKind.VARIABLE) { errorScope.getContributedVariables(kotlinCall.name, scopeTower.location) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/ImplicitScopeTower.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/ImplicitScopeTower.kt index e02818b97f6..a7cc029bff1 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/ImplicitScopeTower.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/ImplicitScopeTower.kt @@ -154,7 +154,6 @@ object ResolvedUsingNewFeatures : ResolutionDiagnostic(RESOLVED_NEED_PRESERVE_CO object UnstableSmartCastDiagnostic : ResolutionDiagnostic(UNSTABLE_SMARTCAST) object HiddenExtensionRelatedToDynamicTypes : ResolutionDiagnostic(HIDDEN) object HiddenDescriptor : ResolutionDiagnostic(HIDDEN) -object RecursiveCallableReferenceType : ResolutionDiagnostic(INAPPLICABLE) object InvokeConventionCallNoOperatorModifier : ResolutionDiagnostic(CONVENTION_ERROR) object InfixCallNoInfixModifier : ResolutionDiagnostic(CONVENTION_ERROR) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerResolver.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerResolver.kt index 581f5406577..17922c544d8 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerResolver.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerResolver.kt @@ -19,7 +19,6 @@ package org.jetbrains.kotlin.resolve.calls.tower import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind -import org.jetbrains.kotlin.resolve.calls.util.ErrorCandidateReason import org.jetbrains.kotlin.resolve.descriptorUtil.HIDES_MEMBERS_NAME_LIST import org.jetbrains.kotlin.resolve.scopes.HierarchicalScope import org.jetbrains.kotlin.resolve.scopes.ImportingScope @@ -48,7 +47,7 @@ interface CandidateFactory { extensionReceiver: ReceiverValueWithSmartCastInfo? ): C - fun createErrorCandidate(reason: ErrorCandidateReason = ErrorCandidateReason.OTHER): C + fun createErrorCandidate(): C fun createCandidate( towerCandidate: CandidateWithBoundDispatchReceiver, diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/util/ErrorCandidateReason.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/util/ErrorCandidateReason.kt deleted file mode 100644 index 315bd247c2e..00000000000 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/util/ErrorCandidateReason.kt +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.resolve.calls.util - -enum class ErrorCandidateReason { TYPE_COMPUTATION_RECURSION, OTHER } diff --git a/compiler/testData/codegen/box/callableReference/kt51844.kt b/compiler/testData/codegen/box/callableReference/kt51844.kt deleted file mode 100644 index 83712bb4021..00000000000 --- a/compiler/testData/codegen/box/callableReference/kt51844.kt +++ /dev/null @@ -1,15 +0,0 @@ -// WITH_STDLIB - -abstract class Foo { - abstract fun contains(x: Int); -} - -// ERROR: Type checking has run into a recursive problem. Easiest workaround: specify types of your declarations explicitly -fun Foo.contains(vararg xs: Int) = xs.forEach(this::contains) - -fun box(): String { - object : Foo() { - override fun contains(x: Int) {} - }.contains(1) - return "OK" -} diff --git a/compiler/testData/diagnostics/tests/delegation/kt49477.kt b/compiler/testData/diagnostics/tests/delegation/kt49477.kt index 41d2fd3d087..2efb3cc60fd 100644 --- a/compiler/testData/diagnostics/tests/delegation/kt49477.kt +++ b/compiler/testData/diagnostics/tests/delegation/kt49477.kt @@ -26,7 +26,7 @@ infix fun filter(filter: (R, Any?) -> Boolean): Delegate class GitLabChangesProcessor: DatabaseEntity { var buildProcessors by >"), TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR!>child_many( GitLabBuildProcessor::class.java, - GitLabBuildProcessor::processor + GitLabBuildProcessor::processor ) } diff --git a/compiler/testData/diagnostics/tests/delegation/kt49477Error.kt b/compiler/testData/diagnostics/tests/delegation/kt49477Error.kt index f6aad7b240a..e51ea6d7b9e 100644 --- a/compiler/testData/diagnostics/tests/delegation/kt49477Error.kt +++ b/compiler/testData/diagnostics/tests/delegation/kt49477Error.kt @@ -27,7 +27,7 @@ infix fun filter(filter: (R, Any?) -> Boolean): Delegate class GitLabChangesProcessor: DatabaseEntity { var buildProcessors by >"), TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR!>child_many( GitLabBuildProcessor::class.java, - GitLabBuildProcessor::processor + GitLabBuildProcessor::processor ) } diff --git a/compiler/testData/diagnostics/tests/inference/kt51844.fir.kt b/compiler/testData/diagnostics/tests/inference/kt51844.fir.kt deleted file mode 100644 index 6400879dcc2..00000000000 --- a/compiler/testData/diagnostics/tests/inference/kt51844.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// WITH_STDLIB - -abstract class Foo { -} - -// ERROR: Type checking has run into a recursive problem. Easiest workaround: specify types of your declarations explicitly -fun Foo.contains(vararg xs: Int) = xs.forEach(this::contains) - -fun box(): String { - return "OK" -} diff --git a/compiler/testData/diagnostics/tests/inference/kt51844.kt b/compiler/testData/diagnostics/tests/inference/kt51844.kt deleted file mode 100644 index f9fd990faff..00000000000 --- a/compiler/testData/diagnostics/tests/inference/kt51844.kt +++ /dev/null @@ -1,11 +0,0 @@ -// WITH_STDLIB - -abstract class Foo { -} - -// ERROR: Type checking has run into a recursive problem. Easiest workaround: specify types of your declarations explicitly -fun Foo.contains(vararg xs: Int) = xs.forEach(this::contains) - -fun box(): String { - return "OK" -} diff --git a/compiler/testData/diagnostics/tests/inference/kt51844.txt b/compiler/testData/diagnostics/tests/inference/kt51844.txt deleted file mode 100644 index 4a40034cb7a..00000000000 --- a/compiler/testData/diagnostics/tests/inference/kt51844.txt +++ /dev/null @@ -1,11 +0,0 @@ -package - -public fun box(): kotlin.String -public fun Foo.contains(/*0*/ vararg xs: kotlin.Int /*kotlin.IntArray*/): kotlin.Unit - -public abstract class Foo { - public constructor Foo() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/platformTypes/kt50877.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/kt50877.fir.kt new file mode 100644 index 00000000000..99d5b007510 --- /dev/null +++ b/compiler/testData/diagnostics/tests/platformTypes/kt50877.fir.kt @@ -0,0 +1,31 @@ +// FULL_JDK +// WITH_STDLIB + +// FILE: Schematic.kt +class Schematic { + var name: String? = null + + var error: String? = null + + override fun toString(): String { + return name!! + } +} + +// FILE: SortedListModel.java +import java.util.Comparator; + +public class SortedListModel { + public SortedListModel(Comparator comparator) { + } +} + + +// FILE: main.kt +val model = SortedListModel(Comparator.comparing { b1: Schematic -> + when { + b1.error != null -> 2 + b1.name!!.contains(":") -> 1 + else -> 0 + } +}.thenComparing { b1: Schematic -> b1.name!! }) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/kt50877.kt b/compiler/testData/diagnostics/tests/platformTypes/kt50877.kt index 1b57f849afd..99d5b007510 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/kt50877.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/kt50877.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // FULL_JDK // WITH_STDLIB 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 3afa193512b..95a7198b149 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 @@ -13916,12 +13916,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/inference/kt49961.kt"); } - @Test - @TestMetadata("kt51844.kt") - public void testKt51844() throws Exception { - runTest("compiler/testData/diagnostics/tests/inference/kt51844.kt"); - } - @Test @TestMetadata("kt6175.kt") public void testKt6175() 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 18f8ca3ec16..d3c9c37a9a3 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 @@ -3033,12 +3033,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/callableReference/kt50172.kt"); } - @Test - @TestMetadata("kt51844.kt") - public void testKt51844() throws Exception { - runTest("compiler/testData/codegen/box/callableReference/kt51844.kt"); - } - @Test @TestMetadata("nested.kt") public void testNested() 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 e5785d14433..ce22763964c 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 @@ -3129,12 +3129,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/callableReference/kt50172.kt"); } - @Test - @TestMetadata("kt51844.kt") - public void testKt51844() throws Exception { - runTest("compiler/testData/codegen/box/callableReference/kt51844.kt"); - } - @Test @TestMetadata("nested.kt") public void testNested() 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 34f1f9bcf27..1d6418aa4f5 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -2658,11 +2658,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/callableReference/kt50172.kt"); } - @TestMetadata("kt51844.kt") - public void testKt51844() throws Exception { - runTest("compiler/testData/codegen/box/callableReference/kt51844.kt"); - } - @TestMetadata("nested.kt") public void testNested() throws Exception { runTest("compiler/testData/codegen/box/callableReference/nested.kt"); diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/error/LazyWrappedTypeComputationException.kt b/core/descriptors/src/org/jetbrains/kotlin/types/error/LazyWrappedTypeComputationException.kt deleted file mode 100644 index 44d0ee1f6da..00000000000 --- a/core/descriptors/src/org/jetbrains/kotlin/types/error/LazyWrappedTypeComputationException.kt +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.types.error - -abstract class LazyWrappedTypeComputationException : RuntimeException() diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java index 6505409d931..22626d75f4b 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java @@ -1983,12 +1983,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/callableReference/kt50172.kt"); } - @Test - @TestMetadata("kt51844.kt") - public void testKt51844() throws Exception { - runTest("compiler/testData/codegen/box/callableReference/kt51844.kt"); - } - @Test @TestMetadata("nested.kt") public void testNested() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index ec01a63ce6c..1fc7e9047b5 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -2025,12 +2025,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/callableReference/kt50172.kt"); } - @Test - @TestMetadata("kt51844.kt") - public void testKt51844() throws Exception { - runTest("compiler/testData/codegen/box/callableReference/kt51844.kt"); - } - @Test @TestMetadata("nested.kt") public void testNested() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 3d4bd282c94..7dc996e6a5f 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -1808,11 +1808,6 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/callableReference/kt50172.kt"); } - @TestMetadata("kt51844.kt") - public void testKt51844() throws Exception { - runTest("compiler/testData/codegen/box/callableReference/kt51844.kt"); - } - @TestMetadata("nested.kt") public void testNested() throws Exception { runTest("compiler/testData/codegen/box/callableReference/nested.kt"); diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java index 1ca36677f3c..61f56a3f821 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java @@ -2077,12 +2077,6 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest runTest("compiler/testData/codegen/box/callableReference/kt50172.kt"); } - @Test - @TestMetadata("kt51844.kt") - public void testKt51844() throws Exception { - runTest("compiler/testData/codegen/box/callableReference/kt51844.kt"); - } - @Test @TestMetadata("nested.kt") public void testNested() throws Exception {