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]: checked(-x) if x is int or long #1281

Merged
merged 3 commits into from
Jan 21, 2025

Conversation

nan01ab
Copy link
Contributor

@nan01ab nan01ab commented Jan 19, 2025

Fix #1175:

checked(-int.MinValue) -> throw exception.
unchecked(-int.MinValue) -> int.MinValue(the same value).

as well as long.

@nan01ab nan01ab changed the title [Fix]: check(-x) if x is int or long [Fix]: checked(-x) if x is int or long Jan 20, 2025
Copy link
Contributor

@Hecate2 Hecate2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is OK to check (typeSymbol.Name != "Int32" && typeSymbol.Name != "Int64") before handling nullable type with while (typeSymbol.NullableAnnotation == NullableAnnotation.Annotated), because the .Name is always Int32, no matter whether it is nullable.

@Jim8y
Copy link
Contributor

Jim8y commented Jan 21, 2025

I hate nullable in contract, if we remove nullable support in contract, it will be much easier.

@Jim8y Jim8y merged commit 0431391 into neo-project:master Jan 21, 2025
3 checks passed
@Jim8y Jim8y deleted the fix.negate-checked branch January 21, 2025 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

checked does not handle the -x operation.
4 participants