-
-
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
Possible Bug: Incomplete Function Analysis with refAllDecls #22953
Comments
The issue here is relatively fundamental: The function has an Currently, generic functions aren't analyzed at all when they are referenced with In status-quo I believe this to be documented/intentional behavior, so not a bug. |
Yes, in that case it's due to the |
Well yes, but I think It could be analyzed, no? 🙁 Because the result of |
Zig Version
0.14.0-dev.3267+59dc15fa0
Steps to Reproduce and Observed Behavior
I'm currently migrating my codebase from Zig 0.13.0 to 0.14.0-dev.3267+59dc15fa0, and I've noticed what might be unexpected behavior in the semantic analysis of functions.
In my test file, I'm using
std.testing.refAllDecls
which, as far as I understand, should trigger semantic analysis for all declarations. While this generally works as expected, I've observed that some functions seem to be skipped during analysis.To reproduce:
std.testing.refAllDecls(opencl.errors);
which should analyze all declarations (src/errors.zig)translate_opencl_error_for_all_fields
that contains:This should trigger an error as the correct syntax should be:
_ = &opencl.errors.translate_opencl_error_for_all_fields
opencl.errors.translate_opencl_error_for_all_fields(0);
Question: Shouldn't
refAllDecls
trigger semantic analysis for all declarations? Is this intended behavior or potentially a bug?I'm not entirely sure if this is a bug or if I'm misunderstanding how
refAllDecls
is supposed to work. Any clarification would be appreciated.Expected Behavior
The compiler should detect and report that
.Enum
is an invalid field access or something like thatThe text was updated successfully, but these errors were encountered: