From b2fa104081fa12ba08f02a70a6ba6cfceb932abb Mon Sep 17 00:00:00 2001 From: Kirill Rakhman Date: Wed, 3 May 2023 13:32:42 +0200 Subject: [PATCH] [FIR] Keep all failed resolution candidates and fully resolve them Previously, when a candidate was found with an applicability that is better than the current best applicability, all previous candidates were thrown away. Now we keep them, unless the new applicability is successful. If no successful candidates are found, we fully resolve all the unsuccessful ones and select the ones with the least bad applicability. This improves diagnostics for unresolved calls. #KT-57844 Fixed --- ...CompilerTestFE10TestdataTestGenerated.java | 6 ++ ...sticCompilerFE10TestDataTestGenerated.java | 6 ++ .../resolve/delegatingConstructorCall.kt | 4 +- .../testData/resolve/sealedClass.kt | 4 +- ...eeOldFrontendDiagnosticsTestGenerated.java | 6 ++ ...siOldFrontendDiagnosticsTestGenerated.java | 6 ++ ...LightTreeBlackBoxCodegenTestGenerated.java | 6 ++ .../FirPsiBlackBoxCodegenTestGenerated.java | 6 ++ .../jvm/ConeEquivalentCallConflictResolver.kt | 7 +- .../jetbrains/kotlin/fir/FirCallResolver.kt | 66 +++++++------------ .../calls/AbstractConeCallConflictResolver.kt | 35 +++++++--- .../fir/resolve/calls/CandidateCollector.kt | 8 ++- .../calls/ConeOverloadConflictResolver.kt | 11 +++- .../box/suppressions/suppressInvisibleCtor.kt | 17 +++++ .../tests/ObjectWithConstructor.fir.kt | 2 +- .../checkArguments/overloadedFunction.fir.kt | 2 +- .../stubTypes/memberScope.fir.kt | 4 +- .../completeInferenceIfManyFailed.fir.kt | 2 +- .../specialCallsWithCallableReferences.fir.kt | 10 +-- .../incompleteCodeNoNoneApplicable.fir.kt | 20 ------ .../incompleteCodeNoNoneApplicable.kt | 1 + .../WrongTraceInCallResolver.fir.kt | 2 +- .../tests/resolve/errorPriority.fir.kt | 27 ++++++++ .../tests/resolve/errorPriority.kt | 27 ++++++++ ...tionExpectedWhenSeveralInvokesExist.fir.kt | 2 +- .../varargsInDifferentPositions.fir.kt | 2 +- .../constructorCallType.fir.kt | 2 +- .../secondaryConstructors/generics2.fir.kt | 4 +- .../varnotnull/plusplusMinusminus.fir.kt | 2 +- .../implicitIntegerCoercionOverloading.fir.kt | 2 +- .../inferenceForSignedAndUnsignedTypes.fir.kt | 4 +- ...onversionForUnsignedTypesOnReceiver.fir.kt | 4 +- ...ResolutionForSignedAndUnsignedTypes.fir.kt | 2 +- .../test/runners/DiagnosticTestGenerated.java | 6 ++ .../codegen/BlackBoxCodegenTestGenerated.java | 6 ++ .../IrBlackBoxCodegenTestGenerated.java | 6 ++ ...kBoxCodegenWithIrInlinerTestGenerated.java | 6 ++ .../LightAnalysisModeTestGenerated.java | 5 ++ .../conditional-expression/p-6/neg/1.1.fir.kt | 4 +- .../p-3/neg/1.1.fir.kt | 4 +- .../diagnostics/notLinked/dfa/neg/13.fir.kt | 2 +- .../diagnostics/notLinked/dfa/neg/26.fir.kt | 2 +- .../diagnostics/notLinked/dfa/neg/43.fir.kt | 2 +- .../diagnostics/notLinked/dfa/neg/5.fir.kt | 2 +- 44 files changed, 245 insertions(+), 109 deletions(-) create mode 100644 compiler/testData/codegen/box/suppressions/suppressInvisibleCtor.kt delete mode 100644 compiler/testData/diagnostics/tests/multimodule/duplicateMethod/incompleteCodeNoNoneApplicable.fir.kt create mode 100644 compiler/testData/diagnostics/tests/resolve/errorPriority.fir.kt create mode 100644 compiler/testData/diagnostics/tests/resolve/errorPriority.kt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java index dc0a42c12c5..666d44bce4e 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java @@ -26592,6 +26592,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/resolve/CycleInTypeArgs.kt"); } + @Test + @TestMetadata("errorPriority.kt") + public void testErrorPriority() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/errorPriority.kt"); + } + @Test @TestMetadata("HiddenDeclarations.kt") public void testHiddenDeclarations() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java index 2303026b2e1..ce5e02daa8b 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java @@ -26592,6 +26592,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/resolve/CycleInTypeArgs.kt"); } + @Test + @TestMetadata("errorPriority.kt") + public void testErrorPriority() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/errorPriority.kt"); + } + @Test @TestMetadata("HiddenDeclarations.kt") public void testHiddenDeclarations() throws Exception { diff --git a/compiler/fir/analysis-tests/testData/resolve/delegatingConstructorCall.kt b/compiler/fir/analysis-tests/testData/resolve/delegatingConstructorCall.kt index b4a312e62e3..bae44112600 100644 --- a/compiler/fir/analysis-tests/testData/resolve/delegatingConstructorCall.kt +++ b/compiler/fir/analysis-tests/testData/resolve/delegatingConstructorCall.kt @@ -23,5 +23,5 @@ open class A5 { constructor(x: Short) } -class B5_1 : A5(1 + 1) -class B5_2 : A5(100 * 2) +class B5_1 : A5(1 + 1) +class B5_2 : A5(100 * 2) diff --git a/compiler/fir/analysis-tests/testData/resolve/sealedClass.kt b/compiler/fir/analysis-tests/testData/resolve/sealedClass.kt index 071205181ae..0980bd066ea 100644 --- a/compiler/fir/analysis-tests/testData/resolve/sealedClass.kt +++ b/compiler/fir/analysis-tests/testData/resolve/sealedClass.kt @@ -6,5 +6,5 @@ sealed class WithPrivateConstructor private constructor(val x: Int) { private constructor() : this(42) } -object First : WithPrivateConstructor() // error -object Second : WithPrivateConstructor(0) // error +object First : WithPrivateConstructor() // error +object Second : WithPrivateConstructor(0) // error diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java index 6bd25e8f1d3..3a290a99647 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java @@ -26592,6 +26592,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/resolve/CycleInTypeArgs.kt"); } + @Test + @TestMetadata("errorPriority.kt") + public void testErrorPriority() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/errorPriority.kt"); + } + @Test @TestMetadata("HiddenDeclarations.kt") public void testHiddenDeclarations() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java index 0d5f251ad8c..18ed0b3347c 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java @@ -26604,6 +26604,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/resolve/CycleInTypeArgs.kt"); } + @Test + @TestMetadata("errorPriority.kt") + public void testErrorPriority() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/errorPriority.kt"); + } + @Test @TestMetadata("HiddenDeclarations.kt") public void testHiddenDeclarations() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index 8d996b46fae..5481abfd6e8 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -50156,6 +50156,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr public void testSuppressInvisible() throws Exception { runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt"); } + + @Test + @TestMetadata("suppressInvisibleCtor.kt") + public void testSuppressInvisibleCtor() throws Exception { + runTest("compiler/testData/codegen/box/suppressions/suppressInvisibleCtor.kt"); + } } @Nested diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index a39a44268f9..970d659404d 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -50156,6 +50156,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo public void testSuppressInvisible() throws Exception { runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt"); } + + @Test + @TestMetadata("suppressInvisibleCtor.kt") + public void testSuppressInvisibleCtor() throws Exception { + runTest("compiler/testData/codegen/box/suppressions/suppressInvisibleCtor.kt"); + } } @Nested diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/resolve/calls/jvm/ConeEquivalentCallConflictResolver.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/resolve/calls/jvm/ConeEquivalentCallConflictResolver.kt index 090b32a57f6..07a1329307f 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/resolve/calls/jvm/ConeEquivalentCallConflictResolver.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/resolve/calls/jvm/ConeEquivalentCallConflictResolver.kt @@ -25,7 +25,12 @@ class ConeEquivalentCallConflictResolver( specificityComparator: TypeSpecificityComparator, inferenceComponents: InferenceComponents, transformerComponents: BodyResolveComponents -) : AbstractConeCallConflictResolver(specificityComparator, inferenceComponents, transformerComponents) { +) : AbstractConeCallConflictResolver( + specificityComparator, + inferenceComponents, + transformerComponents, + considerMissingArgumentsInSignatures = true, +) { override fun chooseMaximallySpecificCandidates( candidates: Set, discriminateAbstracts: Boolean diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt index 240e6f48deb..1f7d6418b50 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt @@ -164,52 +164,46 @@ class FirCallResolver( ) towerResolver.reset() val result = towerResolver.runResolver(info, resolutionContext, collector) - val bestCandidates = result.bestCandidates() - var reducedCandidates = reduceCandidates(bestCandidates, explicitReceiver, resolutionContext, result.currentApplicability.isSuccess) - reducedCandidates = overloadByLambdaReturnTypeResolver.reduceCandidates(qualifiedAccess, bestCandidates, reducedCandidates) + var (reducedCandidates, newApplicability) = reduceCandidates(result, explicitReceiver, resolutionContext) + reducedCandidates = overloadByLambdaReturnTypeResolver.reduceCandidates(qualifiedAccess, reducedCandidates, reducedCandidates) - return ResolutionResult(info, result.currentApplicability, reducedCandidates) + return ResolutionResult(info, newApplicability ?: result.currentApplicability, reducedCandidates) } + /** + * Returns a [Pair] consisting of the reduced candidates and the new applicability if it has changed and `null` otherwise. + */ private fun reduceCandidates( - candidates: List, - explicitReceiver: FirExpression?, - resolutionContext: ResolutionContext, - isSuccess: Boolean, - ): Set { + collector: CandidateCollector, + explicitReceiver: FirExpression? = null, + resolutionContext: ResolutionContext = transformer.resolutionContext, + ): Pair, CandidateApplicability?> { fun chooseMostSpecific(list: List): Set { val onSuperReference = (explicitReceiver as? FirQualifiedAccessExpression)?.calleeReference is FirSuperReference return conflictResolver.chooseMaximallySpecificCandidates(list, discriminateAbstracts = onSuperReference) } - if (isSuccess) { - return chooseMostSpecific(candidates) + val candidates = collector.bestCandidates() + + if (collector.currentApplicability.isSuccess) { + return chooseMostSpecific(candidates) to null } - val singleApplicability = candidates.mapTo(mutableSetOf()) { it.currentApplicability }.singleOrNull() - - if (singleApplicability == null || singleApplicability <= CandidateApplicability.INAPPLICABLE) { - return candidates.toSet() - } - - // If all candidates have the same kind on inapplicability - try to choose the most specific one if (candidates.size > 1) { - // We have multiple candidates with the same inapplicability. We want to select the "least bad" candidates. - // First, fully process all of them and group them by their worst applicability. val groupedByDiagnosticCount = candidates.groupBy { components.resolutionStageRunner.fullyProcessCandidate(it, resolutionContext) it.diagnostics.minOf(ResolutionDiagnostic::applicability) } - // Then, select the group with the best worst applicability. + // Then, select the group with the least bad applicability. groupedByDiagnosticCount.maxBy { it.key }.let { - return chooseMostSpecific(it.value) + return chooseMostSpecific(it.value) to it.key } } - return chooseMostSpecific(candidates) + return candidates.toSet() to null } fun resolveVariableAccessAndSelectCandidate( @@ -384,23 +378,18 @@ class FirCallResolver( manager = TowerResolveManager(localCollector), ) } - val bestCandidates = result.bestCandidates() - val applicability = result.currentApplicability - val noSuccessfulCandidates = !applicability.isSuccess - val reducedCandidates = if (noSuccessfulCandidates) { - bestCandidates.toSet() - } else { - conflictResolver.chooseMaximallySpecificCandidates(bestCandidates) - } + val isSuccess = result.currentApplicability.isSuccess + val (reducedCandidates, newApplicability) = reduceCandidates(result, callableReferenceAccess.explicitReceiver) + val applicability = newApplicability ?: result.currentApplicability (callableReferenceAccess.explicitReceiver as? FirResolvedQualifier)?.replaceResolvedToCompanionObject( - bestCandidates.isNotEmpty() && bestCandidates.all { it.isFromCompanionObjectTypeScope } + reducedCandidates.isNotEmpty() && reducedCandidates.all { it.isFromCompanionObjectTypeScope } ) resolvedCallableReferenceAtom.hasBeenResolvedOnce = true when { - noSuccessfulCandidates -> { + !isSuccess -> { val errorReference = buildReferenceWithErrorCandidate( info, if (applicability == CandidateApplicability.K2_UNSUPPORTED) { @@ -496,7 +485,7 @@ class FirCallResolver( transformer.resolutionContext ) - return components.callResolver.selectDelegatingConstructorCall(delegatedConstructorCall, name, result, callInfo) + return selectDelegatingConstructorCall(delegatedConstructorCall, name, result, callInfo) } private fun ConeTypeProjection.toFirTypeProjection(): FirTypeProjection = when (this) { @@ -594,19 +583,14 @@ class FirCallResolver( private fun selectDelegatingConstructorCall( call: FirDelegatedConstructorCall, name: Name, result: CandidateCollector, callInfo: CallInfo ): FirDelegatedConstructorCall { - val bestCandidates = result.bestCandidates() - val reducedCandidates = if (!result.currentApplicability.isSuccess) { - bestCandidates.toSet() - } else { - conflictResolver.chooseMaximallySpecificCandidates(bestCandidates) - } + val (reducedCandidates, newApplicability) = reduceCandidates(result) val nameReference = createResolvedNamedReference( call.calleeReference, name, callInfo, reducedCandidates, - result.currentApplicability, + newApplicability ?: result.currentApplicability, ) return call.apply { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt index 9eabec9622d..9d827d99574 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.fir.resolve.calls +import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.utils.isExpect import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents @@ -32,7 +33,8 @@ import org.jetbrains.kotlin.utils.addIfNotNull abstract class AbstractConeCallConflictResolver( private val specificityComparator: TypeSpecificityComparator, protected val inferenceComponents: InferenceComponents, - private val transformerComponents: BodyResolveComponents + private val transformerComponents: BodyResolveComponents, + private val considerMissingArgumentsInSignatures: Boolean, ) : ConeCallConflictResolver() { private val samResolver: FirSamResolver get() = transformerComponents.samResolver @@ -188,19 +190,36 @@ abstract class AbstractConeCallConflictResolver( } else { called.contextReceivers.mapTo(this) { TypeWithConversion(it.typeRef.coneType.fullyExpandedType(session)) } call.argumentMapping?.mapTo(this) { (_, parameter) -> - val argumentType = parameter.argumentType().fullyExpandedType(session) - if (!call.usesSAM) { - TypeWithConversion(argumentType) - } else { - val functionType = samResolver.getFunctionTypeForPossibleSamType(argumentType) - if (functionType == null) TypeWithConversion(argumentType) - else TypeWithConversion(functionType, argumentType) + parameter.toTypeWithConversion(session, call) + } + + if (considerMissingArgumentsInSignatures) { + // When we create signatures for unsuccessful candidates, some parameters might be missing an argument. + // When necessary, we consider those too. + // fun foo(a: String, b: Int) + // fun foo(a: String, c: Boolean) + // foo(a) + // Here, no argument is passed for the parameters b and c, but the signatures will be different. + call.diagnostics.mapNotNullTo(this) { + if (it !is NoValueForParameter) return@mapNotNullTo null + it.valueParameter.toTypeWithConversion(session, call) } } } } } + private fun FirValueParameter.toTypeWithConversion(session: FirSession, call: Candidate): TypeWithConversion { + val argumentType = argumentType().fullyExpandedType(session) + return if (!call.usesSAM) { + TypeWithConversion(argumentType) + } else { + val functionType = samResolver.getFunctionTypeForPossibleSamType(argumentType) + if (functionType == null) TypeWithConversion(argumentType) + else TypeWithConversion(functionType, argumentType) + } + } + private fun createFlatSignature(call: Candidate, klass: FirClassLikeDeclaration): FlatSignature { return FlatSignature( call, diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CandidateCollector.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CandidateCollector.kt index 0bea064ceec..5f79b70f0b0 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CandidateCollector.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CandidateCollector.kt @@ -34,7 +34,13 @@ open class CandidateCollector( val applicability = resolutionStageRunner.processCandidate(candidate, context) if (applicability > currentApplicability || (applicability == currentApplicability && group < bestGroup)) { - candidates.clear() + // Only throw away previous candidates if the new one is successful. If we don't find a successful candidate, we keep all + // unsuccessful ones so that we can run all stages and pick the one with the least bad applicability. + // See FirCallResolver.reduceCandidates. + if (applicability >= CandidateApplicability.RESOLVED_LOW_PRIORITY) { + candidates.clear() + } + currentApplicability = applicability bestGroup = group } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConeOverloadConflictResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConeOverloadConflictResolver.kt index cf48c1cc409..7516a16401d 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConeOverloadConflictResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConeOverloadConflictResolver.kt @@ -31,12 +31,17 @@ typealias CandidateSignature = FlatSignature class ConeOverloadConflictResolver( specificityComparator: TypeSpecificityComparator, inferenceComponents: InferenceComponents, - transformerComponents: BodyResolveComponents -) : AbstractConeCallConflictResolver(specificityComparator, inferenceComponents, transformerComponents) { + transformerComponents: BodyResolveComponents, +) : AbstractConeCallConflictResolver( + specificityComparator, + inferenceComponents, + transformerComponents, + considerMissingArgumentsInSignatures = false, +) { override fun chooseMaximallySpecificCandidates( candidates: Set, - discriminateAbstracts: Boolean + discriminateAbstracts: Boolean, ): Set = chooseMaximallySpecificCandidates(candidates, discriminateAbstracts, discriminateGenerics = true) private fun chooseMaximallySpecificCandidates( diff --git a/compiler/testData/codegen/box/suppressions/suppressInvisibleCtor.kt b/compiler/testData/codegen/box/suppressions/suppressInvisibleCtor.kt new file mode 100644 index 00000000000..c20fdf3632b --- /dev/null +++ b/compiler/testData/codegen/box/suppressions/suppressInvisibleCtor.kt @@ -0,0 +1,17 @@ +// ISSUE: KT-58421 +// TARGET_BACKEND: JVM + +// MODULE: lib +// FILE: ContinuationImpl.kt + +internal abstract class ContinuationImpl() { + constructor(arg: Int) : this() +} + +// MODULE: main(lib) +// FILE: box.kt + +@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "NONE_APPLICABLE") +internal class SafeCollector: ContinuationImpl() + +fun box() = "OK" \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/ObjectWithConstructor.fir.kt b/compiler/testData/diagnostics/tests/ObjectWithConstructor.fir.kt index 446d0eecf65..af504b4e89b 100644 --- a/compiler/testData/diagnostics/tests/ObjectWithConstructor.fir.kt +++ b/compiler/testData/diagnostics/tests/ObjectWithConstructor.fir.kt @@ -1,5 +1,5 @@ object A1() { - constructor(x: Int = "", y: Int) : this() { + constructor(x: Int = "", y: Int) : this() { x + y } } diff --git a/compiler/testData/diagnostics/tests/checkArguments/overloadedFunction.fir.kt b/compiler/testData/diagnostics/tests/checkArguments/overloadedFunction.fir.kt index 1010d82ea82..1e6d3028b79 100644 --- a/compiler/testData/diagnostics/tests/checkArguments/overloadedFunction.fir.kt +++ b/compiler/testData/diagnostics/tests/checkArguments/overloadedFunction.fir.kt @@ -11,6 +11,6 @@ fun test() { foo(1, 2) foo("") - bar(1, 2) + bar(1, 2) bar() } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.fir.kt index 885e40cb4c3..b7a9a950253 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.fir.kt @@ -94,7 +94,7 @@ fun test() { emit(null) val x = get() if (x == null) { - x.toString("") + x.toString("") } "" @@ -134,7 +134,7 @@ fun test() { emit(null) val x = get() if (x === null) { - x.toString("") + x.toString("") } "" diff --git a/compiler/testData/diagnostics/tests/inference/completeInferenceIfManyFailed.fir.kt b/compiler/testData/diagnostics/tests/inference/completeInferenceIfManyFailed.fir.kt index 4af5d4b1d12..e67532e1659 100644 --- a/compiler/testData/diagnostics/tests/inference/completeInferenceIfManyFailed.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/completeInferenceIfManyFailed.fir.kt @@ -13,6 +13,6 @@ fun joinT(x: Comparable<*>, y: T): T? { } fun test() { - val x2 = joinT(Unit, "2") + val x2 = joinT(Unit, "2") checkSubtype(x2) } diff --git a/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt b/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt index b3590fc1912..44263d33920 100644 --- a/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt @@ -274,8 +274,8 @@ fun poll76() { } fun poll8() { - val inv = ::bar in setOf(::foo) - inv() + val inv = ::bar in setOf(::foo) + inv() } fun poll81() { @@ -284,8 +284,8 @@ fun poll81() { } fun poll82() { - val inv = ::bar3 in setOf(::foo3) - inv() + val inv = ::bar3 in setOf(::foo3) + inv() } fun poll83() { @@ -294,7 +294,7 @@ fun poll83() { } fun poll84() { - val inv = ::bar5 in setOf(::foo5) + val inv = ::bar5 in setOf(::foo5) inv } diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/incompleteCodeNoNoneApplicable.fir.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/incompleteCodeNoNoneApplicable.fir.kt deleted file mode 100644 index 8802f1cd5b7..00000000000 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/incompleteCodeNoNoneApplicable.fir.kt +++ /dev/null @@ -1,20 +0,0 @@ -// MODULE: m1 -// FILE: a.kt -package p - -fun f(s: String, t: String) = s + t - -// MODULE: m2 -// FILE: b.kt -package p - -fun f(s: String, t: String) = t + s - -// MODULE: m3(m1, m2) -// FILE: c.kt -import p.f - -fun test() { - // There should be no "none applicable" error here - f( -} diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/incompleteCodeNoNoneApplicable.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/incompleteCodeNoNoneApplicable.kt index 4a661e7b5b4..c1e53a4566e 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/incompleteCodeNoNoneApplicable.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/incompleteCodeNoNoneApplicable.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // MODULE: m1 // FILE: a.kt package p diff --git a/compiler/testData/diagnostics/tests/regressions/WrongTraceInCallResolver.fir.kt b/compiler/testData/diagnostics/tests/regressions/WrongTraceInCallResolver.fir.kt index 895ef9ffa4b..017ad58a60f 100644 --- a/compiler/testData/diagnostics/tests/regressions/WrongTraceInCallResolver.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/WrongTraceInCallResolver.fir.kt @@ -5,5 +5,5 @@ fun foo(x : Int) {} fun foo(x : Long) {} fun f(): Unit { - foo(1) + foo<Int, Int>(1) } diff --git a/compiler/testData/diagnostics/tests/resolve/errorPriority.fir.kt b/compiler/testData/diagnostics/tests/resolve/errorPriority.fir.kt new file mode 100644 index 00000000000..5202119337a --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/errorPriority.fir.kt @@ -0,0 +1,27 @@ +// SKIP_TXT + +// FILE: MyJClass.java + +public class MyJClass { + public void meth(int pathname) {} + private void meth(String pathname, int prefixLength) {} + private void meth(String child, boolean b) {} +} + +// FILE: MyJClass2.java + +public class MyJClass2 { + public void meth(int pathname) {} + public void meth(String pathname, int prefixLength) {} + private void meth(String child, boolean b) {} +} + +// FILE: test.kt + +fun test1(myJClass: MyJClass) { + myJClass.meth("") +} + +fun test2(myJClass: MyJClass2) { + myJClass.meth("") +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/errorPriority.kt b/compiler/testData/diagnostics/tests/resolve/errorPriority.kt new file mode 100644 index 00000000000..46567ac7b4b --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/errorPriority.kt @@ -0,0 +1,27 @@ +// SKIP_TXT + +// FILE: MyJClass.java + +public class MyJClass { + public void meth(int pathname) {} + private void meth(String pathname, int prefixLength) {} + private void meth(String child, boolean b) {} +} + +// FILE: MyJClass2.java + +public class MyJClass2 { + public void meth(int pathname) {} + public void meth(String pathname, int prefixLength) {} + private void meth(String child, boolean b) {} +} + +// FILE: test.kt + +fun test1(myJClass: MyJClass) { + myJClass.meth("") +} + +fun test2(myJClass: MyJClass2) { + myJClass.meth("") +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/functionExpectedWhenSeveralInvokesExist.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/functionExpectedWhenSeveralInvokesExist.fir.kt index 9b1d7aae0ad..ade7feeb8ad 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/functionExpectedWhenSeveralInvokesExist.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/functionExpectedWhenSeveralInvokesExist.fir.kt @@ -7,7 +7,7 @@ class SomeClass fun test(identifier: SomeClass, fn: String.() -> Unit) { identifier() - identifier(123) + identifier(123) identifier(1, 2) 1.fn() } diff --git a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/varargsInDifferentPositions.fir.kt b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/varargsInDifferentPositions.fir.kt index 7a0759a1f57..531177aabfa 100644 --- a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/varargsInDifferentPositions.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/varargsInDifferentPositions.fir.kt @@ -8,6 +8,6 @@ fun overloadedFun(arg: String, vararg args: String) = X1 fun overloadedFun(arg: String, vararg args: String, flag: Boolean = true) = X2 val test1a: X1 = overloadedFun("", "") -val test1b: X1 = overloadedFun("", args = "") +val test1b: X1 = overloadedFun("", args = "") val test1c: X2 = overloadedFun("", "", "", flag = true) diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/constructorCallType.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/constructorCallType.fir.kt index e599d730eba..23157e948ab 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/constructorCallType.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/constructorCallType.fir.kt @@ -18,7 +18,7 @@ val y2: B = B("") val y3: B = B(1) val y4: B = B("") -val y5: B = B(1) +val y5: B = B(1) val y6: B = B("") val y7: B = B(1) val y8: B = B("") diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/generics2.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/generics2.fir.kt index 45c826f81ce..24354bc1f37 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/generics2.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/generics2.fir.kt @@ -6,9 +6,9 @@ class A0 { constructor(x: T1, y: T2, z: T2): this(x, 1) // ok, delegates to constructor(x: T1, y: Int) - constructor(x: T1, y: Int): this(x, "") + constructor(x: T1, y: Int): this(x, "") constructor(x: T1): this(x, 1) - constructor(x: T1, y: T2, z: String): this(y, x) + constructor(x: T1, y: T2, z: String): this(y, x) } class A1 : B { diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/plusplusMinusminus.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/plusplusMinusminus.fir.kt index 97923e11e59..05f52e8b68c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/plusplusMinusminus.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/plusplusMinusminus.fir.kt @@ -14,7 +14,7 @@ fun bar(arg: Long?): Long { return i-- + i } if (i++ == 7L) { - return i++ + i + return i++ + i } return 0L } diff --git a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionOverloading.fir.kt b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionOverloading.fir.kt index 061d2442296..becd444290f 100644 --- a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionOverloading.fir.kt +++ b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionOverloading.fir.kt @@ -18,7 +18,7 @@ fun testLong(@ImplicitIntegerCoercion x: ULong) = x fun box(): String = when { test(5) != 5.toUInt() -> "Fail: test(5)" - test(5L) != 5L.toULong() -> "Fail: test(5L)" + test(5L) != 5L.toULong() -> "Fail: test(5L)" testLong(5) != 5L.toULong() -> "Fail: test(5L)" testLong(5L) != 5L.toULong() -> "Fail: test(5L)" else -> "OK" diff --git a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/inferenceForSignedAndUnsignedTypes.fir.kt b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/inferenceForSignedAndUnsignedTypes.fir.kt index dce32845439..7989f1e7b9c 100644 --- a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/inferenceForSignedAndUnsignedTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/inferenceForSignedAndUnsignedTypes.fir.kt @@ -12,8 +12,8 @@ fun foo() { select(1, 1u) checkType { _>() } takeUByte(id(1)) - 1 + 1u - (1u + 1) checkType { _() } + 1 + 1u + (1u + 1) checkType { _() } id(1) } diff --git a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/noConversionForUnsignedTypesOnReceiver.fir.kt b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/noConversionForUnsignedTypesOnReceiver.fir.kt index 5e947d654c0..377ab8b522a 100644 --- a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/noConversionForUnsignedTypesOnReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/noConversionForUnsignedTypesOnReceiver.fir.kt @@ -9,6 +9,6 @@ fun test() { 1.fUShort() 1.fULong() - 3000000000 until 3000000004UL - 0 until 10u + 3000000000 until 3000000004UL + 0 until 10u } diff --git a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/overloadResolutionForSignedAndUnsignedTypes.fir.kt b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/overloadResolutionForSignedAndUnsignedTypes.fir.kt index 34476ddaeb0..55eb5897eec 100644 --- a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/overloadResolutionForSignedAndUnsignedTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/overloadResolutionForSignedAndUnsignedTypes.fir.kt @@ -21,7 +21,7 @@ fun test() { foo(1) checkType { _() } foo(1u) checkType { _() } - foo(2147483648) checkType { _() } + foo(2147483648) checkType { _() } foo(2147483647 + 1) checkType { _() } fooByte(1) checkType { _() } 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 e9dec78b0a8..d8ecd80f66b 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 @@ -27376,6 +27376,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/resolve/CycleInTypeArgs.kt"); } + @Test + @TestMetadata("errorPriority.kt") + public void testErrorPriority() throws Exception { + runTest("compiler/testData/diagnostics/tests/resolve/errorPriority.kt"); + } + @Test @TestMetadata("HiddenDeclarations.kt") public void testHiddenDeclarations() 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 4681dd1c018..6413edb7e0b 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 @@ -47534,6 +47534,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testSuppressInvisible() throws Exception { runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt"); } + + @Test + @TestMetadata("suppressInvisibleCtor.kt") + public void testSuppressInvisibleCtor() throws Exception { + runTest("compiler/testData/codegen/box/suppressions/suppressInvisibleCtor.kt"); + } } @Nested 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 6899b7f3b98..46882d8b798 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 @@ -50156,6 +50156,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes public void testSuppressInvisible() throws Exception { runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt"); } + + @Test + @TestMetadata("suppressInvisibleCtor.kt") + public void testSuppressInvisibleCtor() throws Exception { + runTest("compiler/testData/codegen/box/suppressions/suppressInvisibleCtor.kt"); + } } @Nested diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java index 1e842537f19..fa732244e78 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java @@ -50156,6 +50156,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack public void testSuppressInvisible() throws Exception { runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt"); } + + @Test + @TestMetadata("suppressInvisibleCtor.kt") + public void testSuppressInvisibleCtor() throws Exception { + runTest("compiler/testData/codegen/box/suppressions/suppressInvisibleCtor.kt"); + } } @Nested diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 399ed99134b..96f92aee175 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -38575,6 +38575,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes public void testSuppressInvisible() throws Exception { runTest("compiler/testData/codegen/box/suppressions/suppressInvisible.kt"); } + + @TestMetadata("suppressInvisibleCtor.kt") + public void testSuppressInvisibleCtor() throws Exception { + runTest("compiler/testData/codegen/box/suppressions/suppressInvisibleCtor.kt"); + } } @TestMetadata("compiler/testData/codegen/box/suspendConversion") diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.fir.kt index 325524757a6..ab6e5a36f97 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.fir.kt @@ -26,7 +26,7 @@ import checkSubtype fun case1() { val a: Any = true if (a) { "true" } else "false" - checkSubtype(a) + checkSubtype(a) } /* @@ -37,7 +37,7 @@ fun case1() { fun case2() { val a = JavaContainer.aO if (a) { "true" } else "false" - checkSubtype(a) + checkSubtype(a) } // TESTCASE NUMBER: 3 diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.fir.kt index 1ac21c4531c..380968481d4 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/resolving-callable-references/bidirectional-resolution-for-callable-calls/p-3/neg/1.1.fir.kt @@ -10,7 +10,7 @@ class Case1() { } fun case() { - Companion(::x) + Companion(::x) } val x = "" @@ -26,7 +26,7 @@ class Case2() { } fun case() { - Companion(::x) + Companion(::x) } val x = C() diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt index 530be466f30..e69732111ff 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt @@ -13,7 +13,7 @@ fun case_1(x: Class?) { fun case_2() { var x: Class? = 10 x!! - x(if (true) {x=null;0} else 0, x) + x(if (true) {x=null;0} else 0, x) x x.fun_1() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt index a70a5c1ea9c..67c95ead7a5 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt @@ -53,7 +53,7 @@ fun case_4() { fun case_5() { var x: Class? = Class() x!! - x(if (true) {x=null;0} else 0, x) + x(if (true) {x=null;0} else 0, x) x.fun_1() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.kt index cf1a691e51c..78cd7387cb0 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.kt @@ -13,7 +13,7 @@ fun case_1(x: Double?, y: Double?) : Double { } else if (x == null && y != null) { y } else { - x + y + x + y } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.kt index 5e306e1144c..d82c2a0bc42 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.kt @@ -6,7 +6,7 @@ class Case1 { inline fun case_1(x: Any?) { if (x is T) { x - x.toByte() + x.toByte() } } }