[K2] Do not report CONFLICTING_OVERLOADS for hidden callables.
This makes sense as such callables do not conflict on their use-sites, because a hidden callable loses to a non-hidden one when doing overload resolution. We achieve this by not considering such callables as conflicting when collecting them in FirDeclarationCollector. A callable is hidden if it will be hidden from the overload resolution, meaning it has a `Deprecated` or `DeprecatedSinceKotlin` annotation. NB: this also impacts `REDECLARATION` diagnostic for properties, as they can also be marked as `Deprecated`. NB: this change ignores local callables, as they are ignored w.r.t. `Deprecated` in K2. ^KT-22004 Fixed
This commit is contained in:
+82
@@ -24326,12 +24326,24 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/overload/kt1998.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt22004.kt")
|
||||
public void testKt22004() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/kt22004.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt2493.kt")
|
||||
public void testKt2493() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/kt2493.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt61168WithFix.kt")
|
||||
public void testKt61168WithFix() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/kt61168WithFix.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt7068.kt")
|
||||
public void testKt7068() throws Exception {
|
||||
@@ -24415,6 +24427,76 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
public void testUnsubstitutedJavaGenetics() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/UnsubstitutedJavaGenetics.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class NoConflictingOverloadsWithDeprecated {
|
||||
@Test
|
||||
public void testAllFilesPresentInNoConflictingOverloadsWithDeprecated() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConflictingOverloadsFunsDifferentReturnInClass.kt")
|
||||
public void testConflictingOverloadsFunsDifferentReturnInClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConflictingOverloadsFunsDifferentReturnInClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConflictingOverloadsFunsDifferentReturnInPackage.kt")
|
||||
public void testConflictingOverloadsFunsDifferentReturnInPackage() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConflictingOverloadsFunsDifferentReturnInPackage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConflictingOverloadsGenericFunctions.kt")
|
||||
public void testConflictingOverloadsGenericFunctions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConflictingOverloadsGenericFunctions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConflictingOverloadsIdenticalExtFunsInPackage.kt")
|
||||
public void testConflictingOverloadsIdenticalExtFunsInPackage() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConflictingOverloadsIdenticalExtFunsInPackage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConflictingOverloadsIdenticalFunsInClass.kt")
|
||||
public void testConflictingOverloadsIdenticalFunsInClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConflictingOverloadsIdenticalFunsInClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConflictingOverloadsIdenticalValsInClass.kt")
|
||||
public void testConflictingOverloadsIdenticalValsInClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConflictingOverloadsIdenticalValsInClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConflictingOverloadsValsDifferentTypeInClass.kt")
|
||||
public void testConflictingOverloadsValsDifferentTypeInClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConflictingOverloadsValsDifferentTypeInClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConstructorVsFunOverload.kt")
|
||||
public void testConstructorVsFunOverload() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConstructorVsFunOverload.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LocalFunctions.kt")
|
||||
public void testLocalFunctions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/LocalFunctions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterMultipleBounds.kt")
|
||||
public void testTypeParameterMultipleBounds() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/TypeParameterMultipleBounds.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+82
@@ -24332,12 +24332,24 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/overload/kt1998.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt22004.kt")
|
||||
public void testKt22004() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/kt22004.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt2493.kt")
|
||||
public void testKt2493() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/kt2493.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt61168WithFix.kt")
|
||||
public void testKt61168WithFix() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/kt61168WithFix.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt7068.kt")
|
||||
public void testKt7068() throws Exception {
|
||||
@@ -24421,6 +24433,76 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
public void testUnsubstitutedJavaGenetics() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/UnsubstitutedJavaGenetics.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class NoConflictingOverloadsWithDeprecated {
|
||||
@Test
|
||||
public void testAllFilesPresentInNoConflictingOverloadsWithDeprecated() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConflictingOverloadsFunsDifferentReturnInClass.kt")
|
||||
public void testConflictingOverloadsFunsDifferentReturnInClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConflictingOverloadsFunsDifferentReturnInClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConflictingOverloadsFunsDifferentReturnInPackage.kt")
|
||||
public void testConflictingOverloadsFunsDifferentReturnInPackage() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConflictingOverloadsFunsDifferentReturnInPackage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConflictingOverloadsGenericFunctions.kt")
|
||||
public void testConflictingOverloadsGenericFunctions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConflictingOverloadsGenericFunctions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConflictingOverloadsIdenticalExtFunsInPackage.kt")
|
||||
public void testConflictingOverloadsIdenticalExtFunsInPackage() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConflictingOverloadsIdenticalExtFunsInPackage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConflictingOverloadsIdenticalFunsInClass.kt")
|
||||
public void testConflictingOverloadsIdenticalFunsInClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConflictingOverloadsIdenticalFunsInClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConflictingOverloadsIdenticalValsInClass.kt")
|
||||
public void testConflictingOverloadsIdenticalValsInClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConflictingOverloadsIdenticalValsInClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConflictingOverloadsValsDifferentTypeInClass.kt")
|
||||
public void testConflictingOverloadsValsDifferentTypeInClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConflictingOverloadsValsDifferentTypeInClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("ConstructorVsFunOverload.kt")
|
||||
public void testConstructorVsFunOverload() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/ConstructorVsFunOverload.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LocalFunctions.kt")
|
||||
public void testLocalFunctions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/LocalFunctions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterMultipleBounds.kt")
|
||||
public void testTypeParameterMultipleBounds() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/overload/noConflictingOverloadsWithDeprecated/TypeParameterMultipleBounds.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
Reference in New Issue
Block a user