[KT-58817] Compiler defect workaround
Base method `RawFirBuilder.Visitor.convertElement` has a parameter with default value, its overridden one in `VisitorWithReplacement` is not allowed to declare default. So far so good. During its work the compiler throws an exception: `java.lang.IllegalArgumentException: No argument for parameter`.
This commit is contained in:
committed by
Space Team
parent
6535278bd3
commit
3d1e5bb548
+1
-1
@@ -29,7 +29,7 @@ internal fun buildFileFirAnnotation(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
builder.context.packageFqName = fileAnnotation.containingKtFile.packageFqName
|
builder.context.packageFqName = fileAnnotation.containingKtFile.packageFqName
|
||||||
val result = builder.VisitorWithReplacement().convertElement(fileAnnotation) as FirAnnotation
|
val result = builder.VisitorWithReplacement().convertElement(fileAnnotation, null) as FirAnnotation
|
||||||
replacementApplier?.ensureApplied()
|
replacementApplier?.ensureApplied()
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,10 +164,10 @@ open class RawFirBuilder(
|
|||||||
|
|
||||||
protected open inner class Visitor : KtVisitor<FirElement, FirElement?>() {
|
protected open inner class Visitor : KtVisitor<FirElement, FirElement?>() {
|
||||||
private inline fun <reified R : FirElement> KtElement?.convertSafe(): R? =
|
private inline fun <reified R : FirElement> KtElement?.convertSafe(): R? =
|
||||||
this?.let(::convertElement) as? R
|
this?.let { convertElement(it, null)} as? R
|
||||||
|
|
||||||
private inline fun <reified R : FirElement> KtElement.convert(): R =
|
private inline fun <reified R : FirElement> KtElement.convert(): R =
|
||||||
convertElement(this) as R
|
convertElement(this, null) as R
|
||||||
|
|
||||||
private inline fun <T> buildOrLazy(build: () -> T, noinline lazy: () -> T): T {
|
private inline fun <T> buildOrLazy(build: () -> T, noinline lazy: () -> T): T {
|
||||||
return when (mode) {
|
return when (mode) {
|
||||||
@@ -262,7 +262,7 @@ open class RawFirBuilder(
|
|||||||
return buildErrorExpression(source = null, diagnosticFn())
|
return buildErrorExpression(source = null, diagnosticFn())
|
||||||
}
|
}
|
||||||
|
|
||||||
val result = when (val fir = convertElement(this)) {
|
val result = when (val fir = convertElement(this, null)) {
|
||||||
is FirExpression -> fir
|
is FirExpression -> fir
|
||||||
else -> {
|
else -> {
|
||||||
return buildErrorExpression {
|
return buildErrorExpression {
|
||||||
@@ -298,7 +298,7 @@ open class RawFirBuilder(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private inline fun KtExpression.toFirStatement(errorReasonLazy: () -> String): FirStatement {
|
private inline fun KtExpression.toFirStatement(errorReasonLazy: () -> String): FirStatement {
|
||||||
return when (val fir = convertElement(this)) {
|
return when (val fir = convertElement(this, null)) {
|
||||||
is FirStatement -> fir
|
is FirStatement -> fir
|
||||||
else -> buildErrorExpression {
|
else -> buildErrorExpression {
|
||||||
nonExpressionElement = fir
|
nonExpressionElement = fir
|
||||||
|
|||||||
Reference in New Issue
Block a user