diff --git a/compiler/fir/analysis-tests/testData/resolve/callResolution/lambdaAsReceiver.fir.txt b/compiler/fir/analysis-tests/testData/resolve/callResolution/lambdaAsReceiver.fir.txt index eafc3a71ccf..17d13aad240 100644 --- a/compiler/fir/analysis-tests/testData/resolve/callResolution/lambdaAsReceiver.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/callResolution/lambdaAsReceiver.fir.txt @@ -16,6 +16,6 @@ FILE: lambdaAsReceiver.kt fun (): R|kotlin/String| { ^ String() } - .#() + .#() String().R|/bar|() } diff --git a/compiler/fir/analysis-tests/testData/resolve/callResolution/lambdaAsReceiver.kt b/compiler/fir/analysis-tests/testData/resolve/callResolution/lambdaAsReceiver.kt index 543f908a55b..87c55d93531 100644 --- a/compiler/fir/analysis-tests/testData/resolve/callResolution/lambdaAsReceiver.kt +++ b/compiler/fir/analysis-tests/testData/resolve/callResolution/lambdaAsReceiver.kt @@ -9,6 +9,6 @@ fun main1() { } fun main2() { - { "" }.bar() + { "" }.bar() "".bar() } diff --git a/compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.fir.txt b/compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.fir.txt index c202a84bbf1..3fc78c7f234 100644 --- a/compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.fir.txt @@ -29,7 +29,7 @@ FILE: lambdaArgInScopeFunction.kt } ) } R|/lambda|.R|/checkType| KotlinClass)?|>( = checkType@fun R|CheckTypeInv?>|.(): R|kotlin/Unit| { - this@R|special/anonymous|.# KotlinClass?|>() + this@R|special/anonymous|.# KotlinClass?|>() } ) } @@ -50,7 +50,7 @@ FILE: lambdaArgInScopeFunction.kt } ) R|/lambda|.R|/checkType| KotlinClass|>( = checkType@fun R|CheckTypeInv>|.(): R|kotlin/Unit| { - this@R|special/anonymous|.# KotlinClass?|>() + this@R|special/anonymous|.# KotlinClass?|>() } ) } diff --git a/compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.kt b/compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.kt index 16b0ad25478..2e207ca3838 100644 --- a/compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.kt +++ b/compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.kt @@ -21,7 +21,7 @@ fun case1(kotlinClass: KotlinClass?) { {it} } - lambda.checkType { _>() } + lambda.checkType { _>() } } // TESTCASE NUMBER: 2 fun case2(kotlinClass: KotlinClass) { @@ -36,5 +36,5 @@ fun case2(kotlinClass: KotlinClass) { {it} } - lambda.checkType { _>() } + lambda.checkType { _>() } } diff --git a/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.fir.txt b/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.fir.txt index 242cf9e7534..1027807dbdf 100644 --- a/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.fir.txt @@ -29,11 +29,11 @@ FILE: KotlinClass.kt } ) R|/invalidType|.R|/checkType| kotlin/Boolean|>( = checkType@fun R|CheckTypeInv>|.(): R|kotlin/Unit| { - this@R|special/anonymous|.# kotlin/Boolean|>() + this@R|special/anonymous|.# kotlin/Boolean|>() } ) R|/Case1.Case1|(R|/javaClass|).R|/Case1.x|.R|/checkType| kotlin/Boolean|>( = checkType@fun R|CheckTypeInv>|.(): R|kotlin/Unit| { - this@R|special/anonymous|.# kotlin/Boolean|>() + this@R|special/anonymous|.# kotlin/Boolean|>() } ) } @@ -122,11 +122,11 @@ FILE: KotlinClass.kt } ) R|/invalidType|.R|/checkType| kotlin/Boolean|>( = checkType@fun R|CheckTypeInv>|.(): R|kotlin/Unit| { - this@R|special/anonymous|.# kotlin/Boolean|>() + this@R|special/anonymous|.# kotlin/Boolean|>() } ) R|/Case2.Case2|(R|/kotlinClass|).R|/Case2.x|.R|/checkType| kotlin/Boolean|>( = checkType@fun R|CheckTypeInv>|.(): R|kotlin/Unit| { - this@R|special/anonymous|.# kotlin/Boolean|>() + this@R|special/anonymous|.# kotlin/Boolean|>() } ) } diff --git a/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.kt b/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.kt index ae9f0e41837..f69c1b469b6 100644 --- a/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.kt +++ b/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.kt @@ -26,9 +26,9 @@ fun case1(javaClass: JavaClass?) { validType.checkType { _>() } //ok - invalidType.checkType { _>() } //(!!!) + invalidType.checkType { _>() } //(!!!) - Case1(javaClass).x.checkType { _>() } //(!!!) + Case1(javaClass).x.checkType { _>() } //(!!!) } class Case1(val javaClass: JavaClass?) { @@ -55,9 +55,9 @@ fun case2(kotlinClass: KotlinClass?) { validType.checkType { _>() } //ok - invalidType.checkType { _>() } //(!!!) + invalidType.checkType { _>() } //(!!!) - Case2(kotlinClass).x.checkType { _>() } //(!!!) + Case2(kotlinClass).x.checkType { _>() } //(!!!) } class Case2(val kotlinClass: KotlinClass?) { diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.fir.txt index 88464ef0949..c3c05662e60 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.fir.txt @@ -4,7 +4,7 @@ FILE: orInWhenBranch.kt public final fun test_1(a: R|kotlin/Any?|): R|kotlin/Unit| { when (R|/a|) { ($subj$ is R|kotlin/String|) || ($subj$ is R|kotlin/Any|) -> { - R|/a|.#() + R|/a|.#() } } @@ -12,7 +12,7 @@ FILE: orInWhenBranch.kt public final fun test_2(a: R|kotlin/Any?|): R|kotlin/Unit| { when () { (R|/a| is R|kotlin/String|) || (R|/a| is R|kotlin/Any|) -> { - R|/a|.#() + R|/a|.#() } } @@ -20,7 +20,7 @@ FILE: orInWhenBranch.kt public final fun test_3(a: R|kotlin/Any?|, b: R|kotlin/Boolean|): R|kotlin/Unit| { when (R|/a|) { ($subj$ is R|kotlin/String|) || ==($subj$, R|/b|) -> { - R|/a|.#() + R|/a|.#() } } @@ -28,7 +28,7 @@ FILE: orInWhenBranch.kt public final fun test_4(a: R|kotlin/Any?|, b: R|kotlin/Boolean|): R|kotlin/Unit| { when () { (R|/a| is R|kotlin/String|) || R|/b| -> { - R|/a|.#() + R|/a|.#() } } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt index 82cb9c6d713..61e14e18e2f 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt @@ -4,24 +4,24 @@ fun String.foo() {} fun test_1(a: Any?) { when (a) { - is String, is Any -> a.foo() // Should be Bad + is String, is Any -> a.foo() // Should be Bad } } fun test_2(a: Any?) { if (a is String || a is Any) { - a.foo() // Should be Bad + a.foo() // Should be Bad } } fun test_3(a: Any?, b: Boolean) { when (a) { - is String, b -> a.foo() // Should be Bad + is String, b -> a.foo() // Should be Bad } } fun test_4(a: Any?, b: Boolean) { if (a is String || b) { - a.foo() // Should be Bad + a.foo() // Should be Bad } } 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 68165f08700..6f849154cd2 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 @@ -141,9 +141,9 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti } @Test - @TestMetadata("checkType.kt") - public void testCheckType() throws Exception { - runTest("compiler/testData/diagnostics/tests/checkType.kt"); + @TestMetadata("checkTypeTest.kt") + public void testCheckTypeTest() throws Exception { + runTest("compiler/testData/diagnostics/tests/checkTypeTest.kt"); } @Test 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 32f4b807d9c..dab4689f68d 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 @@ -141,9 +141,9 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac } @Test - @TestMetadata("checkType.kt") - public void testCheckType() throws Exception { - runTest("compiler/testData/diagnostics/tests/checkType.kt"); + @TestMetadata("checkTypeTest.kt") + public void testCheckTypeTest() throws Exception { + runTest("compiler/testData/diagnostics/tests/checkTypeTest.kt"); } @Test diff --git a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt index 3a574bc4b57..615ee34c3ac 100644 --- a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt +++ b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt @@ -111,6 +111,10 @@ object DIAGNOSTICS_LIST : DiagnosticList("FirErrors") { parameter("reference") parameter("message") } + + val UNRESOLVED_REFERENCE_WRONG_RECEIVER by error { + parameter>("candidates") + } } val CALL_RESOLUTION by object : DiagnosticGroup("Call resolution") { diff --git a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index 203b868709c..ee85fa6bf49 100644 --- a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -136,6 +136,7 @@ object FirErrors { val NO_THIS by error0() val DEPRECATION_ERROR by error2, String>(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED) val DEPRECATION by warning2, String>(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED) + val UNRESOLVED_REFERENCE_WRONG_RECEIVER by error1>>() // Call resolution val CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS by error0() diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegatedPropertyChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegatedPropertyChecker.kt index e2e8a0040ba..2141d534dc4 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegatedPropertyChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDelegatedPropertyChecker.kt @@ -19,6 +19,7 @@ import org.jetbrains.kotlin.fir.expressions.arguments import org.jetbrains.kotlin.fir.references.FirErrorNamedReference import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeAmbiguityError import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableCandidateError +import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableWrongReceiver import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedNameError import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.fir.typeContext @@ -26,7 +27,6 @@ import org.jetbrains.kotlin.fir.types.ConeKotlinErrorType import org.jetbrains.kotlin.fir.types.coneType import org.jetbrains.kotlin.fir.types.render import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid -import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability import org.jetbrains.kotlin.resolve.calls.tower.isSuccess import org.jetbrains.kotlin.types.AbstractTypeChecker @@ -63,28 +63,14 @@ object FirDelegatedPropertyChecker : FirPropertyChecker() { (if (isGet) "getValue" else "setValue") + "(${functionCall.arguments.joinToString(", ") { it.typeRef.coneType.render() }})" val delegateDescription = if (isGet) "delegate" else "delegate for var (read-write property)" - fun reportInapplicableDiagnostics( - candidateApplicability: CandidateApplicability, - candidates: Collection> - ) { - if (candidateApplicability == CandidateApplicability.INAPPLICABLE_WRONG_RECEIVER) { - reporter.reportOn( - errorNamedReference.source, - FirErrors.DELEGATE_SPECIAL_FUNCTION_MISSING, - expectedFunctionSignature, - delegateType, - delegateDescription, - context - ) - } else { - reporter.reportOn( - errorNamedReference.source, - FirErrors.DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE, - expectedFunctionSignature, - candidates, - context - ) - } + fun reportInapplicableDiagnostics(candidates: Collection>) { + reporter.reportOn( + errorNamedReference.source, + FirErrors.DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE, + expectedFunctionSignature, + candidates, + context + ) } return when (val diagnostic = errorNamedReference.diagnostic) { @@ -110,12 +96,23 @@ object FirDelegatedPropertyChecker : FirPropertyChecker() { context ) } else { - reportInapplicableDiagnostics(diagnostic.applicability, diagnostic.candidates.map { it.symbol }) + reportInapplicableDiagnostics(diagnostic.candidates.map { it.symbol }) } true } + is ConeInapplicableWrongReceiver -> { + reporter.reportOn( + errorNamedReference.source, + FirErrors.DELEGATE_SPECIAL_FUNCTION_MISSING, + expectedFunctionSignature, + delegateType, + delegateDescription, + context + ) + true + } is ConeInapplicableCandidateError -> { - reportInapplicableDiagnostics(diagnostic.applicability, listOf(diagnostic.candidate.symbol)) + reportInapplicableDiagnostics(listOf(diagnostic.candidate.symbol)) true } else -> false diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUpperBoundViolatedExpressionChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUpperBoundViolatedExpressionChecker.kt index e5a6382e42d..8bf24153be8 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUpperBoundViolatedExpressionChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUpperBoundViolatedExpressionChecker.kt @@ -15,6 +15,7 @@ import org.jetbrains.kotlin.fir.expressions.toResolvedCallableSymbol import org.jetbrains.kotlin.fir.references.FirErrorNamedReference import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableCandidateError +import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableWrongReceiver import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol @@ -33,10 +34,7 @@ object FirUpperBoundViolatedExpressionChecker : FirQualifiedAccessExpressionChec if (calleReference is FirResolvedNamedReference) { calleeSymbol = calleReference.toResolvedCallableSymbol() } else if (calleReference is FirErrorNamedReference) { - val diagnostic = calleReference.diagnostic - if (diagnostic is ConeInapplicableCandidateError && - diagnostic.applicability == CandidateApplicability.INAPPLICABLE_WRONG_RECEIVER - ) { + if (calleReference.diagnostic is ConeInapplicableWrongReceiver) { return } calleeSymbol = calleReference.candidateSymbol as? FirCallableSymbol<*> diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt index 3d81dfacad9..abfc5db1c7d 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt @@ -19,10 +19,7 @@ import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.references.FirErrorNamedReference -import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeAmbiguityError -import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableCandidateError -import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInstanceAccessBeforeSuperCall -import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedNameError +import org.jetbrains.kotlin.fir.resolve.diagnostics.* import org.jetbrains.kotlin.fir.types.ConeKotlinErrorType import org.jetbrains.kotlin.fir.types.FirErrorTypeRef import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef @@ -121,7 +118,7 @@ class ErrorNodeDiagnosticCollectorComponent( // Will be handled by [FirDelegatedPropertyChecker] if (source.kind == FirFakeSourceElementKind.DelegatedPropertyAccessor && - (diagnostic is ConeUnresolvedNameError || diagnostic is ConeAmbiguityError || diagnostic is ConeInapplicableCandidateError) + (diagnostic is ConeUnresolvedNameError || diagnostic is ConeAmbiguityError || diagnostic is ConeInapplicableWrongReceiver || diagnostic is ConeInapplicableCandidateError) ) { return } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt index b0d69f3e733..8e1e85018c9 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt @@ -430,6 +430,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNNECESSARY_SAFE_ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNREACHABLE_CODE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNRESOLVED_LABEL import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNRESOLVED_REFERENCE +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNRESOLVED_REFERENCE_WRONG_RECEIVER import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNSAFE_CALL import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNSAFE_IMPLICIT_INVOKE_CALL import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNSAFE_INFIX_CALL @@ -797,6 +798,7 @@ class FirDefaultErrorMessages { map.put(ITERATOR_AMBIGUITY, "Method ''iterator()'' is ambiguous for this expression: {0}", SYMBOLS) map.put(HAS_NEXT_FUNCTION_AMBIGUITY, "Method ''hasNext()'' is ambiguous for this expression: {0}", SYMBOLS) map.put(NEXT_AMBIGUITY, "Method ''next()'' is ambiguous for this expression: {0}", SYMBOLS) + map.put(UNRESOLVED_REFERENCE_WRONG_RECEIVER, "Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: {0}", SYMBOLS) // Types & type parameters map.put(RECURSION_IN_IMPLICIT_TYPES, "Recursion in implicit types") diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt index 6edb353ae2d..6711886276d 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt @@ -44,6 +44,7 @@ private fun ConeDiagnostic.toFirDiagnostic( is ConeFunctionExpectedError -> FirErrors.FUNCTION_EXPECTED.createOn(source, this.expression, this.type) is ConeResolutionToClassifierError -> FirErrors.RESOLUTION_TO_CLASSIFIER.createOn(source, this.classSymbol) is ConeHiddenCandidateError -> FirErrors.INVISIBLE_REFERENCE.createOn(source, this.candidateSymbol) + is ConeInapplicableWrongReceiver -> FirErrors.UNRESOLVED_REFERENCE_WRONG_RECEIVER.createOn(source, this.candidates) is ConeNoCompanionObject -> FirErrors.NO_COMPANION_OBJECT.createOn(source, this.symbol) is ConeAmbiguityError -> when { applicability.isSuccess -> FirErrors.OVERLOAD_RESOLUTION_AMBIGUITY.createOn(source, this.candidates.map { it.symbol }) 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 85ff066cd6d..c694de4c8df 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt @@ -705,6 +705,7 @@ class FirCallResolver( val candidate = candidates.single() val diagnostic = when (applicability) { CandidateApplicability.HIDDEN -> ConeHiddenCandidateError(candidate.symbol) + CandidateApplicability.INAPPLICABLE_WRONG_RECEIVER -> ConeInapplicableWrongReceiver(listOf(candidate.symbol)) CandidateApplicability.NO_COMPANION_OBJECT -> ConeNoCompanionObject(candidate.symbol as FirRegularClassSymbol) else -> ConeInapplicableCandidateError(applicability, candidate) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt index af5230a7034..8a1fc636c37 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt @@ -63,6 +63,17 @@ class ConeHiddenCandidateError( override val reason: String get() = "HIDDEN: ${describeSymbol(candidateSymbol)} is invisible" } +class ConeInapplicableWrongReceiver(val candidates: Collection>) : ConeDiagnostic() { + override val reason: String + get() = "None of the following candidates is applicable because of receiver type mismatch: ${ + candidates.map { + describeSymbol( + it + ) + } + }" +} + class ConeInapplicableCandidateError( val applicability: CandidateApplicability, val candidate: Candidate, diff --git a/compiler/testData/diagnostics/tests/Bounds.fir.kt b/compiler/testData/diagnostics/tests/Bounds.fir.kt index a3e9131d1e9..2168390d0d2 100644 --- a/compiler/testData/diagnostics/tests/Bounds.fir.kt +++ b/compiler/testData/diagnostics/tests/Bounds.fir.kt @@ -34,7 +34,7 @@ fun test() { bar() bar<Double?>() bar<Double>() - 1.buzz() + 1.buzz() } fun foo() {} diff --git a/compiler/testData/diagnostics/tests/DeprecatedUnaryOperatorConventions.fir.kt b/compiler/testData/diagnostics/tests/DeprecatedUnaryOperatorConventions.fir.kt index c7df06f542f..8ea730f8b15 100644 --- a/compiler/testData/diagnostics/tests/DeprecatedUnaryOperatorConventions.fir.kt +++ b/compiler/testData/diagnostics/tests/DeprecatedUnaryOperatorConventions.fir.kt @@ -15,7 +15,7 @@ operator fun String.unaryPlus(): Int = 0 fun test() { requireInt(+ "") requireInt(+ Example()) - requireString(+ ExampleDeprecated()) + requireString(+ ExampleDeprecated()) } fun requireInt(n: Int) {} @@ -26,7 +26,7 @@ class Example2 { operator fun minus() = this fun test() { - +this + +this -this } } diff --git a/compiler/testData/diagnostics/tests/callableReference/deprecatedCompanionReceiverInParentheses.fir.kt b/compiler/testData/diagnostics/tests/callableReference/deprecatedCompanionReceiverInParentheses.fir.kt index 9a76ef5900f..441600794f8 100644 --- a/compiler/testData/diagnostics/tests/callableReference/deprecatedCompanionReceiverInParentheses.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/deprecatedCompanionReceiverInParentheses.fir.kt @@ -21,10 +21,10 @@ import kotlin.reflect.KProperty0 import kotlin.reflect.KProperty1 fun case() { - (V)::a checkType { _>() } + (V)::a checkType { _>() } (V)::a checkType { _>() } - (test.abc.V)::a checkType { _>() } + (test.abc.V)::a checkType { _>() } (test.abc.V)::a checkType { _>() } V::a checkType { _>() } diff --git a/compiler/testData/diagnostics/tests/callableReference/generic/argumentAndReturnExpectedType.fir.kt b/compiler/testData/diagnostics/tests/callableReference/generic/argumentAndReturnExpectedType.fir.kt index 61bce14c61d..f454bd325bd 100644 --- a/compiler/testData/diagnostics/tests/callableReference/generic/argumentAndReturnExpectedType.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/generic/argumentAndReturnExpectedType.fir.kt @@ -15,7 +15,7 @@ fun test1() { bar("", 1, ::foo).checkType { _>() } bar("", 1, ::fooReturnInt).checkType { _>() } bar("", 1, ::fooTakeString).checkType { _>() } - bar("", "", ::fooReturnInt).checkType { _>() } + bar("", "", ::fooReturnInt).checkType { _>() } val x: String = bar("", "", ::fooReturnInt) diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/ambiguityWithBoundExtensionReceiver.fir.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/ambiguityWithBoundExtensionReceiver.fir.kt index 7c4f4c9a778..0f30990cb3e 100644 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/ambiguityWithBoundExtensionReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/resolve/ambiguityWithBoundExtensionReceiver.fir.kt @@ -10,6 +10,6 @@ fun A.foo() = "" class A { fun main() { - bar(::foo) checkType { _() } + bar(::foo) checkType { _() } } } diff --git a/compiler/testData/diagnostics/tests/checkType.fir.kt b/compiler/testData/diagnostics/tests/checkType.fir.kt deleted file mode 100644 index d37f7b7a67e..00000000000 --- a/compiler/testData/diagnostics/tests/checkType.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// !CHECK_TYPE - -interface A -interface B : A -interface C : B - -fun test(b: B) { - b checkType { _() } - b checkType { _() } - b checkType { _() } -} diff --git a/compiler/testData/diagnostics/tests/checkType.kt b/compiler/testData/diagnostics/tests/checkTypeTest.kt similarity index 93% rename from compiler/testData/diagnostics/tests/checkType.kt rename to compiler/testData/diagnostics/tests/checkTypeTest.kt index 03dc66e2976..ac3f10c9c85 100644 --- a/compiler/testData/diagnostics/tests/checkType.kt +++ b/compiler/testData/diagnostics/tests/checkTypeTest.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE interface A diff --git a/compiler/testData/diagnostics/tests/checkType.txt b/compiler/testData/diagnostics/tests/checkTypeTest.txt similarity index 100% rename from compiler/testData/diagnostics/tests/checkType.txt rename to compiler/testData/diagnostics/tests/checkTypeTest.txt diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.fir.kt b/compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.fir.kt index a474cd486b8..ed945edea34 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.fir.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.fir.kt @@ -19,5 +19,5 @@ fun check() { val f: IntArray = [1] [f] checkType { _>() } - [1, ""] checkType { _>() } + [1, ""] checkType { _>() } } diff --git a/compiler/testData/diagnostics/tests/controlStructures/typeInferenceForExclExcl.fir.kt b/compiler/testData/diagnostics/tests/controlStructures/typeInferenceForExclExcl.fir.kt deleted file mode 100644 index e547a97883d..00000000000 --- a/compiler/testData/diagnostics/tests/controlStructures/typeInferenceForExclExcl.fir.kt +++ /dev/null @@ -1,20 +0,0 @@ -// !CHECK_TYPE -// FILE: A.java -public class A { - public static String foo() { - return ""; - } -} - -// FILE: b.kt -fun exclExcl(t: T?): T = t!! - -fun test11() { - // not 'String!' - exclExcl(A.foo()) checkType { _() } - exclExcl(A.foo()) checkType { _() } - - // not 'String!' - A.foo()!! checkType { _() } - A.foo()!! checkType { _() } -} diff --git a/compiler/testData/diagnostics/tests/controlStructures/typeInferenceForExclExcl.kt b/compiler/testData/diagnostics/tests/controlStructures/typeInferenceForExclExcl.kt index d6142bae636..f3a02a0dd2c 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/typeInferenceForExclExcl.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/typeInferenceForExclExcl.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE // FILE: A.java public class A { diff --git a/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt index 67745821ca2..f329e25eb25 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt @@ -4,7 +4,7 @@ fun foo(block: () -> (() -> Int)) {} fun test() { val x = fun named1(x: Int): Int { return 1 } - x checkType { _>() } + x checkType { _>() } foo { fun named2(): Int {return 1} } foo({ fun named3() = 1 }) diff --git a/compiler/testData/diagnostics/tests/extensions/classObject.fir.kt b/compiler/testData/diagnostics/tests/extensions/classObject.fir.kt deleted file mode 100644 index 504fca39d45..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/classObject.fir.kt +++ /dev/null @@ -1,19 +0,0 @@ -interface Tr - -class A { companion object } -class B { companion object : Tr } - -fun Any.f1() {} -fun Any?.f2() {} -fun Tr.f3() {} -fun Tr?.f4() {} -fun A.f5() {} - -fun test() { - A.f1() - A.f2() - B.f3() - B.f4() - A.f5() - B.f5() -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/classObject.kt b/compiler/testData/diagnostics/tests/extensions/classObject.kt index e6d4e5aa45f..d2555510ff5 100644 --- a/compiler/testData/diagnostics/tests/extensions/classObject.kt +++ b/compiler/testData/diagnostics/tests/extensions/classObject.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL interface Tr class A { companion object } diff --git a/compiler/testData/diagnostics/tests/extensions/kt3563.fir.kt b/compiler/testData/diagnostics/tests/extensions/kt3563.fir.kt deleted file mode 100644 index b13f924f277..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/kt3563.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ -// KT-3563 Compiler requiring java.io.File, and it's unclear why - -package bar - -import java.io.File - -class Customer(name1: String) - -fun foo(f: File, c: Customer) { - f.name1 - - c.name1 // name1 should be unresolved here -} - -val File.name1: String - get() = getName() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/kt3563.kt b/compiler/testData/diagnostics/tests/extensions/kt3563.kt index b7aa22e52ac..0da06594c1e 100644 --- a/compiler/testData/diagnostics/tests/extensions/kt3563.kt +++ b/compiler/testData/diagnostics/tests/extensions/kt3563.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // KT-3563 Compiler requiring java.io.File, and it's unclear why package bar diff --git a/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt b/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt index 8e4e54031fc..62c2c7b2367 100644 --- a/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt @@ -6,19 +6,19 @@ package bar fun List.a() {} fun test1(i: Int?) { - 1.a() - i.a() + 1.a() + i.a() } fun test2(c: Collection) { - c.a() + c.a() } fun Int.foo() {} fun test3(s: String?) { - "".foo() - s.foo() + "".foo() + s.foo() "".foo(1) s.foo("a") } @@ -27,7 +27,7 @@ interface A fun T.c() {} fun test4() { - 1.c() + 1.c() } @@ -40,16 +40,16 @@ fun test5() { fun R?.sure() : R = this!! fun test6(l: List?) { - l.sure() + l.sure() } fun List.b() {} fun test7(l: List) { - l.b() + l.b() } fun test8(l: List?) { - l.b() + l.b() } diff --git a/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver2.fir.kt b/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver2.fir.kt deleted file mode 100644 index 2ecd180fbab..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver2.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -package a - -class A {} - -fun test(a1: A, a2: A) { - val range = "island".."isle" - - a1..a2 -} - - -public operator fun > T.rangeTo(that: T): ClosedRange { - throw UnsupportedOperationException() -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver2.kt b/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver2.kt index a358604b17a..7bfbb865a83 100644 --- a/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver2.kt +++ b/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package a class A {} diff --git a/compiler/testData/diagnostics/tests/funInterface/funInterfaceConversionOnReceiver.fir.kt b/compiler/testData/diagnostics/tests/funInterface/funInterfaceConversionOnReceiver.fir.kt index 2c88e4dfe66..f5b8ef1de8c 100644 --- a/compiler/testData/diagnostics/tests/funInterface/funInterfaceConversionOnReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/funInterface/funInterfaceConversionOnReceiver.fir.kt @@ -5,5 +5,5 @@ fun interface Bar { operator fun Bar.plus(b: Bar): String = invoke() + b.invoke() fun box(): String { - return { "O" } + { "K" } + return { "O" } + { "K" } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/complexInference.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/complexInference.fir.kt index 8d9bb8c8ba9..774682db6fa 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/complexInference.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/complexInference.fir.kt @@ -31,8 +31,8 @@ fun bar(aInstance: A, bInstance: B) { foo(bInstance) { (a, b), (c, d) -> - a checkType { _() } - b checkType { _() } + a checkType { _() } + b checkType { _() } c checkType { _() } d checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/inferredFunctionalType.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/inferredFunctionalType.fir.kt index 547897f30d7..9913f57a286 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/inferredFunctionalType.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/inferredFunctionalType.fir.kt @@ -22,12 +22,12 @@ fun bar(aList: List) { } aList.foo { (a: String, b) -> - a checkType { _() } + a checkType { _() } b checkType { _() } } aList.foo { (a, b): B -> - b checkType { _() } - a checkType { _() } + b checkType { _() } + a checkType { _() } } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/noExpectedType.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/noExpectedType.fir.kt index 90aec275a7d..4a176c8f6b1 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/noExpectedType.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/noExpectedType.fir.kt @@ -18,7 +18,7 @@ fun bar() { y checkType { _<(A) -> Unit>() } val y2 = { (a: Number, b): A -> - a checkType { _() } + a checkType { _() } b checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/redeclaration.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/redeclaration.fir.kt index 9b268965011..b4fb40537f5 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/redeclaration.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/redeclaration.fir.kt @@ -7,8 +7,8 @@ fun foo(block: (A, B) -> Unit) { } fun bar() { foo { (a, a), b -> - a checkType { _() } - b checkType { _() } + a checkType { _() } + b checkType { _() } } foo { (a, b), a -> @@ -17,13 +17,13 @@ fun bar() { } foo { a, (a, b) -> - a checkType { _() } - b checkType { _() } + a checkType { _() } + b checkType { _() } } foo { (a, b), (c, b) -> a checkType { _() } - b checkType { _() } - c checkType { _() } + b checkType { _() } + c checkType { _() } } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/simple.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/simple.fir.kt index 13e1d1f1757..deb4346f6c2 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/simple.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/simple.fir.kt @@ -42,7 +42,7 @@ fun bar() { } foo { (a: String, b) -> - a checkType { _() } + a checkType { _() } b checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/generics/capturedParameters/innerLocalClass.fir.kt b/compiler/testData/diagnostics/tests/generics/capturedParameters/innerLocalClass.fir.kt index bb354c54523..dbc0e0a3748 100644 --- a/compiler/testData/diagnostics/tests/generics/capturedParameters/innerLocalClass.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/capturedParameters/innerLocalClass.fir.kt @@ -24,9 +24,9 @@ private class Outer { doubleStringInt = Outer().Inner().foo()() - doubleStringInt.e.checkType { _() } - doubleStringInt.f.checkType { _() } - doubleStringInt.g.checkType { _() } + doubleStringInt.e.checkType { _() } + doubleStringInt.f.checkType { _() } + doubleStringInt.g.checkType { _() } } } } diff --git a/compiler/testData/diagnostics/tests/generics/capturedParameters/localClass.fir.kt b/compiler/testData/diagnostics/tests/generics/capturedParameters/localClass.fir.kt index 02fe183ea8f..a9647b110b2 100644 --- a/compiler/testData/diagnostics/tests/generics/capturedParameters/localClass.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/capturedParameters/localClass.fir.kt @@ -18,7 +18,7 @@ class Q { x = foo()() y = foo()() - x.prop.checkType { _() } - y.prop.checkType { _() } + x.prop.checkType { _() } + y.prop.checkType { _() } } } diff --git a/compiler/testData/diagnostics/tests/generics/capturedParameters/localWithTypeParameter.fir.kt b/compiler/testData/diagnostics/tests/generics/capturedParameters/localWithTypeParameter.fir.kt index 034d17b6ce0..6e6ebf9ecfc 100644 --- a/compiler/testData/diagnostics/tests/generics/capturedParameters/localWithTypeParameter.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/capturedParameters/localWithTypeParameter.fir.kt @@ -15,8 +15,8 @@ class Q { private var x = foo()() fun bar() { - x.e.checkType { _() } - x.f.checkType { _() } + x.e.checkType { _() } + x.f.checkType { _() } x.g.checkType { _() } } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt index d0e82d8e420..148afb2ec25 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt @@ -20,7 +20,7 @@ class A : Outer() { fun foo() { Derived().foo() checkType { _.Inner>() } - Derived().baz() checkType { _>() } + Derived().baz() checkType { _>() } A.B().bar() checkType { _.Inner>() } - A.B().x() checkType { _>() } + A.B().x() checkType { _>() } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt index 2d888eed1df..7533319fb20 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt @@ -41,8 +41,8 @@ fun test() { var x = foobar() x = foobar() - x().foo().a() checkType { _>() } - x().bar() checkType { _>() } + x().foo().a() checkType { _>() } + x().bar() checkType { _>() } x = foobar() @@ -50,5 +50,5 @@ fun test() { y = noParameters() y().foo().a() checkType { _>() } - y().bar() checkType { _>() } + y().bar() checkType { _>() } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt index 1fd2fc780fd..73bb0a2bf36 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt @@ -42,8 +42,8 @@ class Outer { var x = foobar() x = foobar() - x().foo().a() checkType { _>() } - x().bar() checkType { _>() } + x().foo().a() checkType { _>() } + x().bar() checkType { _>() } x = foobar() x = z.foobar() @@ -52,7 +52,7 @@ class Outer { y = noParameters() y().foo().a() checkType { _>() } - y().bar() checkType { _>() } + y().bar() checkType { _>() } } } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt index fbde26a0a7c..770e4dbd4b3 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt @@ -15,5 +15,5 @@ class Derived : BaseDerived2() { fun foo() { Derived().foo() checkType { _.Inner>() } - Derived().baz() checkType { _>() } + Derived().baz() checkType { _>() } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/iterator.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/iterator.fir.kt index 054c18edf3b..16dbe5da7fb 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/iterator.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/iterator.fir.kt @@ -32,5 +32,5 @@ fun foo() { val csIt: Iterator = A().iterator() - commonSupertype(A().iterator(), A().iterator()).checkType { _.MyIt>() } + commonSupertype(A().iterator(), A().iterator()).checkType { _.MyIt>() } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedOuter.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedOuter.fir.kt index a9381eb8ebd..0e17e7b89f0 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedOuter.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/qualifiedOuter.fir.kt @@ -5,7 +5,7 @@ class Outer { inner class Inner fun foo(x: Outer.Inner, y: Outer.Inner, z: Inner) { var inner = Inner() - x.checkType { _() } + x.checkType { _() } x.checkType { _.Inner>() } z.checkType { _() } z.checkType { _.Inner>() } diff --git a/compiler/testData/diagnostics/tests/generics/kt9985.fir.kt b/compiler/testData/diagnostics/tests/generics/kt9985.fir.kt deleted file mode 100644 index b26fd22ed88..00000000000 --- a/compiler/testData/diagnostics/tests/generics/kt9985.fir.kt +++ /dev/null @@ -1,46 +0,0 @@ -// !CHECK_TYPE -// Incorrect "type mismatch" error for generic extension safe call (required not-null, found nullable) - -// FILE: B.java - -public class B { - public String gav() { - return ""; - } - - public static B create() { - return new B(); - } -} - -// FILE: A.kt - -class A { - fun gav() = "" -} -fun foo(x: R) = x -fun A.bar() = "" -fun B.bar() = "" - -fun foo(l: A?) { - // No errors should be here - foo(l?.bar()) checkType { _() } - foo(l?.gav()) checkType { _() } - if (l != null) { - foo(l?.bar()) checkType { _() } - foo(l?.gav()) checkType { _() } - } -} - -fun fooNotNull(l: A) { - // No errors should be here - foo(l?.bar()) checkType { _() } - foo(l?.gav()) checkType { _() } -} - -fun bar() { - val l = B.create() - foo(l?.bar()) checkType { _() } - foo(l?.gav()) checkType { _() } -} - diff --git a/compiler/testData/diagnostics/tests/generics/kt9985.kt b/compiler/testData/diagnostics/tests/generics/kt9985.kt index fbf95708cd5..1401dad777f 100644 --- a/compiler/testData/diagnostics/tests/generics/kt9985.kt +++ b/compiler/testData/diagnostics/tests/generics/kt9985.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE // Incorrect "type mismatch" error for generic extension safe call (required not-null, found nullable) diff --git a/compiler/testData/diagnostics/tests/generics/multipleBoundsMemberScope/propertiesConflict.fir.kt b/compiler/testData/diagnostics/tests/generics/multipleBoundsMemberScope/propertiesConflict.fir.kt index 08eb7ea9461..cf410abc169 100644 --- a/compiler/testData/diagnostics/tests/generics/multipleBoundsMemberScope/propertiesConflict.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/multipleBoundsMemberScope/propertiesConflict.fir.kt @@ -15,5 +15,5 @@ fun test(a: T) where T : B, T : C { a.foo = "" a.foo = null - a.foo.checkType { _() } + a.foo.checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/generics/nullability/expressionsBoundsViolation.fir.kt b/compiler/testData/diagnostics/tests/generics/nullability/expressionsBoundsViolation.fir.kt index 8c4559c5794..6c29bad734c 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/expressionsBoundsViolation.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/expressionsBoundsViolation.fir.kt @@ -13,6 +13,6 @@ fun bar(x: F) { foo1<F>(x) x.foo2() - x.foo2() + x.foo2() } diff --git a/compiler/testData/diagnostics/tests/generics/projectionsScope/extensionReceiverTypeMismatch.fir.kt b/compiler/testData/diagnostics/tests/generics/projectionsScope/extensionReceiverTypeMismatch.fir.kt deleted file mode 100644 index 033aeb43f75..00000000000 --- a/compiler/testData/diagnostics/tests/generics/projectionsScope/extensionReceiverTypeMismatch.fir.kt +++ /dev/null @@ -1,17 +0,0 @@ -class A { - fun T.foo() {} - fun Out.bar() {} -} -class Out - -fun test(x: A, y: Out) { - with(x) { - // TODO: this diagnostic could be replaced with TYPE_MISMATCH_DUE_TO_TYPE_PROJECTION - "".foo() - y.bar() - - with(y) { - bar() - } - } -} diff --git a/compiler/testData/diagnostics/tests/generics/projectionsScope/extensionReceiverTypeMismatch.kt b/compiler/testData/diagnostics/tests/generics/projectionsScope/extensionReceiverTypeMismatch.kt index e652de641fa..c99346cbb77 100644 --- a/compiler/testData/diagnostics/tests/generics/projectionsScope/extensionReceiverTypeMismatch.kt +++ b/compiler/testData/diagnostics/tests/generics/projectionsScope/extensionReceiverTypeMismatch.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class A { fun T.foo() {} fun Out.bar() {} diff --git a/compiler/testData/diagnostics/tests/generics/projectionsScope/kt7296.fir.kt b/compiler/testData/diagnostics/tests/generics/projectionsScope/kt7296.fir.kt index 3debc87b9e5..510ab6b0378 100644 --- a/compiler/testData/diagnostics/tests/generics/projectionsScope/kt7296.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/projectionsScope/kt7296.fir.kt @@ -10,5 +10,5 @@ fun main() { val c : ListOfLists<*> = b val d : ArrayList> = c.x - c.x checkType { _>>() } + c.x checkType { _>>() } } diff --git a/compiler/testData/diagnostics/tests/generics/projectionsScope/platformSuperClass.fir.kt b/compiler/testData/diagnostics/tests/generics/projectionsScope/platformSuperClass.fir.kt index f7bd702a738..36cd2389afc 100644 --- a/compiler/testData/diagnostics/tests/generics/projectionsScope/platformSuperClass.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/projectionsScope/platformSuperClass.fir.kt @@ -9,10 +9,10 @@ public class Clazz { // FILE: main.kt fun test(clazz: Clazz<*>) { clazz.t checkType { _() } - clazz.getSuperClass() checkType { _?>() } + clazz.getSuperClass() checkType { _?>() } clazz.getSuperClass().t checkType { _() } - clazz.superClass checkType { _?>() } + clazz.superClass checkType { _?>() } clazz.superClass.t checkType { _() } // See KT-9294 diff --git a/compiler/testData/diagnostics/tests/generics/starProjections/invalid.fir.kt b/compiler/testData/diagnostics/tests/generics/starProjections/invalid.fir.kt index f97dbcb6ee0..ca8fac5d78f 100644 --- a/compiler/testData/diagnostics/tests/generics/starProjections/invalid.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/starProjections/invalid.fir.kt @@ -12,9 +12,9 @@ class Inv2>(val x: T) fun main(a: A<*>, j: JavaClass<*>, i2: Inv2<*>) { // Probably it's too restrictive to suppose star projection type here as Any?, // but looks like we can refine it later - a.foo() checkType { _() } - j.foo() checkType { _() } - i2.x checkType { _() } + a.foo() checkType { _() } + j.foo() checkType { _() } + i2.x checkType { _() } j.bar(1, 2, Any()) j.bar(null) diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/approximateContravariantCapturedTypes.fir.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/approximateContravariantCapturedTypes.fir.kt index 2ca5bf8f5c6..348b54220dc 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/approximateContravariantCapturedTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/approximateContravariantCapturedTypes.fir.kt @@ -47,7 +47,7 @@ fun test3() { fooSetRef.invoke(foo, "") - foo.x.bar() + foo.x.bar() } fun test4() { @@ -56,5 +56,5 @@ fun test4() { fooSetRef.invoke(foo, "") - foo.x.bar() + foo.x.bar() } diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/captureForNullableTypes.fir.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/captureForNullableTypes.fir.kt index 55b14ab75f1..a1d38994dd9 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/captureForNullableTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/captureForNullableTypes.fir.kt @@ -6,7 +6,7 @@ fun bar(a: Array): Array = null!! fun test1(a: Array) { val r: Array = bar(a) val t = bar(a) - t checkType { _>() } + t checkType { _>() } } fun foo(l: Array): Array> = null!! @@ -14,5 +14,5 @@ fun foo(l: Array): Array> = null!! fun test2(a: Array) { val r: Array> = foo(a) val t = foo(a) - t checkType { _>>() } + t checkType { _>>() } } diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromNullableTypeVariable.fir.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromNullableTypeVariable.fir.kt index ee1d61cf97f..83eb8751585 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromNullableTypeVariable.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromNullableTypeVariable.fir.kt @@ -3,11 +3,11 @@ fun Array.filterNotNull(): List = throw Exception() fun test1(a: Array) { - val list = a.filterNotNull() + val list = a.filterNotNull() list checkType { _>() } } fun test2(vararg a: Int?) { - val list = a.filterNotNull() + val list = a.filterNotNull() list checkType { _>() } } diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/kt2872.fir.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/kt2872.fir.kt index 2840939446f..e12f5dcaa1e 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/kt2872.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/kt2872.fir.kt @@ -2,5 +2,5 @@ fun Array.foo() {} fun test(array: Array) { array.foo() - array.foo<out Int>() + array.foo<out Int>() } diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/nullableCaptruredTypeAgainstNullableVariable.fir.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/nullableCaptruredTypeAgainstNullableVariable.fir.kt index ef82b2a74eb..1ca52af6073 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/nullableCaptruredTypeAgainstNullableVariable.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/nullableCaptruredTypeAgainstNullableVariable.fir.kt @@ -20,20 +20,20 @@ fun main(x: Foo, y: Bar, z1: Foo, z2: Bar< x.foo() x.bar() x.boo1() - x.boo2() + x.boo2() - y.foo() + y.foo() y.bar() - y.boo1() - y.boo2() + y.boo1() + y.boo2() z1.foo() z1.bar() z1.boo1() - z1.boo2() + z1.boo2() z2.foo() z2.bar() - z2.boo1() - z2.boo2() + z2.boo1() + z2.boo2() } diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/nullableCaptruredTypeAgainstNullableVariableWithDisabledComplatibilityFlag.fir.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/nullableCaptruredTypeAgainstNullableVariableWithDisabledComplatibilityFlag.fir.kt index f833d34d8f8..1b035394adf 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/nullableCaptruredTypeAgainstNullableVariableWithDisabledComplatibilityFlag.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/nullableCaptruredTypeAgainstNullableVariableWithDisabledComplatibilityFlag.fir.kt @@ -20,20 +20,20 @@ fun main(x: Foo, y: Bar, z1: Foo, z2: Bar< x.foo() x.bar() x.boo1() - x.boo2() + x.boo2() - y.foo() + y.foo() y.bar() - y.boo1() - y.boo2() + y.boo1() + y.boo2() z1.foo() z1.bar() z1.boo1() - z1.boo2() + z1.boo2() z2.foo() z2.bar() - z2.boo1() - z2.boo2() + z2.boo1() + z2.boo2() } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt37419.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt37419.fir.kt index d5c351124cf..6e3ee39e421 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt37419.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt37419.fir.kt @@ -17,14 +17,14 @@ class SomeClass { val withoutType: LambdaWithReceiver get() = when (e) { E.VALUE -> { param -> - method(param) + method(param) } } val withExplicitType: LambdaWithReceiver get() = when (e) { E.VALUE -> { param: Parameter -> - method(param) + method(param) } } } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt742.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt742.fir.kt index 283620aedcc..be25a838424 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt742.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt742.fir.kt @@ -9,4 +9,4 @@ fun List.map1(f: (T)-> Q): List? = tail!!.map1(f) fun List.map2(f: (T)-> Q): List? = tail.sure().map2(f) -fun List.map3(f: (T)-> Q): List? = tail.sure().map3(f) +fun List.map3(f: (T)-> Q): List? = tail.sure().map3(f) diff --git a/compiler/testData/diagnostics/tests/inference/tooEagerSmartcast.fir.kt b/compiler/testData/diagnostics/tests/inference/tooEagerSmartcast.fir.kt index c81d8df0e5d..8e05105cadc 100644 --- a/compiler/testData/diagnostics/tests/inference/tooEagerSmartcast.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/tooEagerSmartcast.fir.kt @@ -36,7 +36,7 @@ fun Number.num() {} fun main(b: Base) { b.foo().num() if (b is Derived<*>) { - b.foo().num() + b.foo().num() b.baz().length } } diff --git a/compiler/testData/diagnostics/tests/j+k/genericConstructor/classTypeParameterInferredFromArgument.fir.kt b/compiler/testData/diagnostics/tests/j+k/genericConstructor/classTypeParameterInferredFromArgument.fir.kt index 35220c8e3c5..771a25c2944 100644 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/classTypeParameterInferredFromArgument.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/genericConstructor/classTypeParameterInferredFromArgument.fir.kt @@ -8,7 +8,7 @@ public class A { // FILE: main.kt fun test(x: List, y: List) { - A("", x) checkType { _>() } + A("", x) checkType { _>() } A("", y) checkType { _>() } A("", x) diff --git a/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.fir.kt b/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.fir.kt index 7e51219511e..e2c6aff08a3 100644 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.fir.kt @@ -12,6 +12,6 @@ fun test(x: List, y: List) { Outer().Inner("", y, 1) checkType { _.Inner>() } Outer().Inner("", y, 1) checkType { _.Inner>() } - Outer().Inner("", x, 1) checkType { _.Inner>() } + Outer().Inner("", x, 1) checkType { _.Inner>() } Outer().Inner("", x, 1) } diff --git a/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsDisabled.fir.kt b/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsDisabled.fir.kt index ad7bdee682e..3da90b0530a 100644 --- a/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsDisabled.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsDisabled.fir.kt @@ -20,9 +20,9 @@ public abstract class CollectionWithSize implements java.util.Collection // FILE: main.kt fun main(c: CollectionWithSize) { - CompressionType.ZIP.name checkType { _() } - c.size checkType { _() } + CompressionType.ZIP.name checkType { _() } + c.size checkType { _() } - CompressionType.ZIP::name checkType { _>() } - c::size checkType { _>() } + CompressionType.ZIP::name checkType { _>() } + c::size checkType { _>() } } diff --git a/compiler/testData/diagnostics/tests/j+k/selectMoreSpecific.fir.kt b/compiler/testData/diagnostics/tests/j+k/selectMoreSpecific.fir.kt index a67ee7e003e..e0f2838b9a2 100644 --- a/compiler/testData/diagnostics/tests/j+k/selectMoreSpecific.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/selectMoreSpecific.fir.kt @@ -11,6 +11,6 @@ public class A { // FILE: main.kt fun foo(a: A) { - a.foo() checkType { _() } - A.bar() checkType { _() } + a.foo() checkType { _() } + A.bar() checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/numbers/numbersInSimpleConstraints.fir.kt b/compiler/testData/diagnostics/tests/numbers/numbersInSimpleConstraints.fir.kt index 2ab2d63d285..c8284c76053 100644 --- a/compiler/testData/diagnostics/tests/numbers/numbersInSimpleConstraints.fir.kt +++ b/compiler/testData/diagnostics/tests/numbers/numbersInSimpleConstraints.fir.kt @@ -35,7 +35,7 @@ fun test() { otherGeneric(1) val r = either(1, "") - r checkType { _() } + r checkType { _() } use(a, b, c, d, e, f, g, r) } @@ -60,7 +60,7 @@ fun lowerBound(t: T, l : Cov): T = throw Exception("$t $l") fun testLowerBound(cov: Cov, covN: Cov) { val r = lowerBound(1, cov) - r checkType { _() } + r checkType { _() } val n = lowerBound(1, covN) n checkType { _() } diff --git a/compiler/testData/diagnostics/tests/operatorRem/DeprecatedModAssignOperatorConventions.fir.kt b/compiler/testData/diagnostics/tests/operatorRem/DeprecatedModAssignOperatorConventions.fir.kt index f328d45217c..68a4881569d 100644 --- a/compiler/testData/diagnostics/tests/operatorRem/DeprecatedModAssignOperatorConventions.fir.kt +++ b/compiler/testData/diagnostics/tests/operatorRem/DeprecatedModAssignOperatorConventions.fir.kt @@ -29,7 +29,7 @@ fun test() { oldAndNew %= 1 val onlyOld = OnlyOld() - onlyOld %= 1 + onlyOld %= 1 val onlyNew = OnlyNew() onlyNew %= 1 diff --git a/compiler/testData/diagnostics/tests/operatorRem/DeprecatedModOperatorConventions.fir.kt b/compiler/testData/diagnostics/tests/operatorRem/DeprecatedModOperatorConventions.fir.kt index f02f145bcc5..ebe52c32cb9 100644 --- a/compiler/testData/diagnostics/tests/operatorRem/DeprecatedModOperatorConventions.fir.kt +++ b/compiler/testData/diagnostics/tests/operatorRem/DeprecatedModOperatorConventions.fir.kt @@ -26,11 +26,11 @@ class IntAndUnit { fun test() { OldAndNew() % 1 - OnlyOld() % 1 + OnlyOld() % 1 OnlyNew() % 1 Sample() % 1 takeInt(IntAndUnit() % 1) } -fun takeInt(x: Int) {} \ No newline at end of file +fun takeInt(x: Int) {} diff --git a/compiler/testData/diagnostics/tests/operatorRem/doNotResolveToInapplicableRem.fir.kt b/compiler/testData/diagnostics/tests/operatorRem/doNotResolveToInapplicableRem.fir.kt index f219481b102..e6965a5e5eb 100644 --- a/compiler/testData/diagnostics/tests/operatorRem/doNotResolveToInapplicableRem.fir.kt +++ b/compiler/testData/diagnostics/tests/operatorRem/doNotResolveToInapplicableRem.fir.kt @@ -9,5 +9,5 @@ object RemExtension operator fun RemExtension.rem(x: Int) {} fun foo() { - OldMod % 123 -} \ No newline at end of file + OldMod % 123 +} diff --git a/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/withNothing.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/withNothing.fir.kt deleted file mode 100644 index a865c4e99a7..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/withNothing.fir.kt +++ /dev/null @@ -1,26 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// !CHECK_TYPE -// SKIP_JAVAC -// NI_EXPECTED_FILE -// FILE: p/J.java - -package p; - -public class J { - public static J j() { return null; } -} - -// FILE: k.kt - -import p.* - -interface Out - -fun f(a: Out, b: Out, c: Out): T = null!! -fun out(t: T): Out> = null!! - -fun test(a: Out, b: Out>) { - val v = f(a, b, out(J.j())) - v checkType { _>() } - v checkType { _>() } -} diff --git a/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/withNothing.kt b/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/withNothing.kt index a3744cddf8f..1c0592714aa 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/withNothing.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/withNothing.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // !CHECK_TYPE // SKIP_JAVAC diff --git a/compiler/testData/diagnostics/tests/regressions/kt5362.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt5362.fir.kt index 25a5b46b0e0..1d3e66b699f 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt5362.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt5362.fir.kt @@ -11,7 +11,7 @@ class Outer { fun Activity.toast() = Unit class Activity(){ class Fragment{ - fun call() = toast() + fun call() = toast() } } @@ -27,4 +27,4 @@ public class Manager { callback() // Manager is not accessible here, but no error is shown } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/regressions/kt557.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt557.fir.kt deleted file mode 100644 index e1f6c4fb228..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt557.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// KT-557 Wrong type inference near sure extension function - -fun T?.sure() : T = this!! - -fun Array.length() : Int { - return 0; -} - -fun test(array : Array?) { - array?.sure>().length() -} diff --git a/compiler/testData/diagnostics/tests/regressions/kt557.kt b/compiler/testData/diagnostics/tests/regressions/kt557.kt index d34f5a7b580..1f51b38a9ab 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt557.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt557.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // KT-557 Wrong type inference near sure extension function fun T?.sure() : T = this!! diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverTypeForInvoke.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverTypeForInvoke.fir.kt index b529ad4ce2f..5b2e5bc1a13 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverTypeForInvoke.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverTypeForInvoke.fir.kt @@ -3,7 +3,7 @@ fun String.invoke(i: Int) {} fun foo(i: Int) { - i(1) + i(1) - 1(1) -} \ No newline at end of file + 1(1) +} diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.fir.kt index ed5e1181f3b..6a32eb70ba4 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.fir.kt @@ -16,7 +16,7 @@ fun test(a: A, b: B) { b.(foo)() - (b.foo)() + (b.foo)() foo(b) (foo)(b) diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/reportFunctionExpectedWhenOneInvokeExist.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/reportFunctionExpectedWhenOneInvokeExist.fir.kt index b1638a6ce7d..75f74c6e38a 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/reportFunctionExpectedWhenOneInvokeExist.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/reportFunctionExpectedWhenOneInvokeExist.fir.kt @@ -5,7 +5,7 @@ fun Int.invoke() {} class SomeClass fun test(identifier: SomeClass, fn: String.() -> Unit) { - identifier() + identifier() identifier(123) identifier(1, 2) 1.fn() diff --git a/compiler/testData/diagnostics/tests/resolve/propertyInCompanionOfEnum.fir.kt b/compiler/testData/diagnostics/tests/resolve/propertyInCompanionOfEnum.fir.kt index 4cd10c29baa..a2cc3fd99df 100644 --- a/compiler/testData/diagnostics/tests/resolve/propertyInCompanionOfEnum.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/propertyInCompanionOfEnum.fir.kt @@ -20,7 +20,7 @@ import test.E fun foo() { E.Entry checkType { _() } - E.Entry checkType { _() } + E.Entry checkType { _() } E.Companion.Entry checkType { _() } E.NotEntry checkType { _() } Entry checkType { _() } @@ -33,8 +33,8 @@ fun foo() { import test.E as U fun bar() { - U.Entry checkType { _<E>() } - U.Entry checkType { _() } + U.Entry checkType { _<E>() } + U.Entry checkType { _() } U.Companion.Entry checkType { _() } U.NotEntry checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/resolve/wrongReceiver.fir.kt b/compiler/testData/diagnostics/tests/resolve/wrongReceiver.fir.kt index d774c27cb25..ca051ac6b8a 100644 --- a/compiler/testData/diagnostics/tests/resolve/wrongReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/wrongReceiver.fir.kt @@ -10,11 +10,11 @@ fun Int.extFun() = 4 fun String.test() { some some.A() - "".some + "".some - foo - "".foo + foo + "".foo - extFun() - "".extFun() -} \ No newline at end of file + extFun() + "".extFun() +} diff --git a/compiler/testData/diagnostics/tests/samConversions/OverloadPriority.fir.kt b/compiler/testData/diagnostics/tests/samConversions/OverloadPriority.fir.kt index 6e6eb1a62ae..b88b32607d5 100644 --- a/compiler/testData/diagnostics/tests/samConversions/OverloadPriority.fir.kt +++ b/compiler/testData/diagnostics/tests/samConversions/OverloadPriority.fir.kt @@ -22,10 +22,10 @@ public interface J { // FILE: 1.kt fun test(j: J) { - j.foo({ it checkType { _() }; "" }, "") checkType { _() } + j.foo({ it checkType { _() }; "" }, "") checkType { _() } - j.bas({ it checkType { _() }; "" }, "") checkType { _() } + j.bas({ it checkType { _() }; "" }, "") checkType { _() } // NI: TODO - j.bar { it checkType { _() }; "" } checkType { _() } + j.bar { it checkType { _() }; "" } checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/samConversions/OverloadPriorityKT.fir.kt b/compiler/testData/diagnostics/tests/samConversions/OverloadPriorityKT.fir.kt index 02c4eb2f0f4..a66cccfb58a 100644 --- a/compiler/testData/diagnostics/tests/samConversions/OverloadPriorityKT.fir.kt +++ b/compiler/testData/diagnostics/tests/samConversions/OverloadPriorityKT.fir.kt @@ -21,10 +21,10 @@ interface K { } fun test(k: K) { - k.foo { it checkType { _() }; "" } checkType { _() } + k.foo { it checkType { _() }; "" } checkType { _() } - k.bas { it checkType { _() }; "" } checkType { _() } + k.bas { it checkType { _() }; "" } checkType { _() } // NI: TODO - k.bar { it checkType { _() }; "" } checkType { _() } + k.bar { it checkType { _() }; "" } checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/kt7971.fir.kt b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/kt7971.fir.kt index acced7b9e14..c569a82c051 100644 --- a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/kt7971.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/kt7971.fir.kt @@ -20,6 +20,6 @@ public class AppServiceModule : AbstractModule() { inline fun AbstractModule.bind() { val x = bind(javaClass()) - x checkType { _() } // check that Class receiver is used instead of extension one + x checkType { _() } // check that Class receiver is used instead of extension one } } diff --git a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/unstableSmartCast.fir.kt b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/unstableSmartCast.fir.kt index de47b4d7ce6..8f0e9eab162 100644 --- a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/unstableSmartCast.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/unstableSmartCast.fir.kt @@ -11,7 +11,7 @@ fun BaseOuter.foo(): String = "" class Derived : BaseOuter() { fun test(foo: Foo) { if (foo.base is Derived) { - foo.base.foo() checkType { _() } // Resolved to extension + foo.base.foo() checkType { _() } // Resolved to extension foo.base.bar() } } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/objectLiteralAsArgument.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/objectLiteralAsArgument.fir.kt index 615ece5d687..3382a175652 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/objectLiteralAsArgument.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/objectLiteralAsArgument.fir.kt @@ -7,6 +7,6 @@ class A { constructor(x: Any?) constructor() : this(object { fun bar() = foo() + this@A.foo() + - foobar() + super@A.hashCode() + foobar() + super@A.hashCode() }) } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/objectLiteralAsDefaultValueParameter.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/objectLiteralAsDefaultValueParameter.fir.kt index ab43688cbf9..bb841e6846f 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/objectLiteralAsDefaultValueParameter.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/objectLiteralAsDefaultValueParameter.fir.kt @@ -6,6 +6,6 @@ class A { fun foo() = 1 constructor( x: Any = object { fun bar() = foo() + this@A.foo() + - foobar() + foobar() }) } diff --git a/compiler/testData/diagnostics/tests/smartCasts/intersectionScope/flexibleTypes.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/intersectionScope/flexibleTypes.fir.kt index 7a7b58fac91..150eab827b2 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/intersectionScope/flexibleTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/intersectionScope/flexibleTypes.fir.kt @@ -16,37 +16,37 @@ interface C { fun foo(x: Any?) { if (x is A && x is B) { - x.foo().checkType { _() } + x.foo().checkType { _() } x.foo().checkType { _() } } if (x is B && x is A) { - x.foo().checkType { _() } + x.foo().checkType { _() } x.foo().checkType { _() } } if (x is A && x is C) { x.foo().checkType { _() } - x.foo().checkType { _() } + x.foo().checkType { _() } } if (x is C && x is A) { x.foo().checkType { _() } - x.foo().checkType { _() } + x.foo().checkType { _() } } if (x is A && x is B && x is C) { x.foo().checkType { _() } - x.foo().checkType { _() } + x.foo().checkType { _() } } if (x is B && x is A && x is C) { x.foo().checkType { _() } - x.foo().checkType { _() } + x.foo().checkType { _() } } if (x is B && x is C && x is A) { x.foo().checkType { _() } - x.foo().checkType { _() } + x.foo().checkType { _() } } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt30927.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/kt30927.fir.kt index 041e7943e43..b3b54b0aeb8 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt30927.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt30927.fir.kt @@ -7,7 +7,7 @@ fun case_0() { this as Int this // error in NI: required Int, found Any?; just inferred to Any? in OI } - y checkType { _() } + y checkType { _() } y checkType { _() } } @@ -19,7 +19,7 @@ fun case_1(z: Any?) { else -> return@run "" } } - y checkType { _() } + y checkType { _() } y checkType { _() } // y is inferred to Any? } @@ -44,7 +44,7 @@ fun case_3(z: Any?) { else -> return@let "" } } - y checkType { _() } + y checkType { _() } y checkType { _() } // y is inferred to String } diff --git a/compiler/testData/diagnostics/tests/sourceCompatibility/noBoundCallableReferences/qualifiedJavaClassLiteralInKClassExtension.fir.kt b/compiler/testData/diagnostics/tests/sourceCompatibility/noBoundCallableReferences/qualifiedJavaClassLiteralInKClassExtension.fir.kt index 37d2199f810..83c30e22ae4 100644 --- a/compiler/testData/diagnostics/tests/sourceCompatibility/noBoundCallableReferences/qualifiedJavaClassLiteralInKClassExtension.fir.kt +++ b/compiler/testData/diagnostics/tests/sourceCompatibility/noBoundCallableReferences/qualifiedJavaClassLiteralInKClassExtension.fir.kt @@ -7,5 +7,5 @@ val KClass.java: Class get() = null!! val KClass.javaObjectType: Class get() { - return java.lang.Class::class.java as Class + return java.lang.Class::class.java as Class } diff --git a/compiler/testData/diagnostics/tests/substitutions/starProjections.fir.kt b/compiler/testData/diagnostics/tests/substitutions/starProjections.fir.kt index 182a5d52bec..fb8b574fd34 100644 --- a/compiler/testData/diagnostics/tests/substitutions/starProjections.fir.kt +++ b/compiler/testData/diagnostics/tests/substitutions/starProjections.fir.kt @@ -17,7 +17,7 @@ interface B, T>> { fun testB(b: B<*, *>) { b.r().checkType { _() } - b.t().checkType { _, *>>() } + b.t().checkType { _, *>>() } b.t().r().size } diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/overloadResolutionStaticWithoutRefinedSams.fir.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/overloadResolutionStaticWithoutRefinedSams.fir.kt index d347532c799..03ae61e7861 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/overloadResolutionStaticWithoutRefinedSams.fir.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/overloadResolutionStaticWithoutRefinedSams.fir.kt @@ -12,8 +12,8 @@ public class A { // FILE: 1.kt fun fn() {} fun x(r: Runnable) { - A.foo(::fn) checkType { _() } - A.foo {} checkType { _() } + A.foo(::fn) checkType { _() } + A.foo {} checkType { _() } A.foo(null) checkType { _() } A.foo(Runnable { }) checkType { _() } diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/overloadResolutionWithoutRefinedSams.fir.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/overloadResolutionWithoutRefinedSams.fir.kt index 8da21938c13..b54b6089673 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/overloadResolutionWithoutRefinedSams.fir.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/overloadResolutionWithoutRefinedSams.fir.kt @@ -12,8 +12,8 @@ public class A { // FILE: 1.kt fun fn() {} fun x(a: A, r: Runnable) { - a.foo(::fn) checkType { _() } - a.foo {} checkType { _() } + a.foo(::fn) checkType { _() } + a.foo {} checkType { _() } a.foo(null) checkType { _() } a.foo(Runnable { }) checkType { _() } diff --git a/compiler/testData/diagnostics/tests/typealias/innerClassTypeAliasConstructor.fir.kt b/compiler/testData/diagnostics/tests/typealias/innerClassTypeAliasConstructor.fir.kt deleted file mode 100644 index 470c1e142c6..00000000000 --- a/compiler/testData/diagnostics/tests/typealias/innerClassTypeAliasConstructor.fir.kt +++ /dev/null @@ -1,23 +0,0 @@ -// NI_EXPECTED_FILE - -class Outer { - inner class Inner -} - -typealias OI = Outer.Inner - -fun test1(x: Outer) = x.OI() - - -class Generic { - inner class Inner -} - -typealias GI = Generic.Inner -typealias GIntI = Generic.Inner - -fun test2(x: Generic) = x.GI() -fun test3(x: Generic) = x.GI() -fun test4(x: Generic>) = x.GI() -fun test5(x: Generic) = x.GIntI() -fun Generic.test6() = GIntI() diff --git a/compiler/testData/diagnostics/tests/typealias/innerClassTypeAliasConstructor.kt b/compiler/testData/diagnostics/tests/typealias/innerClassTypeAliasConstructor.kt index 4a7b173a0cf..616abc81b45 100644 --- a/compiler/testData/diagnostics/tests/typealias/innerClassTypeAliasConstructor.kt +++ b/compiler/testData/diagnostics/tests/typealias/innerClassTypeAliasConstructor.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // NI_EXPECTED_FILE class Outer { diff --git a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/inferenceForSignedAndUnsignedTypes.fir.kt b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/inferenceForSignedAndUnsignedTypes.fir.kt index e3992a08ef6..dce32845439 100644 --- a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/inferenceForSignedAndUnsignedTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/inferenceForSignedAndUnsignedTypes.fir.kt @@ -9,11 +9,11 @@ fun select(x: K, y: K): K = TODO() fun takeUByte(u: UByte) {} fun foo() { - select(1, 1u) checkType { _>() } + select(1, 1u) checkType { _>() } takeUByte(id(1)) 1 + 1u - (1u + 1) checkType { _() } + (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 e99e8a597cc..5e947d654c0 100644 --- a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/noConversionForUnsignedTypesOnReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/noConversionForUnsignedTypesOnReceiver.fir.kt @@ -4,10 +4,10 @@ fun UShort.fUShort() {} fun ULong.fULong() {} fun test() { - 1.fUInt() - 1.fUByte() - 1.fUShort() - 1.fULong() + 1.fUInt() + 1.fUByte() + 1.fUShort() + 1.fULong() 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 26ff62bee63..34476ddaeb0 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/testData/diagnostics/testsWithStdLib/coroutines/suspendExternalFunctions.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendExternalFunctions.fir.kt index 19be74fed9e..83fd4c8f0fe 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendExternalFunctions.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendExternalFunctions.fir.kt @@ -35,7 +35,7 @@ fun test() { severalParams("", 89) checkType { _() } // TODO: should we allow somehow to call with passing continuation explicitly? - severalParams("", 89, 6.9) checkType { _() } + severalParams("", 89, 6.9) checkType { _() } "".stringReceiver(1) Any().anyReceiver(1) diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.fir.kt index c4c2de10b02..cac3e694b33 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.fir.kt @@ -36,7 +36,7 @@ fun test() { severalParams("", 89) checkType { _() } // TODO: should we allow somehow to call with passing continuation explicitly? - severalParams("", 89, 6.9) checkType { _() } - severalParams("", 89, this as Continuation) checkType { _() } + severalParams("", 89, 6.9) checkType { _() } + severalParams("", 89, this as Continuation) checkType { _() } } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesAndTopLevelCapturedTypes.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesAndTopLevelCapturedTypes.fir.kt index ea185fdbb87..839cb7b2ff4 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesAndTopLevelCapturedTypes.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesAndTopLevelCapturedTypes.fir.kt @@ -21,7 +21,7 @@ fun test( invOut.onlyOut(1L) invOut.onlyOutUB("str") - invStar.onlyOutUB(0) + invStar.onlyOutUB(0) invOut.onlyOutUB(42) invOut.onlyOutUB(1L) diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/hidesMembers2.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/hidesMembers2.fir.kt index 1a296925739..1b43cbdcdde 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/resolve/hidesMembers2.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/hidesMembers2.fir.kt @@ -33,11 +33,11 @@ fun test2(a: A) { @kotlin.internal.HidesMembers fun A.forEach(i: Int) = "" - a.forEach() checkType { _() } + a.forEach() checkType { _() } a.forEach(1) with(a) { - forEach() checkType { _() } + forEach() checkType { _() } forEach(1) } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/samAgainstFunctionalType.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/samAgainstFunctionalType.fir.kt index 5943c9ad7e7..f7eb59f9b20 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/resolve/samAgainstFunctionalType.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/samAgainstFunctionalType.fir.kt @@ -23,7 +23,7 @@ public class StaticOverrides { // FILE: test.kt fun test() { - StaticOverrides.A.foo {} checkType { _() } + StaticOverrides.A.foo {} checkType { _() } StaticOverrides.B.foo {} checkType { _() } - StaticOverrides.C.foo {} checkType { _() } + StaticOverrides.C.foo {} checkType { _() } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenerics.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenerics.fir.kt index 7835e3e4cae..ec7b20b7b46 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenerics.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenerics.fir.kt @@ -19,6 +19,6 @@ class Foo { // FILE: 1.kt fun test() { - Foo().foo {} checkType { _() } - Foo().bar {} checkType { _() } + Foo().foo {} checkType { _() } + Foo().bar {} checkType { _() } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenericsWithoutRefinedSams.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenericsWithoutRefinedSams.fir.kt index 093763bbf37..65c1a424cfd 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenericsWithoutRefinedSams.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenericsWithoutRefinedSams.fir.kt @@ -20,6 +20,6 @@ class Foo { // FILE: 1.kt fun test() { - Foo().foo {} checkType { _() } - Foo().bar {} checkType { _() } + Foo().foo {} checkType { _() } + Foo().bar {} checkType { _() } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunction.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunction.fir.kt index 0b789adf874..3726bfd96e5 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunction.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunction.fir.kt @@ -16,5 +16,5 @@ public class Foo { // FILE: 1.kt fun bar() { - Foo().test {} checkType { _() } + Foo().test {} checkType { _() } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunctionWithoutRefinedSams.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunctionWithoutRefinedSams.fir.kt index 8d824ce395b..02bc6ca3fc8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunctionWithoutRefinedSams.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunctionWithoutRefinedSams.fir.kt @@ -17,5 +17,5 @@ public class Foo { // FILE: 1.kt fun bar() { - Foo().test {} checkType { _() } + Foo().test {} checkType { _() } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns/unsupportedFeature.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns/unsupportedFeature.fir.kt index 21eb6458023..f17f3716cc2 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns/unsupportedFeature.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns/unsupportedFeature.fir.kt @@ -43,7 +43,7 @@ fun foo(x: List, y: Throwable, z: A3) { x.stream() java.util.ArrayList().stream() - y.fillInStackTrace() checkType { _() } + y.fillInStackTrace() checkType { _() } HashMap().getOrDefault(Any(), null) 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 153f381d79e..4b8c5e971f4 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 @@ -141,9 +141,9 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { } @Test - @TestMetadata("checkType.kt") - public void testCheckType() throws Exception { - runTest("compiler/testData/diagnostics/tests/checkType.kt"); + @TestMetadata("checkTypeTest.kt") + public void testCheckTypeTest() throws Exception { + runTest("compiler/testData/diagnostics/tests/checkTypeTest.kt"); } @Test diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.1.fir.kt index f494f8ebaee..c4233047393 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.1.fir.kt @@ -2,10 +2,10 @@ // TESTCASE NUMBER: 1 fun case_1() { - 0l checkType { check() } - 10000000000000l checkType { check() } - 0X000Af10cDl checkType { check() } - 0x0_0l checkType { check() } - 0b100_000_111_111l checkType { check() } - 0b0l checkType { check() } + 0l checkType { check() } + 10000000000000l checkType { check() } + 0X000Af10cDl checkType { check() } + 0x0_0l checkType { check() } + 0b100_000_111_111l checkType { check() } + 0b0l checkType { check() } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt index 47636fc59f6..e9d21205e03 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt @@ -105,8 +105,8 @@ fun case_6() { checkSubtype(-100000000000000000000000000000000) checkSubtype(-100000000000000000000000000000000) checkSubtype(-100000000000000000000000000000000) - -100000000000000000000000000000000 checkType { check() } - -100000000000000000000000000000000 checkType { check() } - -100000000000000000000000000000000 checkType { check() } - -100000000000000000000000000000000 checkType { check() } + -100000000000000000000000000000000 checkType { check() } + -100000000000000000000000000000000 checkType { check() } + -100000000000000000000000000000000 checkType { check() } + -100000000000000000000000000000000 checkType { check() } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt index f3113609672..db1a340dd04 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt @@ -3,23 +3,23 @@ // TESTCASE NUMBER: 1 fun case_1() { checkSubtype(-9223372036854775808L) - -9223372036854775808L checkType { check() } + -9223372036854775808L checkType { check() } checkSubtype(9223372036854775808L) - 9223372036854775808L checkType { check() } + 9223372036854775808L checkType { check() } } // TESTCASE NUMBER: 2 fun case_2() { checkSubtype(100000000000000000000000000000000L) - 100000000000000000000000000000000L checkType { check() } + 100000000000000000000000000000000L checkType { check() } checkSubtype(100000000000000000000000000000000l) - 100000000000000000000000000000000l checkType { check() } + 100000000000000000000000000000000l checkType { check() } checkSubtype(-100000000000000000000000000000000L) - -100000000000000000000000000000000L checkType { check() } + -100000000000000000000000000000000L checkType { check() } checkSubtype(-100000000000000000000000000000000l) - -100000000000000000000000000000000l checkType { check() } + -100000000000000000000000000000000l checkType { check() } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/3.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/3.2.fir.kt index b813cc55dc5..d036f6f79e6 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/3.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/3.2.fir.kt @@ -4,9 +4,9 @@ // TESTCASE NUMBER: 1 fun case_1(value_1: Int, value_2: EmptyClass, value_3: Int, value_4: Any): String { when (value_1) { - in value_2 -> return "" - in value_3 -> return "" - in value_4 -> return "" + in value_2 -> return "" + in value_3 -> return "" + in value_4 -> return "" } return "" diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.fir.kt index 37292c00415..f7127e5c6cf 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.fir.kt @@ -283,7 +283,7 @@ fun case_12(value_1: Any?, value_2: Any?) { println(value_2?.toByte()) } if (funWithReturnsFalse(value_1 !is Float? || value_1 == null || value_2 == null)) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) } if (funWithReturnsNotNull(value_1 !is String || value_2 !is Number) == null) { @@ -299,7 +299,7 @@ fun case_12(value_1: Any?, value_2: Any?) { // TESTCASE NUMBER: 13 fun case_13(value_1: Any?, value_2: Any?) { if (!funWithReturnsTrueAndInvertCondition(value_1 is Float? && value_1 != null && value_2 != null)) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) } if (funWithReturnsFalseAndInvertCondition(value_1 is String && value_2 is Number)) { @@ -319,7 +319,7 @@ fun case_13(value_1: Any?, value_2: Any?) { println(value_2?.toByte()) } if (funWithReturnsNotNull(value_1 is Float? && value_1 != null && value_2 != null) == null) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) } if (funWithReturnsNullAndInvertCondition(value_1 is String && value_2 is Number) != null) { @@ -331,7 +331,7 @@ fun case_13(value_1: Any?, value_2: Any?) { println(value_2?.toByte()) } if (funWithReturnsNull(value_1 is Float? && value_1 != null && value_2 != null) != null) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) } } @@ -343,22 +343,22 @@ class case_14_class { fun case_14(value_1: Any?, value_2: Number?) { val o = case_14_class() if (!funWithReturnsTrueAndInvertCondition(value_1 is Float? && value_1 != null && value_2 != null && o.prop_1 != null)) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (funWithReturnsFalse(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null || this.prop_1 == null)) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (funWithReturnsNotNull(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null || this.prop_1 == null) == null) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (funWithReturnsNull(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null || this.prop_1 == null) != null) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) } @@ -412,25 +412,25 @@ class case_17_class { fun case_17(value_1: Any?, value_2: Number?) { val o = case_17_class() if (contracts.case_17_1(value_1, value_2, o.prop_1, this.prop_1)) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) println(this.prop_1.plus(3)) } if (contracts.case_17_2(value_1, value_2, o.prop_1, this.prop_1)) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) println(this.prop_1.plus(3)) } if (contracts.case_17_3(value_1, value_2, o.prop_1, this.prop_1) == null) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) println(this.prop_1.plus(3)) } if (contracts.case_17_4(value_1, value_2, o.prop_1, this.prop_1) != null) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) println(this.prop_1.plus(3)) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.fir.kt index 82f210a3f53..a2035ce82e9 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.fir.kt @@ -26,7 +26,7 @@ fun case_3(value_1: Any?, value_2: Any?) { // TESTCASE NUMBER: 4 fun case_4(value_1: Any?, value_2: Number?) { funWithReturns(value_1 !is Float? || value_1 == null || value_2 == null) - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) } @@ -36,7 +36,7 @@ class case_5_class { fun case_5(value_1: Any?, value_2: Number?) { val o = case_5_class() funWithReturns(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null) - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) } @@ -105,19 +105,19 @@ fun case_8(value_1: Any?, value_2: Any?) { // TESTCASE NUMBER: 9 fun case_9(value_1: Any?, value_2: Number?) { if (funWithReturnsTrue(value_1 !is Float? || value_1 == null || value_2 == null)) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) } if (!funWithReturnsFalse(value_1 !is Float? || value_1 == null || value_2 == null)) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) } if (funWithReturnsNotNull(value_1 is Float? && value_1 != null && value_2 != null) == null) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) } if (funWithReturnsNull(value_1 is Float? && value_1 != null && value_2 != null) != null) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) } } @@ -129,22 +129,22 @@ class case_10_class { fun case_10(value_1: Any?, value_2: Number?) { val o = case_10_class() if (funWithReturnsTrue(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null || this.prop_1 == null)) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (!funWithReturnsFalse(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null || this.prop_1 == null)) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (funWithReturnsNotNull(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null || this.prop_1 == null) != null) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (funWithReturnsNull(value_1 !is Float? || value_1 == null || value_2 == null || o.prop_1 == null || this.prop_1 == null) == null) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) } @@ -156,5 +156,5 @@ fun case_11(value_1: Any?, value_2: Any?, value_3: Any?) { funWithReturnsAndInvertCondition(value_1 !is String? || value_2 !is Number && value_3 !is Float) println(value_1!!.length) println(value_2.toByte()) - println(value_3.dec()) + println(value_3.dec()) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/3.fir.kt index 0799c972cd4..334c5e80c71 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/3.fir.kt @@ -103,7 +103,7 @@ class case_3_class { fun case_3(value_1: Any?, value_2: Number?) { val o = case_3_class() contracts.case_3(value_1, value_2, o.prop_1, this.prop_1) - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) } @@ -156,22 +156,22 @@ class case_6_class { fun case_6(value_1: Any?, value_2: Number?) { val o = case_6_class() if (contracts.case_6_1(value_1, value_2, o.prop_1, this.prop_1)) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (!contracts.case_6_2(value_1, value_2, o.prop_1, this.prop_1)) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (contracts.case_6_3(value_1, value_2, o.prop_1, this.prop_1) == null) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (contracts.case_6_4(value_1, value_2, o.prop_1, this.prop_1) != null) { - println(value_1.dec()) + println(value_1.dec()) println(value_2?.toByte()) println(o.prop_1.plus(3)) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt index c21b755c31c..5b1c4dac0bf 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt @@ -153,7 +153,7 @@ fun case_14(x: Any) { x.NaN } else { ")!>x - ")!>x.inv() + ")!>x.inv() } } } 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 f43c9ee6504..87a4e76dea2 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 @@ -141,9 +141,9 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag } @Test - @TestMetadata("checkType.kt") - public void testCheckType() throws Exception { - runTest("compiler/testData/diagnostics/tests/checkType.kt"); + @TestMetadata("checkTypeTest.kt") + public void testCheckTypeTest() throws Exception { + runTest("compiler/testData/diagnostics/tests/checkTypeTest.kt"); } @Test diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDataClassConverters.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDataClassConverters.kt index ea9ff46f08e..590c8653f74 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDataClassConverters.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDataClassConverters.kt @@ -304,6 +304,15 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert token, ) } + add(FirErrors.UNRESOLVED_REFERENCE_WRONG_RECEIVER) { firDiagnostic -> + UnresolvedReferenceWrongReceiverImpl( + firDiagnostic.a.map { firBasedSymbol -> + firSymbolBuilder.buildSymbol(firBasedSymbol.fir) + }, + firDiagnostic as FirPsiDiagnostic, + token, + ) + } add(FirErrors.CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS) { firDiagnostic -> CreatingAnInstanceOfAbstractClassImpl( firDiagnostic as FirPsiDiagnostic, diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnostics.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnostics.kt index 600ccf177ba..693a0e3e444 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnostics.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnostics.kt @@ -241,6 +241,11 @@ sealed class KtFirDiagnostic : KtDiagnosticWithPsi { abstract val message: String } + abstract class UnresolvedReferenceWrongReceiver : KtFirDiagnostic() { + override val diagnosticClass get() = UnresolvedReferenceWrongReceiver::class + abstract val candidates: List + } + abstract class CreatingAnInstanceOfAbstractClass : KtFirDiagnostic() { override val diagnosticClass get() = CreatingAnInstanceOfAbstractClass::class } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnosticsImpl.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnosticsImpl.kt index 34b4d6f70a1..da1abde2d15 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnosticsImpl.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnosticsImpl.kt @@ -353,6 +353,14 @@ internal class DeprecationImpl( override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic) } +internal class UnresolvedReferenceWrongReceiverImpl( + override val candidates: List, + firDiagnostic: FirPsiDiagnostic, + override val token: ValidityToken, +) : KtFirDiagnostic.UnresolvedReferenceWrongReceiver(), KtAbstractFirDiagnostic { + override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic) +} + internal class CreatingAnInstanceOfAbstractClassImpl( firDiagnostic: FirPsiDiagnostic, override val token: ValidityToken,