Add CustomKotlinLikeDumpStrategy.nameOf API#5741
Add CustomKotlinLikeDumpStrategy.nameOf API#5741ZacSweers wants to merge 1 commit intoJetBrains:masterfrom
Conversation
Code Owners
|
|
Hi. Could you please provide examples when printing companios object's simple name is not sufficient? From my experience, it's usually the top-level class that is dumped. So, there would be a nested object that would be structurally visibly as located under the class. Something like this Isn't that clear enough? |
|
There are a lot of examples in the linked PR. It's not about class dumps but rather how IrCall expressions are rendered, as they do not currently show any context indicating what class's companion object is being invoked. |
OK, I see. It's about replacing by something like I'd say it's better to render the exact name of the companion object instead of adding But it's up to you, because the actual |
ddolovov
left a comment
There was a problem hiding this comment.
Could you please squash commits into a single one?
There was a problem hiding this comment.
I am not sure container parameter is necessary. We can always deduce the container from the declaration using IrDeclaration.parent.
There was a problem hiding this comment.
the declaration being referenced here isn't necessarily in the container though. This is like a context scope, whereas the declaration is the resolved referenced class
There was a problem hiding this comment.
I think it would be useful to have a more generic version of nameOf() suitable for any IrDeclarationWithName.
25720c5 to
76936d8
Compare
Currently, class names in
dumpKotlinLike()always just print the simple class name. This works fine in a lot of scenarios, but is ambiguous in scenarios where the class name is either a companion object or a common/generated simple name. This is a proposal API to allow customization of class names with added container context.If this is acceptable, I can also add a test to the sandbox.
Open questions (aside from the API itself)
Companionis desirable. Though it would be a large change to existing dump files.Here is an example PR using a fork based on this API: ZacSweers/metro#1976