[LL FIR] KT-57220 Optimize & combine synthetic function symbol providers

- Dependency symbol providers contained a lot of useless
  `FirExtensionSyntheticFunctionInterfaceProvider`s, because such a
  provider only generates function classes from compiler plugins. If
  there aren't any such `FunctionTypeKind`s in the session, there is no
  need to even add the provider.
- `FirExtensionSyntheticFunctionInterfaceProvider`s that are added to
  the list of dependency providers despite this optimization will now be
  combined in `LLFirCombinedSyntheticFunctionSymbolProvider`. It checks
  `ClassId` heuristics once, which is more efficient than checking them
  in every provider separately.
This commit is contained in:
Marco Pennekamp
2023-03-09 20:00:02 +01:00
committed by Space Team
parent 09ab192205
commit 2d85e9db51
5 changed files with 101 additions and 6 deletions
@@ -23,6 +23,16 @@ abstract class FirFunctionTypeKindService : FirSessionComponent {
return extractor.hasKindWithSpecificPackage(packageFqName)
}
/**
* Returns all package names for which [getKindByClassNamePrefix] may return a [FunctionTypeKind].
*/
fun getFunctionKindPackageNames(): Set<FqName> = extractor.getFunctionKindPackageNames()
/**
* Whether [getKindByClassNamePrefix] may return a [FunctionTypeKind] added by a compiler plugin.
*/
fun hasExtensionKinds(): Boolean = extractor.hasExtensionKinds()
abstract fun extractSingleSpecialKindForFunction(functionSymbol: FirFunctionSymbol<*>): FunctionTypeKind?
abstract fun extractAllSpecialKindsForFunction(functionSymbol: FirFunctionSymbol<*>): List<FunctionTypeKind>
abstract fun extractAllSpecialKindsForFunctionTypeRef(typeRef: FirFunctionTypeRef): List<FunctionTypeKind>