Joel Wilcox
06/11/2025, 9:20 PM@Singleton
@Inject
class Foo
I generate a top-level function like
@Singleton
fun hintForScopeSingleton(contributed: Foo) = stub(..)
in a common 'hints' package that allows me to later grab all of the generated functions and reference back to their class parameters. With an IC test, I found that with multiple back-to-back compilations where I change the scope annotation (@Singleton
above), new hint functions would be successfully generated but the old ones would not be invalidated and some later compilations would e.g. end up with
@Singleton
fun hintForScopeSingleton(contributed: Foo) = stub(..)
@NewerScope
fun hintForScopeNewerScope(contributed: Foo) = stub(..)
Is tracking and invalidating top-level functions like this supported? And if so, any advice on the best way to do so? There's this IC tracking function used elsewhere in Metro, but it is specific to functions that live in a class and from what I could tell the underlying compiler calls also seemed to not be compatible with a top-level functionYoussef Shoaib [MOD]
06/12/2025, 1:04 AMLookupTracker.record
supports that explicitly by passing in ScopeKind.PACKAGE
and presumably the package fqnameJoel Wilcox
06/12/2025, 11:56 PM