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

JML parser makes no distinction between int and long literals #1446

Closed
wadoon opened this issue Dec 23, 2022 · 0 comments
Closed

JML parser makes no distinction between int and long literals #1446

wadoon opened this issue Dec 23, 2022 · 0 comments

Comments

@wadoon
Copy link
Member

wadoon commented Dec 23, 2022

This issue was created at git.key-project.org where the discussions are preserved.


Description

Currently long literals in JML must not have a trailing 'l' or 'L'.
The syntax of number literals in JML should be the same as in Java.

Interestingly, one exception exists: Assignments to ghost fields (initialisation and via set-statement) actually require the trailing 'l' or 'L', if the value exceeds the int range.

Reproducible

always

Steps to reproduce

Try to load the following class:

class LiteralTest {
    static long longLiteral = 0x100000000L;         // accepted by parser

    /*@ normal_behavior
      @ ensures \result == 0x100000000L;            // not accepted by parser
      (at)*/
    static long test() {
        return longLiteral;
    }

}

This results in an SLTranslationException:
Mismatched token at line 5:38 'L'


  • Commit: d0c574550b85be8e7d38287389bc870d0454662c
  • Component: ~"JML Parser"
  • Severity: ~LOW

Information:

  • created_at: 2017-06-19T16:19:58.676Z
  • updated_at: 2018-06-15T07:25:11.527Z
  • closed_at: 2018-06-15T07:25:11.499Z (closed_by: pfeifer)
  • milestone:
  • user_notes_count: 1
@wadoon wadoon changed the title <placeholder> JML parser makes no distinction between int and long literals Dec 24, 2022
@wadoon wadoon closed this as completed Dec 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant