Skip to content

Update all references std.builtin.Type, usually via @typeInfo, to following Zig naming conventions - #2

Merged
lalinsky merged 4 commits into
lalinsky:mainfrom
jules-sommer:main
Dec 12, 2024
Merged

Update all references std.builtin.Type, usually via @typeInfo, to following Zig naming conventions#2
lalinsky merged 4 commits into
lalinsky:mainfrom
jules-sommer:main

Conversation

@jules-sommer

Copy link
Copy Markdown

The following breaking change was merged in this Zig PR: ziglang/zig#21225 which means that on newer Zig versions all references to std.builtin.Type have to be updated to correctly reflect that, an example:

// new format matching naming conventions:consttype_info=@typeInfo(T);
constfields=type_info.@"struct".fields;
// previous to PR#21225consttype_info=@typeInfo(T);
constfields=type_info.Struct.fields;

I am on Zig version: v0.14.0-dev.2270+a5d4ad17b but older versions will also run into compiler errors. Not sure exactly where that PR ended up in relation to semver. Either way, I ran into it and the change was easy enough I figured I'd quickly submit this PR.

test
└─ run test
└─ zig test Debug native 7 errors
src/float.zig:35:23: error: no field named 'Float'in union 'builtin.Type'
switch (type_info.Float.bits) {
^~~~~

tests are passing on my machine, but if anything is wrong or needs changing feel free to reply/edit. 😄

~ Jules

@lalinsky

Copy link
Copy Markdown
Owner

Thank you for this, I'll create a branch for zig 0.13 and then merge it.

@lalinsky
lalinsky merged commit 3a2978f into lalinsky:mainDec 12, 2024
@jules-sommer

Copy link
Copy Markdown
Author

Thank you for this, I'll create a branch for zig 0.13 and then merge it.

of course! glad it was helpful. ❤️

Sign up for freeto 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

@jules-sommer@lalinsky