[FIR] FirSymbolNamesProvider: Provide default implementation for mayHaveSyntheticFunctionType
- Composite providers may call `mayHaveSyntheticFunctionType` on *all* of their children if *one* child has `mayHaveSyntheticFunctionTypes == true`, so `mayHaveSyntheticFunctionType` should have a proper default implementation to avoid runtime errors. - The alternative of requiring to check `mayHaveSyntheticFunctionTypes` before calling `mayHaveSyntheticFunctionType` at the call-site was considered, but deemed too error-prone. Given that `mayHaveSyntheticFunctionType` is an optimization and admits false positives, an imprecise default implementation of it is allowed. Thanks to Mikhail Glukhikh for discovering this problem.
This commit is contained in:
committed by
Space Team
parent
0be566f6b6
commit
d89e29f289
+1
-2
@@ -63,8 +63,7 @@ abstract class FirSymbolNamesProvider {
|
||||
/**
|
||||
* Whether [classId] is considered a generated function type within the provider's scope and session.
|
||||
*/
|
||||
open fun mayHaveSyntheticFunctionType(classId: ClassId): Boolean =
|
||||
error("`mayHaveSyntheticFunctionType` needs to be implemented when `mayHaveSyntheticFunctionTypes` is true.")
|
||||
open fun mayHaveSyntheticFunctionType(classId: ClassId): Boolean = mayHaveSyntheticFunctionTypes
|
||||
|
||||
/**
|
||||
* Checks if the provider's scope may contain a top-level classifier (class, interface, object, or type alias) with the given [classId].
|
||||
|
||||
Reference in New Issue
Block a user