diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java index 1de62d8f1bf..c82cec7acb3 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java @@ -2439,11 +2439,6 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi public void testNoReflectionInClassPath() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/reflection/noReflectionInClassPath.kt"); } - - @TestMetadata("typeOfWithNonReifiedParameter.kt") - public void testTypeOfWithNonReifiedParameter() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/reflection/typeOfWithNonReifiedParameter.kt"); - } } @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/regression") diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt index f31fdad063a..c2e3fdab941 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/PlatformConfiguratorBase.kt @@ -48,7 +48,7 @@ private val DEFAULT_CALL_CHECKERS = listOf( UnderscoreUsageChecker, AssigningNamedArgumentToVarargChecker(), ImplicitNothingAsTypeParameterCallChecker, PrimitiveNumericComparisonCallChecker, LambdaWithSuspendModifierCallChecker, UselessElvisCallChecker(), ResultTypeWithNullableOperatorsChecker(), NullableVarargArgumentCallChecker, - NamedFunAsExpressionChecker, ContractNotAllowedCallChecker, ReifiedTypeParameterSubstitutionChecker(), TypeOfChecker, + NamedFunAsExpressionChecker, ContractNotAllowedCallChecker, ReifiedTypeParameterSubstitutionChecker(), MissingDependencySupertypeChecker.ForCalls, AbstractClassInstantiationChecker, ) private val DEFAULT_TYPE_CHECKERS = emptyList() diff --git a/compiler/testData/diagnostics/testsWithStdLib/reflection/typeOfWithNonReifiedParameter.kt b/compiler/testData/diagnostics/testsWithJsStdLib/reflection/typeOfWithNonReifiedParameter.kt similarity index 100% rename from compiler/testData/diagnostics/testsWithStdLib/reflection/typeOfWithNonReifiedParameter.kt rename to compiler/testData/diagnostics/testsWithJsStdLib/reflection/typeOfWithNonReifiedParameter.kt diff --git a/compiler/testData/diagnostics/testsWithStdLib/reflection/typeOfWithNonReifiedParameter.txt b/compiler/testData/diagnostics/testsWithJsStdLib/reflection/typeOfWithNonReifiedParameter.txt similarity index 100% rename from compiler/testData/diagnostics/testsWithStdLib/reflection/typeOfWithNonReifiedParameter.txt rename to compiler/testData/diagnostics/testsWithJsStdLib/reflection/typeOfWithNonReifiedParameter.txt diff --git a/compiler/testData/diagnostics/testsWithStdLib/reflection/typeOfWithNonReifiedParameter.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/reflection/typeOfWithNonReifiedParameter.fir.kt deleted file mode 100644 index 2f910a1e162..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/reflection/typeOfWithNonReifiedParameter.fir.kt +++ /dev/null @@ -1,35 +0,0 @@ -// !USE_EXPERIMENTAL: kotlin.ExperimentalStdlibApi -// !LANGUAGE: +ProhibitNonReifiedArraysAsReifiedTypeArguments - -import kotlin.reflect.typeOf - -inline fun test1() { - typeOf() - typeOf>() - typeOf>() - - typeOf() - - typeOf() - typeOf?>() - typeOf>() -} - - -class Test2 { - fun test2() { - typeOf() - typeOf>() - typeOf>() - } -} - - -inline fun f() { - typeOf() -} - -fun test3() { - // We don't report anything here because we can't know in frontend how the corresponding type parameter is used in f - f>() -} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJsStdLibGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJsStdLibGenerated.java index 702e5f51379..e0b4ed9960d 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJsStdLibGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJsStdLibGenerated.java @@ -1074,5 +1074,10 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes public void testReflectionApi() throws Exception { runTest("compiler/testData/diagnostics/testsWithJsStdLib/reflection/reflectionApi.kt"); } + + @TestMetadata("typeOfWithNonReifiedParameter.kt") + public void testTypeOfWithNonReifiedParameter() throws Exception { + runTest("compiler/testData/diagnostics/testsWithJsStdLib/reflection/typeOfWithNonReifiedParameter.kt"); + } } } diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java index 40b1b32afa2..f33bcd93ea4 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java @@ -3454,11 +3454,6 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW public void testNoReflectionInClassPath() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/reflection/noReflectionInClassPath.kt"); } - - @TestMetadata("typeOfWithNonReifiedParameter.kt") - public void testTypeOfWithNonReifiedParameter() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/reflection/typeOfWithNonReifiedParameter.kt"); - } } @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/regression") diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java index d57a071048b..5c992197264 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java @@ -3454,11 +3454,6 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno public void testNoReflectionInClassPath() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/reflection/noReflectionInClassPath.kt"); } - - @TestMetadata("typeOfWithNonReifiedParameter.kt") - public void testTypeOfWithNonReifiedParameter() throws Exception { - runTest("compiler/testData/diagnostics/testsWithStdLib/reflection/typeOfWithNonReifiedParameter.kt"); - } } @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/regression") diff --git a/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/JsPlatformConfigurator.kt b/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/JsPlatformConfigurator.kt index ff61cdc5090..59b8ebe7a4e 100644 --- a/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/JsPlatformConfigurator.kt +++ b/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/JsPlatformConfigurator.kt @@ -23,6 +23,7 @@ import org.jetbrains.kotlin.js.analyze.JsNativeDiagnosticSuppressor import org.jetbrains.kotlin.js.naming.NameSuggestion import org.jetbrains.kotlin.js.resolve.diagnostics.* import org.jetbrains.kotlin.resolve.PlatformConfiguratorBase +import org.jetbrains.kotlin.resolve.calls.checkers.TypeOfChecker import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker import org.jetbrains.kotlin.resolve.deprecation.CoroutineCompatibilitySupport import org.jetbrains.kotlin.types.DynamicTypesAllowed @@ -39,7 +40,8 @@ object JsPlatformConfigurator : PlatformConfiguratorBase( additionalCallCheckers = listOf( JsModuleCallChecker, JsDynamicCallChecker, - JsDefinedExternallyCallChecker + JsDefinedExternallyCallChecker, + TypeOfChecker, ), identifierChecker = JsIdentifierChecker ) { diff --git a/native/frontend/src/org/jetbrains/kotlin/resolve/konan/platform/NativePlatformConfigurator.kt b/native/frontend/src/org/jetbrains/kotlin/resolve/konan/platform/NativePlatformConfigurator.kt index 0fd6172e627..512ae5693b2 100644 --- a/native/frontend/src/org/jetbrains/kotlin/resolve/konan/platform/NativePlatformConfigurator.kt +++ b/native/frontend/src/org/jetbrains/kotlin/resolve/konan/platform/NativePlatformConfigurator.kt @@ -10,7 +10,9 @@ import org.jetbrains.kotlin.container.useImpl import org.jetbrains.kotlin.container.useInstance import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor import org.jetbrains.kotlin.psi.KtCallableDeclaration -import org.jetbrains.kotlin.resolve.* +import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.PlatformConfiguratorBase +import org.jetbrains.kotlin.resolve.calls.checkers.TypeOfChecker import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker import org.jetbrains.kotlin.resolve.inline.ReasonableInlineRule import org.jetbrains.kotlin.resolve.jvm.checkers.SuperCallWithDefaultArgumentsChecker @@ -20,7 +22,10 @@ import org.jetbrains.kotlin.resolve.konan.diagnostics.NativeThrowsChecker import org.jetbrains.kotlin.resolve.konan.diagnostics.NativeTopLevelSingletonChecker object NativePlatformConfigurator : PlatformConfiguratorBase( - additionalCallCheckers = listOf(SuperCallWithDefaultArgumentsChecker()), + additionalCallCheckers = listOf( + SuperCallWithDefaultArgumentsChecker(), + TypeOfChecker, + ), additionalDeclarationCheckers = listOf( NativeThrowsChecker, NativeSharedImmutableChecker, NativeTopLevelSingletonChecker, NativeThreadLocalChecker @@ -42,4 +47,4 @@ object NativeInliningRule : ReasonableInlineRule { declaration: KtCallableDeclaration, context: BindingContext ): Boolean = true -} \ No newline at end of file +}