[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 DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
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 DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
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
@@ -24326,12 +24326,24 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
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 LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
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
@@ -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
|
||||
|
||||
+9
-3
@@ -219,7 +219,7 @@ private fun <D : FirBasedSymbol<*>> FirDeclarationCollector<D>.collect(
|
||||
|
||||
val conflicts = SmartSet.create<FirBasedSymbol<*>>()
|
||||
for (otherDeclaration in it) {
|
||||
if (otherDeclaration != declaration && !isOverloadable(declaration, otherDeclaration, session)) {
|
||||
if (otherDeclaration != declaration && !areNonConflictingCallables(declaration, otherDeclaration, session)) {
|
||||
conflicts.add(otherDeclaration)
|
||||
declarationConflictingSymbols.getOrPut(otherDeclaration) { SmartSet.create() }.add(declaration)
|
||||
}
|
||||
@@ -390,7 +390,7 @@ private fun FirDeclarationCollector<FirBasedSymbol<*>>.collectTopLevelConflict(
|
||||
conflicting is FirMemberDeclaration &&
|
||||
!session.visibilityChecker.isVisible(conflicting, session, containingFile, emptyList(), dispatchReceiver = null)
|
||||
) return
|
||||
if (isOverloadable(declaration, conflictingSymbol, session)) return
|
||||
if (areNonConflictingCallables(declaration, conflictingSymbol, session)) return
|
||||
|
||||
declarationConflictingSymbols.getOrPut(declaration) { SmartSet.create() }.add(conflictingSymbol)
|
||||
}
|
||||
@@ -417,7 +417,7 @@ private fun areCompatibleMainFunctions(
|
||||
&& declaration1.representsMainFunctionAllowingConflictingOverloads(session)
|
||||
&& declaration2.representsMainFunctionAllowingConflictingOverloads(session)
|
||||
|
||||
private fun isOverloadable(
|
||||
private fun areNonConflictingCallables(
|
||||
declaration: FirBasedSymbol<*>,
|
||||
conflicting: FirBasedSymbol<*>,
|
||||
session: FirSession,
|
||||
@@ -428,6 +428,12 @@ private fun isOverloadable(
|
||||
val conflictingIsLowPriority = hasLowPriorityAnnotation(conflicting.annotations)
|
||||
if (declarationIsLowPriority != conflictingIsLowPriority) return true
|
||||
|
||||
val declarationIsHidden = declaration.isDeprecationLevelHidden(session.languageVersionSettings)
|
||||
if (declarationIsHidden) return true
|
||||
|
||||
val conflictingIsHidden = conflicting.isDeprecationLevelHidden(session.languageVersionSettings)
|
||||
if (conflictingIsHidden) return true
|
||||
|
||||
return declaration is FirCallableSymbol<*> &&
|
||||
conflicting is FirCallableSymbol<*> &&
|
||||
session.declarationOverloadabilityHelper.isOverloadable(declaration, conflicting)
|
||||
|
||||
@@ -310,6 +310,13 @@ private fun List<FirAnnotation>.extractDeprecationAnnotationInfoPerUseSite(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun FirBasedSymbol<*>.isDeprecationLevelHidden(languageVersionSettings: LanguageVersionSettings): Boolean =
|
||||
when (this) {
|
||||
is FirCallableSymbol<*> -> getDeprecation(languageVersionSettings)?.all?.deprecationLevel == DeprecationLevelValue.HIDDEN
|
||||
else -> false
|
||||
}
|
||||
|
||||
private object IsHiddenEverywhereBesideSuperCalls : FirDeclarationDataKey()
|
||||
|
||||
var FirCallableDeclaration.isHiddenEverywhereBesideSuperCalls: Boolean? by FirDeclarationDataRegistry.data(
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// ISSUE: KT-22004
|
||||
|
||||
class A() {
|
||||
fun b() {
|
||||
}
|
||||
|
||||
@Deprecated("test", level = DeprecationLevel.HIDDEN)
|
||||
fun b() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// ISSUE: KT-22004
|
||||
|
||||
class A() {
|
||||
<!CONFLICTING_OVERLOADS!>fun b()<!> {
|
||||
}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test", level = DeprecationLevel.HIDDEN)
|
||||
fun b()<!> {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// ISSUE: KT-61168
|
||||
|
||||
class A() {
|
||||
}
|
||||
|
||||
@Deprecated("A", level = DeprecationLevel.HIDDEN)
|
||||
fun A() = A()
|
||||
@@ -0,0 +1,7 @@
|
||||
// ISSUE: KT-61168
|
||||
|
||||
class A<!CONFLICTING_OVERLOADS!>()<!> {
|
||||
}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("A", level = DeprecationLevel.HIDDEN)
|
||||
fun A()<!> = A()
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class A {
|
||||
fun a(a: Int): Int = 0
|
||||
|
||||
@Deprecated("a", level = DeprecationLevel.HIDDEN)
|
||||
fun a(a: Int) {
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class A {
|
||||
<!CONFLICTING_OVERLOADS!>fun a(a: Int): Int<!> = 0
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("a", level = DeprecationLevel.HIDDEN)
|
||||
fun a(a: Int)<!> {
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package qwertyuiop
|
||||
|
||||
fun c(s: String) {
|
||||
}
|
||||
|
||||
@Deprecated("c", level = DeprecationLevel.HIDDEN)
|
||||
fun c(s: String) {
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package qwertyuiop
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun c(s: String)<!> {
|
||||
}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("c", level = DeprecationLevel.HIDDEN)
|
||||
fun c(s: String)<!> {
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
fun <T1> test1(x: List<T1>) = x
|
||||
@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
||||
fun <T2> test1(x: List<T2>) = x
|
||||
|
||||
fun <T1> List<T1>.test1a() {}
|
||||
@Deprecated("test2", level = DeprecationLevel.HIDDEN)
|
||||
fun <T2> List<T2>.test1a() {}
|
||||
|
||||
fun <T> test2(x: List<T>) = x
|
||||
fun test2(x: List<String>) = x
|
||||
|
||||
fun <T> List<T>.test2a() {}
|
||||
fun List<String>.test2a() {}
|
||||
|
||||
fun <T : Any> test3(x: List<T>) = x
|
||||
fun test3(x: List<Any>) = x
|
||||
|
||||
fun <T : Any> List<T>.test3a() {}
|
||||
fun List<Any>.test3a() {}
|
||||
|
||||
fun <T> test4(x: Map<T, T>) = x
|
||||
fun <K, V> test4(x: Map<K, V>) = x
|
||||
|
||||
fun <T> Map<T, T>.test4a() {}
|
||||
fun <K, V> Map<K, V>.test4a() {}
|
||||
|
||||
class Inv<T>
|
||||
|
||||
fun <T> test5(x: Inv<T>) = x
|
||||
@Deprecated("test5", level = DeprecationLevel.HIDDEN)
|
||||
fun <T> test5(x: Inv<out T>) = x
|
||||
|
||||
fun <T> test6(x: Array<T>) = x
|
||||
fun test6(x: Array<String>) = x
|
||||
|
||||
fun <T> test7(x: Inv<T>) = x
|
||||
fun <T> Inv<T>.test7() {}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
<!CONFLICTING_OVERLOADS!>fun <T1> test1(x: List<T1>)<!> = x
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
||||
fun <T2> test1(x: List<T2>)<!> = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun <T1> List<T1>.test1a()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test2", level = DeprecationLevel.HIDDEN)
|
||||
fun <T2> List<T2>.test1a()<!> {}
|
||||
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>fun <T> test2(x: List<T>)<!> = x
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>fun test2(x: List<String>)<!> = x
|
||||
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>fun <T> List<T>.test2a()<!> {}
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>fun List<String>.test2a()<!> {}
|
||||
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>fun <T : Any> test3(x: List<T>)<!> = x
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>fun test3(x: List<Any>)<!> = x
|
||||
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>fun <T : Any> List<T>.test3a()<!> {}
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>fun List<Any>.test3a()<!> {}
|
||||
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>fun <T> test4(x: Map<T, T>)<!> = x
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>fun <K, V> test4(x: Map<K, V>)<!> = x
|
||||
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>fun <T> Map<T, T>.test4a()<!> {}
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>fun <K, V> Map<K, V>.test4a()<!> {}
|
||||
|
||||
class Inv<T>
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun <T> test5(x: Inv<T>)<!> = x
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test5", level = DeprecationLevel.HIDDEN)
|
||||
fun <T> test5(x: Inv<out T>)<!> = x
|
||||
|
||||
fun <T> test6(x: Array<T>) = x
|
||||
fun test6(x: Array<String>) = x
|
||||
|
||||
fun <T> test7(x: Inv<T>) = x
|
||||
fun <T> Inv<T>.test7() {}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package extensionFunctions
|
||||
|
||||
fun Int.qwe(a: Float) = 1
|
||||
|
||||
@Deprecated("qwe", level = DeprecationLevel.HIDDEN)
|
||||
fun Int.qwe(a: Float) = 2
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package extensionFunctions
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Int.qwe(a: Float)<!> = 1
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("qwe", level = DeprecationLevel.HIDDEN)
|
||||
fun Int.qwe(a: Float)<!> = 2
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class A() {
|
||||
fun b() {
|
||||
}
|
||||
|
||||
@Deprecated("b", level = DeprecationLevel.HIDDEN)
|
||||
fun b() {
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class A() {
|
||||
<!CONFLICTING_OVERLOADS!>fun b()<!> {
|
||||
}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("b", level = DeprecationLevel.HIDDEN)
|
||||
fun b()<!> {
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Aaa() {
|
||||
val a = 1
|
||||
@Deprecated("a", level = DeprecationLevel.HIDDEN)
|
||||
val a = 1
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Aaa() {
|
||||
val <!REDECLARATION!>a<!> = 1
|
||||
@Deprecated("a", level = DeprecationLevel.HIDDEN)
|
||||
val <!REDECLARATION!>a<!> = 1
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Aaa() {
|
||||
val a = 1
|
||||
@Deprecated("a", level = DeprecationLevel.HIDDEN)
|
||||
val a = ""
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Aaa() {
|
||||
val <!REDECLARATION!>a<!> = 1
|
||||
@Deprecated("a", level = DeprecationLevel.HIDDEN)
|
||||
val <!REDECLARATION!>a<!> = ""
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
// constructor vs. fun overload
|
||||
|
||||
// FILE: J.java
|
||||
package constructorVsFun;
|
||||
|
||||
public class J {
|
||||
public J(String s) {}
|
||||
}
|
||||
|
||||
// FILE: G.java
|
||||
package constructorVsFun;
|
||||
|
||||
public class G {
|
||||
@kotlin.Deprecated("G", level = DeprecationLevel.HIDDEN)
|
||||
public G(String s) {}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
package constructorVsFun
|
||||
|
||||
class a() { }
|
||||
|
||||
@Deprecated("a", level = DeprecationLevel.HIDDEN)
|
||||
fun a() = 1
|
||||
|
||||
class b @Deprecated("b", level = DeprecationLevel.HIDDEN) constructor() { }
|
||||
|
||||
fun b() = 2
|
||||
|
||||
class Tram {
|
||||
@Deprecated("f", level = DeprecationLevel.HIDDEN)
|
||||
fun f() { }
|
||||
|
||||
class f() { }
|
||||
}
|
||||
|
||||
class Yvayva {
|
||||
companion object {
|
||||
@Deprecated("fghj", level = DeprecationLevel.HIDDEN)
|
||||
fun fghj() { }
|
||||
|
||||
class fghj() { }
|
||||
}
|
||||
}
|
||||
|
||||
class Rtyu {
|
||||
fun ololo() { }
|
||||
|
||||
companion object {
|
||||
class ololo() { }
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("J", level = DeprecationLevel.HIDDEN)
|
||||
fun J(s: String) { }
|
||||
|
||||
fun G(s: String) { }
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
// constructor vs. fun overload
|
||||
|
||||
// FILE: J.java
|
||||
package constructorVsFun;
|
||||
|
||||
public class J {
|
||||
public J(String s) {}
|
||||
}
|
||||
|
||||
// FILE: G.java
|
||||
package constructorVsFun;
|
||||
|
||||
public class G {
|
||||
@kotlin.Deprecated("G", level = DeprecationLevel.HIDDEN)
|
||||
public G(String s) {}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
package constructorVsFun
|
||||
|
||||
class a<!CONFLICTING_OVERLOADS!>()<!> { }
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("a", level = DeprecationLevel.HIDDEN)
|
||||
fun a()<!> = 1
|
||||
|
||||
class b @Deprecated("b", level = DeprecationLevel.HIDDEN) <!CONFLICTING_OVERLOADS!>constructor()<!> { }
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun b()<!> = 2
|
||||
|
||||
class Tram {
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("f", level = DeprecationLevel.HIDDEN)
|
||||
fun f()<!> { }
|
||||
|
||||
class f<!CONFLICTING_OVERLOADS!>()<!> { }
|
||||
}
|
||||
|
||||
class Yvayva {
|
||||
companion object {
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("fghj", level = DeprecationLevel.HIDDEN)
|
||||
fun fghj()<!> { }
|
||||
|
||||
class fghj<!CONFLICTING_OVERLOADS!>()<!> { }
|
||||
}
|
||||
}
|
||||
|
||||
class Rtyu {
|
||||
fun ololo() { }
|
||||
|
||||
companion object {
|
||||
class ololo() { }
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("J", level = DeprecationLevel.HIDDEN)
|
||||
fun J(s: String) { }
|
||||
|
||||
fun G(s: String) { }
|
||||
Vendored
+265
@@ -0,0 +1,265 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
fun test() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
||||
fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
||||
fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
||||
fun test4(): String<!> = ""
|
||||
|
||||
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5(x: Int)<!> = x
|
||||
|
||||
fun local() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
||||
fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
||||
fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
||||
fun test4(): String<!> = ""
|
||||
|
||||
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5(x: Int)<!> = x
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
init {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
||||
fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
||||
fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
||||
fun test4(): String<!> = ""
|
||||
|
||||
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5(x: Int)<!> = x
|
||||
}
|
||||
|
||||
fun test() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
||||
fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
||||
fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
||||
fun test4(): String<!> = ""
|
||||
|
||||
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5(x: Int)<!> = x
|
||||
}
|
||||
|
||||
val property: Any get() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
||||
fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
||||
fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
||||
fun test4(): String<!> = ""
|
||||
|
||||
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5(x: Int)<!> = x
|
||||
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
val property: Any get() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
||||
fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
||||
fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
||||
fun test4(): String<!> = ""
|
||||
|
||||
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5(x: Int)<!> = x
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
object Object {
|
||||
fun test() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
||||
fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
||||
fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
||||
fun test4(): String<!> = ""
|
||||
|
||||
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5(x: Int)<!> = x
|
||||
}
|
||||
|
||||
val property: Any get() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
||||
fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
||||
fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
||||
fun test4(): String<!> = ""
|
||||
|
||||
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5(x: Int)<!> = x
|
||||
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
val obj = object {
|
||||
fun test() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
||||
fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
||||
fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
||||
fun test4(): String<!> = ""
|
||||
|
||||
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5(x: Int)<!> = x
|
||||
}
|
||||
|
||||
val property: Any get() {
|
||||
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
||||
fun test1()<!> {}
|
||||
|
||||
fun Any.test2() {}
|
||||
fun test2(x: Any) = x
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
||||
fun Any.test3()<!> {}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
||||
fun test4(): String<!> = ""
|
||||
|
||||
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
||||
}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
||||
fun Test5(x: Int)<!> = x
|
||||
|
||||
return 0
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import java.io.Serializable
|
||||
|
||||
interface Test1 {
|
||||
fun <T> foo(t: T) where T : Cloneable, T : Serializable
|
||||
@Deprecated("foo", level = DeprecationLevel.HIDDEN)
|
||||
fun <T> foo(t: T) where T : Serializable, T : Cloneable
|
||||
}
|
||||
|
||||
|
||||
interface I1
|
||||
interface I2 : I1
|
||||
|
||||
interface Test2 {
|
||||
fun <T> foo(t: T) where T : I1, T : I2
|
||||
@Deprecated("foo", level = DeprecationLevel.HIDDEN)
|
||||
fun <T> foo(t: T) where T : I2, T : I1
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import java.io.Serializable
|
||||
|
||||
interface Test1 {
|
||||
<!CONFLICTING_OVERLOADS!>fun <T> foo(t: T)<!> where T : Cloneable, T : Serializable
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("foo", level = DeprecationLevel.HIDDEN)
|
||||
fun <T> foo(t: T)<!> where T : Serializable, T : Cloneable
|
||||
}
|
||||
|
||||
|
||||
interface I1
|
||||
interface I2 : I1
|
||||
|
||||
interface Test2 {
|
||||
<!CONFLICTING_OVERLOADS!>fun <T> foo(t: T)<!> where T : I1, T : I2
|
||||
<!CONFLICTING_OVERLOADS!>@Deprecated("foo", level = DeprecationLevel.HIDDEN)
|
||||
fun <T> foo(t: T)<!> where T : I2, T : I1
|
||||
}
|
||||
Generated
+82
@@ -26184,12 +26184,24 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
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 {
|
||||
@@ -26273,6 +26285,76 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
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);
|
||||
}
|
||||
|
||||
@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