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]: The parser does not create diagnostics for int/float literals with more than one sign characters #42138

Closed
nipunayf opened this issue Feb 9, 2024 · 1 comment
Assignees
Labels
Area/Parser Everything related to the ballerina lexer and the parser #Compiler Reason/Invalid Issue is invalid. Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug

Comments

@nipunayf
Copy link
Contributor

nipunayf commented Feb 9, 2024

Description

As mentioned in the spec, there can be only zero or one sign character prefixed to an integer or float. However, the parser does not generate a diagnostic when there are more than one such characters.

Steps to Reproduce

Execute the following Ballerina code.

public function main() {
    int x = -++--5;
    float y = --+-5.0;
}

Affected Version(s)

Ballerina 2201.8.4 (Swan Lake Update 8)

OS, DB, other environment details and versions

OS: macOS 14.2.1 23C71
JDK: openjdk 17.0.8 2023-07-18

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@nipunayf nipunayf added Type/Bug Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Area/Parser Everything related to the ballerina lexer and the parser #Compiler labels Feb 9, 2024
@nipunayf nipunayf changed the title [Bug]: The parser does not create diagnostics for more than one sign character [Bug]: The parser does not create diagnostics for more than one sign characters Feb 9, 2024
@nipunayf nipunayf changed the title [Bug]: The parser does not create diagnostics for more than one sign characters [Bug]: The parser does not create diagnostics for int/float expressions with more than one sign characters Feb 9, 2024
@nipunayf nipunayf changed the title [Bug]: The parser does not create diagnostics for int/float expressions with more than one sign characters [Bug]: The parser does not create diagnostics for int/float literals with more than one sign characters Feb 9, 2024
@nipunayf nipunayf self-assigned this Feb 12, 2024
@nipunayf nipunayf moved this to Planned for Sprint in Ballerina Team Main Board Feb 12, 2024
@KavinduZoysa KavinduZoysa moved this from Planned for Sprint to In Progress in Ballerina Team Main Board Feb 15, 2024
@nipunayf nipunayf added the Reason/Invalid Issue is invalid. label Feb 15, 2024
@nipunayf
Copy link
Contributor Author

The following expression is valid as it considers the unary-numeric-expr instead of a signed literal.

int x = -+-5;

@github-project-automation github-project-automation bot moved this from In Progress to Done in Ballerina Team Main Board Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Parser Everything related to the ballerina lexer and the parser #Compiler Reason/Invalid Issue is invalid. Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug
Projects
Archived in project
Development

No branches or pull requests

1 participant