Fix wrong "InlineProperties are unsupported at this language level" error on inline functions when inline properties are disabled
This commit is contained in:
@@ -98,6 +98,10 @@ object ModifierCheckerCore {
|
||||
INLINE_KEYWORD to LanguageFeature.InlineProperties
|
||||
)
|
||||
|
||||
val featureDependenciesTargets = mapOf(
|
||||
LanguageFeature.InlineProperties to setOf(PROPERTY, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||
)
|
||||
|
||||
// NOTE: deprecated targets must be possible!
|
||||
private val deprecatedTargetMap = mapOf<KtModifierKeywordToken, Set<KotlinTarget>>()
|
||||
|
||||
@@ -261,7 +265,8 @@ object ModifierCheckerCore {
|
||||
val dependency = featureDependencies[modifier] ?: return true
|
||||
|
||||
if (!languageFeatureSettings.supportsFeature(dependency)) {
|
||||
if (dependency == LanguageFeature.InlineProperties && actualTargets.size == 1 && actualTargets.contains(FUNCTION)) {
|
||||
val restrictedTargets = featureDependenciesTargets[dependency]
|
||||
if (restrictedTargets != null && actualTargets.intersect(restrictedTargets).isEmpty()) {
|
||||
return true
|
||||
}
|
||||
trace.report(Errors.UNSUPPORTED_FEATURE.on(node.psi, dependency))
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// !DIAGNOSTICS: -NOTHING_TO_INLINE
|
||||
// !LANGUAGE: -InlineProperties
|
||||
|
||||
inline fun String.test() {
|
||||
}
|
||||
|
||||
inline fun test() {
|
||||
}
|
||||
|
||||
class A {
|
||||
inline fun String.test() {
|
||||
}
|
||||
|
||||
inline fun test() {
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package
|
||||
|
||||
public inline fun test(): kotlin.Unit
|
||||
public inline fun kotlin.String.test(): kotlin.Unit
|
||||
|
||||
public final class A {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final inline fun test(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
public final inline fun kotlin.String.test(): kotlin.Unit
|
||||
}
|
||||
@@ -19077,6 +19077,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/sourceCompatibility"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionAlways.kt")
|
||||
public void testInlineFunctionAlways() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/sourceCompatibility/inlineFunctionAlways.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noDataClassInheritance.kt")
|
||||
public void testNoDataClassInheritance() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/sourceCompatibility/noDataClassInheritance.kt");
|
||||
|
||||
Reference in New Issue
Block a user