K2: Refine how JDK members are mapped to built-in classes
Previously, the semantic was more-or-less correct for most of the cases but some corner one, like `sort` in MutableList didn't work properly. Namely, `sort` should be marked there in a way to forbid to call it everywhere beside super-calls. Also, overriding it should be allowed. Mostly, the logic was re-written to K2 model from K1-related JvmBuiltInsCustomizer. ^KT-57694 In progress ^KT-57269 Fixed
This commit is contained in:
committed by
Space Team
parent
161fe1d2ca
commit
2e5b783cc6
@@ -91,6 +91,23 @@ fun FirTypeScope.processOverriddenFunctions(
|
||||
mutableSetOf()
|
||||
)
|
||||
|
||||
fun FirTypeScope.anyOverriddenOf(
|
||||
functionSymbol: FirNamedFunctionSymbol,
|
||||
predicate: (FirNamedFunctionSymbol) -> Boolean
|
||||
): Boolean {
|
||||
var result = false
|
||||
processOverriddenFunctions(functionSymbol) {
|
||||
if (predicate(it)) {
|
||||
result = true
|
||||
return@processOverriddenFunctions ProcessorAction.STOP
|
||||
}
|
||||
|
||||
return@processOverriddenFunctions ProcessorAction.NEXT
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
private fun FirTypeScope.processOverriddenFunctionsWithVisited(
|
||||
functionSymbol: FirNamedFunctionSymbol,
|
||||
visited: MutableSet<Pair<FirTypeScope, FirNamedFunctionSymbol>>,
|
||||
|
||||
Reference in New Issue
Block a user