-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Assertion failed at ir.cpp:22760 in ir_analyze_container_member_access_inner #7813
Comments
Are you on the branch? I have this: $ git checkout zig_assert_ir_analyze_container
$ git describe --long --all
heads/zig_assert_ir_analyze_container-0-g79708ba |
The problem is at |
that was it -- wrong branch -- can reproduce now fyi, it's tedious but you can isolate tests by filtering.
This can be isolated further. |
@LemonBoy Thanks for helping me find where this error comes from! It is a bit strange to me that just moving the @mikdusan Thanks for the testing tip! I will try try it out |
@LemonBoy Hey you're right – just casting it fixes that assertion and tests passing again! diff --git a/src/czpeg.zig b/src/czpeg.zig
index c3246c9..24f85d8 100644
--- a/src/czpeg.zig
+++ b/src/czpeg.zig
@@ -282,7 +282,7 @@ pub const Pattern = struct {
break :blk if (comptime canError(@TypeOf(aerr))) try aerr else aerr;
},
.Type => blk: {
- var aerr = folder.init.parse(p);
+ var aerr = @as(type, folder.init).parse(p);
var aopt = if (comptime canError(@TypeOf(aerr))) try aerr else aerr;
if (aopt) |a| {
break :blk a; |
@LemonBoy I'll put together a PR for this if you're not doing it already? |
@mikdusan |
- prevents stage1 panic - error "no field named '...' in '(anytype)' (opaque has no fields)" - add test case closes ziglang#7813
with #7815 applied, |
Yea, that's great! I could probably debug from that; and esp like "opaque has no fields" extra hint. (although, maybe "opaque type ..." could be clearer if the reader wasn't familiar where it's coming from?) I built this PR and can confirm that it also fixes the assertion for me. Is there any plan to make this work without the cast in the future? I'm sure there is subtle context here that I don't have, but to me "compile-time duck typing" means that if the compiler knows the thing has a method (which it must, somewhere, because I can test for and cast it), then we should be able to call that method without extra ceremony? Thanks for your help! yinz rock 🤘 |
I believe so. LemonBoy has a better idea than just this error fix and might give that a go if it's not too complex. |
- prevents stage1 panic - error "no field named '...' in '(anytype)' (opaque has no fields)" - add test case closes ziglang#7813
- prevents stage1 panic - error "no field named '...' in '(anytype)' (opaque has no fields)" - add test case closes ziglang#7813
While trying to factor some comptime arguments into a struct for cZPeg, I ran into this:
The code to reproduce is here: https://github.com/spadix0/cZPeg/tree/zig_assert_ir_analyze_container
that may not compile even without the assertion, but all tests pass before the branch, so something in that (small) diff probably triggered the problem(?)
stack trace
The text was updated successfully, but these errors were encountered: