I have an FIR Checker that runs on `interface Exam...
# compiler
z
I have an FIR Checker that runs on
interface ExampleGraph
, which extends some other generated class
Contribution
. This supertype is generated during FIR as well
Copy code
@DependencyGraph(AppScope::class)
interface ExampleGraph : Impl.Contribution

// another file
@Inject
@ContributesBinding(AppScope::class)
class Impl : Base {
  // Generated in FIR
  interface Contribution {
    @Binds fun Impl.bindImplAsBase(): Base
  }
}
My checker checks that
Contribution
has a compatible visibility with
ExampleGraph
, as I want to give a more meaningful error message where possible than the standard compiler error message that would happen. However, a user reported that in an incremental compilation scenario where
Impl
is changed to
internal
(and thus incompatible, the
public
ExampleGraph would extend an
internal
type) but only the
Impl
file is ever passed to the checker. As a result, the issue escapes it since
ExampleGraph
is not passed to the checker again. Is this expected? It surprised me because I would expect a changed visibility of a class's supertype to trigger recompilation or at least FIR checks. I tried explicitly copying the
visibility
of the parent when generating the nested
Contribution
class just in case but alas no dice. We do generate a function during IR that we make visible to metadata that helps us avoid some IC issues, but since it's IR-only it's too late in the pipeline to help
Actually, to my surprise this is actually legal in kotlinc
Copy code
interface Base
internal class Impl : Base {
  internal interface Contribution
}
class Graph : Impl.Contribution
Whereas this would be an error
Copy code
class Graph(
  val contribution: Impl.Contribution
) : Impl.Contribution
Filed KT-77938 kotlinc does not error on internal supertypes