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

native: cleanup assign, fix nested struct #23778

Merged
merged 6 commits into from
Feb 21, 2025

Conversation

Eliyaan
Copy link
Contributor

@Eliyaan Eliyaan commented Feb 20, 2025

Cleanup the assign_stmt function (and some functions called in it)
Add file:line on some n_error calls for faster debugging
Fix nested struct expressions, ex: foo.bar.a did not work
Add tests for fixed behavior and for more already supported behavior

Copy link

Connected to Huly®: V_0.6-22189

Copy link
Contributor

@JalonSolov JalonSolov left a comment

Choose a reason for hiding this comment

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

Structs and enums, too? Excellent!

@Eliyaan
Copy link
Contributor Author

Eliyaan commented Feb 21, 2025

Oh true, == is not implemented for floats. assert 2.0 == 1.0 is passing...

Comment on lines +31 to 42

a = 1.0
mut b := &a
unsafe{*b += 2.5}
assert a == 3.5
unsafe{*b -= 1.25}
assert a == 2.25
unsafe{*b *= 6.0}
assert a == 13.5
unsafe{*b /= 4.5}
assert a == 3.0
}
Copy link
Member

Choose a reason for hiding this comment

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

this may need a change too

Copy link
Member

Choose a reason for hiding this comment

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

however it can also serve as a check when the asserts and == work for f64, and the rest of the tests can cross check it, so imho it is good to merge as it is

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, I'll change that for the next PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will require to change all the tests in the file, as it is using asserts between floats for all checks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I may wait until assert between floats are fixed as some of the tests would be interesting to keep as such.

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

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

Excellent work.

@spytheman spytheman merged commit 515d78d into vlang:master Feb 21, 2025
64 checks passed
@Eliyaan Eliyaan deleted the cleanup_assign_stmt-and-fixes branch February 21, 2025 18:09
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.

3 participants