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

chore: new @intCast syntax #24

Merged
merged 3 commits into from
Jun 27, 2023
Merged

chore: new @intCast syntax #24

merged 3 commits into from
Jun 27, 2023

Conversation

Hanaasagi
Copy link
Contributor

Zig 0.11.0-dev.3853 has changed @intCast syntax. The return value type could be inferred.

Copy link
Collaborator

@Hejsil Hejsil left a comment

Choose a reason for hiding this comment

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

I'm not sure all my suggestions will compile, but I think we can avoid quite a few of these @as

src/datetime.zig Show resolved Hide resolved
src/datetime.zig Outdated Show resolved Hide resolved
src/datetime.zig Outdated Show resolved Hide resolved
src/datetime.zig Outdated Show resolved Hide resolved
src/datetime.zig Outdated Show resolved Hide resolved
src/datetime.zig Show resolved Hide resolved
src/datetime.zig Show resolved Hide resolved
src/datetime.zig Show resolved Hide resolved
src/datetime.zig Outdated Show resolved Hide resolved
src/datetime.zig Outdated Show resolved Hide resolved
Hanaasagi and others added 2 commits June 27, 2023 15:14
Co-authored-by: Komari Spaghetti <contact@hejsil.anonaddy.me>
@Hejsil Hejsil merged commit ddecb4e into frmdstryr:master Jun 27, 2023
@Hejsil
Copy link
Collaborator

Hejsil commented Jun 27, 2023

Thanks 👍

@Hanaasagi
Copy link
Contributor Author

Hanaasagi commented Jun 27, 2023

I found that using the increment operator, the type could be inferred.

        year += @intCast(delta.years);

However, if written as follows:

        year = year + @intCast(delta.years);

The type could not be inferred.

Tested in 0.11.0-dev.3853+cc2daae47. Perhaps this issue will be addressed in future updates of Zig.

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.

2 participants