FIR: record 'suspend' function modifier in type references

This commit is contained in:
Jinseong Jeon
2020-04-17 14:49:07 -07:00
committed by Mikhail Glukhikh
parent bf97391c51
commit 88f81b9b71
31 changed files with 60 additions and 10 deletions
@@ -1405,7 +1405,7 @@ class DeclarationsConverter(
if (type.asText.isEmpty()) { if (type.asText.isEmpty()) {
return buildErrorTypeRef { diagnostic = ConeSimpleDiagnostic("Unwrapped type is null", DiagnosticKind.Syntax) } return buildErrorTypeRef { diagnostic = ConeSimpleDiagnostic("Unwrapped type is null", DiagnosticKind.Syntax) }
} }
var typeModifiers = TypeModifier() //TODO what with suspend? var typeModifiers = TypeModifier()
var firType: FirTypeRef = buildErrorTypeRef { diagnostic = ConeSimpleDiagnostic("Incomplete code", DiagnosticKind.Syntax) } var firType: FirTypeRef = buildErrorTypeRef { diagnostic = ConeSimpleDiagnostic("Incomplete code", DiagnosticKind.Syntax) }
var afterLPar = false var afterLPar = false
type.forEachChildren { type.forEachChildren {
@@ -1415,7 +1415,7 @@ class DeclarationsConverter(
MODIFIER_LIST -> if (!afterLPar || typeModifiers.hasNoAnnotations()) typeModifiers = convertTypeModifierList(it) MODIFIER_LIST -> if (!afterLPar || typeModifiers.hasNoAnnotations()) typeModifiers = convertTypeModifierList(it)
USER_TYPE -> firType = convertUserType(it) USER_TYPE -> firType = convertUserType(it)
NULLABLE_TYPE -> firType = convertNullableType(it) NULLABLE_TYPE -> firType = convertNullableType(it)
FUNCTION_TYPE -> firType = convertFunctionType(it) FUNCTION_TYPE -> firType = convertFunctionType(it, isSuspend = typeModifiers.hasSuspend)
DYNAMIC_TYPE -> firType = buildDynamicTypeRef { DYNAMIC_TYPE -> firType = buildDynamicTypeRef {
source = type.toFirSourceElement() source = type.toFirSourceElement()
isMarkedNullable = false isMarkedNullable = false
@@ -1529,7 +1529,7 @@ class DeclarationsConverter(
/** /**
* @see org.jetbrains.kotlin.parsing.KotlinParsing.parseFunctionType * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseFunctionType
*/ */
private fun convertFunctionType(functionType: LighterASTNode, isNullable: Boolean = false): FirTypeRef { private fun convertFunctionType(functionType: LighterASTNode, isNullable: Boolean = false, isSuspend: Boolean = false): FirTypeRef {
var receiverTypeReference: FirTypeRef? = null var receiverTypeReference: FirTypeRef? = null
lateinit var returnTypeReference: FirTypeRef lateinit var returnTypeReference: FirTypeRef
val valueParametersList = mutableListOf<ValueParameter>() val valueParametersList = mutableListOf<ValueParameter>()
@@ -1550,6 +1550,7 @@ class DeclarationsConverter(
if (receiverTypeReference != null) { if (receiverTypeReference != null) {
annotations += extensionFunctionAnnotation annotations += extensionFunctionAnnotation
} }
this.isSuspend = isSuspend
} }
} }
@@ -1138,6 +1138,7 @@ class RawFirBuilder(
FirFunctionTypeRefBuilder().apply { FirFunctionTypeRefBuilder().apply {
this.source = source this.source = source
isMarkedNullable = isNullable isMarkedNullable = isNullable
isSuspend = typeReference.hasModifier(SUSPEND_KEYWORD)
receiverTypeRef = unwrappedElement.receiverTypeReference.convertSafe() receiverTypeRef = unwrappedElement.receiverTypeReference.convertSafe()
// TODO: probably implicit type should not be here // TODO: probably implicit type should not be here
returnTypeRef = unwrappedElement.returnTypeReference.toFirOrErrorType() returnTypeRef = unwrappedElement.returnTypeReference.toFirOrErrorType()
@@ -32,6 +32,7 @@ class FirSpecificTypeResolverTransformer(
source = functionTypeRef.source source = functionTypeRef.source
type = typeResolver.resolveType(functionTypeRef, towerScope) type = typeResolver.resolveType(functionTypeRef, towerScope)
isMarkedNullable = functionTypeRef.isMarkedNullable isMarkedNullable = functionTypeRef.isMarkedNullable
isSuspend = functionTypeRef.isSuspend
receiverTypeRef = functionTypeRef.receiverTypeRef receiverTypeRef = functionTypeRef.receiverTypeRef
returnTypeRef = functionTypeRef.returnTypeRef returnTypeRef = functionTypeRef.returnTypeRef
annotations += functionTypeRef.annotations annotations += functionTypeRef.annotations
@@ -137,7 +137,10 @@ class FirIntegerOperator @FirImplementationDetail constructor(
} }
} }
class FirILTTypeRefPlaceHolder(isUnsigned: Boolean) : FirResolvedTypeRef() { class FirILTTypeRefPlaceHolder(
isUnsigned: Boolean,
override val isSuspend: Boolean = false
) : FirResolvedTypeRef() {
override val source: FirSourceElement? get() = null override val source: FirSourceElement? get() = null
override val annotations: List<FirAnnotationCall> get() = emptyList() override val annotations: List<FirAnnotationCall> get() = emptyList()
override var type: ConeIntegerLiteralType = ConeIntegerLiteralTypeImpl(0, isUnsigned) override var type: ConeIntegerLiteralType = ConeIntegerLiteralTypeImpl(0, isUnsigned)
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.fir.visitors.*
abstract class FirComposedSuperTypeRef : FirPureAbstractElement(), FirTypeRef { abstract class FirComposedSuperTypeRef : FirPureAbstractElement(), FirTypeRef {
abstract override val source: FirSourceElement? abstract override val source: FirSourceElement?
abstract override val annotations: List<FirAnnotationCall> abstract override val annotations: List<FirAnnotationCall>
abstract override val isSuspend: Boolean
abstract val superTypeRefs: List<FirResolvedTypeRef> abstract val superTypeRefs: List<FirResolvedTypeRef>
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitComposedSuperTypeRef(this, data) override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitComposedSuperTypeRef(this, data)
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.fir.visitors.*
abstract class FirDelegatedTypeRef : FirPureAbstractElement(), FirTypeRef { abstract class FirDelegatedTypeRef : FirPureAbstractElement(), FirTypeRef {
abstract override val source: FirSourceElement? abstract override val source: FirSourceElement?
abstract override val annotations: List<FirAnnotationCall> abstract override val annotations: List<FirAnnotationCall>
abstract override val isSuspend: Boolean
abstract val delegate: FirExpression? abstract val delegate: FirExpression?
abstract val typeRef: FirTypeRef abstract val typeRef: FirTypeRef
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.fir.visitors.*
abstract class FirDynamicTypeRef : FirPureAbstractElement(), FirTypeRefWithNullability { abstract class FirDynamicTypeRef : FirPureAbstractElement(), FirTypeRefWithNullability {
abstract override val source: FirSourceElement? abstract override val source: FirSourceElement?
abstract override val annotations: List<FirAnnotationCall> abstract override val annotations: List<FirAnnotationCall>
abstract override val isSuspend: Boolean
abstract override val isMarkedNullable: Boolean abstract override val isMarkedNullable: Boolean
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitDynamicTypeRef(this, data) override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitDynamicTypeRef(this, data)
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.fir.visitors.*
abstract class FirErrorTypeRef : FirResolvedTypeRef(), FirDiagnosticHolder { abstract class FirErrorTypeRef : FirResolvedTypeRef(), FirDiagnosticHolder {
abstract override val source: FirSourceElement? abstract override val source: FirSourceElement?
abstract override val annotations: List<FirAnnotationCall> abstract override val annotations: List<FirAnnotationCall>
abstract override val isSuspend: Boolean
abstract override val type: ConeKotlinType abstract override val type: ConeKotlinType
abstract override val delegatedTypeRef: FirTypeRef? abstract override val delegatedTypeRef: FirTypeRef?
abstract override val diagnostic: ConeDiagnostic abstract override val diagnostic: ConeDiagnostic
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.fir.visitors.*
interface FirFunctionTypeRef : FirTypeRefWithNullability { interface FirFunctionTypeRef : FirTypeRefWithNullability {
override val source: FirSourceElement? override val source: FirSourceElement?
override val annotations: List<FirAnnotationCall> override val annotations: List<FirAnnotationCall>
override val isSuspend: Boolean
override val isMarkedNullable: Boolean override val isMarkedNullable: Boolean
val receiverTypeRef: FirTypeRef? val receiverTypeRef: FirTypeRef?
val valueParameters: List<FirValueParameter> val valueParameters: List<FirValueParameter>
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.fir.visitors.*
abstract class FirImplicitTypeRef : FirPureAbstractElement(), FirTypeRef { abstract class FirImplicitTypeRef : FirPureAbstractElement(), FirTypeRef {
abstract override val source: FirSourceElement? abstract override val source: FirSourceElement?
abstract override val annotations: List<FirAnnotationCall> abstract override val annotations: List<FirAnnotationCall>
abstract override val isSuspend: Boolean
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitImplicitTypeRef(this, data) override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitImplicitTypeRef(this, data)
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.fir.visitors.*
abstract class FirResolvedFunctionTypeRef : FirResolvedTypeRef(), FirFunctionTypeRef { abstract class FirResolvedFunctionTypeRef : FirResolvedTypeRef(), FirFunctionTypeRef {
abstract override val source: FirSourceElement? abstract override val source: FirSourceElement?
abstract override val annotations: List<FirAnnotationCall> abstract override val annotations: List<FirAnnotationCall>
abstract override val isSuspend: Boolean
abstract override val type: ConeKotlinType abstract override val type: ConeKotlinType
abstract override val delegatedTypeRef: FirTypeRef? abstract override val delegatedTypeRef: FirTypeRef?
abstract override val isMarkedNullable: Boolean abstract override val isMarkedNullable: Boolean
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.fir.visitors.*
abstract class FirResolvedTypeRef : FirPureAbstractElement(), FirTypeRef { abstract class FirResolvedTypeRef : FirPureAbstractElement(), FirTypeRef {
abstract override val source: FirSourceElement? abstract override val source: FirSourceElement?
abstract override val annotations: List<FirAnnotationCall> abstract override val annotations: List<FirAnnotationCall>
abstract override val isSuspend: Boolean
abstract val type: ConeKotlinType abstract val type: ConeKotlinType
abstract val delegatedTypeRef: FirTypeRef? abstract val delegatedTypeRef: FirTypeRef?
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.fir.visitors.*
interface FirTypeRef : FirAnnotationContainer { interface FirTypeRef : FirAnnotationContainer {
override val source: FirSourceElement? override val source: FirSourceElement?
override val annotations: List<FirAnnotationCall> override val annotations: List<FirAnnotationCall>
val isSuspend: Boolean
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitTypeRef(this, data) override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitTypeRef(this, data)
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.fir.visitors.*
interface FirTypeRefWithNullability : FirTypeRef { interface FirTypeRefWithNullability : FirTypeRef {
override val source: FirSourceElement? override val source: FirSourceElement?
override val annotations: List<FirAnnotationCall> override val annotations: List<FirAnnotationCall>
override val isSuspend: Boolean
val isMarkedNullable: Boolean val isMarkedNullable: Boolean
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitTypeRefWithNullability(this, data) override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitTypeRefWithNullability(this, data)
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.fir.visitors.*
abstract class FirUserTypeRef : FirPureAbstractElement(), FirTypeRefWithNullability { abstract class FirUserTypeRef : FirPureAbstractElement(), FirTypeRefWithNullability {
abstract override val source: FirSourceElement? abstract override val source: FirSourceElement?
abstract override val annotations: List<FirAnnotationCall> abstract override val annotations: List<FirAnnotationCall>
abstract override val isSuspend: Boolean
abstract override val isMarkedNullable: Boolean abstract override val isMarkedNullable: Boolean
abstract val qualifier: List<FirQualifierPart> abstract val qualifier: List<FirQualifierPart>
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.fir.visitors.*
class FirFunctionTypeRefBuilder : FirAnnotationContainerBuilder { class FirFunctionTypeRefBuilder : FirAnnotationContainerBuilder {
override var source: FirSourceElement? = null override var source: FirSourceElement? = null
override val annotations: MutableList<FirAnnotationCall> = mutableListOf() override val annotations: MutableList<FirAnnotationCall> = mutableListOf()
var isSuspend: Boolean by kotlin.properties.Delegates.notNull<Boolean>()
var isMarkedNullable: Boolean by kotlin.properties.Delegates.notNull<Boolean>() var isMarkedNullable: Boolean by kotlin.properties.Delegates.notNull<Boolean>()
var receiverTypeRef: FirTypeRef? = null var receiverTypeRef: FirTypeRef? = null
val valueParameters: MutableList<FirValueParameter> = mutableListOf() val valueParameters: MutableList<FirValueParameter> = mutableListOf()
@@ -35,6 +36,7 @@ class FirFunctionTypeRefBuilder : FirAnnotationContainerBuilder {
return FirFunctionTypeRefImpl( return FirFunctionTypeRefImpl(
source, source,
annotations, annotations,
isSuspend,
isMarkedNullable, isMarkedNullable,
receiverTypeRef, receiverTypeRef,
valueParameters, valueParameters,
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.fir.visitors.*
class FirResolvedFunctionTypeRefBuilder : FirAnnotationContainerBuilder { class FirResolvedFunctionTypeRefBuilder : FirAnnotationContainerBuilder {
override var source: FirSourceElement? = null override var source: FirSourceElement? = null
override val annotations: MutableList<FirAnnotationCall> = mutableListOf() override val annotations: MutableList<FirAnnotationCall> = mutableListOf()
var isSuspend: Boolean by kotlin.properties.Delegates.notNull<Boolean>()
lateinit var type: ConeKotlinType lateinit var type: ConeKotlinType
var isMarkedNullable: Boolean by kotlin.properties.Delegates.notNull<Boolean>() var isMarkedNullable: Boolean by kotlin.properties.Delegates.notNull<Boolean>()
var receiverTypeRef: FirTypeRef? = null var receiverTypeRef: FirTypeRef? = null
@@ -36,6 +37,7 @@ class FirResolvedFunctionTypeRefBuilder : FirAnnotationContainerBuilder {
return FirResolvedFunctionTypeRefImpl( return FirResolvedFunctionTypeRefImpl(
source, source,
annotations, annotations,
isSuspend,
type, type,
isMarkedNullable, isMarkedNullable,
receiverTypeRef, receiverTypeRef,
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.fir.visitors.*
class FirResolvedTypeRefBuilder : FirAnnotationContainerBuilder { class FirResolvedTypeRefBuilder : FirAnnotationContainerBuilder {
override var source: FirSourceElement? = null override var source: FirSourceElement? = null
override val annotations: MutableList<FirAnnotationCall> = mutableListOf() override val annotations: MutableList<FirAnnotationCall> = mutableListOf()
var isSuspend: Boolean = false
lateinit var type: ConeKotlinType lateinit var type: ConeKotlinType
var delegatedTypeRef: FirTypeRef? = null var delegatedTypeRef: FirTypeRef? = null
@@ -32,6 +33,7 @@ class FirResolvedTypeRefBuilder : FirAnnotationContainerBuilder {
return FirResolvedTypeRefImpl( return FirResolvedTypeRefImpl(
source, source,
annotations, annotations,
isSuspend,
type, type,
delegatedTypeRef, delegatedTypeRef,
) )
@@ -21,6 +21,8 @@ internal class FirComposedSuperTypeRefImpl(
override val annotations: MutableList<FirAnnotationCall>, override val annotations: MutableList<FirAnnotationCall>,
override val superTypeRefs: MutableList<FirResolvedTypeRef>, override val superTypeRefs: MutableList<FirResolvedTypeRef>,
) : FirComposedSuperTypeRef() { ) : FirComposedSuperTypeRef() {
override val isSuspend: Boolean = false
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) { override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
annotations.forEach { it.accept(visitor, data) } annotations.forEach { it.accept(visitor, data) }
superTypeRefs.forEach { it.accept(visitor, data) } superTypeRefs.forEach { it.accept(visitor, data) }
@@ -23,6 +23,7 @@ internal class FirDelegatedTypeRefImpl(
) : FirDelegatedTypeRef() { ) : FirDelegatedTypeRef() {
override val source: FirSourceElement? get() = typeRef.source override val source: FirSourceElement? get() = typeRef.source
override val annotations: List<FirAnnotationCall> get() = typeRef.annotations override val annotations: List<FirAnnotationCall> get() = typeRef.annotations
override val isSuspend: Boolean = false
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) { override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
delegate?.accept(visitor, data) delegate?.accept(visitor, data)
@@ -20,6 +20,8 @@ internal class FirDynamicTypeRefImpl(
override val annotations: MutableList<FirAnnotationCall>, override val annotations: MutableList<FirAnnotationCall>,
override val isMarkedNullable: Boolean, override val isMarkedNullable: Boolean,
) : FirDynamicTypeRef() { ) : FirDynamicTypeRef() {
override val isSuspend: Boolean = false
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) { override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
annotations.forEach { it.accept(visitor, data) } annotations.forEach { it.accept(visitor, data) }
} }
@@ -24,6 +24,7 @@ internal class FirErrorTypeRefImpl(
override val diagnostic: ConeDiagnostic, override val diagnostic: ConeDiagnostic,
) : FirErrorTypeRef() { ) : FirErrorTypeRef() {
override val annotations: MutableList<FirAnnotationCall> = mutableListOf() override val annotations: MutableList<FirAnnotationCall> = mutableListOf()
override val isSuspend: Boolean = false
override val type: ConeKotlinType = ConeClassErrorType(diagnostic.reason) override val type: ConeKotlinType = ConeClassErrorType(diagnostic.reason)
override val delegatedTypeRef: FirTypeRef? get() = null override val delegatedTypeRef: FirTypeRef? get() = null
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.fir.visitors.*
internal class FirFunctionTypeRefImpl( internal class FirFunctionTypeRefImpl(
override val source: FirSourceElement?, override val source: FirSourceElement?,
override val annotations: MutableList<FirAnnotationCall>, override val annotations: MutableList<FirAnnotationCall>,
override val isSuspend: Boolean,
override val isMarkedNullable: Boolean, override val isMarkedNullable: Boolean,
override var receiverTypeRef: FirTypeRef?, override var receiverTypeRef: FirTypeRef?,
override val valueParameters: MutableList<FirValueParameter>, override val valueParameters: MutableList<FirValueParameter>,
@@ -19,6 +19,7 @@ internal class FirImplicitTypeRefImpl(
override val source: FirSourceElement?, override val source: FirSourceElement?,
) : FirImplicitTypeRef() { ) : FirImplicitTypeRef() {
override val annotations: List<FirAnnotationCall> get() = emptyList() override val annotations: List<FirAnnotationCall> get() = emptyList()
override val isSuspend: Boolean = false
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) { override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
} }
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.fir.visitors.*
internal class FirResolvedFunctionTypeRefImpl( internal class FirResolvedFunctionTypeRefImpl(
override val source: FirSourceElement?, override val source: FirSourceElement?,
override val annotations: MutableList<FirAnnotationCall>, override val annotations: MutableList<FirAnnotationCall>,
override val isSuspend: Boolean,
override val type: ConeKotlinType, override val type: ConeKotlinType,
override val isMarkedNullable: Boolean, override val isMarkedNullable: Boolean,
override var receiverTypeRef: FirTypeRef?, override var receiverTypeRef: FirTypeRef?,
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.fir.visitors.*
internal class FirResolvedTypeRefImpl( internal class FirResolvedTypeRefImpl(
override val source: FirSourceElement?, override val source: FirSourceElement?,
override val annotations: MutableList<FirAnnotationCall>, override val annotations: MutableList<FirAnnotationCall>,
override val isSuspend: Boolean,
override val type: ConeKotlinType, override val type: ConeKotlinType,
override var delegatedTypeRef: FirTypeRef?, override var delegatedTypeRef: FirTypeRef?,
) : FirResolvedTypeRef() { ) : FirResolvedTypeRef() {
@@ -22,7 +22,8 @@ sealed class FirImplicitBuiltinTypeRef(
override val source: FirSourceElement?, override val source: FirSourceElement?,
val id: ClassId, val id: ClassId,
typeArguments: Array<out ConeTypeProjection> = emptyArray(), typeArguments: Array<out ConeTypeProjection> = emptyArray(),
isNullable: Boolean = false isNullable: Boolean = false,
override val isSuspend: Boolean = false
) : FirResolvedTypeRef() { ) : FirResolvedTypeRef() {
override val annotations: List<FirAnnotationCall> override val annotations: List<FirAnnotationCall>
get() = emptyList() get() = emptyList()
@@ -19,7 +19,8 @@ open class FirUserTypeRefImpl(
override val source: FirSourceElement?, override val source: FirSourceElement?,
override val isMarkedNullable: Boolean, override val isMarkedNullable: Boolean,
override val qualifier: MutableList<FirQualifierPart>, override val qualifier: MutableList<FirQualifierPart>,
override val annotations: MutableList<FirAnnotationCall> override val annotations: MutableList<FirAnnotationCall>,
override val isSuspend: Boolean = false
) : FirUserTypeRef(), FirAnnotationContainer { ) : FirUserTypeRef(), FirAnnotationContainer {
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) { override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
@@ -232,6 +232,7 @@ object BuilderConfigurator : AbstractBuilderConfigurator<FirTreeBuilder>(FirTree
} }
builder(resolvedTypeRef) { builder(resolvedTypeRef) {
defaultFalse("isSuspend")
defaultNull("delegatedTypeRef") defaultNull("delegatedTypeRef")
} }
@@ -376,6 +376,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
withGetter = true withGetter = true
} }
default("annotations", "mutableListOf()") default("annotations", "mutableListOf()")
defaultFalse("isSuspend")
useTypes(coneClassErrorTypeType) useTypes(coneClassErrorTypeType)
} }
@@ -398,12 +399,23 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
useTypes(errorTypeRefImpl) useTypes(errorTypeRefImpl)
} }
impl(functionTypeRef) impl(dynamicTypeRef) {
impl(implicitTypeRef) { defaultFalse("isSuspend")
defaultEmptyList("annotations")
} }
impl(composedSuperTypeRef) impl(functionTypeRef) {
// Note that we intentionally do _not_ set default value (false) for `isSuspend`, since function type reference is the only
// place where type modifier `suspend` matters.
}
impl(implicitTypeRef) {
defaultEmptyList("annotations")
defaultFalse("isSuspend")
}
impl(composedSuperTypeRef) {
defaultFalse("isSuspend")
}
impl(reference, "FirStubReference") { impl(reference, "FirStubReference") {
default("source") { default("source") {
@@ -454,6 +466,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
delegate = "typeRef" delegate = "typeRef"
} }
} }
defaultFalse("isSuspend")
} }
noImpl(userTypeRef) noImpl(userTypeRef)
@@ -530,6 +530,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
typeRef.configure { typeRef.configure {
+annotations +annotations
+booleanField("isSuspend")
} }
resolvedTypeRef.configure { resolvedTypeRef.configure {