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

fix(compiler): Fix math ops for u64 [fixes LNG-204] #811

Merged
merged 4 commits into from
Jul 25, 2023
Merged

Conversation

InversionSpaces
Copy link
Contributor

No description provided.

@linear
Copy link

linear bot commented Jul 24, 2023

LNG-204 Fix math for `u64` type

Now it is impossible to use u64 in mathematical operations:

func getU64() -> u64:
    <- 42

func main():
    a <- getU64()
    b <- getU64()
    c = a + b

output:

7     c = a + b
          ^====
          Types mismatch.
          expected:   i64
          given:      u64

@InversionSpaces
Copy link
Contributor Author

Made literal numbers without sign (e.g. 42) to have LiteralType.unsgined instead of LiteralType.number.
Note that LiteralType.unsigned includes signed types. Logic is that literal without sign could have type with sign.
However LiteralType.signed and LiteralType.unsgined do not include float despite that they could be treated as floats.

I don't like idea of literal types in general, and propagating them through expressions (e.g. 42 + 37 has LiteralType.unsigned) creates a lot of troubles

@DieMyst DieMyst merged commit 50ba194 into main Jul 25, 2023
9 checks passed
@DieMyst DieMyst deleted the fix/math-ops branch July 25, 2023 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run e2e workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants