[JS, Frontend] Add option to allow extension lambdas in externals

This commit is contained in:
Ilya Goncharov
2021-06-10 19:31:54 +03:00
committed by TeamCityServer
parent 2a54f1c610
commit 83c1a119ee
2 changed files with 6 additions and 1 deletions
@@ -177,6 +177,8 @@ enum class LanguageFeature(
SamWrapperClassesAreSynthetic(KOTLIN_1_5, defaultState = State.ENABLED, kind = BUG_FIX),
StrictOnlyInputTypesChecks(KOTLIN_1_5),
JsEnableExtensionFunctionInExternals(KOTLIN_1_5, defaultState = State.DISABLED, kind = OTHER),
// Disabled until the breaking change is approved by the committee, see KT-10884.
PackagePrivateFileClassesWithAllPrivateMembers(KOTLIN_1_5, defaultState = State.DISABLED),
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.js.resolve.diagnostics
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.builtins.isExtensionFunctionType
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory0
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
@@ -119,7 +120,9 @@ object JsExternalChecker : DeclarationChecker {
}
reportOnParametersAndReturnTypesIf(ErrorsJs.INLINE_CLASS_IN_EXTERNAL_DECLARATION, KotlinType::isInlineClassType)
reportOnParametersAndReturnTypesIf(ErrorsJs.EXTENSION_FUNCTION_IN_EXTERNAL_DECLARATION, KotlinType::isExtensionFunctionType)
if (!context.languageVersionSettings.supportsFeature(LanguageFeature.JsEnableExtensionFunctionInExternals)) {
reportOnParametersAndReturnTypesIf(ErrorsJs.EXTENSION_FUNCTION_IN_EXTERNAL_DECLARATION, KotlinType::isExtensionFunctionType)
}
if (descriptor is CallableMemberDescriptor && descriptor.isNonAbstractMemberOfInterface() &&
!descriptor.isNullableProperty()