[FIR] Replace FirExpression.typeRef.coneType (and variants) with FirExpression.coneType
#KT-59855
This commit is contained in:
committed by
Space Team
parent
1472b21993
commit
9ec814b7ad
+1
-1
@@ -27,7 +27,7 @@ object FirJsDynamicDeclarationChecker : FirClassChecker() {
|
||||
// and it's a shape it couldn't have been accessed directly
|
||||
val initializer = delegate.fir.initializer ?: continue
|
||||
|
||||
if (initializer.typeRef.coneType is ConeDynamicType) {
|
||||
if (initializer.coneType is ConeDynamicType) {
|
||||
reporter.reportOn(initializer.source, FirJsErrors.DELEGATION_BY_DYNAMIC, context)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -34,9 +34,9 @@ object FirJsExternalFileChecker : FirBasicDeclarationChecker() {
|
||||
reporter.reportOn(
|
||||
declaration.source,
|
||||
FirJsErrors.NON_EXTERNAL_DECLARATION_IN_INAPPROPRIATE_FILE,
|
||||
targetAnnotations.typeRef.coneType,
|
||||
targetAnnotations.coneType,
|
||||
context
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ internal abstract class FirJsAbstractNativeAnnotationChecker(private val require
|
||||
reporter.reportOn(
|
||||
declaration.source,
|
||||
FirJsErrors.NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN,
|
||||
annotation.typeRef.coneType,
|
||||
annotation.coneType,
|
||||
context
|
||||
)
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.fir.types.coneTypeOrNull
|
||||
|
||||
object FirJsPropertyDelegationByDynamicChecker : FirPropertyChecker() {
|
||||
override fun check(declaration: FirProperty, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
if (declaration.delegate?.typeRef?.coneTypeOrNull is ConeDynamicType) {
|
||||
if (declaration.delegate?.coneTypeOrNull is ConeDynamicType) {
|
||||
reporter.reportOn(declaration.delegate?.source, FirJsErrors.PROPERTY_DELEGATION_BY_DYNAMIC, context)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ object FirJsDynamicCallChecker : FirQualifiedAccessExpressionChecker() {
|
||||
|
||||
private fun checkSpreadOperator(expression: FirQualifiedAccessExpression, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
forAllSpreadArgumentsOf(expression) {
|
||||
if (it.typeRef.coneType is ConeDynamicType) {
|
||||
if (it.coneType is ConeDynamicType) {
|
||||
reporter.reportOn(it.source, FirJsErrors.WRONG_OPERATION_WITH_DYNAMIC, "spread operator", context)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ object FirJsExternalArgumentCallChecker : FirCallChecker() {
|
||||
for ((argument, parameter) in arguments) {
|
||||
if (parameter.hasAnnotation(JsExternalArgument, context.session)) {
|
||||
val unwrappedArg = argument.unwrapArgument()
|
||||
val type = unwrappedArg.typeRef.coneTypeOrNull ?: continue
|
||||
val type = unwrappedArg.coneTypeOrNull ?: continue
|
||||
val symbol = type.toRegularClassSymbol(context.session)
|
||||
if (symbol?.isEffectivelyExternal(context.session) == false || type is ConeDynamicType) {
|
||||
reporter.reportOn(
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.fir.types.toSymbol
|
||||
|
||||
object FirJsModuleGetClassCallChecker : FirGetClassCallChecker() {
|
||||
override fun check(expression: FirGetClassCall, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
val callee = expression.argument.typeRef.coneTypeOrNull?.toSymbol(context.session) ?: return
|
||||
val callee = expression.argument.coneTypeOrNull?.toSymbol(context.session) ?: return
|
||||
checkJsModuleUsage(callee, context, reporter, expression.argument.typeRef.source ?: expression.source)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-4
@@ -7,13 +7,14 @@ package org.jetbrains.kotlin.fir.analysis.js.checkers.expression
|
||||
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.diagnostics.reportOn
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.*
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirBasicExpressionChecker
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.toRegularClassSymbol
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors
|
||||
import org.jetbrains.kotlin.fir.analysis.js.checkers.isNativeInterface
|
||||
import org.jetbrains.kotlin.fir.expressions.*
|
||||
import org.jetbrains.kotlin.fir.types.coneType
|
||||
import org.jetbrains.kotlin.fir.types.toRegularClassSymbol
|
||||
|
||||
object FirJsNativeRttiChecker : FirBasicExpressionChecker() {
|
||||
override fun check(expression: FirStatement, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
@@ -25,7 +26,7 @@ object FirJsNativeRttiChecker : FirBasicExpressionChecker() {
|
||||
}
|
||||
|
||||
private fun checkGetClassCall(expression: FirGetClassCall, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
val declarationToCheck = expression.argument.typeRef.toRegularClassSymbol(context.session) ?: return
|
||||
val declarationToCheck = expression.argument.coneType.toRegularClassSymbol(context.session) ?: return
|
||||
|
||||
if (expression.arguments.firstOrNull() !is FirResolvedQualifier) {
|
||||
return
|
||||
@@ -48,7 +49,7 @@ object FirJsNativeRttiChecker : FirBasicExpressionChecker() {
|
||||
FirOperation.AS, FirOperation.SAFE_AS -> reporter.reportOn(
|
||||
expression.source,
|
||||
FirJsErrors.UNCHECKED_CAST_TO_EXTERNAL_INTERFACE,
|
||||
expression.argument.typeRef.coneType,
|
||||
expression.argument.coneType,
|
||||
targetTypeRef.coneType,
|
||||
context,
|
||||
)
|
||||
@@ -61,4 +62,4 @@ object FirJsNativeRttiChecker : FirBasicExpressionChecker() {
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user