[FIR] Sort HMPP dependencies topologically for symbol providers
This fixes an issue where an actual class from an intermediate module has more supertypes than its expect declaration which leads to a false-positive resolution error because a type reference resolves to the expect class. The fix is to sort the dependencies topologically from "most actual" to "most expect" when creating the list of symbol providers. #KT-57369 Fixed
This commit is contained in:
committed by
Space Team
parent
6fe0849402
commit
60b227c519
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.container
|
||||
import java.util.ArrayList
|
||||
import java.util.HashSet
|
||||
|
||||
fun <T> topologicalSort(items: Iterable<T>, dependencies: (T) -> Iterable<T>): List<T> {
|
||||
fun <T> topologicalSort(items: Iterable<T>, reverseOrder: Boolean = false, dependencies: (T) -> Iterable<T>): List<T> {
|
||||
val itemsInProgress = HashSet<T>()
|
||||
val completedItems = HashSet<T>()
|
||||
val result = ArrayList<T>()
|
||||
@@ -45,7 +45,7 @@ fun <T> topologicalSort(items: Iterable<T>, dependencies: (T) -> Iterable<T>): L
|
||||
for (item in items)
|
||||
DfsVisit(item)
|
||||
|
||||
return result.apply { reverse() }
|
||||
return result.apply { if (!reverseOrder) reverse() }
|
||||
}
|
||||
|
||||
class CycleInTopoSortException : Exception()
|
||||
class CycleInTopoSortException : Exception()
|
||||
|
||||
Reference in New Issue
Block a user