Render FQ name of default package as "root package" in OverloadResolver
This commit is contained in:
@@ -106,7 +106,9 @@ public class OverloadResolver {
|
||||
}
|
||||
|
||||
for (Map.Entry<FqNameUnsafe, Collection<CallableMemberDescriptor>> e : functionsByName.entrySet()) {
|
||||
checkOverloadsWithSameName(e.getValue(), e.getKey().parent().asString());
|
||||
// TODO: don't render FQ name here, extract this logic to somewhere
|
||||
FqNameUnsafe fqName = e.getKey().parent();
|
||||
checkOverloadsWithSameName(e.getValue(), fqName.isRoot() ? "root package" : fqName.asString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// !DIAGNOSTICS_NUMBER: 2
|
||||
// !DIAGNOSTICS: CONFLICTING_OVERLOADS
|
||||
// !MESSAGE_TYPE: TEXT
|
||||
|
||||
fun foo(x: Int) = x
|
||||
fun foo(y: Int) = y
|
||||
@@ -0,0 +1,2 @@
|
||||
<!-- conflictingOverloadsDefaultPackage1 -->
|
||||
'internal fun foo(x: kotlin.Int): kotlin.Int' is already defined in root package
|
||||
@@ -0,0 +1,2 @@
|
||||
<!-- conflictingOverloadsDefaultPackage2 -->
|
||||
'internal fun foo(y: kotlin.Int): kotlin.Int' is already defined in root package
|
||||
@@ -41,6 +41,11 @@ public class DiagnosticMessageTestGenerated extends AbstractDiagnosticMessageTes
|
||||
doTest("idea/testData/diagnosticMessage/conflictingOverloadsClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("conflictingOverloadsDefaultPackage.kt")
|
||||
public void testConflictingOverloadsDefaultPackage() throws Exception {
|
||||
doTest("idea/testData/diagnosticMessage/conflictingOverloadsDefaultPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("conflictingSubstitutions.kt")
|
||||
public void testConflictingSubstitutions() throws Exception {
|
||||
doTest("idea/testData/diagnosticMessage/conflictingSubstitutions.kt");
|
||||
|
||||
Reference in New Issue
Block a user