Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@IgnatBeresnev
Copy link
Contributor

Fixes #2762

@IgnatBeresnev IgnatBeresnev requested a review from vmishenev July 11, 2023 16:27
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
Contributor 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
Contributor 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
Contributor

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
Contributor

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
Contributor 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.

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

4 participants