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

Provide spec for multiple platform-specific non-actuals with identical DRIs #3503

Open
owengray-google opened this issue Feb 26, 2024 · 2 comments
Labels
enhancement An issue for a feature or an overall improvement feedback: Google An issue/PR submitted by colleagues at Google, most likely related to the Android API reference docs kdoc-spec An issue that requires clarification from the KDoc spec's perspective

Comments

@owengray-google
Copy link
Contributor

An example of this is KAnnotatedElement, which has definitions in JVM and native but not common, with the same DRI/fully-qualified-name.

In this case, it seems very reasonable to have a unified page, but what if these two members had meaningfully different definitions, e.g. Field.jvm.kt: interface Field : PSIElement and Field.native.kt: class Field : GrassyTerrain or something.
(Or just a significant difference in supertypes like UASTElement and SomeNativeSyntaxTreeElement that lead to completely disjoint API surfaces.)

What I would propose is banning this at a compiler level and e.g. making @Suppress("NO_ACTUAL_FOR_EXPECT") expect interface KAnnotatedElement, or diverging the names by platform.

@owengray-google owengray-google added the enhancement An issue for a feature or an overall improvement label Feb 26, 2024
@owengray-google
Copy link
Contributor Author

It's possible case may be a blocker for fully supporting android and JVM as different things, because it's very possible to have an android app import both?

@IgnatBeresnev IgnatBeresnev added feedback: Google An issue/PR submitted by colleagues at Google, most likely related to the Android API reference docs kdoc-spec An issue that requires clarification from the KDoc spec's perspective labels Feb 27, 2024
@owengray-google
Copy link
Contributor Author

We've just run into someone doing this in androidx, but not because they wanted--because of https://youtrack.jetbrains.com/issue/KT-69741.

They want to define an expect class in commonMain, and then in another intermediate sourceSet jvmCommon add an inner expect class to it, which syntax doesn't seem to exist for, so they defined unconnected versions in each leaf sourceSet instead.
I think the simplest syntax here would be an extension class, in which you define a class Foo.Bar as an inner class of Foo, without being inside the definition of Foo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An issue for a feature or an overall improvement feedback: Google An issue/PR submitted by colleagues at Google, most likely related to the Android API reference docs kdoc-spec An issue that requires clarification from the KDoc spec's perspective
Projects
None yet
Development

No branches or pull requests

2 participants