-
Notifications
You must be signed in to change notification settings - Fork 43
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
proposal to update generated function names #265
Open
davissuber
wants to merge
4
commits into
uber:main
Choose a base branch
from
davissuber:ds-whats-in-a-name
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is quite a useful annotation for kotlin/java interop - and people do use it with motif - so we'd like to add tests with this annotation
We no longer need to map the primitive names for tests - possibly due to a room compiler processing version bump. However, we do notice that there's still a space difference when generating the java/kotlin string representation of generic classes
This commit updates the name generation to always add a trailing underscore for the following reasons: 1. There are some missing keywords - for example, a custom type named `Null` will crash motif since it will try to name the function `null()`, it seems that adding to the list is not as safe as always append 2. Motif append a `2` (or `3` and so on) to a function name to avoid collision, so a type whose name ends with a `2` e.g. `Function2` will have its name `Function22` (or `Function23` and so on) - it's not wrong, but reads a bit funny
This commit adds a test that would fail without the changes in this pull request, such as JvmSuppressWildcard, `Null` class name, and kotlin/java generic name difference
davissuber
commented
Mar 28, 2024
@@ -31,7 +31,7 @@ import org.junit.runners.Parameterized | |||
|
|||
@RunWith(Parameterized::class) | |||
@OptIn(ExperimentalProcessingApi::class) | |||
class XNamesTest(private val processorType: ProcessorType, private val srcLang: SourceLanguage) { | |||
class NamesTest(private val processorType: ProcessorType, private val srcLang: SourceLanguage) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Matching the file name
davissuber
commented
Mar 28, 2024
|
||
fun child(): ChildScope | ||
|
||
fun myByte(): Byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to verify the name renderer change is not breaking stuff
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note for reviewers: I have NOT tested this against Uber's apps at the time of this writing - this pull request is more of a "is this even a problem worth changing" type of deal - if this seems agreeable, I'll test out the code generation in buck/bazel.
The main behavioral change in this pull request is in the function name generation in
Names.kt
, one can run into the following problems:Null
, it would break the keyword check since it's not in the keywordnull
to the keyword list as alternative2
such asFunction2
will pass through the uniqueness check and be converted asfunction22
function2_2