IR: add type parameter to IrMemberAccessExpression and some subclasses

This is needed to get rid of the diamond hierarchy:

                 IrMemberAccessExpression
                 /                       \
                /                         \
IrFunctionAccessExpression     IrCallableReference
                \                      /
                 \                    /
                   IrFunctionReference

In the subsequent commit, IrFunctionReference no longer inherits from
IrFunctionAccessExpression; the more precise type of `val symbol:
IrFunctionSymbol` is now carried via the generic type argument.

This will help to refactor IR element hierarchy from interfaces to
classes, improving performance of visitors and transformers.
This commit is contained in:
Alexander Udalov
2020-06-23 20:12:36 +02:00
parent d794c9dc4d
commit d4605f5816
46 changed files with 140 additions and 140 deletions
@@ -71,7 +71,7 @@ interface IrBuilderExtension {
callee: IrFunctionSymbol,
vararg args: IrExpression,
typeHint: IrType? = null
): IrMemberAccessExpression {
): IrMemberAccessExpression<*> {
assert(callee.isBound) { "Symbol $callee expected to be bound" }
val returnType = typeHint ?: callee.run { owner.returnType }
val call = irCall(callee, type = returnType)
@@ -86,7 +86,7 @@ interface IrBuilderExtension {
typeArguments: List<IrType?>,
valueArguments: List<IrExpression>,
returnTypeHint: IrType? = null
): IrMemberAccessExpression =
): IrMemberAccessExpression<*> =
irInvoke(
dispatchReceiver,
callee,