Fir2Ir: extract error about unsupported mutation
This commit is contained in:
committed by
Space Team
parent
22b4b29292
commit
1cb77a47ec
@@ -40,4 +40,7 @@ interface AbstractFir2IrLazyDeclaration<F> :
|
||||
get() = shouldNotBeCalled()
|
||||
override val typeTranslator: TypeTranslator
|
||||
get() = shouldNotBeCalled()
|
||||
|
||||
fun mutationNotSupported(): Nothing =
|
||||
error("Mutation of Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
|
||||
+8
-24
@@ -46,27 +46,19 @@ abstract class AbstractFir2IrLazyFunction<F : FirCallableDeclaration>(
|
||||
|
||||
override var isTailrec: Boolean
|
||||
get() = fir.isTailRec
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isSuspend: Boolean
|
||||
get() = fir.isSuspend
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isOperator: Boolean
|
||||
get() = fir.isOperator
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isInfix: Boolean
|
||||
get() = fir.isInfix
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: FunctionDescriptor
|
||||
@@ -74,21 +66,15 @@ abstract class AbstractFir2IrLazyFunction<F : FirCallableDeclaration>(
|
||||
|
||||
override var isInline: Boolean
|
||||
get() = fir.isInline
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isExternal: Boolean
|
||||
get() = fir.isExternal
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isExpect: Boolean
|
||||
get() = fir.isExpect
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var body: IrBody? by lazyVar(lock) {
|
||||
if (tryLoadIr()) body else null
|
||||
@@ -100,9 +86,7 @@ abstract class AbstractFir2IrLazyFunction<F : FirCallableDeclaration>(
|
||||
|
||||
override var modality: Modality
|
||||
get() = fir.modality!!
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var correspondingPropertySymbol: IrPropertySymbol? = null
|
||||
|
||||
|
||||
@@ -60,75 +60,50 @@ class Fir2IrLazyClass(
|
||||
|
||||
override var name: Name
|
||||
get() = fir.name
|
||||
set(_) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
@Suppress("SetterBackingFieldAssignment")
|
||||
override var visibility: DescriptorVisibility = components.visibilityConverter.convertToDescriptorVisibility(fir.visibility)
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var modality: Modality
|
||||
get() = fir.modality!!
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var attributeOwnerId: IrAttributeContainer
|
||||
get() = this
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var kind: ClassKind
|
||||
get() = fir.classKind
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isCompanion: Boolean
|
||||
get() = fir.isCompanion
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isInner: Boolean
|
||||
get() = fir.isInner
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isData: Boolean
|
||||
get() = fir.isData
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isExternal: Boolean
|
||||
get() = fir.isExternal
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isValue: Boolean
|
||||
get() = fir.isInline
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isExpect: Boolean
|
||||
get() = fir.isExpect
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isFun: Boolean
|
||||
get() = fir.isFun
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var superTypes: List<IrType> by lazyVar(lock) {
|
||||
fir.superTypeRefs.map { it.toIrType(typeConverter) }
|
||||
@@ -160,9 +135,7 @@ class Fir2IrLazyClass(
|
||||
|
||||
override var valueClassRepresentation: ValueClassRepresentation<IrSimpleType>?
|
||||
get() = computeValueClassRepresentation(fir)
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
private val fakeOverridesByName = mutableMapOf<Name, Collection<IrDeclaration>>()
|
||||
|
||||
|
||||
@@ -48,9 +48,7 @@ class Fir2IrLazyConstructor(
|
||||
|
||||
override var isPrimary: Boolean
|
||||
get() = fir.isPrimary
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: ClassConstructorDescriptor
|
||||
@@ -58,35 +56,24 @@ class Fir2IrLazyConstructor(
|
||||
|
||||
override var isInline: Boolean
|
||||
get() = fir.isInline
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isExternal: Boolean
|
||||
get() = fir.isExternal
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isExpect: Boolean
|
||||
get() = fir.isExpect
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var body: IrBody? = null
|
||||
|
||||
override var name: Name
|
||||
get() = SpecialNames.INIT
|
||||
set(_) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
@Suppress("SetterBackingFieldAssignment")
|
||||
override var visibility: DescriptorVisibility = components.visibilityConverter.convertToDescriptorVisibility(fir.visibility)
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var returnType: IrType by lazyVar(lock) {
|
||||
fir.returnTypeRef.toIrType(typeConverter)
|
||||
|
||||
@@ -55,57 +55,38 @@ class Fir2IrLazyProperty(
|
||||
|
||||
override var isVar: Boolean
|
||||
get() = fir.isVar
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isConst: Boolean
|
||||
get() = fir.isConst
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isLateinit: Boolean
|
||||
get() = fir.isLateInit
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isDelegated: Boolean
|
||||
get() = fir.delegate != null
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isExternal: Boolean
|
||||
get() = fir.isExternal
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var isExpect: Boolean
|
||||
get() = fir.isExpect
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var name: Name
|
||||
get() = fir.name
|
||||
set(_) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
@Suppress("SetterBackingFieldAssignment")
|
||||
override var visibility: DescriptorVisibility = components.visibilityConverter.convertToDescriptorVisibility(fir.visibility)
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var modality: Modality
|
||||
get() = fir.modality!!
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
private val type: IrType by lazy {
|
||||
with(typeConverter) { fir.returnTypeRef.toIrType() }
|
||||
|
||||
@@ -46,17 +46,13 @@ class Fir2IrLazyPropertyAccessor(
|
||||
// TODO: investigate why some deserialized properties are inline
|
||||
override var isInline: Boolean
|
||||
get() = firAccessor?.isInline == true
|
||||
set(_) {
|
||||
error("Mutating Fir2Ir lazy elements is not possible")
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var annotations: List<IrConstructorCall> by createLazyAnnotations()
|
||||
|
||||
override var name: Name
|
||||
get() = Name.special("<${if (isSetter) "set" else "get"}-${firParentProperty.name}>")
|
||||
set(_) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var returnType: IrType by lazyVar(lock) {
|
||||
if (isSetter) irBuiltIns.unitType else firParentProperty.returnTypeRef.toIrType(typeConverter, conversionTypeContext)
|
||||
|
||||
@@ -43,9 +43,7 @@ class Fir2IrLazySimpleFunction(
|
||||
|
||||
override var name: Name
|
||||
get() = fir.name
|
||||
set(_) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
set(_) = mutationNotSupported()
|
||||
|
||||
override var returnType: IrType by lazyVar(lock) {
|
||||
fir.returnTypeRef.toIrType(typeConverter)
|
||||
|
||||
Reference in New Issue
Block a user