Support nullable callable references in FIR resolve
This commit is contained in:
@@ -25,6 +25,7 @@ abstract class FirResolvedQualifier : FirPureAbstractElement(), FirExpression {
|
||||
abstract val packageFqName: FqName
|
||||
abstract val relativeClassFqName: FqName?
|
||||
abstract val classId: ClassId?
|
||||
abstract val safe: Boolean
|
||||
abstract val typeArguments: List<FirTypeProjection>
|
||||
|
||||
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitResolvedQualifier(this, data)
|
||||
|
||||
+2
-1
@@ -24,7 +24,8 @@ import org.jetbrains.kotlin.fir.visitors.*
|
||||
class FirResolvedQualifierImpl(
|
||||
override val source: FirSourceElement?,
|
||||
override var packageFqName: FqName,
|
||||
override var relativeClassFqName: FqName?
|
||||
override var relativeClassFqName: FqName?,
|
||||
override var safe: Boolean
|
||||
) : FirResolvedQualifier(), FirAbstractAnnotatedElement {
|
||||
override var typeRef: FirTypeRef = FirImplicitTypeRefImpl(null)
|
||||
override val annotations: MutableList<FirAnnotationCall> = mutableListOf()
|
||||
|
||||
@@ -944,7 +944,7 @@ class FirRenderer(builder: StringBuilder) : FirVisitorVoid() {
|
||||
override fun visitCallableReferenceAccess(callableReferenceAccess: FirCallableReferenceAccess) {
|
||||
callableReferenceAccess.annotations.renderAnnotations()
|
||||
callableReferenceAccess.explicitReceiver?.accept(this)
|
||||
if (callableReferenceAccess.safe) {
|
||||
if (callableReferenceAccess.safe && callableReferenceAccess.explicitReceiver !is FirResolvedQualifier) {
|
||||
print("?")
|
||||
}
|
||||
print("::")
|
||||
@@ -1052,6 +1052,9 @@ class FirRenderer(builder: StringBuilder) : FirVisitorVoid() {
|
||||
} else {
|
||||
print(resolvedQualifier.packageFqName.asString().replace(".", "/"))
|
||||
}
|
||||
if (resolvedQualifier.safe) {
|
||||
print("?")
|
||||
}
|
||||
print("|")
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -323,7 +323,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
||||
}
|
||||
|
||||
impl(resolvedQualifier) {
|
||||
isMutable("packageFqName", "relativeClassFqName")
|
||||
isMutable("packageFqName", "relativeClassFqName", "safe")
|
||||
default("classId") {
|
||||
value = """
|
||||
|relativeClassFqName?.let {
|
||||
|
||||
+1
@@ -435,6 +435,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
+field("packageFqName", fqNameType)
|
||||
+field("relativeClassFqName", fqNameType, nullable = true)
|
||||
+field("classId", classIdType, nullable = true)
|
||||
+booleanField("safe")
|
||||
+typeArguments.withTransform()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user