Skip to content

Explicit backing fields support#580

Closed
dayanruben wants to merge 11 commits intofacebook:mainfrom
dayanruben:explicit-backing-fields
Closed

Explicit backing fields support#580
dayanruben wants to merge 11 commits intofacebook:mainfrom
dayanruben:explicit-backing-fields

Conversation

@dayanruben
Copy link
Copy Markdown
Contributor

  • Handle Kotlin 2.3.0 explicit backing fields (field = … / field: Type = …) by visiting KtBackingField, emitting modifiers/name/type/initializer, and ordering backing fields with accessors by source position so tokenization no longer fails when -Xexplicit-backing-fields is enabled.
  • Add regression coverage for explicit backing field formatting.

Resolves #531

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 18, 2025
Copy link
Copy Markdown
Contributor

@hick209 hick209 left a comment

Choose a reason for hiding this comment

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

Looking great! Thank you so much for helping add support to this feature.

Please address the comments here and make sure to format the code as well (I think it's ./gradlew ktfmtFormat).

Update: I see you are from São Paulo => Mandou bem nesse PR!

dayanruben and others added 3 commits December 19, 2025 16:36
Summary:
It's not required by the runtime classpath. This also fixes errors like:

```
Execution failed for task ':ktfmt:compileTestKotlin'.
> Could not resolve all files for configuration ':ktfmt:testCompileClasspath'.
   > Could not resolve org.jetbrains.kotlin:kotlin-test:2.2.0.
     Required by:
         project :ktfmt
      > Unable to find a variant with the requested capability: coordinates 'org.jetbrains.kotlin:kotlin-test-framework-junit':
           - Variant 'compile' provides 'org.jetbrains.kotlin:kotlin-test:2.2.0'
           - Variant 'enforced-platform-compile' provides 'org.jetbrains.kotlin:kotlin-test-derived-enforced-platform:2.2.0'
           - Variant 'enforced-platform-runtime' provides 'org.jetbrains.kotlin:kotlin-test-derived-enforced-platform:2.2.0'
           - Variant 'javadoc' provides 'org.jetbrains.kotlin:kotlin-test:2.2.0'
           - Variant 'platform-compile' provides 'org.jetbrains.kotlin:kotlin-test-derived-platform:2.2.0'
           - Variant 'platform-runtime' provides 'org.jetbrains.kotlin:kotlin-test-derived-platform:2.2.0'
           - Variant 'runtime' provides 'org.jetbrains.kotlin:kotlin-test:2.2.0'
           - Variant 'sources' provides 'org.jetbrains.kotlin:kotlin-test:2.2.0'
```

Pull Request resolved: facebook#579

Reviewed By: strulovich

Differential Revision: D89469731

Pulled By: hick209

fbshipit-source-id: 18eca1fd1d42673af0f240072418690a41a7fe08
@dayanruben
Copy link
Copy Markdown
Contributor Author

Looking great! Thank you so much for helping add support to this feature.

Please address the comments here and make sure to format the code as well (I think it's ./gradlew ktfmtFormat).

Update: I see you are from São Paulo => Mandou bem nesse PR!

Thanks for the review! I’ve already addressed the comments and pushed the changes (including running ./gradlew ktfmtFormat). Valeu, bora pra cima!

@dayanruben dayanruben requested a review from hick209 December 19, 2025 19:41
@hick209
Copy link
Copy Markdown
Contributor

hick209 commented Dec 19, 2025

Perfeito! Obrigado por contribuir!

@hick209
Copy link
Copy Markdown
Contributor

hick209 commented Dec 19, 2025

Espera um pouco...

Here it says that one of the tests did not pass. Could you address that?

Copy link
Copy Markdown
Contributor

@hick209 hick209 left a comment

Choose a reason for hiding this comment

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

Failing unit tests

@dayanruben
Copy link
Copy Markdown
Contributor Author

Failing unit tests

Perdão. I’ve just pushed the remaining changes, including the changes to remove support for modifiers.

@dayanruben dayanruben requested a review from hick209 December 19, 2025 20:29
@dayanruben dayanruben requested a review from hick209 December 20, 2025 00:12
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Dec 20, 2025

@hick209 has imported this pull request. If you are a Meta employee, you can view this in D89570823.

@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Dec 30, 2025

@hick209 merged this pull request in 1b6b2b0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to format with new Explicit Backing Fields

4 participants