Skip to content

Commit

Permalink
Fix typealiases with type parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
eygraber committed Nov 20, 2024
1 parent 1ab5ef9 commit 690146b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 5 additions & 1 deletion ast/ksp/src/main/kotlin/me/tatarka/kotlin/ast/KSAst.kt
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,11 @@ private class KSAstType private constructor(
override fun resolvedType(): AstType {
val declaration = type.declaration
return if (declaration is KSTypeAlias) {
KSAstType(resolver, declaration.type.resolve().replace(type.arguments))
if (type.arguments.isEmpty()) {
KSAstType(resolver, declaration.type.resolve())
} else {
KSAstType(resolver, declaration.type.resolve().replace(type.arguments))
}
} else {
this
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,9 @@ class TypeResultResolver(private val provider: AstProvider, private val options:
var assistedFailed = false
val args = context.args.toMutableList()
for (param in params) {
val type = if (param.type.isPlatform()) {
param.type.makeNonNullable()
} else {
param.type
}
val resolvedType = if (param.type.isTypeAlias()) param.type.resolvedType() else param.type
val type = if (resolvedType.isPlatform()) resolvedType.makeNonNullable() else resolvedType

val qualifier = qualifier(provider, options, param, type)
val key = TypeKey(type, qualifier)
if (param.isAssisted()) {
Expand Down

0 comments on commit 690146b

Please sign in to comment.