[FIR] Introduce FirValueParameterSymbol.defaultValueSource
It's easier to read the code if you don't see generic `fir` access and thus don't need to check all its usages to make sure it's used correctly.
This commit is contained in:
committed by
Space Team
parent
cb89695e21
commit
f08c167729
+2
-4
@@ -221,15 +221,13 @@ object FirOverrideChecker : FirAbstractOverrideChecker() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(SymbolInternals::class)
|
|
||||||
private fun FirFunctionSymbol<*>.checkDefaultValues(
|
private fun FirFunctionSymbol<*>.checkDefaultValues(
|
||||||
reporter: DiagnosticReporter,
|
reporter: DiagnosticReporter,
|
||||||
context: CheckerContext,
|
context: CheckerContext,
|
||||||
) {
|
) {
|
||||||
for (valueParameterSymbol in valueParameterSymbols) {
|
for (valueParameterSymbol in valueParameterSymbols) {
|
||||||
val defaultValue = valueParameterSymbol.fir.defaultValue
|
if (valueParameterSymbol.hasDefaultValue) {
|
||||||
if (defaultValue != null) {
|
reporter.reportOn(valueParameterSymbol.defaultValueSource, FirErrors.DEFAULT_VALUE_NOT_ALLOWED_IN_OVERRIDE, context)
|
||||||
reporter.reportOn(defaultValue.source, FirErrors.DEFAULT_VALUE_NOT_ALLOWED_IN_OVERRIDE, context)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.fir.symbols.impl
|
package org.jetbrains.kotlin.fir.symbols.impl
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.KtSourceElement
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic
|
import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirAnonymousObjectExpression
|
import org.jetbrains.kotlin.fir.expressions.FirAnonymousObjectExpression
|
||||||
@@ -115,6 +116,9 @@ class FirValueParameterSymbol(name: Name) : FirVariableSymbol<FirValueParameter>
|
|||||||
val hasDefaultValue: Boolean
|
val hasDefaultValue: Boolean
|
||||||
get() = fir.defaultValue != null
|
get() = fir.defaultValue != null
|
||||||
|
|
||||||
|
val defaultValueSource: KtSourceElement?
|
||||||
|
get() = fir.defaultValue?.source
|
||||||
|
|
||||||
val isCrossinline: Boolean
|
val isCrossinline: Boolean
|
||||||
get() = fir.isCrossinline
|
get() = fir.isCrossinline
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user