FIR2IR: use information about callable reference adaptation from resolve
This commit is contained in:
+2
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.fir.references
|
||||
|
||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.CallableReferenceMappedArguments
|
||||
import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -22,6 +23,7 @@ abstract class FirResolvedCallableReference : FirResolvedNamedReference() {
|
||||
abstract override val candidateSymbol: AbstractFirBasedSymbol<*>?
|
||||
abstract override val resolvedSymbol: AbstractFirBasedSymbol<*>
|
||||
abstract val inferredTypeArguments: List<ConeKotlinType>
|
||||
abstract val mappedArguments: CallableReferenceMappedArguments
|
||||
|
||||
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitResolvedCallableReference(this, data)
|
||||
}
|
||||
|
||||
+3
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.builder.FirBuilderDsl
|
||||
import org.jetbrains.kotlin.fir.references.FirResolvedCallableReference
|
||||
import org.jetbrains.kotlin.fir.references.impl.FirResolvedCallableReferenceImpl
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.CallableReferenceMappedArguments
|
||||
import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
@@ -26,6 +27,7 @@ class FirResolvedCallableReferenceBuilder {
|
||||
lateinit var name: Name
|
||||
lateinit var resolvedSymbol: AbstractFirBasedSymbol<*>
|
||||
val inferredTypeArguments: MutableList<ConeKotlinType> = mutableListOf()
|
||||
lateinit var mappedArguments: CallableReferenceMappedArguments
|
||||
|
||||
fun build(): FirResolvedCallableReference {
|
||||
return FirResolvedCallableReferenceImpl(
|
||||
@@ -33,6 +35,7 @@ class FirResolvedCallableReferenceBuilder {
|
||||
name,
|
||||
resolvedSymbol,
|
||||
inferredTypeArguments,
|
||||
mappedArguments,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.references.impl
|
||||
|
||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.references.FirResolvedCallableReference
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.CallableReferenceMappedArguments
|
||||
import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -22,6 +23,7 @@ internal class FirResolvedCallableReferenceImpl(
|
||||
override val name: Name,
|
||||
override val resolvedSymbol: AbstractFirBasedSymbol<*>,
|
||||
override val inferredTypeArguments: MutableList<ConeKotlinType>,
|
||||
override val mappedArguments: CallableReferenceMappedArguments,
|
||||
) : FirResolvedCallableReference() {
|
||||
override val candidateSymbol: AbstractFirBasedSymbol<*>? get() = null
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.resolve.calls
|
||||
|
||||
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
|
||||
sealed class ResolvedCallArgument {
|
||||
abstract val arguments: List<FirExpression>
|
||||
|
||||
object DefaultArgument : ResolvedCallArgument() {
|
||||
override val arguments: List<FirExpression>
|
||||
get() = emptyList()
|
||||
|
||||
}
|
||||
|
||||
class SimpleArgument(val callArgument: FirExpression) : ResolvedCallArgument() {
|
||||
override val arguments: List<FirExpression>
|
||||
get() = listOf(callArgument)
|
||||
|
||||
}
|
||||
|
||||
class VarargArgument(override val arguments: List<FirExpression>) : ResolvedCallArgument()
|
||||
}
|
||||
|
||||
typealias CallableReferenceMappedArguments = Map<FirValueParameter, ResolvedCallArgument>
|
||||
+1
@@ -535,6 +535,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
|
||||
resolvedCallableReference.configure {
|
||||
+fieldList("inferredTypeArguments", coneKotlinTypeType)
|
||||
+field("mappedArguments", callableReferenceMappedArgumentsType)
|
||||
}
|
||||
|
||||
delegateFieldReference.configure {
|
||||
|
||||
@@ -86,3 +86,5 @@ val declarationAttributesType = generatedType("declarations", "FirDeclarationAtt
|
||||
val annotationResolveStatusType = generatedType("expressions", "FirAnnotationResolveStatus")
|
||||
|
||||
val exhaustivenessStatusType = generatedType("expressions", "ExhaustivenessStatus")
|
||||
|
||||
val callableReferenceMappedArgumentsType = type("fir.resolve.calls", "CallableReferenceMappedArguments")
|
||||
Reference in New Issue
Block a user