[SLC] Ignore callables with invalid or absent names (KTIJ-23584)

This commit is contained in:
Yan Zhulanow
2022-11-10 17:23:38 +09:00
committed by teamcity
parent 6fe989b4b4
commit e21226d02a
11 changed files with 68 additions and 85 deletions
@@ -193,9 +193,8 @@ internal fun SymbolLightClassBase.createMethods(
when (declaration) {
is KtFunctionSymbol -> {
// TODO: check if it has expect modifier
if (declaration.hasReifiedParameters ||
declaration.isHiddenOrSynthetic()
) return
if (declaration.hasReifiedParameters || declaration.isHiddenOrSynthetic()) return
if (declaration.name.isSpecial) return
result.add(
SymbolLightSimpleMethod(
@@ -272,6 +271,7 @@ internal fun SymbolLightClassBase.createPropertyAccessors(
) {
if (declaration is KtKotlinPropertySymbol && declaration.isConst) return
if (declaration.origin == KtSymbolOrigin.SOURCE_MEMBER_GENERATED) return
if (declaration.name.isSpecial) return
if (declaration.visibility.isPrivateOrPrivateToThis() &&
declaration.getter?.hasBody == false &&
@@ -285,6 +285,12 @@ public class SymbolLightClassesForSourceTestGenerated extends AbstractSymbolLigh
runTest("compiler/testData/asJava/lightClasses/compilationErrors/ExpectedNestedClassInObject.kt");
}
@Test
@TestMetadata("FunctionWithoutName.kt")
public void testFunctionWithoutName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/FunctionWithoutName.kt");
}
@Test
@TestMetadata("JvmPackageName.kt")
public void testJvmPackageName() throws Exception {
@@ -303,6 +309,12 @@ public class SymbolLightClassesForSourceTestGenerated extends AbstractSymbolLigh
runTest("compiler/testData/asJava/lightClasses/compilationErrors/PrivateInTrait.kt");
}
@Test
@TestMetadata("PropertyWithoutName.kt")
public void testPropertyWithoutName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/PropertyWithoutName.kt");
}
@Test
@TestMetadata("RepetableAnnotations.kt")
public void testRepetableAnnotations() throws Exception {
@@ -285,6 +285,12 @@ public class SymbolLightClassesParentingForSourceTestGenerated extends AbstractS
runTest("compiler/testData/asJava/lightClasses/compilationErrors/ExpectedNestedClassInObject.kt");
}
@Test
@TestMetadata("FunctionWithoutName.kt")
public void testFunctionWithoutName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/FunctionWithoutName.kt");
}
@Test
@TestMetadata("JvmPackageName.kt")
public void testJvmPackageName() throws Exception {
@@ -303,6 +309,12 @@ public class SymbolLightClassesParentingForSourceTestGenerated extends AbstractS
runTest("compiler/testData/asJava/lightClasses/compilationErrors/PrivateInTrait.kt");
}
@Test
@TestMetadata("PropertyWithoutName.kt")
public void testPropertyWithoutName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/PropertyWithoutName.kt");
}
@Test
@TestMetadata("RepetableAnnotations.kt")
public void testRepetableAnnotations() throws Exception {