Remove TypeOfChecker for JVM frontend
This is needed to support typeOf with non-reified type parameters. #KT-30279
This commit is contained in:
-5
@@ -2439,11 +2439,6 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
|
|||||||
public void testNoReflectionInClassPath() throws Exception {
|
public void testNoReflectionInClassPath() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/reflection/noReflectionInClassPath.kt");
|
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")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/regression")
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ private val DEFAULT_CALL_CHECKERS = listOf(
|
|||||||
UnderscoreUsageChecker, AssigningNamedArgumentToVarargChecker(), ImplicitNothingAsTypeParameterCallChecker,
|
UnderscoreUsageChecker, AssigningNamedArgumentToVarargChecker(), ImplicitNothingAsTypeParameterCallChecker,
|
||||||
PrimitiveNumericComparisonCallChecker, LambdaWithSuspendModifierCallChecker,
|
PrimitiveNumericComparisonCallChecker, LambdaWithSuspendModifierCallChecker,
|
||||||
UselessElvisCallChecker(), ResultTypeWithNullableOperatorsChecker(), NullableVarargArgumentCallChecker,
|
UselessElvisCallChecker(), ResultTypeWithNullableOperatorsChecker(), NullableVarargArgumentCallChecker,
|
||||||
NamedFunAsExpressionChecker, ContractNotAllowedCallChecker, ReifiedTypeParameterSubstitutionChecker(), TypeOfChecker,
|
NamedFunAsExpressionChecker, ContractNotAllowedCallChecker, ReifiedTypeParameterSubstitutionChecker(),
|
||||||
MissingDependencySupertypeChecker.ForCalls, AbstractClassInstantiationChecker,
|
MissingDependencySupertypeChecker.ForCalls, AbstractClassInstantiationChecker,
|
||||||
)
|
)
|
||||||
private val DEFAULT_TYPE_CHECKERS = emptyList<AdditionalTypeChecker>()
|
private val DEFAULT_TYPE_CHECKERS = emptyList<AdditionalTypeChecker>()
|
||||||
|
|||||||
Vendored
-35
@@ -1,35 +0,0 @@
|
|||||||
// !USE_EXPERIMENTAL: kotlin.ExperimentalStdlibApi
|
|
||||||
// !LANGUAGE: +ProhibitNonReifiedArraysAsReifiedTypeArguments
|
|
||||||
|
|
||||||
import kotlin.reflect.typeOf
|
|
||||||
|
|
||||||
inline fun <X, reified Y, Z : Y> test1() {
|
|
||||||
typeOf<X>()
|
|
||||||
typeOf<List<X>>()
|
|
||||||
typeOf<Array<X?>>()
|
|
||||||
|
|
||||||
typeOf<Y>()
|
|
||||||
|
|
||||||
typeOf<Z>()
|
|
||||||
typeOf<List<Z>?>()
|
|
||||||
typeOf<Array<Z>>()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class Test2<W> {
|
|
||||||
fun test2() {
|
|
||||||
typeOf<W>()
|
|
||||||
typeOf<List<W?>>()
|
|
||||||
typeOf<Array<W>>()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline fun <reified U> f() {
|
|
||||||
typeOf<U>()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun <T> test3() {
|
|
||||||
// We don't report anything here because we can't know in frontend how the corresponding type parameter is used in f
|
|
||||||
f<List<T>>()
|
|
||||||
}
|
|
||||||
+5
@@ -1074,5 +1074,10 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes
|
|||||||
public void testReflectionApi() throws Exception {
|
public void testReflectionApi() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/testsWithJsStdLib/reflection/reflectionApi.kt");
|
runTest("compiler/testData/diagnostics/testsWithJsStdLib/reflection/reflectionApi.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("typeOfWithNonReifiedParameter.kt")
|
||||||
|
public void testTypeOfWithNonReifiedParameter() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithJsStdLib/reflection/typeOfWithNonReifiedParameter.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-5
@@ -3454,11 +3454,6 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
|||||||
public void testNoReflectionInClassPath() throws Exception {
|
public void testNoReflectionInClassPath() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/reflection/noReflectionInClassPath.kt");
|
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")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/regression")
|
||||||
|
|||||||
compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
Generated
-5
@@ -3454,11 +3454,6 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
|
|||||||
public void testNoReflectionInClassPath() throws Exception {
|
public void testNoReflectionInClassPath() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/reflection/noReflectionInClassPath.kt");
|
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")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/regression")
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.js.analyze.JsNativeDiagnosticSuppressor
|
|||||||
import org.jetbrains.kotlin.js.naming.NameSuggestion
|
import org.jetbrains.kotlin.js.naming.NameSuggestion
|
||||||
import org.jetbrains.kotlin.js.resolve.diagnostics.*
|
import org.jetbrains.kotlin.js.resolve.diagnostics.*
|
||||||
import org.jetbrains.kotlin.resolve.PlatformConfiguratorBase
|
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.checkers.ExpectedActualDeclarationChecker
|
||||||
import org.jetbrains.kotlin.resolve.deprecation.CoroutineCompatibilitySupport
|
import org.jetbrains.kotlin.resolve.deprecation.CoroutineCompatibilitySupport
|
||||||
import org.jetbrains.kotlin.types.DynamicTypesAllowed
|
import org.jetbrains.kotlin.types.DynamicTypesAllowed
|
||||||
@@ -39,7 +40,8 @@ object JsPlatformConfigurator : PlatformConfiguratorBase(
|
|||||||
additionalCallCheckers = listOf(
|
additionalCallCheckers = listOf(
|
||||||
JsModuleCallChecker,
|
JsModuleCallChecker,
|
||||||
JsDynamicCallChecker,
|
JsDynamicCallChecker,
|
||||||
JsDefinedExternallyCallChecker
|
JsDefinedExternallyCallChecker,
|
||||||
|
TypeOfChecker,
|
||||||
),
|
),
|
||||||
identifierChecker = JsIdentifierChecker
|
identifierChecker = JsIdentifierChecker
|
||||||
) {
|
) {
|
||||||
|
|||||||
+8
-3
@@ -10,7 +10,9 @@ import org.jetbrains.kotlin.container.useImpl
|
|||||||
import org.jetbrains.kotlin.container.useInstance
|
import org.jetbrains.kotlin.container.useInstance
|
||||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||||
import org.jetbrains.kotlin.psi.KtCallableDeclaration
|
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.checkers.ExpectedActualDeclarationChecker
|
||||||
import org.jetbrains.kotlin.resolve.inline.ReasonableInlineRule
|
import org.jetbrains.kotlin.resolve.inline.ReasonableInlineRule
|
||||||
import org.jetbrains.kotlin.resolve.jvm.checkers.SuperCallWithDefaultArgumentsChecker
|
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
|
import org.jetbrains.kotlin.resolve.konan.diagnostics.NativeTopLevelSingletonChecker
|
||||||
|
|
||||||
object NativePlatformConfigurator : PlatformConfiguratorBase(
|
object NativePlatformConfigurator : PlatformConfiguratorBase(
|
||||||
additionalCallCheckers = listOf(SuperCallWithDefaultArgumentsChecker()),
|
additionalCallCheckers = listOf(
|
||||||
|
SuperCallWithDefaultArgumentsChecker(),
|
||||||
|
TypeOfChecker,
|
||||||
|
),
|
||||||
additionalDeclarationCheckers = listOf(
|
additionalDeclarationCheckers = listOf(
|
||||||
NativeThrowsChecker, NativeSharedImmutableChecker,
|
NativeThrowsChecker, NativeSharedImmutableChecker,
|
||||||
NativeTopLevelSingletonChecker, NativeThreadLocalChecker
|
NativeTopLevelSingletonChecker, NativeThreadLocalChecker
|
||||||
@@ -42,4 +47,4 @@ object NativeInliningRule : ReasonableInlineRule {
|
|||||||
declaration: KtCallableDeclaration,
|
declaration: KtCallableDeclaration,
|
||||||
context: BindingContext
|
context: BindingContext
|
||||||
): Boolean = true
|
): Boolean = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user