From 8f9489918731ac1ada7b0dbe2d75e3315ce53e9d Mon Sep 17 00:00:00 2001 From: Nikolay Lunyak Date: Thu, 26 Jan 2023 12:16:54 +0200 Subject: [PATCH] [FIR JS] Fix a typo in the dynamic upper bound check `FirDynamicTypeRef` is the unresolved version, and after resolution it becomes `FirResolvedTypeRef` with `ConeDynamicType`. --- .../checkers/declaration/FirTypeParameterBoundsChecker.kt | 2 +- .../dynamicTypes/supertypesAndBounds.fir.kt | 5 ----- .../testsWithJsStdLib/dynamicTypes/supertypesAndBounds.kt | 2 ++ 3 files changed, 3 insertions(+), 6 deletions(-) delete mode 100644 compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/supertypesAndBounds.fir.kt diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirTypeParameterBoundsChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirTypeParameterBoundsChecker.kt index 6f90417a0ee..f30cc1ed781 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirTypeParameterBoundsChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirTypeParameterBoundsChecker.kt @@ -146,7 +146,7 @@ object FirTypeParameterBoundsChecker : FirTypeParameterChecker() { private fun checkDynamicBounds(declaration: FirTypeParameter, context: CheckerContext, reporter: DiagnosticReporter) { declaration.bounds.forEach { bound -> - if (bound is FirDynamicTypeRef) { + if (bound.coneType is ConeDynamicType) { reporter.reportOn(bound.source, FirErrors.DYNAMIC_UPPER_BOUND, context) } } diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/supertypesAndBounds.fir.kt b/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/supertypesAndBounds.fir.kt deleted file mode 100644 index 51bb4c20d7b..00000000000 --- a/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/supertypesAndBounds.fir.kt +++ /dev/null @@ -1,5 +0,0 @@ -interface Tr : dynamic - -fun foo() {} - -class C where T : dynamic diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/supertypesAndBounds.kt b/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/supertypesAndBounds.kt index 5153971a2bd..80a126cf2e7 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/supertypesAndBounds.kt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/supertypesAndBounds.kt @@ -1,3 +1,5 @@ +// FIR_IDENTICAL + interface Tr : dynamic fun dynamic> foo() {}