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

Hardcode documentation for the synthetic Enum.entries property #3071

Merged
merged 1 commit into from Jul 17, 2023

Conversation

IgnatBeresnev
Copy link
Member

Fixes #2762

Comment on lines +1 to +3
Returns a representation of an immutable list of all enum entries, in the order they're declared.

This method may be used to iterate over the enum entries.
Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't find the documentation text in the KEEP, and entries hasn't been documented anywhere else, so I decided to play it safe and stick to the short description similar to the values() function for now.

Should be discussed with @qwwdfsad and the libraries team, maybe there's a KDoc lying around somewhere, or the authors know how they want to document it.

Copy link
Member

Choose a reason for hiding this comment

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

No KDoc around, unfortunately, the proposed approach is the intended one.

I'm in general good with the documentation template, thanks for taking care 👍

@IgnatBeresnev
Copy link
Member Author

IgnatBeresnev commented Jul 11, 2023

As a side note: I noticed that Dokka is unable to parse the KDocs for ordinal and name properties:

Screenshot image

even though they are present in Enum's source code. I tried to address it in this PR, but realized it wasn't a simple fix, so I think it should be addressed separately.

TLDR is that both name and ordinal are not synthetic functions and are not fake overrides, but they don't have the source code attached in the descriptor, thus empty documentation. Not sure if it's a bug of the compiler or what.

Should try it with K2 - maybe it's been fixed there already.

@vmishenev
Copy link
Member

even though they are present in Enum's source code.

This is like #463. The compiler knows nothing about the source code of builtins.

@vmishenev
Copy link
Member

TLDR is that both name and ordinal are not synthetic functions and are not fake overrides,

They are fake overrides for enums and entries.
image

Comment on lines +1 to +3
Returns a representation of an immutable list of all enum entries, in the order they're declared.

This method may be used to iterate over the enum entries.
Copy link
Member

Choose a reason for hiding this comment

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

No KDoc around, unfortunately, the proposed approach is the intended one.

I'm in general good with the documentation template, thanks for taking care 👍

@IgnatBeresnev
Copy link
Member Author

They are fake overrides for enums and entries.

Oh yeah, indeed, thanks for taking a look!

I noticed that they weren't ignored, so I assumed that the result of the isObvious check was false (thus they must be neither fake override nor synthetic), but I've only now noticed that we handle isObvious for functions only, and these are properties, so they are always present in the documentation...

It looks like we need to rename suppressObviousFunctions to suppressObviousMembers or something similar, and hide ordinal and name by default (as "obvious") if they don't have any documentation - for consistency with functions.

@IgnatBeresnev IgnatBeresnev merged commit 72541d1 into master Jul 17, 2023
11 checks passed
@IgnatBeresnev IgnatBeresnev deleted the enum-entries-docs branch July 17, 2023 09:22
IgnatBeresnev added a commit that referenced this pull request Jul 21, 2023
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.

Support Enum.entries
3 participants