From ce396f4ab6a75061caaaac2d600e18603ee72501 Mon Sep 17 00:00:00 2001 From: "Evgeniy.Zhelenskiy" Date: Wed, 25 Oct 2023 19:35:55 +0200 Subject: [PATCH] [FIR] Add check inline declaration inside constructor calls #KT-59933 --- .../checkers/declaration/FirInlineDeclarationChecker.kt | 2 +- .../testData/diagnostics/tests/inline/constructor.fir.kt | 7 ------- compiler/testData/diagnostics/tests/inline/constructor.kt | 1 + 3 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/inline/constructor.fir.kt diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineDeclarationChecker.kt index cfa25410077..e56a7dc7dce 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineDeclarationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineDeclarationChecker.kt @@ -132,7 +132,7 @@ object FirInlineDeclarationChecker : FirFunctionChecker() { reporter: DiagnosticReporter, ) { if (context.isContractBody) return - val calledFunctionSymbol = targetSymbol as? FirNamedFunctionSymbol ?: return + val calledFunctionSymbol = targetSymbol as? FirFunctionSymbol ?: return val argumentMapping = functionCall.resolvedArgumentMapping ?: return for ((wrappedArgument, valueParameter) in argumentMapping) { val argument = wrappedArgument.unwrapArgument() diff --git a/compiler/testData/diagnostics/tests/inline/constructor.fir.kt b/compiler/testData/diagnostics/tests/inline/constructor.fir.kt deleted file mode 100644 index 288bd2417ff..00000000000 --- a/compiler/testData/diagnostics/tests/inline/constructor.fir.kt +++ /dev/null @@ -1,7 +0,0 @@ -class Z(s: (Int) -> Int) { - -} - -public inline fun test(s : (Int) -> Int) { - Z(s) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inline/constructor.kt b/compiler/testData/diagnostics/tests/inline/constructor.kt index f43a2aa5cbd..5500915bba1 100644 --- a/compiler/testData/diagnostics/tests/inline/constructor.kt +++ b/compiler/testData/diagnostics/tests/inline/constructor.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class Z(s: (Int) -> Int) { }