Skip to content

Copy constant field annotations from inclusions #44178

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

heshanpadmasiri
Copy link
Member

@heshanpadmasiri heshanpadmasiri commented Jun 19, 2025

Purpose

Stop-gap solution for #38535 that only copies constant annotations

Approach

Describe how you are implementing the solutions along with the design details.

Samples

Provide high-level details about the samples related to this feature.

Remarks

List any other known issues, related PRs, TODO items, or any other notes related to the PR.

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

@heshanpadmasiri heshanpadmasiri changed the title Copy field annotations from inclusions Copy constant field annotations from inclusions Jun 20, 2025
@heshanpadmasiri heshanpadmasiri marked this pull request as ready for review June 23, 2025 02:33
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a stop-gap mechanism to copy constant field annotations when including record fields, along with tests to verify correct behavior.

  • Extend the compiler’s SymbolEnter to track included record nodes and clone constant annotations onto inlined fields.
  • Introduce copyMatchingConstAnnotations helper and supporting methods to recursively propagate annotations.
  • Add Ballerina and Java tests to validate that annotations on included fields are correctly copied.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/jballerina-unit-test/src/test/resources/.../annotation.bal New Ballerina test cases defining record types and invoking checks
tests/jballerina-unit-test/src/test/java/.../AnnotationTests.java Added testAnnotationInclusion test method
tests/jballerina-unit-test/src/test/java/.../ValidateFieldAnnotations.java New Java helper to assert that field annotations were copied
compiler/ballerina-lang/.../SymbolEnter.java Track structure nodes, clone and attach constant annotations

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.

2 participants