[FIR JS] Implement FirJsExternalChecker
The JsAllowValueClassesInExternals feature is enabled explicitly, because otherwise it's enabled implicitly depending on the backend. See: org/jetbrains/kotlin/test/builders/LanguageVersionSettingsBuilder.kt:90 A property may have a fake source return kind, while its accessor has a real source kind. In this case we can't "just copy" the property return type down to the accessor.
This commit is contained in:
committed by
Space Team
parent
7b8f5f9980
commit
a20e29e8b7
+103
@@ -4685,6 +4685,109 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.EXTERNAL_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER) { firDiagnostic ->
|
||||
ExternalClassConstructorPropertyParameterImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.EXTERNAL_ENUM_ENTRY_WITH_BODY) { firDiagnostic ->
|
||||
ExternalEnumEntryWithBodyImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.EXTERNAL_ANONYMOUS_INITIALIZER) { firDiagnostic ->
|
||||
ExternalAnonymousInitializerImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.EXTERNAL_DELEGATION) { firDiagnostic ->
|
||||
ExternalDelegationImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.EXTERNAL_DELEGATED_CONSTRUCTOR_CALL) { firDiagnostic ->
|
||||
ExternalDelegatedConstructorCallImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.WRONG_BODY_OF_EXTERNAL_DECLARATION) { firDiagnostic ->
|
||||
WrongBodyOfExternalDeclarationImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.WRONG_INITIALIZER_OF_EXTERNAL_DECLARATION) { firDiagnostic ->
|
||||
WrongInitializerOfExternalDeclarationImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.WRONG_DEFAULT_VALUE_FOR_EXTERNAL_FUN_PARAMETER) { firDiagnostic ->
|
||||
WrongDefaultValueForExternalFunParameterImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.NESTED_EXTERNAL_DECLARATION) { firDiagnostic ->
|
||||
NestedExternalDeclarationImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.WRONG_EXTERNAL_DECLARATION) { firDiagnostic ->
|
||||
WrongExternalDeclarationImpl(
|
||||
firDiagnostic.a,
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.NESTED_CLASS_IN_EXTERNAL_INTERFACE) { firDiagnostic ->
|
||||
NestedClassInExternalInterfaceImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE) { firDiagnostic ->
|
||||
ExternalTypeExtendsNonExternalTypeImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.INLINE_EXTERNAL_DECLARATION) { firDiagnostic ->
|
||||
InlineExternalDeclarationImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING) { firDiagnostic ->
|
||||
InlineClassInExternalDeclarationWarningImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.INLINE_CLASS_IN_EXTERNAL_DECLARATION) { firDiagnostic ->
|
||||
InlineClassInExternalDeclarationImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.EXTENSION_FUNCTION_IN_EXTERNAL_DECLARATION) { firDiagnostic ->
|
||||
ExtensionFunctionInExternalDeclarationImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.NON_ABSTRACT_MEMBER_OF_EXTERNAL_INTERFACE) { firDiagnostic ->
|
||||
NonAbstractMemberOfExternalInterfaceImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirJsErrors.DELEGATION_BY_DYNAMIC) { firDiagnostic ->
|
||||
DelegationByDynamicImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
|
||||
+69
@@ -3258,6 +3258,75 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
override val diagnosticClass get() = CallToDefinedExternallyFromNonExternalDeclaration::class
|
||||
}
|
||||
|
||||
abstract class ExternalClassConstructorPropertyParameter : KtFirDiagnostic<KtParameter>() {
|
||||
override val diagnosticClass get() = ExternalClassConstructorPropertyParameter::class
|
||||
}
|
||||
|
||||
abstract class ExternalEnumEntryWithBody : KtFirDiagnostic<KtElement>() {
|
||||
override val diagnosticClass get() = ExternalEnumEntryWithBody::class
|
||||
}
|
||||
|
||||
abstract class ExternalAnonymousInitializer : KtFirDiagnostic<KtAnonymousInitializer>() {
|
||||
override val diagnosticClass get() = ExternalAnonymousInitializer::class
|
||||
}
|
||||
|
||||
abstract class ExternalDelegation : KtFirDiagnostic<KtElement>() {
|
||||
override val diagnosticClass get() = ExternalDelegation::class
|
||||
}
|
||||
|
||||
abstract class ExternalDelegatedConstructorCall : KtFirDiagnostic<KtElement>() {
|
||||
override val diagnosticClass get() = ExternalDelegatedConstructorCall::class
|
||||
}
|
||||
|
||||
abstract class WrongBodyOfExternalDeclaration : KtFirDiagnostic<KtElement>() {
|
||||
override val diagnosticClass get() = WrongBodyOfExternalDeclaration::class
|
||||
}
|
||||
|
||||
abstract class WrongInitializerOfExternalDeclaration : KtFirDiagnostic<KtElement>() {
|
||||
override val diagnosticClass get() = WrongInitializerOfExternalDeclaration::class
|
||||
}
|
||||
|
||||
abstract class WrongDefaultValueForExternalFunParameter : KtFirDiagnostic<KtElement>() {
|
||||
override val diagnosticClass get() = WrongDefaultValueForExternalFunParameter::class
|
||||
}
|
||||
|
||||
abstract class NestedExternalDeclaration : KtFirDiagnostic<KtExpression>() {
|
||||
override val diagnosticClass get() = NestedExternalDeclaration::class
|
||||
}
|
||||
|
||||
abstract class WrongExternalDeclaration : KtFirDiagnostic<KtExpression>() {
|
||||
override val diagnosticClass get() = WrongExternalDeclaration::class
|
||||
abstract val classKind: String
|
||||
}
|
||||
|
||||
abstract class NestedClassInExternalInterface : KtFirDiagnostic<KtExpression>() {
|
||||
override val diagnosticClass get() = NestedClassInExternalInterface::class
|
||||
}
|
||||
|
||||
abstract class ExternalTypeExtendsNonExternalType : KtFirDiagnostic<KtElement>() {
|
||||
override val diagnosticClass get() = ExternalTypeExtendsNonExternalType::class
|
||||
}
|
||||
|
||||
abstract class InlineExternalDeclaration : KtFirDiagnostic<KtDeclaration>() {
|
||||
override val diagnosticClass get() = InlineExternalDeclaration::class
|
||||
}
|
||||
|
||||
abstract class InlineClassInExternalDeclarationWarning : KtFirDiagnostic<KtElement>() {
|
||||
override val diagnosticClass get() = InlineClassInExternalDeclarationWarning::class
|
||||
}
|
||||
|
||||
abstract class InlineClassInExternalDeclaration : KtFirDiagnostic<KtElement>() {
|
||||
override val diagnosticClass get() = InlineClassInExternalDeclaration::class
|
||||
}
|
||||
|
||||
abstract class ExtensionFunctionInExternalDeclaration : KtFirDiagnostic<KtElement>() {
|
||||
override val diagnosticClass get() = ExtensionFunctionInExternalDeclaration::class
|
||||
}
|
||||
|
||||
abstract class NonAbstractMemberOfExternalInterface : KtFirDiagnostic<KtExpression>() {
|
||||
override val diagnosticClass get() = NonAbstractMemberOfExternalInterface::class
|
||||
}
|
||||
|
||||
abstract class DelegationByDynamic : KtFirDiagnostic<KtElement>() {
|
||||
override val diagnosticClass get() = DelegationByDynamic::class
|
||||
}
|
||||
|
||||
+86
@@ -3942,6 +3942,92 @@ internal class CallToDefinedExternallyFromNonExternalDeclarationImpl(
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.CallToDefinedExternallyFromNonExternalDeclaration(), KtAbstractFirDiagnostic<PsiElement>
|
||||
|
||||
internal class ExternalClassConstructorPropertyParameterImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.ExternalClassConstructorPropertyParameter(), KtAbstractFirDiagnostic<KtParameter>
|
||||
|
||||
internal class ExternalEnumEntryWithBodyImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.ExternalEnumEntryWithBody(), KtAbstractFirDiagnostic<KtElement>
|
||||
|
||||
internal class ExternalAnonymousInitializerImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.ExternalAnonymousInitializer(), KtAbstractFirDiagnostic<KtAnonymousInitializer>
|
||||
|
||||
internal class ExternalDelegationImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.ExternalDelegation(), KtAbstractFirDiagnostic<KtElement>
|
||||
|
||||
internal class ExternalDelegatedConstructorCallImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.ExternalDelegatedConstructorCall(), KtAbstractFirDiagnostic<KtElement>
|
||||
|
||||
internal class WrongBodyOfExternalDeclarationImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.WrongBodyOfExternalDeclaration(), KtAbstractFirDiagnostic<KtElement>
|
||||
|
||||
internal class WrongInitializerOfExternalDeclarationImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.WrongInitializerOfExternalDeclaration(), KtAbstractFirDiagnostic<KtElement>
|
||||
|
||||
internal class WrongDefaultValueForExternalFunParameterImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.WrongDefaultValueForExternalFunParameter(), KtAbstractFirDiagnostic<KtElement>
|
||||
|
||||
internal class NestedExternalDeclarationImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.NestedExternalDeclaration(), KtAbstractFirDiagnostic<KtExpression>
|
||||
|
||||
internal class WrongExternalDeclarationImpl(
|
||||
override val classKind: String,
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.WrongExternalDeclaration(), KtAbstractFirDiagnostic<KtExpression>
|
||||
|
||||
internal class NestedClassInExternalInterfaceImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.NestedClassInExternalInterface(), KtAbstractFirDiagnostic<KtExpression>
|
||||
|
||||
internal class ExternalTypeExtendsNonExternalTypeImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.ExternalTypeExtendsNonExternalType(), KtAbstractFirDiagnostic<KtElement>
|
||||
|
||||
internal class InlineExternalDeclarationImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.InlineExternalDeclaration(), KtAbstractFirDiagnostic<KtDeclaration>
|
||||
|
||||
internal class InlineClassInExternalDeclarationWarningImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.InlineClassInExternalDeclarationWarning(), KtAbstractFirDiagnostic<KtElement>
|
||||
|
||||
internal class InlineClassInExternalDeclarationImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.InlineClassInExternalDeclaration(), KtAbstractFirDiagnostic<KtElement>
|
||||
|
||||
internal class ExtensionFunctionInExternalDeclarationImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.ExtensionFunctionInExternalDeclaration(), KtAbstractFirDiagnostic<KtElement>
|
||||
|
||||
internal class NonAbstractMemberOfExternalInterfaceImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
) : KtFirDiagnostic.NonAbstractMemberOfExternalInterface(), KtAbstractFirDiagnostic<KtExpression>
|
||||
|
||||
internal class DelegationByDynamicImpl(
|
||||
override val firDiagnostic: KtPsiDiagnostic,
|
||||
override val token: KtLifetimeToken,
|
||||
|
||||
Reference in New Issue
Block a user