Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[K1] Handle exception for recursive type aliases #3582

Conversation

vmishenev
Copy link
Member

Updated the DefaultDescriptorToDocumentableTranslator to avoid throwing an exception when encountering recursive type aliases. The changes ensure that the defaultType is safely accessed. Also, added a new test for this scenario to avoid regression in the future.

DTypeAlias(
dri = DRI.from(this@with),
name = name.asString(),
type = defaultType.toBound(),
type = defaultType?.toBound() ?: UnresolvedBound(name.asString()),
Copy link
Member Author

@vmishenev vmishenev Apr 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an alternative way: type = GenericTypeConstructor(dri = dri, projections = generics.await().map { it.variantTypeParameter }) like in K2. I would like to have the old logic in K1 to discover the difference between the two ways.

@vmishenev vmishenev force-pushed the vmishenev/3572-Avoid-failing-Dokka-generation-in-jvm+androidJvm-projects branch from 23a27cc to 02cb122 Compare April 24, 2024 22:21
Updated the `DefaultDescriptorToDocumentableTranslator` to avoid throwing an exception when encountering recursive type aliases. The changes ensure that the `defaultType` is safely accessed. Also, added a new test for this scenario to avoid regression in the future.
@vmishenev vmishenev force-pushed the vmishenev/3572-Avoid-failing-Dokka-generation-in-jvm+androidJvm-projects branch from 02cb122 to 35a470d Compare April 25, 2024 10:10
@vmishenev vmishenev marked this pull request as ready for review April 25, 2024 10:16
@IgnatBeresnev IgnatBeresnev linked an issue Apr 25, 2024 that may be closed by this pull request
…n/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/translator/DefaultDescriptorToDocumentableTranslator.kt

Co-authored-by: Ignat Beresnev <ignat.beresnev@jetbrains.com>
@vmishenev vmishenev merged commit 5503b93 into master Apr 25, 2024
9 checks passed
@vmishenev vmishenev deleted the vmishenev/3572-Avoid-failing-Dokka-generation-in-jvm+androidJvm-projects branch April 25, 2024 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid failing Dokka generation in jvm+androidJvm projects
3 participants