Skip to content
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

[Bug]: Function rest param is not set as final #41833

Closed
LakshanWeerasinghe opened this issue Dec 6, 2023 · 1 comment · Fixed by #41844
Closed

[Bug]: Function rest param is not set as final #41833

LakshanWeerasinghe opened this issue Dec 6, 2023 · 1 comment · Fixed by #41844
Assignees
Labels
Fix/BreakingChange Fix containing a backward incompatible change. Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug
Milestone

Comments

@LakshanWeerasinghe
Copy link
Contributor

Description

$subject

According to the spec every parameter in the function should be final. But right now, the rest parameter can change. This means developers can modify them, which shouldn't happen according to the spec.

After the fix it should give a compile time error saying.

cannot assign a value to function argument 'restParam'(BCE2549)

Steps to Reproduce

function name(string param1, string... rest) {
    rest = ["value"]; // no error
}

Affected Version(s)

2201.8.2

OS, DB, other environment details and versions

No response

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@LakshanWeerasinghe LakshanWeerasinghe self-assigned this Dec 6, 2023
@LakshanWeerasinghe LakshanWeerasinghe added the Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. label Dec 6, 2023
@ballerina-bot ballerina-bot added needTriage The issue has to be inspected and labeled manually userCategory/Compilation labels Dec 6, 2023
@LakshanWeerasinghe LakshanWeerasinghe added Fix/BreakingChange Fix containing a backward incompatible change. and removed needTriage The issue has to be inspected and labeled manually userCategory/Compilation labels Dec 6, 2023
@LakshanWeerasinghe LakshanWeerasinghe added this to the 2201.9.0 milestone Dec 7, 2023
@github-project-automation github-project-automation bot moved this from PR Sent to Done in Ballerina Team Main Board Jan 23, 2024
Copy link

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix/BreakingChange Fix containing a backward incompatible change. Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants