From 9f69ea1786d4d9664b08a8117a13c16bc842bcf1 Mon Sep 17 00:00:00 2001 From: Ivan Kochurkin Date: Wed, 1 Jun 2022 00:29:32 +0300 Subject: [PATCH] [FIR] Add TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM diagnostics, ^KT-52327 Fixed --- .../diagnostics/KtFirDataClassConverters.kt | 6 ++++ .../api/fir/diagnostics/KtFirDiagnostics.kt | 4 +++ .../fir/diagnostics/KtFirDiagnosticsImpl.kt | 5 +++ .../callableReferences/implicitTypes.kt | 2 +- .../diagnostics/FirDiagnosticsList.kt | 1 + .../fir/analysis/diagnostics/FirErrors.kt | 1 + .../checkers/CommonExpressionCheckers.kt | 3 +- .../expression/FirRecursiveProblemChecker.kt | 34 +++++++++++++++++++ .../diagnostics/FirErrorsDefaultMessages.kt | 2 ++ .../tests/RecursiveTypeInference.fir.kt | 14 ++++---- ...yRecursivelyAnnotatedGlobalFunction.fir.kt | 4 +++ ...uallyRecursivelyAnnotatedGlobalFunction.kt | 3 +- .../RecursivelyAnnotatedGlobalFunction.fir.kt | 3 ++ .../RecursivelyAnnotatedGlobalFunction.kt | 3 +- .../UninitializedOrReassignedVariables.fir.kt | 2 +- .../tests/delegatedProperty/kt48546.fir.kt | 6 ++-- .../delegatedProperty/kt48546Strict.fir.kt | 6 ++-- .../delegatedProperty/recursiveType.fir.kt | 6 ++-- .../tests/delegation/kt48546.fir.kt | 4 +-- .../inference/recursiveCalls/kt23531.fir.kt | 8 ++--- .../recursionWithJavaSyntheticProperty.fir.kt | 4 +-- .../objectExpression.fir.kt | 2 +- .../recursiveGetter.fir.kt | 12 +++---- .../tests/regressions/Jet81.fir.kt | 6 ++-- .../tests/regressions/ea76264.fir.kt | 4 +-- .../tests/regressions/kt328.fir.kt | 12 +++---- .../testsWithStdLib/coroutines/kt18292.fir.kt | 2 +- 27 files changed, 109 insertions(+), 50 deletions(-) create mode 100644 compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirRecursiveProblemChecker.kt create mode 100644 compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.fir.kt create mode 100644 compiler/testData/diagnostics/tests/annotations/RecursivelyAnnotatedGlobalFunction.fir.kt diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt index 157eede8671..b19b0c9496d 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt @@ -3125,6 +3125,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert token, ) } + add(FirErrors.TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM) { firDiagnostic -> + TypecheckerHasRunIntoRecursiveProblemImpl( + firDiagnostic as KtPsiDiagnostic, + token, + ) + } add(FirErrors.UNSAFE_CALL) { firDiagnostic -> UnsafeCallImpl( firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a), diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnostics.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnostics.kt index 68a6b7516c5..0ff235f1068 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnostics.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnostics.kt @@ -2184,6 +2184,10 @@ sealed class KtFirDiagnostic : KtDiagnosticWithPsi { override val diagnosticClass get() = SenselessNullInWhen::class } + abstract class TypecheckerHasRunIntoRecursiveProblem : KtFirDiagnostic() { + override val diagnosticClass get() = TypecheckerHasRunIntoRecursiveProblem::class + } + abstract class UnsafeCall : KtFirDiagnostic() { override val diagnosticClass get() = UnsafeCall::class abstract val receiverType: KtType diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnosticsImpl.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnosticsImpl.kt index 1923ca04805..97163910eba 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnosticsImpl.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnosticsImpl.kt @@ -2629,6 +2629,11 @@ internal class SenselessNullInWhenImpl( override val token: KtLifetimeToken, ) : KtFirDiagnostic.SenselessNullInWhen(), KtAbstractFirDiagnostic +internal class TypecheckerHasRunIntoRecursiveProblemImpl( + override val firDiagnostic: KtPsiDiagnostic, + override val token: KtLifetimeToken, +) : KtFirDiagnostic.TypecheckerHasRunIntoRecursiveProblem(), KtAbstractFirDiagnostic + internal class UnsafeCallImpl( override val receiverType: KtType, override val receiverExpression: KtExpression?, diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.kt index 590d4b2f871..6298db84ebc 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.kt @@ -4,4 +4,4 @@ fun foo() = use(::bar) fun bar(x: String) = 1 fun loop1() = use(::loop2) -fun loop2() = loop1() +fun loop2() = loop1() 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 a2140f2387a..bef39db4de9 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 @@ -1114,6 +1114,7 @@ object DIAGNOSTICS_LIST : DiagnosticList("FirErrors") { parameter("compareResult") } val SENSELESS_NULL_IN_WHEN by warning() + val TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM by error() } val NULLABILITY by object : DiagnosticGroup("Nullability") { 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 acdf4649cc7..b1ce2b54f42 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 @@ -592,6 +592,7 @@ object FirErrors { val UNREACHABLE_CODE by warning2, Set>(SourceElementPositioningStrategies.UNREACHABLE_CODE) val SENSELESS_COMPARISON by warning2() val SENSELESS_NULL_IN_WHEN by warning0() + val TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM by error0() // Nullability val UNSAFE_CALL by error2(SourceElementPositioningStrategies.DOT_BY_QUALIFIED) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonExpressionCheckers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonExpressionCheckers.kt index f5ba79f8fbc..0b4a3a635c0 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonExpressionCheckers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonExpressionCheckers.kt @@ -21,7 +21,8 @@ object CommonExpressionCheckers : ExpressionCheckers() { get() = setOf( FirUnderscoreChecker, FirExpressionAnnotationChecker, - FirDeprecationChecker + FirDeprecationChecker, + FirRecursiveProblemChecker ) override val qualifiedAccessCheckers: Set diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirRecursiveProblemChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirRecursiveProblemChecker.kt new file mode 100644 index 00000000000..fd9dee72196 --- /dev/null +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirRecursiveProblemChecker.kt @@ -0,0 +1,34 @@ +/* + * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.fir.analysis.checkers.expression + +import org.jetbrains.kotlin.diagnostics.DiagnosticReporter +import org.jetbrains.kotlin.diagnostics.reportOn +import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors +import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic +import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind +import org.jetbrains.kotlin.fir.expressions.FirExpression +import org.jetbrains.kotlin.fir.expressions.FirStatement +import org.jetbrains.kotlin.fir.types.* + +object FirRecursiveProblemChecker : FirBasicExpressionChecker() { + override fun check(expression: FirStatement, context: CheckerContext, reporter: DiagnosticReporter) { + if (expression !is FirExpression) return + + fun checkConeType(coneType: ConeKotlinType?) { + if (coneType is ConeErrorType && (coneType.diagnostic as? ConeSimpleDiagnostic)?.kind == DiagnosticKind.RecursionInImplicitTypes) { + reporter.reportOn(expression.source, FirErrors.TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, context) + } else if (coneType is ConeClassLikeType) { + for (typeArgument in coneType.typeArguments) { + checkConeType(typeArgument.type) + } + } + } + + checkConeType(expression.typeRef.coneType) + } +} \ No newline at end of file diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrorsDefaultMessages.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrorsDefaultMessages.kt index 98ec358ef34..f1fbcc5b092 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrorsDefaultMessages.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrorsDefaultMessages.kt @@ -486,6 +486,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TOO_MANY_ARGUMENT import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TOO_MANY_CHARACTERS_IN_CHARACTER_LITERAL import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TOPLEVEL_TYPEALIASES_ONLY import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPEALIAS_SHOULD_EXPAND_TO_CLASS +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPE_ARGUMENTS_NOT_ALLOWED import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPE_ARGUMENTS_REDUNDANT_IN_SUPER_QUALIFIER import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPE_CANT_BE_USED_FOR_CONST_VAL @@ -1474,6 +1475,7 @@ object FirErrorsDefaultMessages : BaseDiagnosticRendererFactory() { map.put(VARIABLE_WITH_NO_TYPE_NO_INITIALIZER, "This variable must either have a type annotation or be initialized") map.put(INITIALIZATION_BEFORE_DECLARATION, "Variable cannot be initialized before declaration", SYMBOL) + map.put(TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, "Type checking has run into a recursive problem. Easiest workaround: specify types of your declarations explicitly") map.put(MUST_BE_INITIALIZED, "Property must be initialized") map.put(MUST_BE_INITIALIZED_OR_BE_ABSTRACT, "Property must be initialized or be abstract") diff --git a/compiler/testData/diagnostics/tests/RecursiveTypeInference.fir.kt b/compiler/testData/diagnostics/tests/RecursiveTypeInference.fir.kt index b6dd3c5d6d3..095685ae7a2 100644 --- a/compiler/testData/diagnostics/tests/RecursiveTypeInference.fir.kt +++ b/compiler/testData/diagnostics/tests/RecursiveTypeInference.fir.kt @@ -2,23 +2,23 @@ // FILE: a.kt package a - val foo = bar() + val foo = bar() - fun bar() = foo + fun bar() = foo // FILE: b.kt package b - fun foo() = bar() + fun foo() = bar() - fun bar() = foo() + fun bar() = foo() // FILE: c.kt package c - fun bazz() = bar() + fun bazz() = bar() - fun foo() = bazz() + fun foo() = bazz() - fun bar() = foo() + fun bar() = foo() // FILE: d.kt diff --git a/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.fir.kt b/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.fir.kt new file mode 100644 index 00000000000..21c3066e89b --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.fir.kt @@ -0,0 +1,4 @@ +// Functions can be recursively annotated +annotation class ann(val x: Int) +@ann(bar()) fun foo() = 1 +@ann(foo()) fun bar() = 2 diff --git a/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt b/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt index 3a877de7fbe..552ec93b99e 100644 --- a/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt +++ b/compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt @@ -1,5 +1,4 @@ -// FIR_IDENTICAL // Functions can be recursively annotated annotation class ann(val x: Int) @ann(bar()) fun foo() = 1 -@ann(foo()) fun bar() = 2 \ No newline at end of file +@ann(foo()) fun bar() = 2 diff --git a/compiler/testData/diagnostics/tests/annotations/RecursivelyAnnotatedGlobalFunction.fir.kt b/compiler/testData/diagnostics/tests/annotations/RecursivelyAnnotatedGlobalFunction.fir.kt new file mode 100644 index 00000000000..4eb8bf11a92 --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/RecursivelyAnnotatedGlobalFunction.fir.kt @@ -0,0 +1,3 @@ +// Functions can be recursively annotated +annotation class ann(val x: Int) +@ann(foo()) fun foo() = 1 diff --git a/compiler/testData/diagnostics/tests/annotations/RecursivelyAnnotatedGlobalFunction.kt b/compiler/testData/diagnostics/tests/annotations/RecursivelyAnnotatedGlobalFunction.kt index 75524907d87..bdd06ee6027 100644 --- a/compiler/testData/diagnostics/tests/annotations/RecursivelyAnnotatedGlobalFunction.kt +++ b/compiler/testData/diagnostics/tests/annotations/RecursivelyAnnotatedGlobalFunction.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // Functions can be recursively annotated annotation class ann(val x: Int) -@ann(foo()) fun foo() = 1 \ No newline at end of file +@ann(foo()) fun foo() = 1 diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.fir.kt index 8c6aba4782d..8ac5606fa3b 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.fir.kt @@ -240,7 +240,7 @@ class Outer() { } class ForwardAccessToBackingField() { //kt-147 - val a = a // error + val a = a // error val b = c // error val c = 1 } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/kt48546.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/kt48546.fir.kt index 961ba715421..81e341b1d4f 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/kt48546.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/kt48546.fir.kt @@ -4,7 +4,7 @@ object DelegateTest { var result = "" val f by lazy { - result += f.toString() // Compiler crash + result += f.toString() // Compiler crash "hello" } } @@ -12,7 +12,7 @@ object DelegateTest { object DelegateTest2 { var result = "" val f by lazy { - result += f + result += f "hello" } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/kt48546Strict.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/kt48546Strict.fir.kt index d574538fe7b..9d84d24a098 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/kt48546Strict.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/kt48546Strict.fir.kt @@ -5,7 +5,7 @@ object DelegateTest { var result = "" val f by lazy { - result += f.toString() // Compiler crash + result += f.toString() // Compiler crash "hello" } } @@ -13,7 +13,7 @@ object DelegateTest { object DelegateTest2 { var result = "" val f by lazy { - result += f + result += f "hello" } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.fir.kt index 25d0a148e37..631ec9f9acd 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.fir.kt @@ -3,12 +3,12 @@ import kotlin.reflect.KProperty -val a by a +val a by a -val b by Delegate(b) +val b by Delegate(b) val c by d -val d by c +val d by c class Delegate(i: Int) { operator fun getValue(t: Any?, p: KProperty<*>): Int { diff --git a/compiler/testData/diagnostics/tests/delegation/kt48546.fir.kt b/compiler/testData/diagnostics/tests/delegation/kt48546.fir.kt index 52c29ca15f8..b04a5fa33ab 100644 --- a/compiler/testData/diagnostics/tests/delegation/kt48546.fir.kt +++ b/compiler/testData/diagnostics/tests/delegation/kt48546.fir.kt @@ -3,7 +3,7 @@ object DelegateTest { var result = "" val f by lazy { - result += f.toString() // Compiler crash + result += f.toString() // Compiler crash "hello" } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.fir.kt b/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.fir.kt index 9bf287c0699..b3bb186223b 100644 --- a/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.fir.kt @@ -12,7 +12,7 @@ fun insideJob1() = doTheJob1() suspend fun insideJob2() = doTheJob2() suspend fun insideJob3() = doTheJob3() -fun doTheJob0() = simpleAsync0 { insideJob0() } -fun doTheJob1() = simpleAsync1 { insideJob1() } -suspend fun doTheJob2() = simpleAsync2 { insideJob2() } -suspend fun doTheJob3() = simpleAsync3 { insideJob3() } +fun doTheJob0() = simpleAsync0 { insideJob0() } +fun doTheJob1() = simpleAsync1 { insideJob1() } +suspend fun doTheJob2() = simpleAsync2 { insideJob2() } +suspend fun doTheJob3() = simpleAsync3 { insideJob3() } diff --git a/compiler/testData/diagnostics/tests/j+k/recursionWithJavaSyntheticProperty.fir.kt b/compiler/testData/diagnostics/tests/j+k/recursionWithJavaSyntheticProperty.fir.kt index 875fa382fa8..aac5a5bfbaa 100644 --- a/compiler/testData/diagnostics/tests/j+k/recursionWithJavaSyntheticProperty.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/recursionWithJavaSyntheticProperty.fir.kt @@ -8,5 +8,5 @@ public class X { class A : X() { // TODO: DEBUG_INFO_MISSING_UNRESOLVED indicates a bug here - override fun getFoo() = foo -} \ No newline at end of file + override fun getFoo() = foo +} diff --git a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/objectExpression.fir.kt b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/objectExpression.fir.kt index 10d85197bca..c15cf4e8951 100644 --- a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/objectExpression.fir.kt +++ b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/objectExpression.fir.kt @@ -6,7 +6,7 @@ object Outer { get() = 0 override fun get(index: Int): Char { - checkSubtype(x) + checkSubtype(x) return ' ' } diff --git a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/recursiveGetter.fir.kt b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/recursiveGetter.fir.kt index 758371ab934..e46dcbebb55 100644 --- a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/recursiveGetter.fir.kt +++ b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/recursiveGetter.fir.kt @@ -1,16 +1,16 @@ // !CHECK_TYPE // NI_EXPECTED_FILE -val x get() = x +val x get() = x class A { - val y get() = y + val y get() = y - val a get() = b - val b get() = a + val a get() = b + val b get() = a - val z1 get() = id(z1) - val z2 get() = l(z2) + val z1 get() = id(z1) + val z2 get() = l(z2) val u get() = field } diff --git a/compiler/testData/diagnostics/tests/regressions/Jet81.fir.kt b/compiler/testData/diagnostics/tests/regressions/Jet81.fir.kt index 83cab2c3fef..379ca95c824 100644 --- a/compiler/testData/diagnostics/tests/regressions/Jet81.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/Jet81.fir.kt @@ -3,10 +3,10 @@ class Test { private val y = object { - val a = y; + val a = y; } - val z = y.a; + val z = y.a; } @@ -23,6 +23,6 @@ class Test2 { val y = 1 } - val b = a.x + val b = a.x val c = a.y } diff --git a/compiler/testData/diagnostics/tests/regressions/ea76264.fir.kt b/compiler/testData/diagnostics/tests/regressions/ea76264.fir.kt index aab934787db..29285b090d4 100644 --- a/compiler/testData/diagnostics/tests/regressions/ea76264.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/ea76264.fir.kt @@ -1,4 +1,4 @@ // StackOverflow -val p = ::p +val p = ::p -fun foo() = ::foo \ No newline at end of file +fun foo() = ::foo diff --git a/compiler/testData/diagnostics/tests/regressions/kt328.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt328.fir.kt index e6c6003c1a7..5755cafeedb 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt328.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt328.fir.kt @@ -2,28 +2,28 @@ //KT-328 Local function in function literals cause exceptions fun bar1() = { - bar1() + bar1() } fun bar2() = { - fun foo2() = bar2() + fun foo2() = bar2() } //properties //in a class class A() { - val x = { x } + val x = { x } } //in a package -val x = { x } +val x = { x } //KT-787 AssertionError on code 'val x = x' -val z = z +val z = z //KT-329 Assertion failure on local function fun block(f : () -> Unit) = f() fun bar3() = block{ foo3() // <-- missing closing curly bracket -fun foo3() = block{ bar3() } +fun foo3() = block{ bar3() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt18292.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt18292.fir.kt index 87c9645fd3b..861d2ef8b1d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt18292.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt18292.fir.kt @@ -13,6 +13,6 @@ suspend fun fib(n: Long) = async { when { n < 2 -> n - else -> fib(n - 1).await() + fib(n - 2).await() + else -> fib(n - 1).await() + fib(n - 2).await() } }