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

Bicep treating ints as signed 32-bit values instead of unsigned 64-bit. #5324

Closed
WhitWaldo opened this issue Dec 3, 2021 · 2 comments · Fixed by #5791
Closed

Bicep treating ints as signed 32-bit values instead of unsigned 64-bit. #5324

WhitWaldo opened this issue Dec 3, 2021 · 2 comments · Fixed by #5791

Comments

@WhitWaldo
Copy link

WhitWaldo commented Dec 3, 2021

Bicep version
0.4.1008

Describe the bug
I'm typing out an object in my Bicep file. Two of the fields require that I enter an int64 number. According to the documentation:

In Bicep, integers are 64-bit integers.

However, that isn't stopping a red squiggly from being drawn under my value in VS code with the error:

Expected a valid 32-bit signed integer. bicep(BCP010)

image

To Reproduce
Type in something like the following in a Bicep file in VS Code:

var myValue = -9223372036854775808

Additional context
The only workaround I've got to this so far is doing the following:

var myValue = int('-9223372036854775808')
@anthony-c-martin
Copy link
Member

Note that this problem only exists for -9223372036854775808 - all other int64 numbers are expressible in Bicep.

  • int64.MinValue == -9223372036854775808
  • int64.MaxValue == 9223372036854775807
  • I believe the problem arises because we interpret -9223372036854775808 as 0 - 9223372036854775808, but 9223372036854775808 is not a valid int64 as it's greater than int64.MaxValue.

@anthony-c-martin
Copy link
Member

Also - as part of the fix, we should address the wording of the error: "Expected a valid 32-bit signed integer. bicep(BCP010)" should say "Expected a valid 64-bit signed integer. bicep(BCP010)"

@anthony-c-martin anthony-c-martin added this to In progress in 0.5 release Jan 11, 2022
@stephaniezyen stephaniezyen moved this from In progress to In Review in 0.5 release Feb 1, 2022
@stephaniezyen stephaniezyen moved this from In Review to Done in 0.5 release Feb 8, 2022
@ghost ghost locked as resolved and limited conversation to collaborators May 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants