[FIR] Extension point for function calls
This extension point allows changing the return type of call from a declared type to its subtype. With an idea that such a plugin needs the ability to control available (extension) properties for this type. A set of properties should be decided based on the resolved function, provided arguments, types, and resolved lambdas. It is not a goal to enable plugins to affect resolution in any way. Types are not intended to have any structured capabilities In other words. The goal was to come up with a way to enable a limited form of an "extensible records" mechanism through plugins. - It should give enough value for a practical use. (more info in the ticket). - It should have minimal effect on the compilation process This appears to be an extension point that solves this problem. ^KT-65859 Fixed
This commit is contained in:
committed by
Space Team
parent
4d04546652
commit
c49edfef04
+14
@@ -38,6 +38,8 @@ abstract class FirExtensionRegistrar : FirExtensionRegistrarAdapter() {
|
||||
FirFunctionTypeKindExtension::class,
|
||||
@OptIn(FirExtensionApiInternals::class)
|
||||
FirMetadataSerializerPlugin::class,
|
||||
@OptIn(FirExtensionApiInternals::class)
|
||||
FirFunctionCallRefinementExtension::class,
|
||||
)
|
||||
|
||||
internal val ALLOWED_EXTENSIONS_FOR_LIBRARY_SESSION = listOf(
|
||||
@@ -122,6 +124,12 @@ abstract class FirExtensionRegistrar : FirExtensionRegistrarAdapter() {
|
||||
registerExtension(FirMetadataSerializerPlugin::class, this)
|
||||
}
|
||||
|
||||
@FirExtensionApiInternals
|
||||
@JvmName("plusFunctionCallRefinementExtension")
|
||||
operator fun (FirFunctionCallRefinementExtension.Factory).unaryPlus() {
|
||||
registerExtension(FirFunctionCallRefinementExtension::class, this)
|
||||
}
|
||||
|
||||
// ------------------ reference methods ------------------
|
||||
|
||||
@JvmName("plusStatusTransformerExtension")
|
||||
@@ -195,6 +203,12 @@ abstract class FirExtensionRegistrar : FirExtensionRegistrarAdapter() {
|
||||
FirMetadataSerializerPlugin.Factory { this.invoke(it) }.unaryPlus()
|
||||
}
|
||||
|
||||
@FirExtensionApiInternals
|
||||
@JvmName("plusFunctionCallRefinementExtension")
|
||||
operator fun ((FirSession) -> FirFunctionCallRefinementExtension).unaryPlus() {
|
||||
FirFunctionCallRefinementExtension.Factory { this.invoke(it) }.unaryPlus()
|
||||
}
|
||||
|
||||
// ------------------ utilities ------------------
|
||||
|
||||
@JvmName("bindLeft")
|
||||
|
||||
Reference in New Issue
Block a user