[FIR] Implement super resolve as a particular tower resolver case

This commit is contained in:
Mikhail Glukhikh
2020-01-29 12:41:45 +03:00
parent ee020ef290
commit 71b0840ef9
42 changed files with 211 additions and 71 deletions
@@ -0,0 +1,24 @@
/*
* Copyright 2010-2020 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.types
import org.jetbrains.kotlin.fir.FirPureAbstractElement
import org.jetbrains.kotlin.fir.FirSourceElement
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
import org.jetbrains.kotlin.fir.visitors.*
/*
* This file was generated automatically
* DO NOT MODIFY IT MANUALLY
*/
abstract class FirComposedSuperTypeRef : FirPureAbstractElement(), FirTypeRef {
abstract override val source: FirSourceElement?
abstract override val annotations: List<FirAnnotationCall>
abstract val superTypeRefs: List<FirResolvedTypeRef>
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitComposedSuperTypeRef(this, data)
}
@@ -0,0 +1,36 @@
/*
* Copyright 2010-2020 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.types.impl
import org.jetbrains.kotlin.fir.FirSourceElement
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
import org.jetbrains.kotlin.fir.impl.FirAbstractAnnotatedElement
import org.jetbrains.kotlin.fir.types.FirComposedSuperTypeRef
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
import org.jetbrains.kotlin.fir.visitors.*
/*
* This file was generated automatically
* DO NOT MODIFY IT MANUALLY
*/
class FirComposedSuperTypeRefImpl(
override val source: FirSourceElement?
) : FirComposedSuperTypeRef(), FirAbstractAnnotatedElement {
override val annotations: MutableList<FirAnnotationCall> = mutableListOf()
override val superTypeRefs: MutableList<FirResolvedTypeRef> = mutableListOf()
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
annotations.forEach { it.accept(visitor, data) }
superTypeRefs.forEach { it.accept(visitor, data) }
}
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirComposedSuperTypeRefImpl {
annotations.transformInplace(transformer, data)
superTypeRefs.transformInplace(transformer, data)
return this
}
}
@@ -116,6 +116,7 @@ import org.jetbrains.kotlin.fir.types.FirDynamicTypeRef
import org.jetbrains.kotlin.fir.types.FirFunctionTypeRef
import org.jetbrains.kotlin.fir.types.FirResolvedFunctionTypeRef
import org.jetbrains.kotlin.fir.types.FirImplicitTypeRef
import org.jetbrains.kotlin.fir.types.FirComposedSuperTypeRef
import org.jetbrains.kotlin.fir.contracts.FirContractDescription
import org.jetbrains.kotlin.fir.visitors.CompositeTransformResult
@@ -568,6 +569,10 @@ abstract class FirTransformer<in D> : FirVisitor<CompositeTransformResult<FirEle
return transformElement(implicitTypeRef, data)
}
open fun transformComposedSuperTypeRef(composedSuperTypeRef: FirComposedSuperTypeRef, data: D): CompositeTransformResult<FirTypeRef> {
return transformElement(composedSuperTypeRef, data)
}
open fun transformContractDescription(contractDescription: FirContractDescription, data: D): CompositeTransformResult<FirContractDescription> {
return transformElement(contractDescription, data)
}
@@ -1016,6 +1021,10 @@ abstract class FirTransformer<in D> : FirVisitor<CompositeTransformResult<FirEle
return transformImplicitTypeRef(implicitTypeRef, data)
}
final override fun visitComposedSuperTypeRef(composedSuperTypeRef: FirComposedSuperTypeRef, data: D): CompositeTransformResult<FirTypeRef> {
return transformComposedSuperTypeRef(composedSuperTypeRef, data)
}
final override fun visitContractDescription(contractDescription: FirContractDescription, data: D): CompositeTransformResult<FirContractDescription> {
return transformContractDescription(contractDescription, data)
}
@@ -116,6 +116,7 @@ import org.jetbrains.kotlin.fir.types.FirDynamicTypeRef
import org.jetbrains.kotlin.fir.types.FirFunctionTypeRef
import org.jetbrains.kotlin.fir.types.FirResolvedFunctionTypeRef
import org.jetbrains.kotlin.fir.types.FirImplicitTypeRef
import org.jetbrains.kotlin.fir.types.FirComposedSuperTypeRef
import org.jetbrains.kotlin.fir.contracts.FirContractDescription
/*
@@ -346,6 +347,8 @@ abstract class FirVisitor<out R, in D> {
open fun visitImplicitTypeRef(implicitTypeRef: FirImplicitTypeRef, data: D): R = visitElement(implicitTypeRef, data)
open fun visitComposedSuperTypeRef(composedSuperTypeRef: FirComposedSuperTypeRef, data: D): R = visitElement(composedSuperTypeRef, data)
open fun visitContractDescription(contractDescription: FirContractDescription, data: D): R = visitElement(contractDescription, data)
}
@@ -116,6 +116,7 @@ import org.jetbrains.kotlin.fir.types.FirDynamicTypeRef
import org.jetbrains.kotlin.fir.types.FirFunctionTypeRef
import org.jetbrains.kotlin.fir.types.FirResolvedFunctionTypeRef
import org.jetbrains.kotlin.fir.types.FirImplicitTypeRef
import org.jetbrains.kotlin.fir.types.FirComposedSuperTypeRef
import org.jetbrains.kotlin.fir.contracts.FirContractDescription
/*
@@ -566,6 +567,10 @@ abstract class FirVisitorVoid : FirVisitor<Unit, Nothing?>() {
visitElement(implicitTypeRef)
}
open fun visitComposedSuperTypeRef(composedSuperTypeRef: FirComposedSuperTypeRef) {
visitElement(composedSuperTypeRef)
}
open fun visitContractDescription(contractDescription: FirContractDescription) {
visitElement(contractDescription)
}
@@ -1014,6 +1019,10 @@ abstract class FirVisitorVoid : FirVisitor<Unit, Nothing?>() {
visitImplicitTypeRef(implicitTypeRef)
}
final override fun visitComposedSuperTypeRef(composedSuperTypeRef: FirComposedSuperTypeRef, data: Nothing?) {
visitComposedSuperTypeRef(composedSuperTypeRef)
}
final override fun visitContractDescription(contractDescription: FirContractDescription, data: Nothing?) {
visitContractDescription(contractDescription)
}
@@ -137,6 +137,7 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
val functionTypeRef = element("FunctionTypeRef", TypeRef, typeRefWithNullability)
val resolvedFunctionTypeRef = element("ResolvedFunctionTypeRef", TypeRef, resolvedTypeRef, functionTypeRef)
val implicitTypeRef = element("ImplicitTypeRef", TypeRef, typeRef)
val composedSuperTypeRef = element("ComposedSuperTypeRef", TypeRef, typeRef)
val contractDescription = element("ContractDescription", Contracts)
}
@@ -513,6 +513,8 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
defaultEmptyList("annotations")
}
impl(composedSuperTypeRef)
impl(reference, "FirStubReference") {
default("source") {
value = "null"
@@ -521,6 +521,10 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
+returnTypeRef
}
composedSuperTypeRef.configure {
+fieldList("superTypeRefs", resolvedTypeRef)
}
thisReceiverExpression.configure {
+field("calleeReference", thisReference)
}