[LL] Sort modules from the same KMP project in symbol providers

Sort dependency modules topologically if they belong to the same KMP
project, preserving their relative positions. Sorting all modules and
changing positions of unrelated modules can be harmful: in the case of
a classpath hell, IDE results can become different from runtime
behavior. Sorting in place can help to avoid this problem, because
conflicting declarations shouldn't be allowed in different source sets
of the same multiplatform project.

KTIJ-27569
This commit is contained in:
Pavel Kirpichenkov
2023-12-05 11:40:13 +02:00
committed by Space Team
parent 16b1caff7e
commit ce3c05500e
4 changed files with 255 additions and 34 deletions
@@ -1,33 +0,0 @@
// LL_FIR_DIVERGENCE
// False positive reports of ARGUMENT_TYPE_MISMATCH and UNRESOLVED_REFERENCE are due to bug KT-63382.
// LL_FIR_DIVERGENCE
// ISSUE: KT-57369
// MODULE: common
// TARGET_PLATFORM: Common
interface CompletionHandler {
fun foo()
}
expect class CompletionHandlerBase()
fun invokeOnCompletion(handler: CompletionHandler) {}
// MODULE: intermediate()()(common)
// TARGET_PLATFORM: Common
// actual has an additional super type
actual class CompletionHandlerBase : CompletionHandler {
override fun foo() {}
}
fun cancelFutureOnCompletionAlt(handlerBase: CompletionHandlerBase) {
invokeOnCompletion(handlerBase)
handlerBase.foo()
}
// MODULE: main()()(common, intermediate)
// the order of dependencies is important to reproduce KT-57369
fun cancelFutureOnCompletion(handlerBase: CompletionHandlerBase) {
invokeOnCompletion(<!ARGUMENT_TYPE_MISMATCH!>handlerBase<!>)
handlerBase.<!UNRESOLVED_REFERENCE!>foo<!>()
}