[FIR JS] Implement FirJsNativeAnnotationChecker
This commit is contained in:
committed by
Space Team
parent
a20e29e8b7
commit
5b3a73f7cd
+41
@@ -1019,6 +1019,47 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
|||||||
token,
|
token,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
add(FirJsErrors.NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN) { firDiagnostic ->
|
||||||
|
NativeAnnotationsAllowedOnlyOnMemberOrExtensionFunImpl(
|
||||||
|
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a),
|
||||||
|
firDiagnostic as KtPsiDiagnostic,
|
||||||
|
token,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
add(FirJsErrors.NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER) { firDiagnostic ->
|
||||||
|
NativeIndexerKeyShouldBeStringOrNumberImpl(
|
||||||
|
firDiagnostic.a,
|
||||||
|
firDiagnostic as KtPsiDiagnostic,
|
||||||
|
token,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
add(FirJsErrors.NATIVE_INDEXER_WRONG_PARAMETER_COUNT) { firDiagnostic ->
|
||||||
|
NativeIndexerWrongParameterCountImpl(
|
||||||
|
firDiagnostic.a,
|
||||||
|
firDiagnostic.b,
|
||||||
|
firDiagnostic as KtPsiDiagnostic,
|
||||||
|
token,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
add(FirJsErrors.NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS) { firDiagnostic ->
|
||||||
|
NativeIndexerCanNotHaveDefaultArgumentsImpl(
|
||||||
|
firDiagnostic.a,
|
||||||
|
firDiagnostic as KtPsiDiagnostic,
|
||||||
|
token,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
add(FirJsErrors.NATIVE_GETTER_RETURN_TYPE_SHOULD_BE_NULLABLE) { firDiagnostic ->
|
||||||
|
NativeGetterReturnTypeShouldBeNullableImpl(
|
||||||
|
firDiagnostic as KtPsiDiagnostic,
|
||||||
|
token,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
add(FirJsErrors.NATIVE_SETTER_WRONG_RETURN_TYPE) { firDiagnostic ->
|
||||||
|
NativeSetterWrongReturnTypeImpl(
|
||||||
|
firDiagnostic as KtPsiDiagnostic,
|
||||||
|
token,
|
||||||
|
)
|
||||||
|
}
|
||||||
add(FirErrors.OPT_IN_USAGE) { firDiagnostic ->
|
add(FirErrors.OPT_IN_USAGE) { firDiagnostic ->
|
||||||
OptInUsageImpl(
|
OptInUsageImpl(
|
||||||
firDiagnostic.a,
|
firDiagnostic.a,
|
||||||
|
|||||||
+29
@@ -732,6 +732,35 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
|||||||
override val diagnosticClass get() = RuntimeAnnotationOnExternalDeclaration::class
|
override val diagnosticClass get() = RuntimeAnnotationOnExternalDeclaration::class
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract class NativeAnnotationsAllowedOnlyOnMemberOrExtensionFun : KtFirDiagnostic<KtElement>() {
|
||||||
|
override val diagnosticClass get() = NativeAnnotationsAllowedOnlyOnMemberOrExtensionFun::class
|
||||||
|
abstract val type: KtType
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class NativeIndexerKeyShouldBeStringOrNumber : KtFirDiagnostic<KtElement>() {
|
||||||
|
override val diagnosticClass get() = NativeIndexerKeyShouldBeStringOrNumber::class
|
||||||
|
abstract val kind: String
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class NativeIndexerWrongParameterCount : KtFirDiagnostic<KtElement>() {
|
||||||
|
override val diagnosticClass get() = NativeIndexerWrongParameterCount::class
|
||||||
|
abstract val parametersCount: Int
|
||||||
|
abstract val kind: String
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class NativeIndexerCanNotHaveDefaultArguments : KtFirDiagnostic<KtElement>() {
|
||||||
|
override val diagnosticClass get() = NativeIndexerCanNotHaveDefaultArguments::class
|
||||||
|
abstract val kind: String
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class NativeGetterReturnTypeShouldBeNullable : KtFirDiagnostic<KtDeclaration>() {
|
||||||
|
override val diagnosticClass get() = NativeGetterReturnTypeShouldBeNullable::class
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class NativeSetterWrongReturnType : KtFirDiagnostic<KtDeclaration>() {
|
||||||
|
override val diagnosticClass get() = NativeSetterWrongReturnType::class
|
||||||
|
}
|
||||||
|
|
||||||
abstract class OptInUsage : KtFirDiagnostic<PsiElement>() {
|
abstract class OptInUsage : KtFirDiagnostic<PsiElement>() {
|
||||||
override val diagnosticClass get() = OptInUsage::class
|
override val diagnosticClass get() = OptInUsage::class
|
||||||
abstract val optInMarkerFqName: FqName
|
abstract val optInMarkerFqName: FqName
|
||||||
|
|||||||
+35
@@ -880,6 +880,41 @@ internal class RuntimeAnnotationOnExternalDeclarationImpl(
|
|||||||
override val token: KtLifetimeToken,
|
override val token: KtLifetimeToken,
|
||||||
) : KtFirDiagnostic.RuntimeAnnotationOnExternalDeclaration(), KtAbstractFirDiagnostic<PsiElement>
|
) : KtFirDiagnostic.RuntimeAnnotationOnExternalDeclaration(), KtAbstractFirDiagnostic<PsiElement>
|
||||||
|
|
||||||
|
internal class NativeAnnotationsAllowedOnlyOnMemberOrExtensionFunImpl(
|
||||||
|
override val type: KtType,
|
||||||
|
override val firDiagnostic: KtPsiDiagnostic,
|
||||||
|
override val token: KtLifetimeToken,
|
||||||
|
) : KtFirDiagnostic.NativeAnnotationsAllowedOnlyOnMemberOrExtensionFun(), KtAbstractFirDiagnostic<KtElement>
|
||||||
|
|
||||||
|
internal class NativeIndexerKeyShouldBeStringOrNumberImpl(
|
||||||
|
override val kind: String,
|
||||||
|
override val firDiagnostic: KtPsiDiagnostic,
|
||||||
|
override val token: KtLifetimeToken,
|
||||||
|
) : KtFirDiagnostic.NativeIndexerKeyShouldBeStringOrNumber(), KtAbstractFirDiagnostic<KtElement>
|
||||||
|
|
||||||
|
internal class NativeIndexerWrongParameterCountImpl(
|
||||||
|
override val parametersCount: Int,
|
||||||
|
override val kind: String,
|
||||||
|
override val firDiagnostic: KtPsiDiagnostic,
|
||||||
|
override val token: KtLifetimeToken,
|
||||||
|
) : KtFirDiagnostic.NativeIndexerWrongParameterCount(), KtAbstractFirDiagnostic<KtElement>
|
||||||
|
|
||||||
|
internal class NativeIndexerCanNotHaveDefaultArgumentsImpl(
|
||||||
|
override val kind: String,
|
||||||
|
override val firDiagnostic: KtPsiDiagnostic,
|
||||||
|
override val token: KtLifetimeToken,
|
||||||
|
) : KtFirDiagnostic.NativeIndexerCanNotHaveDefaultArguments(), KtAbstractFirDiagnostic<KtElement>
|
||||||
|
|
||||||
|
internal class NativeGetterReturnTypeShouldBeNullableImpl(
|
||||||
|
override val firDiagnostic: KtPsiDiagnostic,
|
||||||
|
override val token: KtLifetimeToken,
|
||||||
|
) : KtFirDiagnostic.NativeGetterReturnTypeShouldBeNullable(), KtAbstractFirDiagnostic<KtDeclaration>
|
||||||
|
|
||||||
|
internal class NativeSetterWrongReturnTypeImpl(
|
||||||
|
override val firDiagnostic: KtPsiDiagnostic,
|
||||||
|
override val token: KtLifetimeToken,
|
||||||
|
) : KtFirDiagnostic.NativeSetterWrongReturnType(), KtAbstractFirDiagnostic<KtDeclaration>
|
||||||
|
|
||||||
internal class OptInUsageImpl(
|
internal class OptInUsageImpl(
|
||||||
override val optInMarkerFqName: FqName,
|
override val optInMarkerFqName: FqName,
|
||||||
override val message: String,
|
override val message: String,
|
||||||
|
|||||||
+16
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.fir.checkers.generator.diagnostics.model.DiagnosticL
|
|||||||
import org.jetbrains.kotlin.fir.checkers.generator.diagnostics.model.PositioningStrategy
|
import org.jetbrains.kotlin.fir.checkers.generator.diagnostics.model.PositioningStrategy
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
|
|
||||||
@Suppress("UNUSED_VARIABLE", "LocalVariableName", "ClassName", "unused")
|
@Suppress("UNUSED_VARIABLE", "LocalVariableName", "ClassName", "unused")
|
||||||
@@ -23,6 +24,21 @@ object JS_DIAGNOSTICS_LIST : DiagnosticList("FirJsErrors") {
|
|||||||
val NESTED_JS_MODULE_PROHIBITED by error<KtElement>(PositioningStrategy.DECLARATION_SIGNATURE_OR_DEFAULT)
|
val NESTED_JS_MODULE_PROHIBITED by error<KtElement>(PositioningStrategy.DECLARATION_SIGNATURE_OR_DEFAULT)
|
||||||
val RUNTIME_ANNOTATION_NOT_SUPPORTED by warning<PsiElement>(PositioningStrategy.DECLARATION_SIGNATURE_OR_DEFAULT)
|
val RUNTIME_ANNOTATION_NOT_SUPPORTED by warning<PsiElement>(PositioningStrategy.DECLARATION_SIGNATURE_OR_DEFAULT)
|
||||||
val RUNTIME_ANNOTATION_ON_EXTERNAL_DECLARATION by error<PsiElement>(PositioningStrategy.DECLARATION_SIGNATURE_OR_DEFAULT)
|
val RUNTIME_ANNOTATION_ON_EXTERNAL_DECLARATION by error<PsiElement>(PositioningStrategy.DECLARATION_SIGNATURE_OR_DEFAULT)
|
||||||
|
val NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN by error<KtElement>(PositioningStrategy.DECLARATION_SIGNATURE_OR_DEFAULT) {
|
||||||
|
parameter<ConeKotlinType>("type")
|
||||||
|
}
|
||||||
|
val NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER by error<KtElement>(PositioningStrategy.DECLARATION_SIGNATURE_OR_DEFAULT) {
|
||||||
|
parameter<String>("kind")
|
||||||
|
}
|
||||||
|
val NATIVE_INDEXER_WRONG_PARAMETER_COUNT by error<KtElement>(PositioningStrategy.DECLARATION_SIGNATURE_OR_DEFAULT) {
|
||||||
|
parameter<Int>("parametersCount")
|
||||||
|
parameter<String>("kind")
|
||||||
|
}
|
||||||
|
val NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS by error<KtElement>(PositioningStrategy.DECLARATION_SIGNATURE_OR_DEFAULT) {
|
||||||
|
parameter<String>("kind")
|
||||||
|
}
|
||||||
|
val NATIVE_GETTER_RETURN_TYPE_SHOULD_BE_NULLABLE by error<KtDeclaration>(PositioningStrategy.DECLARATION_RETURN_TYPE)
|
||||||
|
val NATIVE_SETTER_WRONG_RETURN_TYPE by error<KtDeclaration>(PositioningStrategy.DECLARATION_RETURN_TYPE)
|
||||||
}
|
}
|
||||||
|
|
||||||
val SUPERTYPES by object : DiagnosticGroup("Supertypes") {
|
val SUPERTYPES by object : DiagnosticGroup("Supertypes") {
|
||||||
|
|||||||
+7
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.diagnostics.rendering.RootDiagnosticRendererFactory
|
|||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.*
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.*
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||||
import org.jetbrains.kotlin.psi.KtAnonymousInitializer
|
import org.jetbrains.kotlin.psi.KtAnonymousInitializer
|
||||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||||
@@ -32,6 +33,12 @@ object FirJsErrors {
|
|||||||
val NESTED_JS_MODULE_PROHIBITED by error0<KtElement>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
val NESTED_JS_MODULE_PROHIBITED by error0<KtElement>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
||||||
val RUNTIME_ANNOTATION_NOT_SUPPORTED by warning0<PsiElement>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
val RUNTIME_ANNOTATION_NOT_SUPPORTED by warning0<PsiElement>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
||||||
val RUNTIME_ANNOTATION_ON_EXTERNAL_DECLARATION by error0<PsiElement>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
val RUNTIME_ANNOTATION_ON_EXTERNAL_DECLARATION by error0<PsiElement>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
||||||
|
val NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN by error1<KtElement, ConeKotlinType>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
||||||
|
val NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER by error1<KtElement, String>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
||||||
|
val NATIVE_INDEXER_WRONG_PARAMETER_COUNT by error2<KtElement, Int, String>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
||||||
|
val NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS by error1<KtElement, String>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
||||||
|
val NATIVE_GETTER_RETURN_TYPE_SHOULD_BE_NULLABLE by error0<KtDeclaration>(SourceElementPositioningStrategies.DECLARATION_RETURN_TYPE)
|
||||||
|
val NATIVE_SETTER_WRONG_RETURN_TYPE by error0<KtDeclaration>(SourceElementPositioningStrategies.DECLARATION_RETURN_TYPE)
|
||||||
|
|
||||||
// Supertypes
|
// Supertypes
|
||||||
val WRONG_MULTIPLE_INHERITANCE by error1<KtElement, FirCallableSymbol<*>>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
val WRONG_MULTIPLE_INHERITANCE by error1<KtElement, FirCallableSymbol<*>>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
||||||
|
|||||||
+28
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.fir.analysis.diagnostics.js
|
package org.jetbrains.kotlin.fir.analysis.diagnostics.js
|
||||||
|
|
||||||
import org.jetbrains.kotlin.diagnostics.KtDiagnosticFactoryToRendererMap
|
import org.jetbrains.kotlin.diagnostics.KtDiagnosticFactoryToRendererMap
|
||||||
|
import org.jetbrains.kotlin.diagnostics.KtDiagnosticRenderers
|
||||||
import org.jetbrains.kotlin.diagnostics.rendering.BaseDiagnosticRendererFactory
|
import org.jetbrains.kotlin.diagnostics.rendering.BaseDiagnosticRendererFactory
|
||||||
import org.jetbrains.kotlin.diagnostics.rendering.CommonRenderers
|
import org.jetbrains.kotlin.diagnostics.rendering.CommonRenderers
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers
|
||||||
@@ -26,6 +27,12 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.INLINE_EXTER
|
|||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.JS_MODULE_PROHIBITED_ON_NON_NATIVE
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.JS_MODULE_PROHIBITED_ON_NON_NATIVE
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.JS_MODULE_PROHIBITED_ON_VAR
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.JS_MODULE_PROHIBITED_ON_VAR
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.NESTED_JS_MODULE_PROHIBITED
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.NESTED_JS_MODULE_PROHIBITED
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.NATIVE_GETTER_RETURN_TYPE_SHOULD_BE_NULLABLE
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.NATIVE_INDEXER_WRONG_PARAMETER_COUNT
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.NATIVE_SETTER_WRONG_RETURN_TYPE
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.NESTED_CLASS_IN_EXTERNAL_INTERFACE
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.NESTED_CLASS_IN_EXTERNAL_INTERFACE
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.NESTED_EXTERNAL_DECLARATION
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.NESTED_EXTERNAL_DECLARATION
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.NON_ABSTRACT_MEMBER_OF_EXTERNAL_INTERFACE
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.NON_ABSTRACT_MEMBER_OF_EXTERNAL_INTERFACE
|
||||||
@@ -101,6 +108,27 @@ object FirJsErrorsDefaultMessages : BaseDiagnosticRendererFactory() {
|
|||||||
NON_ABSTRACT_MEMBER_OF_EXTERNAL_INTERFACE,
|
NON_ABSTRACT_MEMBER_OF_EXTERNAL_INTERFACE,
|
||||||
"Only nullable properties of external interfaces are allowed to be non-abstract"
|
"Only nullable properties of external interfaces are allowed to be non-abstract"
|
||||||
)
|
)
|
||||||
|
map.put(
|
||||||
|
NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN,
|
||||||
|
"Annotation ''{0}'' is allowed only on member functions of declaration annotated as ''kotlin.js.native'' or on toplevel extension functions",
|
||||||
|
FirDiagnosticRenderers.RENDER_TYPE
|
||||||
|
)
|
||||||
|
map.put(
|
||||||
|
NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER,
|
||||||
|
"Native {0}''s first parameter type should be ''kotlin.String'' or subtype of ''kotlin.Number''",
|
||||||
|
CommonRenderers.STRING
|
||||||
|
)
|
||||||
|
map.put(NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS, "Native {0}''s parameter can not have default value", CommonRenderers.STRING)
|
||||||
|
map.put(NATIVE_GETTER_RETURN_TYPE_SHOULD_BE_NULLABLE, "Native getter's return type should be nullable")
|
||||||
|
map.put(
|
||||||
|
NATIVE_SETTER_WRONG_RETURN_TYPE,
|
||||||
|
"Native setter's return type should be 'Unit' or a supertype of the second parameter's type"
|
||||||
|
)
|
||||||
|
map.put(
|
||||||
|
NATIVE_INDEXER_WRONG_PARAMETER_COUNT, "Expected {0} parameters for native {1}",
|
||||||
|
KtDiagnosticRenderers.TO_STRING,
|
||||||
|
CommonRenderers.STRING
|
||||||
|
)
|
||||||
|
|
||||||
map.checkMissingMessages(FirJsErrors)
|
map.checkMissingMessages(FirJsErrors)
|
||||||
}
|
}
|
||||||
|
|||||||
+7
@@ -33,4 +33,11 @@ object JsDeclarationCheckers : DeclarationCheckers() {
|
|||||||
FirJsDynamicDeclarationChecker,
|
FirJsDynamicDeclarationChecker,
|
||||||
FirJsInheritanceClassChecker,
|
FirJsInheritanceClassChecker,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
override val simpleFunctionCheckers: Set<FirSimpleFunctionChecker>
|
||||||
|
get() = setOf(
|
||||||
|
FirJsNativeInvokeChecker,
|
||||||
|
FirJsNativeGetterChecker,
|
||||||
|
FirJsNativeSetterChecker,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+132
@@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.fir.analysis.js.checkers.declaration
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||||
|
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
||||||
|
import org.jetbrains.kotlin.diagnostics.reportOn
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.checkers.declaration.FirSimpleFunctionChecker
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.js.checkers.isNativeObject
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.checkers.isTopLevel
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirFunction
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.hasAnnotation
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.utils.isExtension
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.utils.visibility
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.classId
|
||||||
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
|
import org.jetbrains.kotlin.name.ClassId
|
||||||
|
import org.jetbrains.kotlin.name.JsStandardClassIds
|
||||||
|
|
||||||
|
internal abstract class FirJsAbstractNativeAnnotationChecker(private val requiredAnnotation: ClassId) : FirSimpleFunctionChecker() {
|
||||||
|
protected fun FirFunction.hasRequiredAnnotation(context: CheckerContext) = hasAnnotation(requiredAnnotation, context.session)
|
||||||
|
|
||||||
|
override fun check(declaration: FirSimpleFunction, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||||
|
val annotation = declaration.annotations.find { it.classId == requiredAnnotation } ?: return
|
||||||
|
|
||||||
|
val isMember = !context.isTopLevel && declaration.visibility != Visibilities.Local
|
||||||
|
val isExtension = declaration.isExtension
|
||||||
|
|
||||||
|
if (isMember && (isExtension || !declaration.symbol.isNativeObject(context)) || !isMember && !isExtension) {
|
||||||
|
reporter.reportOn(
|
||||||
|
declaration.source,
|
||||||
|
FirJsErrors.NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN,
|
||||||
|
annotation.typeRef.coneType,
|
||||||
|
context
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal object FirJsNativeInvokeChecker : FirJsAbstractNativeAnnotationChecker(JsStandardClassIds.Annotations.JsNativeInvoke)
|
||||||
|
|
||||||
|
internal abstract class FirJsAbstractNativeIndexerChecker(
|
||||||
|
requiredAnnotation: ClassId,
|
||||||
|
private val indexerKind: String,
|
||||||
|
private val requiredParametersCount: Int,
|
||||||
|
) : FirJsAbstractNativeAnnotationChecker(requiredAnnotation) {
|
||||||
|
override fun check(declaration: FirSimpleFunction, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||||
|
super.check(declaration, context, reporter)
|
||||||
|
|
||||||
|
val parameters = declaration.valueParameters
|
||||||
|
val builtIns = context.session.builtinTypes
|
||||||
|
|
||||||
|
if (parameters.isNotEmpty()) {
|
||||||
|
val firstParameterDeclaration = parameters.first()
|
||||||
|
val firstParameter = firstParameterDeclaration.returnTypeRef.coneType
|
||||||
|
|
||||||
|
if (
|
||||||
|
firstParameter !is ConeErrorType &&
|
||||||
|
!firstParameter.isString &&
|
||||||
|
!firstParameter.isSubtypeOf(builtIns.numberType.coneType, context.session)
|
||||||
|
) {
|
||||||
|
reporter.reportOn(
|
||||||
|
firstParameterDeclaration.source,
|
||||||
|
FirJsErrors.NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER,
|
||||||
|
indexerKind,
|
||||||
|
context
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parameters.size != requiredParametersCount) {
|
||||||
|
reporter.reportOn(
|
||||||
|
declaration.source,
|
||||||
|
FirJsErrors.NATIVE_INDEXER_WRONG_PARAMETER_COUNT,
|
||||||
|
requiredParametersCount,
|
||||||
|
indexerKind,
|
||||||
|
context
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (parameter in parameters) {
|
||||||
|
if (parameter.defaultValue != null) {
|
||||||
|
reporter.reportOn(
|
||||||
|
parameter.source,
|
||||||
|
FirJsErrors.NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS,
|
||||||
|
indexerKind,
|
||||||
|
context
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal object FirJsNativeGetterChecker : FirJsAbstractNativeIndexerChecker(JsStandardClassIds.Annotations.JsNativeGetter, "getter", 1) {
|
||||||
|
override fun check(declaration: FirSimpleFunction, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||||
|
if (!declaration.hasRequiredAnnotation(context)) return
|
||||||
|
super.check(declaration, context, reporter)
|
||||||
|
|
||||||
|
if (!declaration.returnTypeRef.coneType.isNullable) {
|
||||||
|
reporter.reportOn(declaration.source, FirJsErrors.NATIVE_GETTER_RETURN_TYPE_SHOULD_BE_NULLABLE, context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal object FirJsNativeSetterChecker : FirJsAbstractNativeIndexerChecker(JsStandardClassIds.Annotations.JsNativeSetter, "setter", 2) {
|
||||||
|
override fun check(declaration: FirSimpleFunction, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||||
|
if (!declaration.hasRequiredAnnotation(context)) return
|
||||||
|
super.check(declaration, context, reporter)
|
||||||
|
|
||||||
|
val returnType = declaration.returnTypeRef.coneType
|
||||||
|
if (returnType.isUnit) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (declaration.valueParameters.size < 2) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val secondParameterType = declaration.valueParameters[1].returnTypeRef.coneType
|
||||||
|
if (secondParameterType.isSubtypeOf(returnType, context.session)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
reporter.reportOn(declaration.source, FirJsErrors.NATIVE_SETTER_WRONG_RETURN_TYPE, context)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -59,6 +59,7 @@ class BuiltinTypes {
|
|||||||
val enumType: FirImplicitBuiltinTypeRef = FirImplicitEnumTypeRef(null)
|
val enumType: FirImplicitBuiltinTypeRef = FirImplicitEnumTypeRef(null)
|
||||||
val annotationType: FirImplicitBuiltinTypeRef = FirImplicitAnnotationTypeRef(null)
|
val annotationType: FirImplicitBuiltinTypeRef = FirImplicitAnnotationTypeRef(null)
|
||||||
val booleanType: FirImplicitBuiltinTypeRef = FirImplicitBooleanTypeRef(null)
|
val booleanType: FirImplicitBuiltinTypeRef = FirImplicitBooleanTypeRef(null)
|
||||||
|
val numberType: FirImplicitBuiltinTypeRef = FirImplicitNumberTypeRef(null)
|
||||||
val byteType: FirImplicitBuiltinTypeRef = FirImplicitByteTypeRef(null)
|
val byteType: FirImplicitBuiltinTypeRef = FirImplicitByteTypeRef(null)
|
||||||
val shortType: FirImplicitBuiltinTypeRef = FirImplicitShortTypeRef(null)
|
val shortType: FirImplicitBuiltinTypeRef = FirImplicitShortTypeRef(null)
|
||||||
val intType: FirImplicitBuiltinTypeRef = FirImplicitIntTypeRef(null)
|
val intType: FirImplicitBuiltinTypeRef = FirImplicitIntTypeRef(null)
|
||||||
|
|||||||
@@ -76,6 +76,10 @@ class FirImplicitBooleanTypeRef(
|
|||||||
source: KtSourceElement?
|
source: KtSourceElement?
|
||||||
) : FirImplicitBuiltinTypeRef(source, StandardClassIds.Boolean)
|
) : FirImplicitBuiltinTypeRef(source, StandardClassIds.Boolean)
|
||||||
|
|
||||||
|
class FirImplicitNumberTypeRef(
|
||||||
|
source: KtSourceElement?
|
||||||
|
) : FirImplicitBuiltinTypeRef(source, StandardClassIds.Number)
|
||||||
|
|
||||||
class FirImplicitByteTypeRef(
|
class FirImplicitByteTypeRef(
|
||||||
source: KtSourceElement?
|
source: KtSourceElement?
|
||||||
) : FirImplicitBuiltinTypeRef(source, StandardClassIds.Byte)
|
) : FirImplicitBuiltinTypeRef(source, StandardClassIds.Byte)
|
||||||
@@ -194,6 +198,7 @@ fun FirImplicitBuiltinTypeRef.withNewSource(newSource: KtSourceElement?): FirImp
|
|||||||
is FirImplicitAnnotationTypeRef -> FirImplicitAnnotationTypeRef(newSource)
|
is FirImplicitAnnotationTypeRef -> FirImplicitAnnotationTypeRef(newSource)
|
||||||
is FirImplicitBooleanTypeRef -> FirImplicitBooleanTypeRef(newSource)
|
is FirImplicitBooleanTypeRef -> FirImplicitBooleanTypeRef(newSource)
|
||||||
is FirImplicitByteTypeRef -> FirImplicitByteTypeRef(newSource)
|
is FirImplicitByteTypeRef -> FirImplicitByteTypeRef(newSource)
|
||||||
|
is FirImplicitNumberTypeRef -> FirImplicitNumberTypeRef(newSource)
|
||||||
is FirImplicitShortTypeRef -> FirImplicitShortTypeRef(newSource)
|
is FirImplicitShortTypeRef -> FirImplicitShortTypeRef(newSource)
|
||||||
is FirImplicitIntTypeRef -> FirImplicitIntTypeRef(newSource)
|
is FirImplicitIntTypeRef -> FirImplicitIntTypeRef(newSource)
|
||||||
is FirImplicitLongTypeRef -> FirImplicitLongTypeRef(newSource)
|
is FirImplicitLongTypeRef -> FirImplicitLongTypeRef(newSource)
|
||||||
|
|||||||
Vendored
-24
@@ -1,24 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
|
||||||
|
|
||||||
fun foo() {
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get(a: String): Int? = 1
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get2(a: Number): String? = "OK"
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get3(a: Int): String? = "OK"
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get(a: Any): Int? = 1
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get2(): String? = "OK"
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get3(a: Any, b: Int, c: Any?): String? = "OK"
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Any.foo(a: Int = 1): Any? = "OK"
|
|
||||||
}
|
|
||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
|
|||||||
-45
@@ -1,45 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
|
||||||
|
|
||||||
fun foo() {
|
|
||||||
class A {
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: String): Any? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun take(a: Number): String? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Double): String? = null
|
|
||||||
}
|
|
||||||
|
|
||||||
class B {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
val foo = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
class C {
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get(a: String): Int? = 1
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get2(a: Number): String? = "OK"
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get3(a: Int): String? = "OK"
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun get(): Any? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: A): Any? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Int) {}
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun bar(a: String): Int = 0
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun baz(a: Int = 0): Int? = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
|
|||||||
Vendored
-12
@@ -1,12 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
|
||||||
|
|
||||||
fun foo() {
|
|
||||||
@nativeGetter
|
|
||||||
fun toplevelFun(): Any = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
val toplevelVal = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
class Foo {}
|
|
||||||
}
|
|
||||||
Vendored
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
@@ -9,4 +10,4 @@ fun foo() {
|
|||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
||||||
class Foo {}
|
class Foo {}
|
||||||
}
|
}
|
||||||
Vendored
-57
@@ -1,57 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
|
||||||
|
|
||||||
external class A {
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: String): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun take(a: Number): String? = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Double): String? = definedExternally
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: String): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun take(a: Number): String? = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Double): String? = definedExternally
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
external class B {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
val foo: Int = definedExternally
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
object Obj1 {}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
val foo: Int = definedExternally
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
object Obj2 {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
external class C {
|
|
||||||
@nativeGetter
|
|
||||||
fun get(): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: A): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Int) { definedExternally }
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun bar(a: String): Int = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun baz(a: String = definedExternally): Int? = definedExternally
|
|
||||||
|
|
||||||
}
|
|
||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||||
|
|
||||||
external class A {
|
external class A {
|
||||||
|
|||||||
-77
@@ -1,77 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
|
||||||
|
|
||||||
external class A {
|
|
||||||
class B {
|
|
||||||
class A {
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: String): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun take(a: Number): String? = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Double): String? = definedExternally
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: String): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun take(a: Number): String? = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Double): String? = definedExternally
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class B {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
val foo: Int = definedExternally
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
object Obj1 {}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
val foo: Int = definedExternally
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
object Obj2 {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class C {
|
|
||||||
@nativeGetter
|
|
||||||
fun get(): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: A): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Int) { definedExternally }
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun bar(a: String): Int = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun baz(a: Number = definedExternally): Int? = definedExternally
|
|
||||||
}
|
|
||||||
|
|
||||||
object obj {
|
|
||||||
@nativeGetter
|
|
||||||
fun get(): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: A): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Int) { definedExternally }
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun bar(a: String): Int = definedExternally
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun baz(a: String = definedExternally): Int? = definedExternally
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||||
|
|
||||||
external class A {
|
external class A {
|
||||||
|
|||||||
-112
@@ -1,112 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
|
||||||
|
|
||||||
class A {
|
|
||||||
class B {
|
|
||||||
class A {
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: String): Any? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun take(a: Number): String? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Double): String? = null
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: String): Any? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun take(a: Number): String? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Double): String? = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class B {
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get(a: String): Int? = 1
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get2(a: Number): String? = "OK"
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get3(a: Int): String? = "OK"
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
val foo = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
object Obj1 {}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
val foo = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
object Obj2 {}
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get(a: String): Int? = 1
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get2(a: Number): String? = "OK"
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get3(a: Int): String? = "OK"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class C {
|
|
||||||
@nativeGetter
|
|
||||||
fun get(): Any? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: A): Any? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Int) {}
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun bar(a: String): Int = 0
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun baz(a: String = "foo"): Int? = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
object obj {
|
|
||||||
@nativeGetter
|
|
||||||
fun get(): Any? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: A): Any? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Int) {}
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun bar(a: String): Int = 0
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun baz(a: Double = 0.0): Int? = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
val anonymous = object {
|
|
||||||
@nativeGetter
|
|
||||||
fun get(): Any? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: A): Any? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Int) {}
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun bar(a: String): Int = 0
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun baz(a: String = "foo"): Int? = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
|
|||||||
Vendored
-65
@@ -1,65 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
|
||||||
|
|
||||||
class A {
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: String): Any? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun take(a: Number): String? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Double): String? = null
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: String): Any? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun take(a: Number): String? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Double): String? = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class B {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
val foo = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
object Obj1 {}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
val foo = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
object Obj2 {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class C {
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get(a: String): Int? = 1
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get2(a: Number): String? = "OK"
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get3(a: Int): String? = "OK"
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun get(): Any? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun get(a: A): Any? = null
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun foo(a: Int) {}
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun bar(a: String): Int = 0
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun baz(a: String = "foo"): Int? = 0
|
|
||||||
}
|
|
||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
|
|||||||
Vendored
-22
@@ -1,22 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get(a: String): Int? = 1
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get2(a: Number): String? = "OK"
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get3(a: Int): String? = "OK"
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.baz(a: Int = 0): String? = "OK"
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get(a: Any): Int? = 1
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get2(): String? = "OK"
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun Int.get3(a: Any, b: Int, c: Any?): String? = "OK"
|
|
||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||||
|
|
||||||
@nativeGetter
|
@nativeGetter
|
||||||
|
|||||||
-10
@@ -1,10 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
|
||||||
|
|
||||||
@nativeGetter
|
|
||||||
fun toplevelFun(): Any = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
val toplevelVal = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
|
|
||||||
class Foo {}
|
|
||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||||
|
|
||||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeGetter
|
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeGetter
|
||||||
|
|||||||
-25
@@ -1,25 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
|
||||||
|
|
||||||
fun foo() {
|
|
||||||
class A {
|
|
||||||
@nativeInvoke
|
|
||||||
fun foo() {}
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun invoke(a: String): Int = 0
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun Int.ext() = 1
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun Int.invoke(a: String, b: Int) = "OK"
|
|
||||||
|
|
||||||
val anonymous = object {
|
|
||||||
@nativeInvoke
|
|
||||||
fun foo() {}
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun invoke(a: String): Int = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
@@ -22,4 +23,4 @@ fun foo() {
|
|||||||
fun invoke(a: String): Int<!> = 0
|
fun invoke(a: String): Int<!> = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vendored
-12
@@ -1,12 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
|
||||||
|
|
||||||
fun foo() {
|
|
||||||
@nativeInvoke
|
|
||||||
fun toplevelFun() {}
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
|
|
||||||
val toplevelVal = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
|
|
||||||
class Foo {}
|
|
||||||
}
|
|
||||||
Vendored
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
@@ -9,4 +10,4 @@ fun foo() {
|
|||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
|
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
|
||||||
class Foo {}
|
class Foo {}
|
||||||
}
|
}
|
||||||
-43
@@ -1,43 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
|
||||||
|
|
||||||
class A {
|
|
||||||
class B {
|
|
||||||
class C {
|
|
||||||
@nativeInvoke
|
|
||||||
fun foo() {}
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun invoke(a: String): Int = 0
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun Int.ext() = 1
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun Int.invoke(a: String, b: Int) = "OK"
|
|
||||||
}
|
|
||||||
|
|
||||||
object obj {
|
|
||||||
@nativeInvoke
|
|
||||||
fun foo() {}
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun invoke(a: String): Int = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@nativeInvoke
|
|
||||||
fun foo() {}
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun invoke(a: String): Int = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
val anonymous = object {
|
|
||||||
@nativeInvoke
|
|
||||||
fun foo() {}
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun invoke(a: String): Int = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
@@ -40,4 +41,4 @@ class A {
|
|||||||
fun invoke(a: String): Int<!> = 0
|
fun invoke(a: String): Int<!> = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vendored
-35
@@ -1,35 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
|
||||||
|
|
||||||
class A {
|
|
||||||
@nativeInvoke
|
|
||||||
fun foo() {}
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun invoke(a: String): Int = 0
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun Int.ext() = 1
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun Int.invoke(a: String, b: Int) = "OK"
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
|
|
||||||
val baz = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
|
|
||||||
object Obj {}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@nativeInvoke
|
|
||||||
fun foo() {}
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun invoke(a: String): Int = 0
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun Int.ext() = 1
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun Int.invoke(a: String, b: Int) = "OK"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
|
|||||||
-10
@@ -1,10 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
|
||||||
|
|
||||||
@nativeInvoke
|
|
||||||
fun toplevelFun() {}
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
|
|
||||||
val toplevelVal = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
|
|
||||||
class Foo {}
|
|
||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||||
|
|
||||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
|
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
|
||||||
|
|||||||
Vendored
-33
@@ -1,33 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
|
||||||
|
|
||||||
fun foo() {
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set(a: String, v: Int) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set2(a: Number, v: String?): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set3(a: Double, v: String) = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set4(a: Double, v: String): Any = 1
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set5(a: Double, v: String): CharSequence = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set6(a: Double, v: String): Number = 1
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set(a: Any): Int? = 1
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set2(): String? = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set3(a: Any, b: Int, c: Any?) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Any.foo(a: Double = 0.0, v: String? = null) = "OK"
|
|
||||||
}
|
|
||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
|
|||||||
-45
@@ -1,45 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
|
||||||
|
|
||||||
fun foo() {
|
|
||||||
class A {
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any?): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun put(a: Number, v: String) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Int, v: String) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
class B {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
var foo = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
class C {
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set(a: String, v: Int) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set2(a: Number, v: String?) = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set3(a: Double, v: String?) = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any, v2: Any) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A, v: Any?) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Int = 0, v: String) = "OK"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
@@ -42,4 +43,4 @@ fun foo() {
|
|||||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
|
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
|
||||||
fun foo(<!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>a: Int = 0<!>, v: String)<!> = "OK"
|
fun foo(<!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>a: Int = 0<!>, v: String)<!> = "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vendored
-12
@@ -1,12 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
|
||||||
|
|
||||||
fun foo() {
|
|
||||||
@nativeSetter
|
|
||||||
fun toplevelFun(): Any = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
val toplevelVal = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
class Foo {}
|
|
||||||
}
|
|
||||||
Vendored
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
@@ -9,4 +10,4 @@ fun foo() {
|
|||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
||||||
class Foo {}
|
class Foo {}
|
||||||
}
|
}
|
||||||
Vendored
-71
@@ -1,71 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
|
||||||
|
|
||||||
external class A {
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any?): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun put(a: Number, v: String) { definedExternally }
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Int, v: String) { definedExternally }
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set4(a: Double, v: String): Any = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set5(a: Double, v: String): CharSequence = definedExternally
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any?): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun put(a: Number, v: String) { definedExternally }
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Int, v: String) { definedExternally }
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set4(a: Double, v: String): Any = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set5(a: Double, v: String): CharSequence = definedExternally
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
external class B {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
val foo: Int = definedExternally
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
object Obj1 {}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
val foo: Int = definedExternally
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
object Obj2 {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
external class C {
|
|
||||||
@nativeSetter
|
|
||||||
fun set6(a: Double, v: String): Number = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any, v2: Any) { definedExternally }
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A, v: Any?) { definedExternally }
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Number, v: String = definedExternally): String = definedExternally
|
|
||||||
}
|
|
||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||||
|
|
||||||
external class A {
|
external class A {
|
||||||
|
|||||||
-92
@@ -1,92 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
|
||||||
|
|
||||||
external class A {
|
|
||||||
class B {
|
|
||||||
class A {
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any?): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun put(a: Number, v: String) { definedExternally }
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Int, v: String) { definedExternally }
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set4(a: Double, v: String): Any = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set5(a: Double, v: String): CharSequence = definedExternally
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any?): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun put(a: Number, v: String) { definedExternally }
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Int, v: String) { definedExternally }
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set4(a: Double, v: String): Any = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set5(a: Double, v: String): CharSequence = definedExternally
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class B {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
val foo: Int = definedExternally
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
object Obj1 {}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
val foo: Int = definedExternally
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
object Obj2 {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class C {
|
|
||||||
@nativeSetter
|
|
||||||
fun set6(a: Double, v: String): Number = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any, v2: Any) { definedExternally }
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A, v: Any?) { definedExternally }
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Double = definedExternally, v: String = definedExternally): String = definedExternally
|
|
||||||
}
|
|
||||||
|
|
||||||
object obj {
|
|
||||||
@nativeSetter
|
|
||||||
fun set(): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A): Any? = definedExternally
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any, v2: Any) { definedExternally }
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A, v: Any?) { definedExternally }
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Int, v: String = definedExternally): String = definedExternally
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||||
|
|
||||||
external class A {
|
external class A {
|
||||||
|
|||||||
-130
@@ -1,130 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
|
||||||
|
|
||||||
class A {
|
|
||||||
class B {
|
|
||||||
class A {
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any?): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun put(a: Number, v: String) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Int, v: String) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set4(a: Double, v: String): Any = 1
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set5(a: Double, v: String): CharSequence = "OK"
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any?): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun put(a: Number, v: String) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Int, v: String) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class B {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
val foo = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
object Obj1 {}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
val foo = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
object Obj2 {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class C {
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set(a: String, v: Int) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set2(a: Number, v: String?) = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set3(a: Double, v: String?) = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set6(a: Double, v: String): Number = 1
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any, v2: Any) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A, v: Any?) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Double = 0.0, v: String = "str") = "OK"
|
|
||||||
}
|
|
||||||
|
|
||||||
object obj {
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set(a: String, v: Int) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set2(a: Number, v: String?) = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set3(a: Double, v: String?) = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any, v2: Any) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A, v: Any?) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Int, v: String = "str") = "OK"
|
|
||||||
}
|
|
||||||
|
|
||||||
val anonymous = object {
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set(a: String, v: Int) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set2(a: Number, v: String?) = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set3(a: Double, v: String?) = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any, v2: Any) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A, v: Any?) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Number = 0.0, v: String) = "OK"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
|
|||||||
Vendored
-65
@@ -1,65 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
|
||||||
|
|
||||||
class A {
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any?): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun put(a: Number, v: String) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Int, v: String) {}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any?): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun put(a: Number, v: String) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: Int, v: String) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class B {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
val foo = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
object Obj1 {}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
val foo = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
object Obj2 {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class C {
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set(a: String, v: Int) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set2(a: Number, v: String?) = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set3(a: Double, v: String?) = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: String, v: Any, v2: Any) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun set(a: A, v: Any?) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun foo(a: String = "0.0", v: String) = "OK"
|
|
||||||
}
|
|
||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
|
|||||||
Vendored
-31
@@ -1,31 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set(a: String, v: Int) {}
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set2(a: Number, v: String?): Any? = null
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set3(a: Double, v: String) = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set4(a: Double, v: String): Any = 1
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set5(a: Double, v: String): CharSequence = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set6(a: Double, v: String): Number = 1
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Any.foo(a: String = "0.0", v: String = "str") = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set(a: <!UNRESOLVED_REFERENCE!>A<!>): Int? = 1
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set2(): String? = "OK"
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun Int.set3(a: Any, b: Int, c: Any?) {}
|
|
||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||||
|
|
||||||
@nativeSetter
|
@nativeSetter
|
||||||
|
|||||||
-10
@@ -1,10 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
|
||||||
|
|
||||||
@nativeSetter
|
|
||||||
fun toplevelFun(): Any = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
val toplevelVal = 0
|
|
||||||
|
|
||||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
|
||||||
class Foo {}
|
|
||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||||
|
|
||||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
||||||
|
|||||||
Reference in New Issue
Block a user