Skip to content

Commit

Permalink
Move type alias name mapping out of ResolverAAImpl init block.
Browse files Browse the repository at this point in the history
Otherwise triggering a full visit of all symbols results in incorrect type parameter
fir symbols being returned for java files.
  • Loading branch information
neetopia committed Mar 26, 2024
1 parent b00b6dc commit 86736c5
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -108,10 +108,8 @@ class ResolverAAImpl(
allKSFiles.filter { it.fileName == "package-info.java" }.asSequence().memoized()
}

private val aliasingFqNs: MutableMap<String, KSTypeAlias> = mutableMapOf()
private val aliasingNames: MutableSet<String> = mutableSetOf()

init {
private val aliasingFqNs: Map<String, KSTypeAlias> by lazy {
val result = mutableMapOf<String, KSTypeAlias>()
val visitor = object : KSVisitorVoid() {
override fun visitFile(file: KSFile, data: Unit) {
file.declarations.forEach { it.accept(this, data) }
Expand All @@ -125,13 +123,15 @@ class ResolverAAImpl(

override fun visitTypeAlias(typeAlias: KSTypeAlias, data: Unit) {
typeAlias.qualifiedName?.asString()?.let { fqn ->
aliasingFqNs[fqn] = typeAlias
result[fqn] = typeAlias
aliasingNames.add(fqn.substringAfterLast('.'))
}
}
}
allKSFiles.forEach { it.accept(visitor, Unit) }
result
}
private val aliasingNames: MutableSet<String> = mutableSetOf()

// TODO: fix in upstream for builtin types.
override val builtIns: KSBuiltIns by lazy {
Expand Down

0 comments on commit 86736c5

Please sign in to comment.