min
09/11/2026, 9:09 AMFirAdditionalCheckersExtension should override declarationCheckers: DeclarationCheckers with an instance that populates one of the following properties:
open val classLikeCheckers: Set<FirClassLikeChecker> = emptySet()
open val classCheckers: Set<FirClassChecker> = emptySet()
open val regularClassCheckers: Set<FirRegularClassChecker> = emptySet()
open val constructorCheckers: Set<FirConstructorChecker> = emptySet()
But which one and why?dmitriy.novozhilov
09/11/2026, 9:11 AMFirRegularClass would be executed checkers from the following lists: [regularClassCheckers, classCheckers, classLikeCheckers, declarationCheckers].dmitriy.novozhilov
09/11/2026, 9:13 AMFirRegularClassChecker (or FirClassChecker if you also want to check anonymous objects for some reason).
It definitely shouldn't be a FirConstructorChecker, as it wouldn't be invoked if there is no constructor in the class.min
09/11/2026, 9:19 AMclass MyFirAdditionalCheckersExtension(
session: FirSession,
mppKind: MppCheckerKind,
): FirAdditionalCheckersExtension(session) {
override val declarationCheckers: DeclarationCheckers = object: DeclarationCheckers() {
override val regularClassCheckers = setOf(object: FirRegularClassChecker(mppKind) {
context(context: CheckerContext, reporter: DiagnosticReporter)
override fun check(declaration: FirRegularClass) {
TODO("Not yet implemented")
}
})
}
}
So should I do this? Am I supposed to override val regularClassCheckers?
abstract class DeclarationCheckers {
// ...
open val regularClassCheckers: Set<FirRegularClassChecker> = emptySet()
I was going to populate this.regularClassCheckers but it’s not a MutableSet<_> and I couldn’t call add on it. The abstract base class is meant to allocate an unused empty set and my derived class is expected to allocate again?dmitriy.novozhilov
09/11/2026, 9:21 AMdmitriy.novozhilov
09/11/2026, 9:22 AMdmitriy.novozhilov
09/11/2026, 9:26 AMThe abstract base class is meant to allocate an unused empty set and my derived class is expected to allocate again?Good spot, actually. It makes sense to replace all these
= emptySet() in the base checkers container with get() = emptySet().min
09/11/2026, 10:39 AMFirAdditionalCheckersExtension that ensures that every relevant class has a primary constructor, is it safe to call classSymbol.primaryConstructorIfAny(this.session)!! in my FirDeclarationGenerationExtension?dmitriy.novozhilov
09/11/2026, 10:52 AMmin
09/11/2026, 4:18 PM