[LL FIR] Respect allowKotlinPackage in LLFirKotlinSymbolNamesProvider

- `LLFirProviderHelper` is guarded by `allowKotlinPackage` and the
  symbol names provider should reflect that in the name sets.
- Note that this does not apply to stub-based deserialized symbol
  providers, because they do not pass any value to `allowKotlinPackage`.

^KT-57314
This commit is contained in:
Marco Pennekamp
2023-10-19 18:38:09 +02:00
committed by Space Team
parent e79bc5bb59
commit 8034d522b9
3 changed files with 36 additions and 12 deletions
@@ -9,8 +9,11 @@ package org.jetbrains.kotlin.analysis.utils.collections
* Maps all elements of this non-empty collection with the given [transform] function to a new mutable set, or returns [emptySet] if this
* collection is empty.
*
* [mapToSet] should be preferred over `collection.mapTo(mutableSetOf()) { ... }` when `collection` may be empty and the resulting set may
* be cached, because [mapToSet] saves memory by avoiding the creation of an empty mutable set.
* [mapToSetOrEmpty] should be preferred over `collection.mapTo(mutableSetOf()) { ... }` when `collection` may be empty and the resulting
* set may be cached, because [mapToSetOrEmpty] saves memory by avoiding the creation of an empty mutable set.
*/
public inline fun <T, R> Collection<T>.mapToSet(transform: (T) -> R): Set<R> =
public inline fun <T, R> Collection<T>.mapToSetOrEmpty(transform: (T) -> R): Set<R> =
if (isNotEmpty()) mapTo(mutableSetOf(), transform) else emptySet()
public inline fun <T> Collection<T>.filterToSetOrEmpty(predicate: (T) -> Boolean): Set<T> =
filterTo(mutableSetOf(), predicate).ifEmpty { emptySet() }